@privy-io/react-auth 1.59.4 → 1.59.5-beta-20240318231123
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 +224 -217
- package/dist/index.js +204 -197
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var P1=Object.create;var Ca=Object.defineProperty;var T1=Object.getOwnPropertyDescriptor;var x1=Object.getOwnPropertyNames;var S1=Object.getPrototypeOf,_1=Object.prototype.hasOwnProperty;var A1=(e,t)=>{for(var r in t)Ca(e,r,{get:t[r],enumerable:!0})},Id=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x1(t))!_1.call(e,n)&&n!==r&&Ca(e,n,{get:()=>t[n],enumerable:!(o=T1(t,n))||o.enumerable});return e};var h=(e,t,r)=>(r=e!=null?P1(S1(e)):{},Id(t||!e||!e.__esModule?Ca(r,"default",{value:e,enumerable:!0}):r,e)),k1=e=>Id(Ca({},"__esModule",{value:!0}),e);var Bl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Md=(e,t,r)=>(Bl(e,t,"read from private field"),r?r.call(e):t.get(e)),ba=(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)},Hl=(e,t,r,o)=>(Bl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Wd=(e,t,r)=>(Bl(e,t,"access private method"),r);var q2={};A1(q2,{AsExternalProvider:()=>gr,Captcha:()=>vs,ConnectorManager:()=>Un,PrivyClient:()=>Fn,PrivyProvider:()=>qg,PrivyProxyProvider:()=>ke,SUPPORTED_CHAINS:()=>Nn,VERSION:()=>Ia,WalletConnector:()=>Et,addRpcUrlOverrideToChain:()=>w1,errorIndicatesMaxMfaRetries:()=>Bs,errorIndicatesMfaTimeout:()=>nn,errorIndicatesMfaVerificationFailed:()=>an,getAccessToken:()=>Ye,useConnectWallet:()=>o1,useCreateWallet:()=>i1,useFundWallet:()=>a1,useLinkAccount:()=>t1,useLogin:()=>Kg,useLoginWithEmail:()=>Qg,useLoginWithOAuth:()=>Zg,useLoginWithSms:()=>Xg,useLogout:()=>Jg,useMfa:()=>fn,useMfaEnrollment:()=>yi,useModalStatus:()=>y1,usePrivy:()=>G,useRegisterMfaListener:()=>Es,useSendTransaction:()=>l1,useSetWalletPassword:()=>d1,useSignMessage:()=>u1,useSignTypedData:()=>f1,useToken:()=>v1,useWallets:()=>Ti});module.exports=k1(q2);var ga=require("@ethersproject/address"),Nl=require("@ethersproject/providers"),Hg=require("mipd"),J=require("react");var Ld=require("ofetch"),lt=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}]`:""}`}},Nr=class extends lt{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},T=class extends lt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ea=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var X=class extends lt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},fe=e=>{if(e instanceof lt)return e;if(!(e instanceof Ld.FetchError))return vt(e);if(!e.response)return new Nr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Nr(t||"ApiError",e.response.status,r||o,e,n)},vt=e=>e instanceof lt?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var bn=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ft=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Pa=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ta="/api/v1/sessions",xa="/api/v1/sessions/logout",Od="/api/v1/sessions/fork",Sa="/api/v1/sessions/fork/recover",Nd="/api/v1/siwe/init",Dd="/api/v1/siwe/authenticate",Ud="/api/v1/siwe/link",Fd="/api/v1/siwe/unlink",Bd="/api/v1/farcaster/init",Hd="/api/v1/farcaster/authenticate",Gd="/api/v1/farcaster/link",Vd="/api/v1/farcaster/status",zd="/api/v1/farcaster/unlink",$d="/api/v1/passwordless/init",qd="/api/v1/passwordless/authenticate",jd="/api/v1/passwordless/link",Kd="/api/v1/passwordless/unlink",Yd="/api/v1/passwordless/update",Jd="/api/v1/passwordless_sms/init",Zd="/api/v1/passwordless_sms/link",Qd="/api/v1/passwordless_sms/unlink",Xd="/api/v1/passwordless_sms/authenticate",ep="/api/v1/oauth/init",tp="/api/v1/oauth/authenticate",rp="/api/v1/oauth/link",op="/api/v1/oauth/unlink";var np="/api/v1/mfa/passwordless_sms/init",ip="/api/v1/mfa/passwordless_sms/enroll";var ap="/api/v1/users/me/accept_terms",sp="/api/v1/analytics_events",lp="/api/v1/plugins/moonpay_on_ramp/sign",cp="/api/v1/custom_jwt_account/authenticate";var En=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(cp,{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 fe(t)}}async link(){throw new Error("Unimplemented")}};var Po=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(qd,{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 fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(jd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw fe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post($d,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw fe(o)}}},_a=class extends Po{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Yd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw fe(r)}}};var Up=require("react-device-detect");var Aa=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)}},Gl=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)}},Vl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function zl(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function R1(){return typeof window<"u"&&window.localStorage?new Gl:new Aa}function I1(){return typeof window<"u"&&window.sessionStorage?new Vl:new Aa}var ct=I1(),he=R1();var Zo=require("@ethersproject/providers");function dp(){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 ka=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 $l=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ka(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!$l(r))return!1}return!0},To=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),pp=()=>{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 up="1.59.4";var ql="4df5e2316331463a9130964bd6078dfa",jl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",mp="34357d3c125c2bcf2ce2bc3309d98715",Ra="https://auth.privy.io",fp=2e4,wt=1400,hp=2500,Ia=up;var Ko="privy:token",Kl="privy-token",Ma="privy:refresh_token",Yl="privy-refresh-token",Wa="privy-session",ki="privy:session_transfer_token",W1="privy:wallet",Ri="privy:caid",Yo="privy:state_code",Pn="privy:code_verifier",Ii="privy:headless_oauth",La=e=>`${W1}:${e}`,Jl="privy:connectors",Zl="privy:connections";var Jo=12e4,no=1,Ql="0x1",Tn=3e4,yp="https://api.moonpay.com/v1",gp="https://api.moonpay.com/v1",vp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",wp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Cp="0x420000000000000000000000000000000000000F",bp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Ep=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Oa=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,}))$/),Pp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},xo=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},Xl=e=>new Promise(t=>setTimeout(t,e));function Tp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var xp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Xl(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Na=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var Sp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Qo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function _p(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of dp()){let u=ka(c);if(!l.some(f=>f.info.name===u)){if($l(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function xn(e){return`eip155:${String(Number(e))}`}var Da=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new X(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+ql:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+jl:a=i.rpcUrls.default?.http[0];if(!a)throw new X(`No RPC url found for ${e}`);return a},Ap=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new X(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},io=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new X(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new Zo.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new Zo.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.infura.http[0]+"/"+ql):i.rpcUrls.blast?.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.blast.http[0]+"/"+jl):a=new Zo.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new X(`No RPC url found for ${e}`);return a},Ua=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 Fa=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Sn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Sn={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function L1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var kp=e=>e in Sn,Rp=e=>{let t=Sn[e].mobile;if("native"in t)return t.native};function Ip(e,t){let r=L1(t);if(r.deepLink)return Np(r.deepLink,e);if(r.universalLink)return Dp(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Mp="WALLETCONNECT_DEEPLINK_CHOICE";function Wp(){try{localStorage.removeItem(Mp)}catch{}}function Lp({href:e,name:t}){try{localStorage.setItem(Mp,JSON.stringify({href:e,name:t}))}catch{}}function Op(e){return e.startsWith("http://")||e.startsWith("https://")}function Np(e,t){if(Op(e))return Dp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Dp(e,t){if(!Op(e))return Np(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ba(e,t){window.open(e,t,"noreferrer noopener")}var Ct=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 Mi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Ct(this._startChannelOnce.bind(this)),this.pollForReady=new Ct(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Hd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Gd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw fe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Bd,{token:this.captchaToken});Up.isMobile&&t.connect_uri&&Ba(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(Vd,{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 ec=require("jose");async function Fp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Bp(e){return crypto.getRandomValues(new Uint8Array(e))}function Ha(){return!!ct.get(Ii)}var O1="S256",N1="S256",Dr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Ha();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=ct.get(Pn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(tp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ct.del(Pn),this.meta.headless&&ct.del(Ii),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=fe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=ct.get(Pn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(rp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ct.del(Pn),r}catch(r){throw fe(r)}}createCodeVerifier(){return ec.base64url.encode(Bp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=O1){if(r==N1){let o=await Fp(t);return ec.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();ct.put(Pn,t);let r=this.createStateCode();ct.put(Yo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&ct.put(Ii,!0);try{return await this.api.post(ep,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw fe(n)}}};function tc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hp(e,t){let r={detail:"",retryable:!1},o=tc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Li(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Ha()}}function Oi(){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"),ct.del(Yo),window.history.replaceState({},"",e)}var Xo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var T1=Object.create;var ba=Object.defineProperty;var x1=Object.getOwnPropertyDescriptor;var S1=Object.getOwnPropertyNames;var _1=Object.getPrototypeOf,A1=Object.prototype.hasOwnProperty;var k1=(e,t)=>{for(var r in t)ba(e,r,{get:t[r],enumerable:!0})},Md=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S1(t))!A1.call(e,n)&&n!==r&&ba(e,n,{get:()=>t[n],enumerable:!(o=x1(t,n))||o.enumerable});return e};var h=(e,t,r)=>(r=e!=null?T1(_1(e)):{},Md(t||!e||!e.__esModule?ba(r,"default",{value:e,enumerable:!0}):r,e)),R1=e=>Md(ba({},"__esModule",{value:!0}),e);var Vl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Wd=(e,t,r)=>(Vl(e,t,"read from private field"),r?r.call(e):t.get(e)),Ea=(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)},zl=(e,t,r,o)=>(Vl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Ld=(e,t,r)=>(Vl(e,t,"access private method"),r);var j2={};k1(j2,{AsExternalProvider:()=>gr,Captcha:()=>Cs,ConnectorManager:()=>Un,PrivyClient:()=>Fn,PrivyProvider:()=>jg,PrivyProxyProvider:()=>ke,SUPPORTED_CHAINS:()=>Nn,VERSION:()=>Ma,WalletConnector:()=>Et,addRpcUrlOverrideToChain:()=>C1,errorIndicatesMaxMfaRetries:()=>Gs,errorIndicatesMfaTimeout:()=>nn,errorIndicatesMfaVerificationFailed:()=>an,getAccessToken:()=>Ye,useConnectWallet:()=>n1,useCreateWallet:()=>a1,useFundWallet:()=>s1,useLinkAccount:()=>r1,useLogin:()=>Yg,useLoginWithEmail:()=>Xg,useLoginWithOAuth:()=>Qg,useLoginWithSms:()=>e1,useLogout:()=>Zg,useMfa:()=>fn,useMfaEnrollment:()=>gi,useModalStatus:()=>g1,usePrivy:()=>G,useRegisterMfaListener:()=>Ts,useSendTransaction:()=>c1,useSetWalletPassword:()=>p1,useSignMessage:()=>m1,useSignTypedData:()=>h1,useToken:()=>w1,useWallets:()=>xi});module.exports=R1(j2);var va=require("@ethersproject/address"),Fl=require("@ethersproject/providers"),Gg=require("mipd"),Z=require("react");var Od=require("ofetch"),lt=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}]`:""}`}},Nr=class extends lt{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},T=class extends lt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Pa=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ee=class extends lt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},fe=e=>{if(e instanceof lt)return e;if(!(e instanceof Od.FetchError))return vt(e);if(!e.response)return new Nr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Nr(t||"ApiError",e.response.status,r||o,e,n)},vt=e=>e instanceof lt?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var bn=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ft=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ta=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var xa="/api/v1/sessions",Sa="/api/v1/sessions/logout",Nd="/api/v1/sessions/fork",_a="/api/v1/sessions/fork/recover",Dd="/api/v1/siwe/init",Ud="/api/v1/siwe/authenticate",Fd="/api/v1/siwe/link",Bd="/api/v1/siwe/unlink",Hd="/api/v1/farcaster/init",Gd="/api/v1/farcaster/authenticate",Vd="/api/v1/farcaster/link",zd="/api/v1/farcaster/status",$d="/api/v1/farcaster/unlink",qd="/api/v1/passwordless/init",jd="/api/v1/passwordless/authenticate",Kd="/api/v1/passwordless/link",Yd="/api/v1/passwordless/unlink",Jd="/api/v1/passwordless/update",Zd="/api/v1/passwordless_sms/init",Qd="/api/v1/passwordless_sms/link",Xd="/api/v1/passwordless_sms/unlink",ep="/api/v1/passwordless_sms/authenticate",tp="/api/v1/oauth/init",rp="/api/v1/oauth/authenticate",op="/api/v1/oauth/link",np="/api/v1/oauth/unlink";var ip="/api/v1/mfa/passwordless_sms/init",ap="/api/v1/mfa/passwordless_sms/enroll";var sp="/api/v1/users/me/accept_terms",lp="/api/v1/analytics_events",cp="/api/v1/plugins/moonpay_on_ramp/sign",dp="/api/v1/custom_jwt_account/authenticate";var En=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(dp,{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 fe(t)}}async link(){throw new Error("Unimplemented")}};var To=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(jd,{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 fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Kd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw fe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(qd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw fe(o)}}},Aa=class extends To{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Jd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw fe(r)}}};var Ga=require("react-device-detect");var ka=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)}},$l=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)}},ql=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function jl(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function I1(){return typeof window<"u"&&window.localStorage?new $l:new ka}function M1(){return typeof window<"u"&&window.sessionStorage?new ql:new ka}var ct=M1(),he=I1();var Zo=require("@ethersproject/providers");function pp(){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 Ra=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 Kl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ra(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Kl(r))return!1}return!0},xo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),up=()=>{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 mp="1.59.5-beta-20240318231123";var Yl="4df5e2316331463a9130964bd6078dfa",Jl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",fp="34357d3c125c2bcf2ce2bc3309d98715",Ia="https://auth.privy.io",hp=2e4,wt=1400,yp=2500,Ma=mp;var Ko="privy:token",Zl="privy-token",Wa="privy:refresh_token",Ql="privy-refresh-token",La="privy-session",Ri="privy:session_transfer_token",L1="privy:wallet",Ii="privy:caid",Yo="privy:state_code",Pn="privy:code_verifier",Mi="privy:headless_oauth",Oa=e=>`${L1}:${e}`,Xl="privy:connectors",ec="privy:connections";var Jo=12e4,no=1,tc="0x1",Tn=3e4,gp="https://api.moonpay.com/v1",vp="https://api.moonpay.com/v1",wp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Cp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",bp="0x420000000000000000000000000000000000000F",Ep=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Pp=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Na=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,}))$/),Tp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},So=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},rc=e=>new Promise(t=>setTimeout(t,e));function xp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var Sp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await rc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Da=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var _p=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Qo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ap(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of pp()){let u=Ra(c);if(!l.some(f=>f.info.name===u)){if(Kl(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function xn(e){return`eip155:${String(Number(e))}`}var Ua=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+Yl:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+Jl:a=i.rpcUrls.default?.http[0];if(!a)throw new ee(`No RPC url found for ${e}`);return a},kp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ee(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},io=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new Zo.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new Zo.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.infura.http[0]+"/"+Yl):i.rpcUrls.blast?.http[0]?a=new Zo.StaticJsonRpcProvider(i.rpcUrls.blast.http[0]+"/"+Jl):a=new Zo.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new ee(`No RPC url found for ${e}`);return a},Fa=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 Ba=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Sn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Sn={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function O1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Rp=e=>e in Sn,Ip=e=>{let t=Sn[e].mobile;if("native"in t)return t.native};function Mp(e,t){let r=O1(t);if(r.deepLink)return Dp(r.deepLink,e);if(r.universalLink)return Up(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Wp="WALLETCONNECT_DEEPLINK_CHOICE";function Lp(){try{localStorage.removeItem(Wp)}catch{}}function Op({href:e,name:t}){try{localStorage.setItem(Wp,JSON.stringify({href:e,name:t}))}catch{}}function Np(e){return e.startsWith("http://")||e.startsWith("https://")}function Dp(e,t){if(Np(e))return Up(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 Up(e,t){if(!Np(e))return Dp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ha(e,t){window.open(e,t,"noreferrer noopener")}var Ct=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 Wi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Ct(this._startChannelOnce.bind(this)),this.pollForReady=new Ct(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Gd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Vd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw fe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Hd,{token:this.captchaToken});Ga.isMobile&&!Ga.isIOS&&t.connect_uri&&Ha(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(zd,{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 oc=require("jose");async function Fp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Bp(e){return crypto.getRandomValues(new Uint8Array(e))}function Va(){return!!ct.get(Mi)}var N1="S256",D1="S256",Dr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Va();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=ct.get(Pn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(rp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ct.del(Pn),this.meta.headless&&ct.del(Mi),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=fe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=ct.get(Pn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(op,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ct.del(Pn),r}catch(r){throw fe(r)}}createCodeVerifier(){return oc.base64url.encode(Bp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=N1){if(r==D1){let o=await Fp(t);return oc.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();ct.put(Pn,t);let r=this.createStateCode();ct.put(Yo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&ct.put(Mi,!0);try{return await this.api.post(tp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw fe(n)}}};function nc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hp(e,t){let r={detail:"",retryable:!1},o=nc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Oi(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Va()}}function Ni(){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"),ct.del(Yo),window.history.replaceState({},"",e)}var Xo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${r}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${a}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new Ct(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Dd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Ud,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw fe(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Nd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var en=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Xd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Zd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw fe(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Jd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw fe(o)}}};var ku=require("uuid");function bt(e){return new Date(e*1e3)}function D1(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:bt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:bt(r.verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:bt(r.verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:bt(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(u);break;case"github_oauth":let f={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(f);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(g);break;case"linkedin_oauth":let C={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(C);break;case"apple_oauth":let P={subject:r.subject,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(P);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:bt(r.verified_at)});break;case"farcaster":let w={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:bt(r.verified_at)};t.push(w);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Jt(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ie=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,U1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Zt=(e,t)=>t==="all-users"&&!Ie(e)||t==="users-without-wallets"&&!U1(e)?.length;function Bt(e){if(!e)return null;let t=D1(e.linked_accounts),r=Jt(t,"wallet"),o=Jt(t,"email"),n=Jt(t,"phone"),i=Jt(t,"google_oauth"),a=Jt(t,"twitter_oauth"),l=Jt(t,"discord_oauth"),s=Jt(t,"github_oauth"),c=Jt(t,"spotify_oauth"),u=Jt(t,"tiktok_oauth"),f=Jt(t,"linkedin_oauth"),g=Jt(t,"apple_oauth"),C=Jt(t,"farcaster"),P=e.mfa_methods.map(({type:S,verified_at:b})=>({type:S,verifiedAt:bt(b)}));return{id:e.id,createdAt:bt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:f&&{subject:f.subject,name:f.name,email:f.email},apple:g&&{subject:g.subject,email:g.email},farcaster:C&&{fid:C.fid,ownerAddress:C.ownerAddress,displayName:C.displayName,username:C.username,bio:C.bio,pfp:C.pfp,url:C.url},mfaMethods:P.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var lc=require("@ethersproject/address"),xu=h(require("eventemitter3"));var Jp=h(require("@coinbase/wallet-sdk"));var Ni=require("react/jsx-runtime"),Ga=({style:e,...t})=>(0,Ni.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,Ni.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ni.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 vr=require("@ethersproject/address"),rc=require("@ethersproject/providers"),Yp=h(require("eventemitter3"));var zp=h(require("eventemitter3"));var F1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Gp=e=>F1.includes(e);var Vp=require("@ethersproject/logger");var _n=class extends X{constructor(){super("Wallet timeout");this.type="wallet_error"}},An=class extends X{constructor(){super("User rejected connection");this.type="wallet_error"}},yr=e=>{if(e instanceof X)return e;if(e?.code&&e?.reason){let t=new Ne(e);return e.code===Vp.ErrorCode.ACTION_REJECTED&&(t.details=dt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ne(e):new X("Unknown connector error",e)},Qt=class extends lt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ne=class extends Qt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(dt).find(i=>i.eipCode===o.code);this.details=n||dt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=dt.E32002_CONNECTION_ALREADY_PENDING:this.details=dt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=dt.E32002_WALLET_LOCKED))}},B1={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}},H1={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},G1={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},dt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...G1,...H1},ao={...B1,...dt};var ke=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 _n,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||Jo,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 X(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw yr(r)})}},So=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Va=class extends zp.default{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=io(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=kn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new So(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ye()||!this.address)throw new So("Disconnected",4900);return(await jp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new So(`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 So(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=io(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await $p(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await qp(Ua(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:Qo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Qo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Gp(r.method)){let o=await Ye();if(await Kp(),!o||!this.address)throw new So("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 So("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ye();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}}},gr=class extends ke{constructor(r){super(r,r.rpcTimeoutDuration)}},_o=class extends ke{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 V1=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Et=class extends Yp.default{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=xn(r),this.walletClientType==="privy"&&he.put(La(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=kn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>(0,vr.getAddress)(a.address)===(0,vr.getAddress)(r));return{address:(0,vr.getAddress)(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new X("Wallet is not currently connected.");let l=this.wallets.find(g=>(0,vr.getAddress)(g.address)===(0,vr.getAddress)(r))?.chainId;if(!l)throw new X("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===xn(s))return;let u=this.chains.find(g=>g.id===c);if(!u)throw new X(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(g){if(V1(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new X(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new X("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new X("Wallet is not currently connected.");return new rc.Web3Provider(new gr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new X("Wallet is not currently connected.");return new _o(this.proxyProvider)},sign:async a=>{if(!await i())throw new X("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=(0,vr.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=he.get(La(i));this.chains.find(u=>u.id===Number(c))||(he.del(La(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Ql}`,c),l=Ql}let s=xn(l);if(!a.find(c=>(0,vr.getAddress)(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet((0,vr.getAddress)(n),s,c))}za(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,vr.getAddress)(n)===(0,vr.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 rc.Web3Provider(new gr(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 Rn={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var z1=(e,t)=>{let o=Da(1,[Rn],{},t);return e.makeWeb3Provider(o,1)},$a,qa=class extends Et{constructor(r,o,n,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),$a||($a=new Jp.default({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(z1($a,i))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){$a.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ga,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 X("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};var oc=require("react/jsx-runtime"),ja=({...e})=>(0,oc.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,oc.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 Ka=class extends Et{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Qo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ja,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var nc=require("react/jsx-runtime"),In=({style:e,...t})=>(0,nc.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,nc.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 pt=require("react/jsx-runtime"),Mn=({style:e,...t})=>(0,pt.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,pt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,pt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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 Di=require("react/jsx-runtime"),Ur=({style:e,...t})=>(0,Di.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,Di.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Di.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 Ln=class extends Et{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new X("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}},Wn,On=class extends Et{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";ba(this,Wn,void 0);this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?Hl(this,Wn,{name:"MetaMask",icon:Mn,id:"io.metamask"}):a==="phantom"&&Hl(this,Wn,{name:"Phantom",icon:Ur,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Md(this,Wn)??{name:"Browser Extension",icon:In,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 X("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};Wn=new WeakMap;var $1=require("@ethersproject/address"),q1=require("@ethersproject/providers"),Zp=require("react-device-detect");var Ya=class extends Ln{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{Zp.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 X("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw yr(t)}}};var Ja=class extends Et{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new ke(void 0,Jo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Za=class extends Ja{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Ur,id:"phantom"}}};var Dn=require("@walletconnect/ethereum-provider"),Tu=require("react-device-detect");var er=require("react");var Qp=require("react/jsx-runtime");function Qa({src:e,...t}){return(0,Qp.jsx)("img",{src:e,...t,style:{display:"none"}})}var Fr=require("react"),vu=require("react");var Xt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:mp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Xp=({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 j1=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),eu=e=>j1.has(e),tu=(e,t,r)=>r.indexOf(e)===t,ru=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(eu).filter(tu):e?e.filter(eu).filter(tu):Xt.appearance.walletList;var Xa={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var es={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ts={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var ou={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 nu={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 rs={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var os={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var ns={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 iu={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 au={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 su={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 lu={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 cu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var du={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 pu={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var uu={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 is={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var as={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var ss={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 Ui={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Fi={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var mu={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 fu={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 ls={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 cs={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 ds={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 Nn=[Xa,es,ts,cu,fu,Rn,is,as,ss,Ui,Fi,iu,au,su,lu,rs,os,ns,pu,uu,ou,nu,ls,ds,cs,du,mu],n4=new Set(Nn.map(e=>e.id));var ko=h(require("tinycolor2")),hu="#FFFFFF",K1="#000000",Y1=hu,J1="#1E1E1D";function Z1(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 Ao(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,ko.default)({...e.toHsl(),l:r})}function yu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=hu,blackHex:a=K1}){let l;switch(e){case"light":l=Y1;break;case"dark":l=J1;break;default:l=e;break}let s=(0,ko.default)(l),c=(0,ko.default)(t),u=(0,ko.default)(r),f=(0,ko.default)(o),g=(0,ko.default)(n),C=Z1(s.getLuminance()),P=Ao(s,C==="light"?-.04:.11),w=Ao(s,C==="light"?-.88:.87),S=Ao(s,C==="light"?-.77:.75),b=Ao(s,C==="light"?-.43:.45).desaturate(C==="light"?60:20),x=Ao(s,C==="light"?-.08:.25).desaturate(C==="light"?60:20),I=Ao(c,.15),M=Ao(c,-.06),A=(0,ko.default)(c.getLuminance()>.5?a:i),B=Ao(u,-.16);return{colorScheme:C,background:s.toHslString(),background2:P.toHslString(),foreground:w.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:x.toHslString(),accent:c.toHslString(),accentLight:I.toHslString(),accentDark:M.toHslString(),foregroundAccent:A.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:g.toHslString(),warn:f.toHslString()}}function ic(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(K=>n.includes(K)),a,l,s,c,u,f,g,C,P,w,S,b;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),c=i?.includes("google"),u=i?.includes("twitter"),f=i?.includes("discord"),C=i?.includes("spotify"),g=i?.includes("tiktok"),w=i?.includes("github"),P=i?.includes("linkedin"),S=i?.includes("apple"),b=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,s=e.walletAuth,c=e.googleOAuth,u=e.twitterOAuth,f=e.discordOAuth,w=e.githubOAuth,C=e.spotifyOAuth,g=e.tiktokOAuth,P=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth);let x=[a,l].filter(Boolean),I=[c,u,f,w,C,g,P,S,b].filter(Boolean),M=[s].filter(Boolean);if(x.length+I.length+M.length===0)throw new Error("You must enable at least one login method");let A=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;A&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),A=!1):!A&&I.length+x.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),A=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=ru({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),F=Xp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:R,defaultChain:j}=Q1({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain||!!t?.supportedChains,Z=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ce,oe=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Z?ce=t?.embeddedWallets?.noPromptOnSignature??!0:ce=t?.embeddedWallets?.noPromptOnSignature??oe:ce=oe,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ce!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:yu({backgroundTheme:t?.appearance?.theme??Xt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Xt.appearance.accentColor}),loginGroupPriority:A?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:a,sms:l,google:c,twitter:u,discord:f,github:w,spotify:C,tiktok:g,linkedin:P,apple:S,farcaster:b},loginMethodsAndOrder:F,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Xt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Xt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Xt.rpcConfig.rpcTimeouts},chains:R,defaultChain:j,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Xt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Z?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ce},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Z?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Xt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Xt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Xt._render.inParentNodeId}}}function gu(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Q1({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:Nn.find(u=>u.id===s.id)??s)}else n=Nn.concat(e??[]);let i=t?n[0]:Rn,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var bu=require("react/jsx-runtime"),wu={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},ac=ic(wu,void 0,!1),sc=(0,vu.createContext)({appConfig:ac,isServerConfigLoaded:!1}),Cu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,Fr.useState)(null),a=(0,Fr.useMemo)(()=>ic(n??wu,o,!!n),[n,o]);return(0,Fr.useEffect)(()=>{let l=gu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),(0,Fr.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,bu.jsx)(sc.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},ps=()=>{let{appConfig:e}=(0,Fr.useContext)(sc);return e},us=()=>{let{isServerConfigLoaded:e}=(0,Fr.useContext)(sc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var ms=require("react/jsx-runtime"),Eu=(0,er.createContext)({ready:!1,app:ac,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),X1=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Pu=e=>{let t=ps(),r=e.authenticated,[o,n]=(0,er.useState)(e.initialScreen);(0,er.useEffect)(()=>{!r&&!X1.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,er.useRef)(null);(0,er.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,er.useEffect)(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return(0,ms.jsxs)(Eu.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,ms.jsx)(Qa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>(0,er.useContext)(Eu);var so=require("react/jsx-runtime"),Bi=({style:e,...t})=>{let{app:r}=_();return(0,so.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,so.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,so.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,so.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,so.jsx)("defs",{children:(0,so.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,so.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Br=class extends Et{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Sn[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Fa(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Mn,id:"io.metamask"}:{name:Sp(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Bi,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=Sn[r],this.walletClientType=r,this.redirectUri=void 0,Wp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new An)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new X("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Fa(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=kn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(yr(a));return}o(new X("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=Da(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Dn.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Dn.OPTIONAL_EVENTS,optionalMethods:Dn.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Tu.isMobile&&this.walletEntry){let{redirect:l,href:s}=Ip(a,this.walletEntry);Lp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ba(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Fa(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var cc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===(0,lc.getAddress)(t)).length:!1},kn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Jo:Jo,Un=class extends xu.default{constructor(r,o,n,i,a,l,s,c){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new ke:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;he.get(Jl)&&(he.getKeys().forEach(o=>{o.startsWith("walletconnect")&&he.del(o)}),he.del(Jl));let r=_p(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!To()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new Va(r,o,this.rpcConfig,this.chains,i,n.id),s=new Ka(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Br&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ya(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ln(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new qa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId):r==="phantom"?new Za(this.defaultChain):new Br(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=he.get(Zl);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));he.put(Zl,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,lc.getAddress)(r),this.emit("walletsUpdated")}};function za(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 Su=require("ofetch");var ev=[Ta,Sa,xa],fs=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Ia,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Su.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!ev.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Ea}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw fe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw fe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw fe(o)}}};var Ro=h(require("js-cookie"));function _u(e){return e instanceof Po?"email":e instanceof en?"sms":e instanceof Xo?"siwe":e instanceof En?"custom_auth":e instanceof Dr?e.meta.provider:null}var Au=h(require("jose")),Hr=class{static parse(t){try{return new Hr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Au.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 tv=30,hs=class{constructor(){this.authenticateOnce=new Ct(async t=>this._authenticate(t)),this.linkOnce=new Ct(async t=>this._link(t)),this.refreshOnce=new Ct(this._refresh.bind(this)),this.destroyOnce=new Ct(this._destroy.bind(this)),this.forkSessionOnce=new Ct(this._forkSession.bind(this))}get token(){try{let t=he.get(Ko);return typeof t=="string"?new Hr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=he.get(Ma);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=he.get(ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Ro.default.get(Wa);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Hr.parse(this.token);return t!==null&&!t.isExpired(tv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:i}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let a=_u(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Bt(n),isNewUser:i}}catch(r){throw console.warn("Error authenticating session"),vt(r)}}async _link(t){try{let r=await t.link();return Bt(r)}catch(r){throw console.warn("Error linking account"),vt(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(Ta,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Sa,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),Bt(n.user)}catch(n){if(n instanceof Nr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw vt(n)}}async _destroy(){try{await this.api?.post(xa,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Od,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw vt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=he.get(Ko);if(he.put(Ko,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=Hr.parse(t)?.expiration;Ro.default.set(Kl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else he.del(Ko),Ro.default.remove(Kl)}storeRefreshToken(t){typeof t=="string"?(he.put(Ma,t),this.client?.useServerCookies||(Ro.default.set(Wa,"t",{sameSite:"Strict",secure:!0,expires:30}),Ro.default.set(Yl,t,{sameSite:"Strict",secure:!0,expires:30}))):(he.del(Ma),Ro.default.remove(Yl),Ro.default.remove(Wa))}clearForkedToken(){he.del(ki)}};var dc,ys,Ru,Fn=class{constructor(t){ba(this,ys);this.apiUrl=t.apiUrl||Ra,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||fp,this.appId=t.appId,this.clientAnalyticsId=Wd(this,ys,Ru).call(this),dc||(dc=new hs),this.session=dc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,r,o,n,i,a,l){this.connectors||(this.connectors=new Un(this.appId,t,r,o,n,i,a,l))}generateApi(){let t=new fs(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(Kd,{address:t});return Bt(r)}catch(r){throw vt(r)}}async acceptTerms(){try{let t=await this.api.post(ap,{});return Bt(t)}catch(t){throw vt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Qd,{phoneNumber:t});return Bt(r)}catch(r){throw vt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Fd,{address:t});return Bt(r)}catch(r){throw vt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(op,{provider:t,subject:r});return Bt(o)}catch(o){throw vt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(zd,{fid:t});return Bt(r)}catch(r){throw vt(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(sp,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(lp,t)}catch(r){throw vt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Hr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw vt(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 forkSession(){return await this.session.forkSession()}};ys=new WeakSet,Ru=function(){if(typeof window>"u")return null;try{let r=he.get(Ri);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,ku.v4)();try{return he.put(Ri,t),t}catch{return t}};var Lu=require("@marsidev/react-turnstile"),gs=require("react");var tr=require("react");var Wu=require("react/jsx-runtime"),Iu=(0,tr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),wr=class extends lt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Mu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,tr.useRef)(null),[i,a]=(0,tr.useState)(),[l,s]=(0,tr.useState)(),[c,u]=(0,tr.useState)(!1),f=(0,tr.useMemo)(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return(0,Wu.jsx)(Iu.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Tp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new wr("Captcha failed",null,"captcha_timeout")}}},children:e})},Ee=()=>(0,tr.useContext)(Iu);var pc=require("react/jsx-runtime"),vs=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Ee(),[,s]=(0,gs.useMemo)(()=>r?.split("t:")||[],[r]);if((0,gs.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,pc.jsx)("div",{className:"hidden h-0 w-0",children:(0,pc.jsx)(Lu.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var Co=require("react"),Dg=h(require("react-dom"));var ws=require("react");var uc=(0,ws.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E}),L=()=>(0,ws.useContext)(uc);var Cs=require("react");var ue=(0,Cs.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,initLoginWithEmail:E,initLoginWithSms:E,loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>(0,Cs.useContext)(ue);var bs=require("react"),Ou=e=>{let[t,r]=(0,bs.useState)("auto");return(0,bs.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 Bn=require("react"),Nu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},mc=(0,Bn.createContext)(void 0),Du=()=>(0,Bn.useContext)(mc);function We(e,t){if(!t)return;let o=Du().current[e];return(0,Bn.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Uu(){let e=Du();return(t,r,...o)=>D(e,t,r,...o)}function Es(e){We("configureMfa",e)}var Ec=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),ju=h(require("@heroicons/react/24/solid/DocumentCheckIcon")),Ku=h(require("styled-components"));var or=h(require("styled-components"));var Ps=h(require("styled-components")),Io=require("react/jsx-runtime"),Mo=({success:e,fail:t})=>(0,Io.jsxs)(Io.Fragment,{children:[(0,Io.jsx)(rr,{className:e?"success":t?"fail":""}),(0,Io.jsx)(fc,{className:e?"success":t?"fail":""})]}),rr=Ps.default.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new Ct(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Ud,{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 fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Fd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw fe(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Dd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var en=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(ep,{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 fe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Qd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw fe(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Zd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw fe(o)}}};var ku=require("uuid");function bt(e){return new Date(e*1e3)}function U1(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:bt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:bt(r.verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:bt(r.verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:bt(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(u);break;case"github_oauth":let f={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(f);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:bt(r.verified_at)};t.push(g);break;case"linkedin_oauth":let w={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(w);break;case"apple_oauth":let P={subject:r.subject,email:r.email,type:r.type,verifiedAt:bt(r.verified_at)};t.push(P);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:bt(r.verified_at)});break;case"farcaster":let C={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:bt(r.verified_at)};t.push(C);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Zt(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Me=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,F1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Qt=(e,t)=>t==="all-users"&&!Me(e)||t==="users-without-wallets"&&!F1(e)?.length;function Bt(e){if(!e)return null;let t=U1(e.linked_accounts),r=Zt(t,"wallet"),o=Zt(t,"email"),n=Zt(t,"phone"),i=Zt(t,"google_oauth"),a=Zt(t,"twitter_oauth"),l=Zt(t,"discord_oauth"),s=Zt(t,"github_oauth"),c=Zt(t,"spotify_oauth"),u=Zt(t,"tiktok_oauth"),f=Zt(t,"linkedin_oauth"),g=Zt(t,"apple_oauth"),w=Zt(t,"farcaster"),P=e.mfa_methods.map(({type:S,verified_at:b})=>({type:S,verifiedAt:bt(b)}));return{id:e.id,createdAt:bt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:f&&{subject:f.subject,name:f.name,email:f.email},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url},mfaMethods:P.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var pc=require("@ethersproject/address"),xu=h(require("eventemitter3"));var Jp=h(require("@coinbase/wallet-sdk"));var Di=require("react/jsx-runtime"),za=({style:e,...t})=>(0,Di.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,Di.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Di.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 vr=require("@ethersproject/address"),ic=require("@ethersproject/providers"),Yp=h(require("eventemitter3"));var zp=h(require("eventemitter3"));var B1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Gp=e=>B1.includes(e);var Vp=require("@ethersproject/logger");var _n=class extends ee{constructor(){super("Wallet timeout");this.type="wallet_error"}},An=class extends ee{constructor(){super("User rejected connection");this.type="wallet_error"}},yr=e=>{if(e instanceof ee)return e;if(e?.code&&e?.reason){let t=new De(e);return e.code===Vp.ErrorCode.ACTION_REJECTED&&(t.details=dt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new De(e):new ee("Unknown connector error",e)},Xt=class extends lt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},De=class extends Xt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(dt).find(i=>i.eipCode===o.code);this.details=n||dt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=dt.E32002_CONNECTION_ALREADY_PENDING:this.details=dt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=dt.E32002_WALLET_LOCKED))}},H1={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}},G1={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},V1={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},dt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...V1,...G1},ao={...H1,...dt};var ke=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 _n,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||Jo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ee(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw yr(r)})}},_o=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},$a=class extends zp.default{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=io(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=kn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new _o(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ye()||!this.address)throw new _o("Disconnected",4900);return(await jp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new _o(`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 _o(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=io(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await $p(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await qp(Fa(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:Qo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Qo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Gp(r.method)){let o=await Ye();if(await Kp(),!o||!this.address)throw new _o("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 _o("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ye();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}}},gr=class extends ke{constructor(r){super(r,r.rpcTimeoutDuration)}},Ao=class extends ke{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 z1=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Et=class extends Yp.default{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=xn(r),this.walletClientType==="privy"&&he.put(Oa(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=kn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>(0,vr.getAddress)(a.address)===(0,vr.getAddress)(r));return{address:(0,vr.getAddress)(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new ee("Wallet is not currently connected.");let l=this.wallets.find(g=>(0,vr.getAddress)(g.address)===(0,vr.getAddress)(r))?.chainId;if(!l)throw new ee("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===xn(s))return;let u=this.chains.find(g=>g.id===c);if(!u)throw new ee(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(g){if(z1(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new ee(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new ic.Web3Provider(new gr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new Ao(this.proxyProvider)},sign:async a=>{if(!await i())throw new ee("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=(0,vr.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=he.get(Oa(i));this.chains.find(u=>u.id===Number(c))||(he.del(Oa(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${tc}`,c),l=tc}let s=xn(l);if(!a.find(c=>(0,vr.getAddress)(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet((0,vr.getAddress)(n),s,c))}qa(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,vr.getAddress)(n)===(0,vr.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 ic.Web3Provider(new gr(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 Rn={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var $1=(e,t)=>{let o=Ua(1,[Rn],{},t);return e.makeWeb3Provider(o,1)},ja,Ka=class extends Et{constructor(r,o,n,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),ja||(ja=new Jp.default({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider($1(ja,i))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){ja.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:za,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ee("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};var ac=require("react/jsx-runtime"),Ya=({...e})=>(0,ac.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,ac.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 Ja=class extends Et{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Qo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Ya,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var sc=require("react/jsx-runtime"),In=({style:e,...t})=>(0,sc.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,sc.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 pt=require("react/jsx-runtime"),Mn=({style:e,...t})=>(0,pt.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,pt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,pt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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,pt.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 Ui=require("react/jsx-runtime"),Ur=({style:e,...t})=>(0,Ui.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,Ui.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Ui.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 Ln=class extends Et{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}},Wn,On=class extends Et{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Ea(this,Wn,void 0);this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?zl(this,Wn,{name:"MetaMask",icon:Mn,id:"io.metamask"}):a==="phantom"&&zl(this,Wn,{name:"Phantom",icon:Ur,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Wd(this,Wn)??{name:"Browser Extension",icon:In,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};Wn=new WeakMap;var q1=require("@ethersproject/address"),j1=require("@ethersproject/providers"),Zp=require("react-device-detect");var Za=class extends Ln{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{Zp.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 ee("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw yr(t)}}};var Qa=class extends Et{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new ke(void 0,Jo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Xa=class extends Qa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Ur,id:"phantom"}}};var Dn=require("@walletconnect/ethereum-provider"),Tu=require("react-device-detect");var tr=require("react");var Qp=require("react/jsx-runtime");function es({src:e,...t}){return(0,Qp.jsx)("img",{src:e,...t,style:{display:"none"}})}var Fr=require("react"),vu=require("react");var er={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:fp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Xp=({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 K1=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),eu=e=>K1.has(e),tu=(e,t,r)=>r.indexOf(e)===t,ru=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(eu).filter(tu):e?e.filter(eu).filter(tu):er.appearance.walletList;var ts={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var rs={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var os={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 ou={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 nu={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 ns={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var is={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var as={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 iu={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 au={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 su={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 lu={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 cu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var du={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 pu={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var uu={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 ss={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var ls={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var cs={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 Fi={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Bi={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var mu={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 fu={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 ds={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 ps={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 us={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 Nn=[ts,rs,os,cu,fu,Rn,ss,ls,cs,Fi,Bi,iu,au,su,lu,ns,is,as,pu,uu,ou,nu,ds,us,ps,du,mu],i4=new Set(Nn.map(e=>e.id));var Ro=h(require("tinycolor2")),hu="#FFFFFF",Y1="#000000",J1=hu,Z1="#1E1E1D";function Q1(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 ko(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,Ro.default)({...e.toHsl(),l:r})}function yu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=hu,blackHex:a=Y1}){let l;switch(e){case"light":l=J1;break;case"dark":l=Z1;break;default:l=e;break}let s=(0,Ro.default)(l),c=(0,Ro.default)(t),u=(0,Ro.default)(r),f=(0,Ro.default)(o),g=(0,Ro.default)(n),w=Q1(s.getLuminance()),P=ko(s,w==="light"?-.04:.11),C=ko(s,w==="light"?-.88:.87),S=ko(s,w==="light"?-.77:.75),b=ko(s,w==="light"?-.43:.45).desaturate(w==="light"?60:20),x=ko(s,w==="light"?-.08:.25).desaturate(w==="light"?60:20),I=ko(c,.15),M=ko(c,-.06),A=(0,Ro.default)(c.getLuminance()>.5?a:i),B=ko(u,-.16);return{colorScheme:w,background:s.toHslString(),background2:P.toHslString(),foreground:C.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:x.toHslString(),accent:c.toHslString(),accentLight:I.toHslString(),accentDark:M.toHslString(),foregroundAccent:A.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:g.toHslString(),warn:f.toHslString()}}function lc(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(Y=>n.includes(Y)),a,l,s,c,u,f,g,w,P,C,S,b;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),c=i?.includes("google"),u=i?.includes("twitter"),f=i?.includes("discord"),w=i?.includes("spotify"),g=i?.includes("tiktok"),C=i?.includes("github"),P=i?.includes("linkedin"),S=i?.includes("apple"),b=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,s=e.walletAuth,c=e.googleOAuth,u=e.twitterOAuth,f=e.discordOAuth,C=e.githubOAuth,w=e.spotifyOAuth,g=e.tiktokOAuth,P=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth);let x=[a,l].filter(Boolean),I=[c,u,f,C,w,g,P,S,b].filter(Boolean),M=[s].filter(Boolean);if(x.length+I.length+M.length===0)throw new Error("You must enable at least one login method");let A=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;A&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),A=!1):!A&&I.length+x.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),A=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=ru({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),F=Xp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:R,defaultChain:K}=X1({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain||!!t?.supportedChains,Q=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ce,ne=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Q?ce=t?.embeddedWallets?.noPromptOnSignature??!0:ce=t?.embeddedWallets?.noPromptOnSignature??ne:ce=ne,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ce!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:yu({backgroundTheme:t?.appearance?.theme??er.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??er.appearance.accentColor}),loginGroupPriority:A?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:a,sms:l,google:c,twitter:u,discord:f,github:C,spotify:w,tiktok:g,linkedin:P,apple:S,farcaster:b},loginMethodsAndOrder:F,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??er.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??er.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??er.rpcConfig.rpcTimeouts},chains:R,defaultChain:K,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??er.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Q?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ce},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Q?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??er.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??er._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??er._render.inParentNodeId}}}function gu(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function X1({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:Nn.find(u=>u.id===s.id)??s)}else n=Nn.concat(e??[]);let i=t?n[0]:Rn,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var bu=require("react/jsx-runtime"),wu={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},cc=lc(wu,void 0,!1),dc=(0,vu.createContext)({appConfig:cc,isServerConfigLoaded:!1}),Cu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,Fr.useState)(null),a=(0,Fr.useMemo)(()=>lc(n??wu,o,!!n),[n,o]);return(0,Fr.useEffect)(()=>{let l=gu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),(0,Fr.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,bu.jsx)(dc.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},ms=()=>{let{appConfig:e}=(0,Fr.useContext)(dc);return e},fs=()=>{let{isServerConfigLoaded:e}=(0,Fr.useContext)(dc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var hs=require("react/jsx-runtime"),Eu=(0,tr.createContext)({ready:!1,app:cc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),ev=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Pu=e=>{let t=ms(),r=e.authenticated,[o,n]=(0,tr.useState)(e.initialScreen);(0,tr.useEffect)(()=>{!r&&!ev.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,tr.useRef)(null);(0,tr.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,tr.useEffect)(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return(0,hs.jsxs)(Eu.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,hs.jsx)(es,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>(0,tr.useContext)(Eu);var so=require("react/jsx-runtime"),Hi=({style:e,...t})=>{let{app:r}=_();return(0,so.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,so.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,so.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,so.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,so.jsx)("defs",{children:(0,so.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,so.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Br=class extends Et{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ke(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Sn[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Ba(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Mn,id:"io.metamask"}:{name:_p(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Hi,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=Sn[r],this.walletClientType=r,this.redirectUri=void 0,Lp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new An)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ee("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ba(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=kn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(yr(a));return}o(new ee("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=Ua(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Dn.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Dn.OPTIONAL_EVENTS,optionalMethods:Dn.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Tu.isMobile&&this.walletEntry){let{redirect:l,href:s}=Mp(a,this.walletEntry);Op({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ha(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Ba(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var uc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===(0,pc.getAddress)(t)).length:!1},kn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Jo:Jo,Un=class extends xu.default{constructor(r,o,n,i,a,l,s,c){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new ke:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;he.get(Xl)&&(he.getKeys().forEach(o=>{o.startsWith("walletconnect")&&he.del(o)}),he.del(Xl));let r=Ap(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!xo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new $a(r,o,this.rpcConfig,this.chains,i,n.id),s=new Ja(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Br&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Za(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new On(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ln(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Ka(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId):r==="phantom"?new Xa(this.defaultChain):new Br(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=he.get(ec);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));he.put(ec,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,pc.getAddress)(r),this.emit("walletsUpdated")}};function qa(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 Su=require("ofetch");var tv=[xa,_a,Sa],ys=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Ma,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Su.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!tv.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Pa}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw fe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw fe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw fe(o)}}};var Io=h(require("js-cookie"));function _u(e){return e instanceof To?"email":e instanceof en?"sms":e instanceof Xo?"siwe":e instanceof En?"custom_auth":e instanceof Dr?e.meta.provider:null}var Au=h(require("jose")),Hr=class{static parse(t){try{return new Hr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Au.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 rv=30,gs=class{constructor(){this.authenticateOnce=new Ct(async t=>this._authenticate(t)),this.linkOnce=new Ct(async t=>this._link(t)),this.refreshOnce=new Ct(this._refresh.bind(this)),this.destroyOnce=new Ct(this._destroy.bind(this)),this.forkSessionOnce=new Ct(this._forkSession.bind(this))}get token(){try{let t=he.get(Ko);return typeof t=="string"?new Hr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=he.get(Wa);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=he.get(Ri);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Io.default.get(La);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Hr.parse(this.token);return t!==null&&!t.isExpired(rv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:i}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let a=_u(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Bt(n),isNewUser:i}}catch(r){throw console.warn("Error authenticating session"),vt(r)}}async _link(t){try{let r=await t.link();return Bt(r)}catch(r){throw console.warn("Error linking account"),vt(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(xa,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(_a,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),Bt(n.user)}catch(n){if(n instanceof Nr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw vt(n)}}async _destroy(){try{await this.api?.post(Sa,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Nd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw vt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=he.get(Ko);if(he.put(Ko,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=Hr.parse(t)?.expiration;Io.default.set(Zl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else he.del(Ko),Io.default.remove(Zl)}storeRefreshToken(t){typeof t=="string"?(he.put(Wa,t),this.client?.useServerCookies||(Io.default.set(La,"t",{sameSite:"Strict",secure:!0,expires:30}),Io.default.set(Ql,t,{sameSite:"Strict",secure:!0,expires:30}))):(he.del(Wa),Io.default.remove(Ql),Io.default.remove(La))}clearForkedToken(){he.del(Ri)}};var mc,vs,Ru,Fn=class{constructor(t){Ea(this,vs);this.apiUrl=t.apiUrl||Ia,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||hp,this.appId=t.appId,this.clientAnalyticsId=Ld(this,vs,Ru).call(this),mc||(mc=new gs),this.session=mc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,r,o,n,i,a,l){this.connectors||(this.connectors=new Un(this.appId,t,r,o,n,i,a,l))}generateApi(){let t=new ys(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(Yd,{address:t});return Bt(r)}catch(r){throw vt(r)}}async acceptTerms(){try{let t=await this.api.post(sp,{});return Bt(t)}catch(t){throw vt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Xd,{phoneNumber:t});return Bt(r)}catch(r){throw vt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Bd,{address:t});return Bt(r)}catch(r){throw vt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(np,{provider:t,subject:r});return Bt(o)}catch(o){throw vt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post($d,{fid:t});return Bt(r)}catch(r){throw vt(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(lp,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(cp,t)}catch(r){throw vt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Hr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw vt(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 forkSession(){return await this.session.forkSession()}};vs=new WeakSet,Ru=function(){if(typeof window>"u")return null;try{let r=he.get(Ii);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,ku.v4)();try{return he.put(Ii,t),t}catch{return t}};var Lu=require("@marsidev/react-turnstile"),ws=require("react");var rr=require("react");var Wu=require("react/jsx-runtime"),Iu=(0,rr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),wr=class extends lt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Mu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,rr.useRef)(null),[i,a]=(0,rr.useState)(),[l,s]=(0,rr.useState)(),[c,u]=(0,rr.useState)(!1),f=(0,rr.useMemo)(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return(0,Wu.jsx)(Iu.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await xp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new wr("Captcha failed",null,"captcha_timeout")}}},children:e})},Ee=()=>(0,rr.useContext)(Iu);var fc=require("react/jsx-runtime"),Cs=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Ee(),[,s]=(0,ws.useMemo)(()=>r?.split("t:")||[],[r]);if((0,ws.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,fc.jsx)("div",{className:"hidden h-0 w-0",children:(0,fc.jsx)(Lu.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var bo=require("react"),Ug=h(require("react-dom"));var bs=require("react");var hc=(0,bs.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E}),L=()=>(0,bs.useContext)(hc);var Es=require("react");var ue=(0,Es.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,initLoginWithEmail:E,initLoginWithSms:E,loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>(0,Es.useContext)(ue);var Ps=require("react"),Ou=e=>{let[t,r]=(0,Ps.useState)("auto");return(0,Ps.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 Bn=require("react"),Nu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},yc=(0,Bn.createContext)(void 0),Du=()=>(0,Bn.useContext)(yc);function We(e,t){if(!t)return;let o=Du().current[e];return(0,Bn.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Uu(){let e=Du();return(t,r,...o)=>D(e,t,r,...o)}function Ts(e){We("configureMfa",e)}var xc=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),ju=h(require("@heroicons/react/24/solid/DocumentCheckIcon")),Ku=h(require("styled-components"));var nr=h(require("styled-components"));var xs=h(require("styled-components")),Mo=require("react/jsx-runtime"),lo=({success:e,fail:t})=>(0,Mo.jsxs)(Mo.Fragment,{children:[(0,Mo.jsx)(or,{className:e?"success":t?"fail":""}),(0,Mo.jsx)(gc,{className:e?"success":t?"fail":""})]}),or=xs.default.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,gc=(0,xs.default)(or)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,tn=e=>(0,
|
|
51
|
+
`,tn=e=>(0,Mo.jsx)(ov,{color:e.color||"var(--privy-color-foreground-3)"}),ov=(0,xs.default)(or)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;var Je=require("react/jsx-runtime"),
|
|
60
|
+
`;var Je=require("react/jsx-runtime"),Ss=nr.default.button`
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: row;
|
|
63
63
|
align-items: center;
|
|
@@ -85,13 +85,13 @@ Resources:
|
|
|
85
85
|
color: var(--privy-color-foreground-3);
|
|
86
86
|
cursor: not-allowed;
|
|
87
87
|
}
|
|
88
|
-
`,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Je.jsx)(Fu,{disabled:t||r,...n,children:t?(0,Je.jsxs)("span",{children:[(0,Je.jsx)(tn,{}),o?(0,Je.jsx)("span",{children:o}):null]}):e}),
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
88
|
+
`,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Je.jsx)(Fu,{disabled:t||r,...n,children:t?(0,Je.jsxs)("span",{children:[(0,Je.jsx)(tn,{}),o?(0,Je.jsx)("span",{children:o}):null]}):e}),GE=(0,nr.default)(U)`
|
|
89
|
+
${e=>e.hideAnimations&&nr.css`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
94
|
+
`,_s=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Je.jsx)(Fu,{as:"a",disabled:t||r,...n,children:t?(0,Je.jsxs)("span",{children:[(0,Je.jsx)(tn,{}),o?(0,Je.jsx)("span",{children:o}):null]}):e}),Fu=(0,nr.default)(Ss)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -117,7 +117,7 @@ Resources:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
120
|
-
${e=>e.disabled?
|
|
120
|
+
${e=>e.disabled?nr.css`
|
|
121
121
|
&&&,
|
|
122
122
|
&&&:hover,
|
|
123
123
|
&&&:active {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
`,Cr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Je.jsx)(
|
|
139
|
+
`,Cr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Je.jsx)(nv,{disabled:t||r,...n,children:t?(0,Je.jsxs)("span",{children:[(0,Je.jsx)(tn,{}),o?(0,Je.jsx)("span",{children:o}):null]}):e}),nv=(0,nr.default)(Ss)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
opacity: 1;
|
|
166
166
|
animation: fadein 200ms ease;
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,As=nr.default.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -178,7 +178,7 @@ Resources:
|
|
|
178
178
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
179
179
|
user-select: none;
|
|
180
180
|
|
|
181
|
-
${e=>e.invisible&&
|
|
181
|
+
${e=>e.invisible&&nr.css`
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
`}
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,VE=nr.default.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,Hn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Je.jsxs)(
|
|
202
|
+
`,Hn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Je.jsxs)(iv,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,Je.jsx)("span",{children:e}),(0,Je.jsx)("span",{children:(0,Je.jsx)(tn,{})})]}),iv=nr.default.button`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -241,7 +241,7 @@ Resources:
|
|
|
241
241
|
cursor: not-allowed;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
`;var
|
|
244
|
+
`;var wc=h(require("styled-components"));var kt=require("react/jsx-runtime"),vc=wc.default.div`
|
|
245
245
|
margin-top: 16px;
|
|
246
246
|
font-size: 13px;
|
|
247
247
|
text-align: center;
|
|
@@ -250,7 +250,7 @@ Resources:
|
|
|
250
250
|
&& > a {
|
|
251
251
|
color: var(--privy-color-accent);
|
|
252
252
|
}
|
|
253
|
-
`;function Gn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,kt.jsx)(
|
|
253
|
+
`;function Gn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,kt.jsx)(vc,{});if(!r&&!t)return(0,kt.jsx)(vc,{});let n=!!(t&&r);return(0,kt.jsxs)(vc,{children:["By logging in I agree to the"," ",r&&(0,kt.jsx)("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,kt.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=({protectedByPrivy:e})=>(0,kt.jsx)(se,{children:e?(0,kt.jsxs)(kt.Fragment,{children:[(0,kt.jsx)(Ya,{className:"hide-on-mobile"}),(0,kt.jsx)("span",{className:"hide-on-mobile",children:(0,kt.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),se=wc.default.div`
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
justify-content: center;
|
|
@@ -277,7 +277,7 @@ Resources:
|
|
|
277
277
|
@media all and (display-mode: standalone) {
|
|
278
278
|
padding-bottom: 30px;
|
|
279
279
|
}
|
|
280
|
-
`;var Hu=h(require("@heroicons/react/24/outline/ArrowLeftIcon")),Gu=h(require("@heroicons/react/24/outline/XMarkIcon")),
|
|
280
|
+
`;var Hu=h(require("@heroicons/react/24/outline/ArrowLeftIcon")),Gu=h(require("@heroicons/react/24/outline/XMarkIcon")),ks=h(require("styled-components"));var Pt=require("react/jsx-runtime"),Bu=()=>(0,Pt.jsx)("div",{}),av=({backFn:e})=>(0,Pt.jsx)("div",{children:(0,Pt.jsx)(Vu,{onClick:e,children:(0,Pt.jsx)(Hu.default,{height:"16px",width:"16px",strokeWidth:2})})}),sv=e=>(0,Pt.jsx)("div",{children:(0,Pt.jsx)(Vu,{"aria-label":"close modal",onClick:e.onClose,children:(0,Pt.jsx)(Gu.default,{height:"16px",width:"16px",strokeWidth:2})})});var k=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=L(),{app:i}=_();return(0,Pt.jsxs)(lv,{children:[e?(0,Pt.jsx)(av,{backFn:e}):(0,Pt.jsx)(Bu,{}),r&&(0,Pt.jsx)(cv,{id:"privy-dialog-title",children:r}),i?.render.inDialog&&o?(0,Pt.jsx)(sv,{onClose:t||(()=>n())}):(0,Pt.jsx)(Bu,{})]})},Vu=ks.default.button`
|
|
281
281
|
&& {
|
|
282
282
|
cursor: pointer;
|
|
283
283
|
display: flex;
|
|
@@ -296,7 +296,7 @@ Resources:
|
|
|
296
296
|
opacity: 1;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
`,
|
|
299
|
+
`,lv=ks.default.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,22 +318,22 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,cv=ks.default.div`
|
|
322
322
|
overflow: hidden;
|
|
323
323
|
white-space: nowrap;
|
|
324
324
|
max-width: 100%;
|
|
325
325
|
text-overflow: ellipsis;
|
|
326
326
|
text-align: center;
|
|
327
327
|
color: var(--privy-color-foreground-2);
|
|
328
|
-
`;var
|
|
328
|
+
`;var co=h(require("styled-components")),Rs=co.default.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
|
-
`,
|
|
331
|
+
`,Is=co.default.div`
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,
|
|
336
|
+
`,ir=co.default.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 12px;
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,zu=
|
|
351
|
+
`,zu=co.css`
|
|
352
352
|
&& {
|
|
353
353
|
width: 100%;
|
|
354
354
|
font-size: 16px;
|
|
@@ -386,11 +386,11 @@ Resources:
|
|
|
386
386
|
max-width: 24px;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
389
|
+
`,Ue=co.default.button`
|
|
390
390
|
${zu}
|
|
391
|
-
`,
|
|
391
|
+
`,Cc=co.default.a`
|
|
392
392
|
${zu}
|
|
393
|
-
`,co
|
|
393
|
+
`,po=co.default.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
396
|
`;var Ze=h(require("styled-components")),ut=Ze.default.div`
|
|
@@ -401,13 +401,13 @@ Resources:
|
|
|
401
401
|
@media (max-width: 440px) {
|
|
402
402
|
padding: 10px 10px 20px;
|
|
403
403
|
}
|
|
404
|
-
`,
|
|
404
|
+
`,Le=Ze.default.div`
|
|
405
405
|
font-size: 18px;
|
|
406
406
|
line-height: 18px;
|
|
407
407
|
text-align: center;
|
|
408
408
|
font-weight: 600;
|
|
409
409
|
margin-bottom: 10px;
|
|
410
|
-
`,
|
|
410
|
+
`,Re=Ze.default.div`
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
@@ -429,7 +429,7 @@ Resources:
|
|
|
429
429
|
padding: 1rem 0rem 0rem;
|
|
430
430
|
flex-grow: 1;
|
|
431
431
|
width: 100%;
|
|
432
|
-
`,
|
|
432
|
+
`,bc=Ze.default.div`
|
|
433
433
|
width: 25px;
|
|
434
434
|
display: flex;
|
|
435
435
|
align-items: center;
|
|
@@ -441,7 +441,7 @@ Resources:
|
|
|
441
441
|
width: 25px !important;
|
|
442
442
|
color: var(--privy-color-accent);
|
|
443
443
|
}
|
|
444
|
-
`,
|
|
444
|
+
`,Ec=Ze.default.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-items: center;
|
|
447
447
|
gap: 10px;
|
|
@@ -453,7 +453,7 @@ Resources:
|
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
455
455
|
padding-top: 20px;
|
|
456
|
-
`,
|
|
456
|
+
`,Ms=Ze.default.div`
|
|
457
457
|
display: flex;
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
align-items: stretch;
|
|
@@ -461,7 +461,7 @@ Resources:
|
|
|
461
461
|
padding: 1rem 0rem 0rem;
|
|
462
462
|
flex-grow: 1;
|
|
463
463
|
width: 100%;
|
|
464
|
-
`,
|
|
464
|
+
`,Ws=Ze.default.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
gap: 5px;
|
|
467
467
|
width: 100%;
|
|
@@ -469,7 +469,7 @@ Resources:
|
|
|
469
469
|
& > button:not(#remove) {
|
|
470
470
|
width: 100%;
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,Pc=Ze.default.button`
|
|
473
473
|
&& {
|
|
474
474
|
background-color: transparent;
|
|
475
475
|
color: var(--privy-color-foreground-3);
|
|
@@ -488,7 +488,7 @@ Resources:
|
|
|
488
488
|
&&:hover {
|
|
489
489
|
color: var(--privy-color-error);
|
|
490
490
|
}
|
|
491
|
-
`,
|
|
491
|
+
`,Ls=Ze.default.div`
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
gap: 0.5rem;
|
|
@@ -512,7 +512,7 @@ Resources:
|
|
|
512
512
|
display: flex !important;
|
|
513
513
|
align-items: flex-end;
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,Os=Ze.default.div`
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
@@ -520,7 +520,7 @@ Resources:
|
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Tc=Ze.default.button`
|
|
524
524
|
display: flex;
|
|
525
525
|
flex-direction: row;
|
|
526
526
|
align-items: center;
|
|
@@ -565,10 +565,10 @@ Resources:
|
|
|
565
565
|
width: auto !important;
|
|
566
566
|
color: white;
|
|
567
567
|
}
|
|
568
|
-
`;var $e=require("react/jsx-runtime"),Yu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=L(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&
|
|
568
|
+
`;var $e=require("react/jsx-runtime"),Yu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=L(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&Qt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:g=>{console.error(g),s("embedded_wallet_creation_failure_logout",{error:g,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,$e.jsx)(dv,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},dv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(k,{closeable:!1}),(0,$e.jsx)(ju.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,$e.jsx)(Le,{style:{marginTop:24},children:"One last step"}),(0,$e.jsx)(Re,{children:"By signing up, you agree to our terms and privacy policy."}),(0,$e.jsxs)(ir,{style:{marginTop:24},children:[e&&(0,$e.jsxs)(Cc,{target:"_blank",href:e,children:["View Terms ",(0,$e.jsx)(xc.default,{style:{marginLeft:"auto"}})]}),t&&(0,$e.jsxs)(Cc,{target:"_blank",href:t,children:["View Privacy Policy ",(0,$e.jsx)(xc.default,{style:{marginLeft:"auto"}})]})]}),(0,$e.jsxs)(pv,{style:{marginTop:24},children:[(0,$e.jsx)(Cr,{onClick:o,children:"No thanks"}),(0,$e.jsx)(U,{onClick:r,children:"Accept"})]}),(0,$e.jsx)($,{protectedByPrivy:!0})]}),pv=Ku.default.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;var
|
|
571
|
+
`;var Us=h(require("styled-components"));var Ju=h(require("styled-components")),Ns=Ju.default.span`
|
|
572
572
|
&& {
|
|
573
573
|
width: 82px;
|
|
574
574
|
height: 82px;
|
|
@@ -583,7 +583,7 @@ Resources:
|
|
|
583
583
|
transition: border-color 800ms;
|
|
584
584
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
585
585
|
}
|
|
586
|
-
`;var
|
|
586
|
+
`;var Sc=require("react/jsx-runtime"),Ds=({style:e,...t})=>(0,Sc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:(0,Sc.jsx)("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});var Ve=require("react/jsx-runtime"),Zu=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(k,{}),(0,Ve.jsxs)(uv,{children:[(0,Ve.jsx)(fv,{children:(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)(Ns,{}),(0,Ve.jsx)(Ds,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,Ve.jsxs)(mv,{children:[typeof r=="string"?(0,Ve.jsx)("h3",{children:r}):(0,Ve.jsx)(Ve.Fragment,{children:r}),typeof o=="string"?(0,Ve.jsx)("p",{children:o}):(0,Ve.jsx)(Ve.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,Ve.jsx)(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,Ve.jsx)(U,{onClick:()=>{e("LANDING")},children:n})]})]})},uv=Us.default.div`
|
|
587
587
|
display: flex;
|
|
588
588
|
flex-direction: column;
|
|
589
589
|
align-items: center;
|
|
@@ -591,11 +591,11 @@ Resources:
|
|
|
591
591
|
gap: 24px;
|
|
592
592
|
width: 100%;
|
|
593
593
|
padding-bottom: 16px;
|
|
594
|
-
`,
|
|
594
|
+
`,mv=Us.default.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,fv=Us.default.div`
|
|
599
599
|
display: flex;
|
|
600
600
|
flex-direction: column;
|
|
601
601
|
justify-content: center;
|
|
@@ -618,7 +618,7 @@ Resources:
|
|
|
618
618
|
left: -19px;
|
|
619
619
|
top: -19px;
|
|
620
620
|
}
|
|
621
|
-
`;var im=h(require("@heroicons/react/24/outline/EnvelopeIcon")),am=h(require("@heroicons/react/24/outline/PhoneIcon")),Oo=require("react"),sm=require("react-device-detect"),zn=h(require("styled-components"));var Rt=h(require("styled-components")),
|
|
621
|
+
`;var im=h(require("@heroicons/react/24/outline/EnvelopeIcon")),am=h(require("@heroicons/react/24/outline/PhoneIcon")),Oo=require("react"),sm=require("react-device-detect"),zn=h(require("styled-components"));var Rt=h(require("styled-components")),ar=Rt.default.div`
|
|
622
622
|
display: flex;
|
|
623
623
|
flex-direction: column;
|
|
624
624
|
align-items: flex-start;
|
|
@@ -626,7 +626,7 @@ Resources:
|
|
|
626
626
|
margin-top: auto;
|
|
627
627
|
gap: 16px;
|
|
628
628
|
flex-grow: 100;
|
|
629
|
-
`,
|
|
629
|
+
`,sr=Rt.default.div`
|
|
630
630
|
display: flex;
|
|
631
631
|
flex-direction: column;
|
|
632
632
|
align-items: center;
|
|
@@ -638,19 +638,19 @@ Resources:
|
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,
|
|
641
|
+
`,Fs=(0,Rt.default)(sr)`
|
|
642
642
|
padding: 20px 0;
|
|
643
|
-
`,br=(0,Rt.default)(
|
|
643
|
+
`,br=(0,Rt.default)(sr)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,_c=Rt.default.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,
|
|
649
|
+
`,Ht=Rt.default.div`
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
`,
|
|
653
|
+
`,y5=Rt.default.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
@@ -678,9 +678,9 @@ Resources:
|
|
|
678
678
|
color: var(--privy-color-foreground-3);
|
|
679
679
|
font-size: 14px;
|
|
680
680
|
}
|
|
681
|
-
`,
|
|
681
|
+
`,oe=Rt.default.div`
|
|
682
682
|
height: 16px;
|
|
683
|
-
`,
|
|
683
|
+
`,ie=Rt.default.div`
|
|
684
684
|
height: 12px;
|
|
685
685
|
`,em=Rt.default.div`
|
|
686
686
|
position: relative;
|
|
@@ -692,9 +692,9 @@ Resources:
|
|
|
692
692
|
border-radius: 50%;
|
|
693
693
|
border-color: white;
|
|
694
694
|
border-width: 2px !important;
|
|
695
|
-
`;var
|
|
695
|
+
`;var Bs=h(require("styled-components")),Er=require("react/jsx-runtime"),Gi=({title:e,description:t,children:r,...o})=>(0,Er.jsx)(rm,{...o,children:(0,Er.jsxs)(Er.Fragment,{children:[(0,Er.jsx)("h3",{children:e}),typeof t=="string"?(0,Er.jsx)("p",{children:t}):t,r]})}),Gr=(0,Bs.default)(Gi)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,Fe=({title:e,description:t,icon:r,children:o,...n})=>(0,Er.jsxs)(
|
|
697
|
+
`,Fe=({title:e,description:t,icon:r,children:o,...n})=>(0,Er.jsxs)(hv,{...n,children:[r||null,(0,Er.jsx)("h3",{children:e}),typeof t=="string"?(0,Er.jsx)("p",{children:t}):t,o]}),rm=Bs.default.div`
|
|
698
698
|
display: flex;
|
|
699
699
|
flex-direction: column;
|
|
700
700
|
justify-content: flex-start;
|
|
@@ -714,7 +714,7 @@ Resources:
|
|
|
714
714
|
color: var(--privy-color-foreground-2);
|
|
715
715
|
font-size: 14px;
|
|
716
716
|
}
|
|
717
|
-
`,
|
|
717
|
+
`,hv=(0,Bs.default)(rm)`
|
|
718
718
|
align-items: center;
|
|
719
719
|
text-align: center;
|
|
720
720
|
gap: 16px;
|
|
@@ -722,7 +722,7 @@ Resources:
|
|
|
722
722
|
h3 {
|
|
723
723
|
margin-bottom: 24px;
|
|
724
724
|
}
|
|
725
|
-
`;var de=require("react/jsx-runtime"),
|
|
725
|
+
`;var de=require("react/jsx-runtime"),Ac=6,om=new Array(Ac).fill(""),yv=1400;var lm=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=L(),{authenticated:g,logout:w,user:P}=G(),[C,S]=(0,Oo.useState)(om),[b,x]=(0,Oo.useState)(!1),[I,M]=(0,Oo.useState)(null),[A,B]=(0,Oo.useState)(null);n.current=()=>null;let F=s()?.email?0:1,H=e?.render.inDialog?wt:0,R=e?.render.inDialog?H-500:0;(0,Oo.useEffect)(()=>{if(g&&b&&P){if(e?.legal.requireUsersAcceptTerms&&!P.hasAcceptedTerms){let re=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(re)}if(Qt(P,e?.embeddedWallets?.createOnLogin)){let re=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Y=>{console.error(Y),f("embedded_wallet_creation_failure_logout",{error:Y,screen:"AwaitingPasswordlessCodeScreen"}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(re)}else{u();let re=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(re)}}},[g,b,P]),(0,Oo.useEffect)(()=>{if(I&&A===0){let ne=setTimeout(()=>{S(om),M(null),document.querySelector("input[name=code-0]")?.focus()},yv);return()=>clearTimeout(ne)}},[I]);let K=ne=>{ne.preventDefault();let re=ne.currentTarget.value.replace(" ","");if(re==="")return;if(isNaN(Number(re))){M("Code should be numeric"),B(1);return}M(null),B(null);let Y=Number(ne.currentTarget.name?.charAt(5)),Ne=[...re||[""]].slice(0,Ac-Y),Ie=[...C.slice(0,Y),...Ne,...C.slice(Y+Ne.length)];S(Ie);let to=Ne.length,Nt=Math.min(Math.max(Y+to,0),Ac-1);isNaN(Number(ne.currentTarget.value))||document.querySelector(`input[name=code-${Nt}]`)?.focus(),Ie.every(ze=>ze&&!isNaN(+ze))&&(document.querySelector(`input[name=code-${Nt}]`)?.blur(),c(Ie.join("")).then(()=>x(!0)).catch(xe=>{xe?.status===422?M("Invalid or expired verification code"):xe instanceof Nr&&xe.privyErrorCode==="cannot_link_more_of_type"?M(xe.message):M("Issue verifying code"),B(0)}))},O=ne=>{A===1&&(M(null),B(null));let re=[...C.slice(0,ne),"",...C.slice(ne+1)];S(re),ne>0&&document.querySelector(`input[name=code-${ne-1}]`)?.focus()},Q=F==0?(0,de.jsx)(im.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,de.jsx)(am.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ce=F==0?(0,de.jsxs)("p",{children:["Please check ",(0,de.jsx)(nm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,de.jsxs)("p",{children:["Please check ",(0,de.jsx)(nm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(k,{backFn:()=>r()},"header"),(0,de.jsxs)(gv,{children:[(0,de.jsx)(Fe,{title:"Enter confirmation code",description:ce,icon:Q}),(0,de.jsxs)(Qu,{children:[(0,de.jsxs)(vv,{children:[(0,de.jsx)(wv,{fail:!!I,success:b,children:(0,de.jsx)("span",{children:I||(b?"Success!":"")})}),(0,de.jsx)("div",{children:C.map((ne,re)=>(0,de.jsx)("input",{name:`code-${re}`,type:"text",value:C[re],onChange:K,onKeyUp:Y=>{Y.key==="Backspace"&&O(re)},inputMode:"numeric",autoFocus:re===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:sm.isMobile?"one-time-code":"off"},re))})]}),(0,de.jsx)(Cv,{children:F==0?(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("span",{children:"Didn't get an email?"}),(0,de.jsx)("button",{onClick:a,children:"Resend code"})]}):(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("span",{children:"Didn't get a message?"}),(0,de.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,de.jsx)($,{protectedByPrivy:!0})]})},gv=zn.default.div`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
728
|
align-items: flex-start;
|
|
@@ -730,7 +730,7 @@ Resources:
|
|
|
730
730
|
margin: auto;
|
|
731
731
|
gap: 16px;
|
|
732
732
|
flex-grow: 1;
|
|
733
|
-
`,
|
|
733
|
+
`,vv=zn.default.div`
|
|
734
734
|
display: flex;
|
|
735
735
|
flex-direction: column;
|
|
736
736
|
width: 100%;
|
|
@@ -786,7 +786,7 @@ Resources:
|
|
|
786
786
|
transform: translate(1px, 0px);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
`,
|
|
789
|
+
`,wv=zn.default.div`
|
|
790
790
|
line-height: 20px;
|
|
791
791
|
height: 20px;
|
|
792
792
|
font-size: 13px;
|
|
@@ -794,7 +794,7 @@ Resources:
|
|
|
794
794
|
display: flex;
|
|
795
795
|
justify-content: flex-end;
|
|
796
796
|
width: 100%;
|
|
797
|
-
`,
|
|
797
|
+
`,Cv=zn.default.div`
|
|
798
798
|
font-size: 13px;
|
|
799
799
|
color: var(--privy-color-foreground-3);
|
|
800
800
|
display: flex;
|
|
@@ -811,7 +811,7 @@ Resources:
|
|
|
811
811
|
`,nm=zn.default.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;var um=h(require("@heroicons/react/24/solid/CheckCircleIcon")),mm=h(require("@heroicons/react/24/solid/XCircleIcon")),
|
|
814
|
+
`;var um=h(require("@heroicons/react/24/solid/CheckCircleIcon")),mm=h(require("@heroicons/react/24/solid/XCircleIcon")),Gt=require("react"),fm=h(require("styled-components"));var cm=h(require("styled-components"));var Pr=require("react/jsx-runtime"),dm=({icon:e})=>{let t=e;return(0,Pr.jsx)(Pr.Fragment,{children:(0,Pr.jsx)(bv,{children:(0,Pr.jsxs)("div",{children:[(0,Pr.jsx)(lo,{}),typeof t=="string"?(0,Pr.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,Pr.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,Pr.jsx)("span",{})]})})})},bv=cm.default.div`
|
|
815
815
|
display: flex;
|
|
816
816
|
flex-direction: column;
|
|
817
817
|
justify-content: center;
|
|
@@ -834,14 +834,14 @@ Resources:
|
|
|
834
834
|
left: -19px;
|
|
835
835
|
top: -19px;
|
|
836
836
|
}
|
|
837
|
-
`;var Qe=require("react/jsx-runtime"),hm=500,pm=hm*2,ym=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Ee(),f=(0,
|
|
837
|
+
`;var Qe=require("react/jsx-runtime"),hm=500,pm=hm*2,ym=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Ee(),f=(0,Gt.useRef)([]),g=Q=>{f.current=[Q,...f.current]},[w,P]=(0,Gt.useState)(!0);(0,Gt.useEffect)(()=>{let Q=setTimeout(P,pm,!1);return g(Q),()=>{f.current.forEach(ce=>clearTimeout(ce)),f.current=[]}},[]);let[C,S]=(0,Gt.useState)(""),[b,x]=(0,Gt.useState)("Checking that you are a human..."),[I,M]=(0,Gt.useState)((0,Qe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,B]=(0,Gt.useState)(!1),[F,H]=(0,Gt.useState)(3),R=r?.captchaModalData,K=async Q=>{try{await R?.callback(Q),R?.onSuccessNavigateTo&&n(R?.onSuccessNavigateTo,!1)}catch(ce){if(ce instanceof wr)return;{let ne={error:ce,previousScreen:e||"LANDING"};i({errorModalData:ne}),n(R?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,Gt.useEffect)(()=>{if(a==="success"){let Q=setTimeout(async()=>{let ce=await s();!ce||R?.userIntentRequired||K(ce)},pm);g(Q)}else if(a==="ready"){let Q=setTimeout(()=>{a==="ready"&&u()},hm);g(Q)}},[a]),(0,Gt.useEffect)(()=>{if(!w)switch(a){case"success":S("Success!"),x("CAPTCHA passed successfully."),M((0,Qe.jsx)(U,{onClick:()=>{B(!0),K(l)},disabled:!R?.userIntentRequired,loading:A,children:R?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),x("Checking that you are a human..."),M((0,Qe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),F<=0?(x("If you use an adblocker or VPN, try disabling and re-attempting."),M(null)):(x("You did not pass CAPTCHA. Please try again."),M((0,Qe.jsx)(U,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[a,w,A]);let O=async()=>{if(F<=0)return;H(ce=>ce-1),c(),u();let Q=await s();!Q||R?.userIntentRequired||K(Q)};return(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(k,{backFn:!e||t===e?void 0:o}),(0,Qe.jsxs)(Ev,{children:[a==="success"?(0,Qe.jsx)(um.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?(0,Qe.jsx)(mm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Qe.jsx)(dm,{}),(0,Qe.jsxs)(Ht,{children:[C?(0,Qe.jsx)("h3",{children:C}):null,(0,Qe.jsx)("p",{children:b})]}),I]}),(0,Qe.jsx)(se,{})]})},Ev=fm.default.div`
|
|
838
838
|
display: flex;
|
|
839
839
|
flex-direction: column;
|
|
840
840
|
align-items: center;
|
|
841
841
|
justify-content: center;
|
|
842
842
|
gap: 24px;
|
|
843
843
|
width: 100%;
|
|
844
|
-
`;var Em=h(require("@heroicons/react/24/outline/WalletIcon")),Pm=require("react-device-detect"),Tm=h(require("styled-components"));var xt=require("react/jsx-runtime"),gm=({...e})=>(0,xt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,xt.jsx)("defs",{children:(0,xt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,xt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,xt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,xt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,xt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,xt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,xt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,xt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,xt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,xt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,xt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var Xe=require("react/jsx-runtime"),vm=({style:e,...t})=>(0,Xe.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,Xe.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,Xe.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,Xe.jsxs)("defs",{children:[(0,Xe.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,Xe.jsx)("stop",{"stop-color":"#002D72"}),(0,Xe.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,Xe.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,Xe.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,Xe.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var z=require("react/jsx-runtime"),wm=({style:e,...t})=>(0,z.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,z.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,z.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,z.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,z.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,z.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,z.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,z.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,z.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,z.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,z.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,z.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,z.jsxs)("defs",{children:[(0,z.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#174299"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,z.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,z.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#8754C9"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,z.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,z.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,z.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsx)("clipPath",{id:"clip0_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,z.jsx)("clipPath",{id:"clip1_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var It=require("react/jsx-runtime"),Cm=({style:e,...t})=>(0,It.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,It.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,It.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,It.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var po=require("react/jsx-runtime"),bm=({style:e,...t})=>(0,po.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,po.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,po.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,po.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,po.jsx)("defs",{children:(0,po.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,po.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var uo=require("react/jsx-runtime"),Vr={coinbase_wallet:{logo:Ga,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Mn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Ur,displayName:"Phantom"},rainbow:{logo:wm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Bi,displayName:"WalletConnect"},zerion:{logo:bm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:gm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:vm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Cm,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},rn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=L(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{To()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Pm.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,uo.jsxs)(xv,{onClick:s,children:[(0,uo.jsx)(Tv,{icon:Pv(e,n.connectorType)??r,name:n.walletClientType}),(0,uo.jsx)("span",{children:Ev(e,n.connectorType)||t||n.walletClientType}),(0,uo.jsx)("span",{id:"connect-text",children:"Connect"})]})},Ev=(e,t)=>{if(Vr[e]?.displayName)return Vr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Pv=(e,t)=>{if(Vr[e]?.logo)return Vr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Bi},Tv=({icon:e,name:t})=>typeof e=="string"?(0,uo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,uo.jsx)(Em.default,{}):e?(0,uo.jsx)(e,{}):null,xv=(0,Tm.default)(De)`
|
|
844
|
+
`;var Em=h(require("@heroicons/react/24/outline/WalletIcon")),Pm=require("react-device-detect"),Tm=h(require("styled-components"));var xt=require("react/jsx-runtime"),gm=({...e})=>(0,xt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,xt.jsx)("defs",{children:(0,xt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,xt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,xt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,xt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,xt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,xt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,xt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,xt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,xt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,xt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,xt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var Xe=require("react/jsx-runtime"),vm=({style:e,...t})=>(0,Xe.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,Xe.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,Xe.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,Xe.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,Xe.jsxs)("defs",{children:[(0,Xe.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,Xe.jsx)("stop",{"stop-color":"#002D72"}),(0,Xe.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,Xe.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,Xe.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,Xe.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var z=require("react/jsx-runtime"),wm=({style:e,...t})=>(0,z.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,z.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,z.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,z.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,z.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,z.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,z.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,z.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,z.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,z.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,z.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,z.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,z.jsxs)("defs",{children:[(0,z.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#174299"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,z.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,z.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#8754C9"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,z.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,z.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,z.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsx)("clipPath",{id:"clip0_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,z.jsx)("clipPath",{id:"clip1_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var It=require("react/jsx-runtime"),Cm=({style:e,...t})=>(0,It.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,It.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,It.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,It.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,It.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var uo=require("react/jsx-runtime"),bm=({style:e,...t})=>(0,uo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,uo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,uo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,uo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,uo.jsx)("defs",{children:(0,uo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,uo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var mo=require("react/jsx-runtime"),Vr={coinbase_wallet:{logo:za,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Mn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Ur,displayName:"Phantom"},rainbow:{logo:wm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Hi,displayName:"WalletConnect"},zerion:{logo:bm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:gm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:vm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Cm,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},rn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=L(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{xo()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Pm.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,mo.jsxs)(Sv,{onClick:s,children:[(0,mo.jsx)(xv,{icon:Tv(e,n.connectorType)??r,name:n.walletClientType}),(0,mo.jsx)("span",{children:Pv(e,n.connectorType)||t||n.walletClientType}),(0,mo.jsx)("span",{id:"connect-text",children:"Connect"})]})},Pv=(e,t)=>{if(Vr[e]?.displayName)return Vr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Tv=(e,t)=>{if(Vr[e]?.logo)return Vr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Hi},xv=({icon:e,name:t})=>typeof e=="string"?(0,mo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,mo.jsx)(Em.default,{}):e?(0,mo.jsx)(e,{}):null,Sv=(0,Tm.default)(Ue)`
|
|
845
845
|
/* Show "Connect" on hover */
|
|
846
846
|
> #connect-text {
|
|
847
847
|
font-weight: 500;
|
|
@@ -863,23 +863,23 @@ Resources:
|
|
|
863
863
|
display: none;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
`;var Tr=require("react/jsx-runtime"),
|
|
866
|
+
`;var Tr=require("react/jsx-runtime"),_v=["coinbase_wallet"],Av=["metamask","okx_wallet","rainbow","uniswap","zerion"],kv=["cryptocom"],Rv=["phantom"],$n=({connectOnly:e})=>{let{connectors:t}=L(),{app:r}=_(),o=Vi(r.appearance.walletList,t,e,r.appearance.walletList);return(0,Tr.jsxs)(Tr.Fragment,{children:[...o]})},Vi=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:f})=>f==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(f));for(let u of c){let{walletClientType:f,walletBranding:g}=u;(f==="unknown"?i:n).push((0,Tr.jsx)(rn,{connectOnly:r,provider:f,logo:g.icon,displayName:g.name,connector:u},`${s}-${f}`))}}else if(Rv.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push((0,Tr.jsx)(rn,{connectOnly:r,provider:s,connector:c},s))}else if(Av.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push((0,Tr.jsx)(rn,{connectOnly:r,provider:s,connector:c},s))}else if(_v.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push((0,Tr.jsx)(rn,{connectOnly:r,provider:s,connector:c},s))}else kv.includes(s)?l&&a.push((0,Tr.jsx)(rn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push((0,Tr.jsx)(rn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};var zr=require("react/jsx-runtime"),xm=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return(0,zr.jsxs)(zr.Fragment,{children:[(0,zr.jsx)(k,{},"header"),(0,zr.jsx)(Gr,{title:"Connect your wallet",description:t}),(0,zr.jsx)(ir,{children:(0,zr.jsx)($n,{connectOnly:!0})}),(0,zr.jsx)($,{protectedByPrivy:!0})]})};var Rm=h(require("styled-components"));var km=h(require("styled-components"));var Sm=h(require("react"));var Am=require("react/jsx-runtime"),_m=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,Am.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?Sm.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 kc=require("react/jsx-runtime"),qn=e=>{let{app:t}=_();return t?.appearance.logo?(0,kc.jsx)(Iv,{...e,children:(0,kc.jsx)(_m,{})}):null},Iv=km.default.div`
|
|
867
867
|
display: flex;
|
|
868
868
|
flex-direction: column;
|
|
869
869
|
align-items: center;
|
|
870
870
|
padding: 24px 0;
|
|
871
871
|
flex-grow: 1;
|
|
872
872
|
justify-content: center;
|
|
873
|
-
`;var xr=require("react/jsx-runtime"),Im=()=>{let{app:e}=_();return(0,xr.jsxs)(xr.Fragment,{children:[(0,xr.jsx)(k,{},"header"),(0,xr.jsx)(
|
|
873
|
+
`;var xr=require("react/jsx-runtime"),Im=()=>{let{app:e}=_();return(0,xr.jsxs)(xr.Fragment,{children:[(0,xr.jsx)(k,{},"header"),(0,xr.jsx)(Mv,{}),(0,xr.jsx)(ir,{children:(0,xr.jsx)($n,{connectOnly:!0})}),e&&(0,xr.jsx)(Gn,{app:e,alwaysShowImplicitConsent:!0}),(0,xr.jsx)($,{protectedByPrivy:!0})]})},Mv=(0,Rm.default)(qn)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;var Yn=require("react"),Om=require("react-device-detect"),Nm=h(require("styled-components"));var lr=require("react"),Kn=require("react-device-detect"),Wm=require("react-use"),
|
|
875
|
+
`;var Yn=require("react"),Om=require("react-device-detect"),Nm=h(require("styled-components"));var lr=require("react"),Kn=require("react-device-detect"),Wm=require("react-use"),Ic=h(require("styled-components"));var jn=require("react");function Mm(){let[e,t]=(0,jn.useState)(!1),r=(0,jn.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,jn.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var ve=require("react/jsx-runtime"),Rc=2,Mc=e=>e?.privyErrorCode==="linked_to_another_user"?ao.ERROR_USER_EXISTS:e instanceof De&&!e.details.default?e.details:e instanceof _n?ao.ERROR_TIMED_OUT:e instanceof An?ao.ERROR_USER_REJECTED_CONNECTION:ao.ERROR_WALLET_CONNECTION,Lm=()=>{let[e,t]=(0,lr.useState)(!1),[r,o]=(0,lr.useState)(!1),[n,i]=(0,lr.useState)(void 0),{authenticated:a,logout:l}=G(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:g,setModalData:w}=_(),{getAuthFlow:P,walletConnectionStatus:C,closePrivyModal:S,initLoginWithWallet:b,loginWithWallet:x,updateWallets:I,createAnalyticsEvent:M}=L(),{walletConnectors:A}=G(),[B,F]=(0,lr.useState)(0),{user:H}=G(),[R]=(0,lr.useState)(H?.linkedAccounts.length||0),[K,O]=(0,lr.useState)(""),[Q,ce]=(0,lr.useState)(!1),{hasTabbedAway:ne}=Mm(),{enabled:re,token:Y}=Ee(),Ne=Kn.isMobile&&C?.connector?.connectorType==="wallet_connect_v2"||Kn.isMobile&&C?.connector?.connectorType==="coinbase_wallet"||Kn.isMobile&&C?.connector?.connectorType==="injected"&&C?.connector?.walletClientType==="phantom",Ie=C?.status==="connected",to=C?.status==="switching_to_supported_chain";(0,lr.useEffect)(()=>{let J=P();if(Ie&&!J&&(re&&!Y&&!a?(w({captchaModalData:{callback:rt=>b(C.connectedWallet,rt).then(()=>{ce(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):b(C.connectedWallet,Y).then(()=>{ce(!0)})),J&&Ne&&Ie&&!J.preparedMessage){J.buildSiweMessage();return}!J||Ne||!Ie||r||(async()=>{o(!0),i(void 0);try{C?.connector?.connectorType==="wallet_connect_v2"&&C?.connector?.walletClientType==="metamask"&&await rc(2500),await ze()}catch(rt){console.warn("Auto-prompted signature failed",rt)}finally{o(!1)}})()},[B,Ie,Q]),(0,lr.useEffect)(()=>{if(H&&e){let J=s?.render.inDialog?wt:0,rt=s?.render.inDialog?J-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let $o=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},rt);return()=>clearTimeout($o)}if(Qt(H,s?.embeddedWallets?.createOnLogin)){let $o=setTimeout(()=>{w({createWallet:{onSuccess:()=>{},onFailure:ur=>{console.error(ur),M("embedded_wallet_creation_failure_logout",{error:ur,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},rt);return()=>clearTimeout($o)}I();let _t=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),wt);return()=>clearTimeout(_t)}},[H,e]);let Nt=J=>{if(J?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}i(Mc(J))};async function ze(){try{if(await x(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(J){Nt(J)}finally{o(!1)}}(0,lr.useEffect)(()=>{C?.connectError&&Nt(C?.connectError)},[C]),(0,Wm.useInterval)(()=>{let J=xe==="wallet_connect_v2"&&C?.connector instanceof Br?C.connector.redirectUri:void 0;J&&O(J)},C?.connector instanceof Br&&!K?500:null);let xe=C?.connector?.connectorType||"injected",Dt=C?.connector?.walletClientType||"unknown",pr=Vr[Dt]?.displayName||C?.connector?.walletBranding.name||"Browser Extension",Eo=Vr[Dt]?.logo||C?.connector?.walletBranding.icon||(J=>(0,ve.jsx)(In,{...J})),Lr=pr==="Browser Extension"?pr.toLowerCase():pr,W;e?W=`Successfully connected with ${Lr}`:n?W=n.message:to?W="Switching networks":Ie?W=r&&Ne?"Signing":"Sign to verify":W=`Waiting for ${Lr}`;let X="Don\u2019t see your wallet? Check your other browser windows.";if(e){let J=H?.linkedAccounts.length||0;R===J?X="Wallet was already linked.":X="You\u2019re good to go!"}else B>=Rc&&n?X="Unable to connect wallet":n?X=n.detail:to?X="Switch your wallet to the requested network.":Ie&&Ne?X="Sign the message in your wallet to verify it belongs to you.":Dt==="metamask"&&Kn.isMobile?X="Click continue to open and connect MetaMask.":Dt==="metamask"?X="For the best experience, connect only one wallet at a time.":xe==="wallet_connect"?X="Open your mobile wallet app to continue":xe==="coinbase_wallet"&&(up()||(uc(H)?X="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":X="Open the Coinbase app on your phone to continue."));let te=A?.walletConnectors?.find(J=>J.walletClientType==="coinbase_wallet"),ki=Dt==="coinbase_wallet"&&(uc(H)||n===ao.ERROR_USER_EXISTS);return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(k,{backFn:!f||g===f?void 0:u}),(0,ve.jsxs)(Lv,{children:[(0,ve.jsx)(Wc,{walletLogo:Eo,success:e,fail:!!n}),(0,ve.jsxs)(Ht,{children:[(0,ve.jsx)("h3",{children:W}),(0,ve.jsx)("p",{children:X}),!Ie&&K&&!ne?(0,ve.jsxs)("p",{children:["Still here?"," ",(0,ve.jsx)("a",{href:K,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),ki?(0,ve.jsx)(U,{onClick:()=>te&&te?.disconnect(),disabled:e,children:"Use a different wallet"}):n==ao.ERROR_USER_EXISTS&&g!==f?(0,ve.jsx)(U,{onClick:u,children:"Use a different wallet"}):Ie&&!e&&Ne?(0,ve.jsx)(U,{onClick:()=>{o(!0),ze(),Wv(Dt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&B<Rc?(0,ve.jsx)(U,{onClick:()=>{F(B+1),i(void 0),Ie?(o(!0),ze()):C?.connectRetry()},disabled:!e&&(!n?.retryable||B>=Rc),children:"Retry"}):!e&&!n?(0,ve.jsx)(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,ve.jsx)(se,{})]})},Wv=e=>{if(!Kn.isMobile||!Rp(e))return;let t=Ip(e);t&&window.open(t,"_self","noopener,noreferrer")},Lv=Ic.default.div`
|
|
876
876
|
display: flex;
|
|
877
877
|
flex-direction: column;
|
|
878
878
|
align-items: center;
|
|
879
879
|
justify-content: center;
|
|
880
880
|
gap: 24px;
|
|
881
881
|
width: 100%;
|
|
882
|
-
`,
|
|
882
|
+
`,Ov=Ic.default.div`
|
|
883
883
|
display: flex;
|
|
884
884
|
flex-direction: column;
|
|
885
885
|
justify-content: center;
|
|
@@ -902,14 +902,14 @@ Resources:
|
|
|
902
902
|
left: -19px;
|
|
903
903
|
top: -19px;
|
|
904
904
|
}
|
|
905
|
-
`,
|
|
905
|
+
`,Wc=e=>{let t=e.walletLogo;return(0,ve.jsx)(ve.Fragment,{children:(0,ve.jsx)(Ov,{children:(0,ve.jsxs)("div",{children:[(0,ve.jsx)(lo,{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 mt=require("react/jsx-runtime"),Hs=2,Dm=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=L(),[i,a]=(0,Yn.useState)(void 0),[l,s]=(0,Yn.useState)(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Yn.useEffect)(()=>{if(c){let I=setTimeout(n,wt);return()=>clearTimeout(I)}},[c]);let f=I=>{a(Mc(I))};(0,Yn.useEffect)(()=>{o?.connectError&&f(o?.connectError)},[o]);let g=o?.connector?.connectorType||"injected",w=o?.connector?.walletClientType||"unknown",P=Vr[w]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",C=Vr[w]?.logo||o?.connector?.walletBranding.icon||(I=>(0,mt.jsx)(In,{...I})),S=P==="Browser Extension"?P.toLowerCase():P,b;c?b=`Successfully connected with ${S}`:i?b=i.message:u?b="Switching networks":b=`Waiting for ${S}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return c?x="You\u2019re good to go!":l>=Hs&&i?x="Unable to connect wallet":i?x=i.detail:u?x="Switch your wallet to the requested network.":w==="metamask"&&Om.isMobile?x="Click to continue to open and connect MetaMask.":w==="metamask"?x="For the best experience, connect only one wallet at a time.":g==="wallet_connect_v2"?x="Open your mobile wallet app to continue":g==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)(k,{backFn:r===t?void 0:e}),(0,mt.jsxs)(Nv,{children:[(0,mt.jsx)(Wc,{walletLogo:C,success:c,fail:!!i}),(0,mt.jsxs)(Ht,{children:[(0,mt.jsx)("h3",{children:b}),(0,mt.jsx)("p",{children:x})]}),i==ao.ERROR_USER_EXISTS?(0,mt.jsx)(U,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Hs?(0,mt.jsx)(U,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=Hs),children:"Retry"}):!c&&i&&l>=Hs?(0,mt.jsx)(U,{onClick:e,children:"Use a different wallet"}):null]}),(0,mt.jsx)(se,{})]})},Nv=Nm.default.div`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
align-items: center;
|
|
909
909
|
justify-content: center;
|
|
910
910
|
gap: 24px;
|
|
911
911
|
width: 100%;
|
|
912
|
-
`;var Hm=h(require("@heroicons/react/24/solid/XCircleIcon")),Xn=require("react"),Gm=h(require("styled-components"));var
|
|
912
|
+
`;var Hm=h(require("@heroicons/react/24/solid/XCircleIcon")),Xn=require("react"),Gm=h(require("styled-components"));var zi=h(require("styled-components")),Jn=require("react/jsx-runtime"),Zn=()=>(0,Jn.jsx)(Dv,{children:(0,Jn.jsxs)(Uv,{children:[(0,Jn.jsx)(Fv,{}),(0,Jn.jsx)(Bv,{})]})}),Dv=zi.default.div`
|
|
913
913
|
display: flex;
|
|
914
914
|
justify-content: center;
|
|
915
915
|
align-items: center;
|
|
@@ -921,14 +921,14 @@ Resources:
|
|
|
921
921
|
@media all and (display-mode: standalone) {
|
|
922
922
|
margin-bottom: 30px;
|
|
923
923
|
}
|
|
924
|
-
`,
|
|
924
|
+
`,Uv=zi.default.div`
|
|
925
925
|
position: relative;
|
|
926
926
|
height: 140px;
|
|
927
927
|
width: 140px;
|
|
928
928
|
|
|
929
929
|
opacity: 1;
|
|
930
930
|
animation: fadein 200ms ease;
|
|
931
|
-
`,
|
|
931
|
+
`,Fv=zi.default.div`
|
|
932
932
|
position: absolute;
|
|
933
933
|
top: 0;
|
|
934
934
|
right: 0;
|
|
@@ -941,7 +941,7 @@ Resources:
|
|
|
941
941
|
border: 4px solid var(--privy-color-accent-light);
|
|
942
942
|
border-radius: 50%;
|
|
943
943
|
}
|
|
944
|
-
`,
|
|
944
|
+
`,Bv=zi.default.div`
|
|
945
945
|
position: absolute;
|
|
946
946
|
top: 0;
|
|
947
947
|
right: 0;
|
|
@@ -965,20 +965,20 @@ Resources:
|
|
|
965
965
|
transform: rotate(360deg);
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
|
-
`;var Um=["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 qe=class extends Error{constructor(r,o){super(o);this.type=r}};function Qn(e){let t=e.type;return typeof t=="string"&&Um.includes(t)}function
|
|
968
|
+
`;var Um=["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 qe=class extends Error{constructor(r,o){super(o);this.type=r}};function Qn(e){let t=e.type;return typeof t=="string"&&Um.includes(t)}function Hv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function on(e){return Qn(e)&&e.type==="wallet_not_on_device"}function Fm(e){return Qn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function nn(e){return!!(Qn(e)&&e.type==="mfa_timeout")}function an(e){return!!(Qn(e)&&e.type==="missing_or_invalid_mfa")}function Gs(e){return!!(Qn(e)&&e.type==="mfa_verification_max_attempts_reached")}function Lc(e){return!!(Qn(e)&&e.message.includes("code 429"))}function Oc(e){return!!(Hv(e)&&e.message==="MFA canceled")}var Mt=require("react/jsx-runtime"),Bm=1,Vm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=L(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=(0,Xn.useMemo)(()=>Date.now(),[]),[f,g]=(0,Xn.useState)(!1),{onCompleteNavigateTo:w,onFailure:P}=l?.connectWallet,C=b=>{f||(g(!0),P(typeof b=="string"?new Error(b):b))};(0,Xn.useEffect)(()=>{let b=Me(t),x;return!e||!b?C("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let M=await r();if(!M)return C("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:M,address:b.address});let A=(Date.now()-u)/1e3;w==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&A<Bm?x=setTimeout(()=>{a(w)},(Bm-A)*1e3):a(w)}catch(A){if(on(A)&&b.recoveryMethod==="privy"){let B=await r();if(!B)return C("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:b.address}),(await i?.recover({address:b.address,accessToken:B}))?.address||C(new Error("Unable to recover wallet")),w?a(w):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:b.address}),a(w)}catch{C("An error has occurred, please try again.")}}else on(A)?(s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:w,onFailure:P}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):C(A)}})(),()=>clearTimeout(x)):void 0},[e,t,i]);let S=()=>{C("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=S,(0,Mt.jsxs)(Mt.Fragment,{children:[(0,Mt.jsx)(k,{onClose:S}),f?(0,Mt.jsxs)(Mt.Fragment,{children:[(0,Mt.jsxs)(br,{children:[(0,Mt.jsx)(Hm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Mt.jsx)(Fe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,Mt.jsx)(U,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,Mt.jsx)(Zn,{}),(0,Mt.jsx)(Gv,{})]})},Gv=Gm.default.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;var zm=h(require("@heroicons/react/24/solid/CheckCircleIcon")),$m=require("react");var cr=require("react/jsx-runtime"),qm=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=L(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=
|
|
970
|
+
`;var zm=h(require("@heroicons/react/24/solid/CheckCircleIcon")),$m=require("react");var cr=require("react/jsx-runtime"),qm=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=L(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=Me(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return(0,$m.useEffect)(()=>{let f=setTimeout(u,yp);return()=>clearTimeout(f)},[]),a.current=u,(0,cr.jsxs)(cr.Fragment,{children:[(0,cr.jsx)(k,{onClose:u}),(0,cr.jsx)(oe,{}),(0,cr.jsxs)(br,{children:[(0,cr.jsx)(zm.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,cr.jsx)(Fe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,cr.jsx)(ie,{}),(0,cr.jsx)($,{protectedByPrivy:!0})]})};var Ym=h(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),Jm=h(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),fo=require("react"),ho=h(require("styled-components"));var le=require("react/jsx-runtime"),Zm=()=>{let[e,t]=(0,fo.useState)(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=L(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Me(o)?.address,{onFailure:f,onSuccess:g,origin:w,appId:P}=s.keyExport,C=b=>{i({shouldCallAuthOnSuccess:!1}),f(typeof b=="string"?new Error(b):b)},S=()=>{i({shouldCallAuthOnSuccess:!1}),g(),a("embedded_wallet_key_export_completed",{walletAddress:u})};return(0,fo.useEffect)(()=>{let b=Me(o);if(!r||!b)return C("User must be authenticated before exporting their wallet");n().then(t,C)},[r,o]),c.current=S,(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(k,{onClose:S}),(0,le.jsxs)($v,{children:[(0,le.jsxs)(Fe,{icon:(0,le.jsx)(Jm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,le.jsxs)(Yv,{children:[(0,le.jsx)(zv,{style:{marginRight:6}}),So(u)]}),(0,le.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,le.jsxs)(qv,{children:[(0,le.jsxs)(jm,{children:[(0,le.jsx)(Km,{children:"1"}),(0,le.jsxs)("span",{children:[(0,le.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,le.jsxs)(jm,{children:[(0,le.jsx)(Km,{children:"2"}),(0,le.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,le.jsx)("div",{style:{width:"100%"},children:e&&(0,le.jsx)(Vv,{origin:w,appId:P,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,le.jsxs)(Jv,{children:[(0,le.jsxs)("div",{children:[(0,le.jsx)(Ym.default,{viewBox:"0 0 20 18"}),(0,le.jsx)("h4",{children:"Warning"})]}),(0,le.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,le.jsx)($,{protectedByPrivy:!0})]})};function Vv(e){let[t,r]=(0,fo.useState)(e.dimensions.width),[o,n]=(0,fo.useState)(void 0),i=(0,fo.useRef)(null);return(0,fo.useEffect)(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),(0,le.jsx)("div",{ref:i,children:t&&(0,le.jsxs)(jv,{children:[(0,le.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Da(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,le.jsx)(Kv,{children:"Loading..."})]})})}function zv(e){return(0,le.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,le.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 $v=ho.default.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
|
|
974
|
+
`,qv=ho.default.div`
|
|
975
975
|
display: flex;
|
|
976
976
|
flex-direction: column;
|
|
977
977
|
gap: 24px;
|
|
978
978
|
padding-bottom: 16px;
|
|
979
979
|
margin-left: 11px;
|
|
980
980
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
981
|
-
`,jm=
|
|
981
|
+
`,jm=ho.default.div`
|
|
982
982
|
display: flex;
|
|
983
983
|
align-items: top;
|
|
984
984
|
gap: 8px;
|
|
@@ -987,7 +987,7 @@ Resources:
|
|
|
987
987
|
color: var(--privy-color-accent);
|
|
988
988
|
text-decoration: underline;
|
|
989
989
|
}
|
|
990
|
-
`,Km=
|
|
990
|
+
`,Km=ho.default.div`
|
|
991
991
|
display: flex;
|
|
992
992
|
align-items: center;
|
|
993
993
|
justify-content: center;
|
|
@@ -1001,11 +1001,11 @@ Resources:
|
|
|
1001
1001
|
border-radius: 100%;
|
|
1002
1002
|
background: var(--privy-color-background);
|
|
1003
1003
|
color: var(--privy-color-accent);
|
|
1004
|
-
`,
|
|
1004
|
+
`,jv=ho.default.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,Kv=ho.default.div`
|
|
1009
1009
|
position: absolute;
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
@@ -1017,7 +1017,7 @@ Resources:
|
|
|
1017
1017
|
border-radius: var(--privy-border-radius-md);
|
|
1018
1018
|
background-color: var(--privy-color-background-2);
|
|
1019
1019
|
color: var(--privy-color-foreground-3);
|
|
1020
|
-
`,
|
|
1020
|
+
`,Yv=ho.default.div`
|
|
1021
1021
|
display: flex;
|
|
1022
1022
|
align-items: center;
|
|
1023
1023
|
padding-top: 1px;
|
|
@@ -1030,7 +1030,7 @@ Resources:
|
|
|
1030
1030
|
font-size: 12px;
|
|
1031
1031
|
font-weight: 500;
|
|
1032
1032
|
margin: auto;
|
|
1033
|
-
`,
|
|
1033
|
+
`,Jv=ho.default.div`
|
|
1034
1034
|
border: 1px solid var(--privy-color-background-2) !important;
|
|
1035
1035
|
border-radius: var(--privy-border-radius-md);
|
|
1036
1036
|
padding: 16px;
|
|
@@ -1052,7 +1052,7 @@ Resources:
|
|
|
1052
1052
|
color: var(--privy-color-error);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
`;var Of=h(require("@heroicons/react/24/solid/XCircleIcon")),Sr=require("react"),Nf=h(require("styled-components"));var
|
|
1055
|
+
`;var Of=h(require("@heroicons/react/24/solid/XCircleIcon")),Sr=require("react"),Nf=h(require("styled-components"));var Yi=require("react");var af=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),ni=require("react");var Qm=h(require("@heroicons/react/24/outline/ArrowPathIcon")),Xm=h(require("@heroicons/react/24/outline/EyeIcon")),ef=h(require("@heroicons/react/24/outline/EyeSlashIcon")),Be=h(require("styled-components"));var Zv=Be.css`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1060,8 +1060,8 @@ Resources:
|
|
|
1060
1060
|
letter-spacing: -0.008px;
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
|
-
`,
|
|
1064
|
-
${
|
|
1063
|
+
`,Vs=Be.default.span`
|
|
1064
|
+
${Zv}
|
|
1065
1065
|
transition: color 0.1s ease-in;
|
|
1066
1066
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1067
1067
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1137,12 +1137,12 @@ Resources:
|
|
|
1137
1137
|
font-weight: 400;
|
|
1138
1138
|
line-height: 20px;
|
|
1139
1139
|
}
|
|
1140
|
-
|
|
1140
|
+
`,$i=Be.default.div`
|
|
1141
1141
|
display: flex;
|
|
1142
1142
|
flex-direction: column;
|
|
1143
1143
|
gap: 10px;
|
|
1144
1144
|
padding-bottom: 1rem;
|
|
1145
|
-
|
|
1145
|
+
`,qi=Be.default.div`
|
|
1146
1146
|
display: flex;
|
|
1147
1147
|
text-align: left;
|
|
1148
1148
|
align-items: center;
|
|
@@ -1162,13 +1162,13 @@ Resources:
|
|
|
1162
1162
|
> :first-child {
|
|
1163
1163
|
min-width: 24px;
|
|
1164
1164
|
}
|
|
1165
|
-
`,
|
|
1165
|
+
`,zP=Be.default.div`
|
|
1166
1166
|
height: var(--privy-height-modal-full);
|
|
1167
1167
|
|
|
1168
1168
|
@media (max-width: 440px) {
|
|
1169
1169
|
height: var(--privy-height-modal-compact);
|
|
1170
1170
|
}
|
|
1171
|
-
`,
|
|
1171
|
+
`,Nc=(0,Be.default)(Ss)`
|
|
1172
1172
|
display: flex;
|
|
1173
1173
|
flex: 1;
|
|
1174
1174
|
gap: 4px;
|
|
@@ -1231,14 +1231,14 @@ Resources:
|
|
|
1231
1231
|
transition: all 0.1s ease-out;
|
|
1232
1232
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1233
1233
|
}
|
|
1234
|
-
`;var He=require("react/jsx-runtime"),sf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,ni.useState)(!0),[l,s]=(0,ni.useState)(!1),[c,u]=(0,ni.useState)(""),f=r===c;return(0,ni.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:n}),(0,He.jsx)(
|
|
1234
|
+
`;var He=require("react/jsx-runtime"),sf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,ni.useState)(!0),[l,s]=(0,ni.useState)(!1),[c,u]=(0,ni.useState)(""),f=r===c;return(0,ni.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:n}),(0,He.jsx)(oe,{}),(0,He.jsxs)(No,{children:[(0,He.jsxs)(Fo,{children:[(0,He.jsx)(af.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,He.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,He.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,He.jsxs)(Uo,{children:[(0,He.jsx)(ei,{value:c,onChange:g=>u(g.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),(0,He.jsx)(ti,{style:{right:"0.75rem"},children:i?(0,He.jsx)(ri,{onClick:()=>a(!1)}):(0,He.jsx)(oi,{onClick:()=>a(!0)})})]}),(0,He.jsx)(Vs,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),(0,He.jsx)(Do,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),(0,He.jsx)(ie,{}),(0,He.jsx)($,{protectedByPrivy:!0})]})};var pf=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),uf=require("react"),mf=h(require("styled-components"));var ji=h(require("styled-components")),Bo=require("react/jsx-runtime"),lf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,Bo.jsx)("label",{children:(0,Bo.jsxs)(Qv,{className:e,children:[(0,Bo.jsx)(df,{checked:t,...o}),(0,Bo.jsx)(Xv,{color:r,checked:t,children:(0,Bo.jsx)(cf,{viewBox:"0 0 24 24",children:(0,Bo.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})}),Qv=ji.default.div`
|
|
1235
1235
|
display: inline-block;
|
|
1236
1236
|
vertical-align: middle;
|
|
1237
|
-
`,cf=
|
|
1237
|
+
`,cf=ji.default.svg`
|
|
1238
1238
|
fill: none;
|
|
1239
1239
|
stroke: white;
|
|
1240
1240
|
stroke-width: 3px;
|
|
1241
|
-
`,df=
|
|
1241
|
+
`,df=ji.default.input.attrs({type:"checkbox"})`
|
|
1242
1242
|
border: 0;
|
|
1243
1243
|
clip: rect(0 0 0 0);
|
|
1244
1244
|
clippath: inset(50%);
|
|
@@ -1249,7 +1249,7 @@ Resources:
|
|
|
1249
1249
|
position: absolute;
|
|
1250
1250
|
white-space: nowrap;
|
|
1251
1251
|
width: 1px;
|
|
1252
|
-
`,
|
|
1252
|
+
`,Xv=ji.default.div`
|
|
1253
1253
|
display: inline-block;
|
|
1254
1254
|
width: 18px;
|
|
1255
1255
|
height: 18px;
|
|
@@ -1271,23 +1271,23 @@ Resources:
|
|
|
1271
1271
|
${cf} {
|
|
1272
1272
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1273
1273
|
}
|
|
1274
|
-
`;var
|
|
1274
|
+
`;var Oe=require("react/jsx-runtime"),ff=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=(0,uf.useState)(!1);return(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:o}),(0,Oe.jsx)(oe,{}),(0,Oe.jsxs)(No,{children:[(0,Oe.jsxs)(Fo,{children:[(0,Oe.jsx)(pf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,Oe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,Oe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,Oe.jsx)($i,{children:(0,Oe.jsxs)(qi,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[(0,Oe.jsx)(lf,{color:"var(--privy-color-error)",checked:i}),(0,Oe.jsx)(Oe.Fragment,{children:"I understand losing my password means losing my account."})]})})]}),(0,Oe.jsxs)(ew,{children:[n.initiatedBy==="user"&&(0,Oe.jsx)(Cr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,Oe.jsx)(Do,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),(0,Oe.jsx)(ie,{}),(0,Oe.jsx)($,{protectedByPrivy:!0})]})},ew=mf.default.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
gap: 10px;
|
|
1277
|
-
`;var Pf=h(require("@heroicons/react/24/outline/KeyIcon")),
|
|
1277
|
+
`;var Pf=h(require("@heroicons/react/24/outline/KeyIcon")),Dc=h(require("@heroicons/react/24/solid/CheckCircleIcon")),yo=require("react"),Uc=h(require("styled-components"));var hf=h(require("fast-password-entropy")),yf=h(require("secure-password-utilities")),gf=require("secure-password-utilities/wordlists"),tw=95,rw=8,ow=3,nw=.3,iw=/[a-z]/,aw=/[A-Z]/,sw=/[0-9]/,lw="a-zA-Z0-9",vf="!@#$%^&*()\\-_+.",wf=`${lw}${vf}`,cw=new RegExp(`[${vf}]`),dw=new RegExp(`[${wf}]`),Cf=new RegExp(`^[${wf}]{6,}$`),bf=(e="")=>{let t=e.split("").filter(r=>!dw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},zs=()=>yf.generatePassphrase(4,gf.DEFAULT_WORDLIST);function pw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function uw(e){if(e.length<rw)return 0;let t=0;iw.test(e)&&(t+=1),aw.test(e)&&(t+=1),sw.test(e)&&(t+=1),cw.test(e)&&(t+=1);let r=t/ow;return Math.max(0,Math.min(1,r))}function mw(e=""){let t=uw(e),r=(0,hf.default)(e)/tw;return(t*nw+r)/2}function Ef(e=""){let t=mw(e);return{value:t,label:pw(t)}}var pe=require("react/jsx-runtime"),Tf=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=(0,yo.useState)(!1),[u,f]=(0,yo.useState)(!1);(0,yo.useEffect)(()=>{r&&!u&&f(!0)},[r]);let g=(0,yo.useMemo)(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Cf.test(r||"")?null:`Invalid characters used ( ${bf(r).join(" ")} )`:null,[r,u]),w=(0,yo.useMemo)(()=>g?{value:0,label:"Weak"}:Ef(r),[r,g]),P=(0,yo.useMemo)(()=>!!(!r?.length||g),[g,r]);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(k,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user"}),(0,pe.jsx)(oe,{}),(0,pe.jsxs)(No,{children:[(0,pe.jsxs)(Fo,{children:[(0,pe.jsx)(Pf.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,pe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,pe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,pe.jsxs)(Uo,{children:[(0,pe.jsx)(ei,{value:r,onChange:C=>a(C.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),(0,pe.jsxs)(ti,{style:{width:"3.5rem"},children:[s?(0,pe.jsx)(ri,{onClick:()=>c(!1)}):(0,pe.jsx)(oi,{onClick:()=>c(!0)}),(0,pe.jsx)(of,{onClick:l})]})]}),(0,pe.jsx)(nf,{value:w.value===0?.01:w.value,label:w.label}),(0,pe.jsx)(Vs,{error:!!g,children:g||`Password Strength: ${u?w.label:"--"}`}),(0,pe.jsxs)(hw,{children:[(0,pe.jsx)(fw,{children:(0,pe.jsxs)($i,{children:[(0,pe.jsxs)(qi,{children:[(0,pe.jsx)(Dc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,pe.jsxs)(qi,{children:[(0,pe.jsx)(Dc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),(0,pe.jsx)(Do,{onClick:n,loading:t,disabled:P,hideAnimations:e,children:"Continue"})]})]}),(0,pe.jsx)(ie,{}),(0,pe.jsx)($,{protectedByPrivy:!0})]})},fw=(0,Uc.default)($i)`
|
|
1278
1278
|
flex: 1;
|
|
1279
1279
|
padding-top: 1rem;
|
|
1280
|
-
`,
|
|
1280
|
+
`,hw=Uc.default.div`
|
|
1281
1281
|
display: flex;
|
|
1282
1282
|
flex-direction: column;
|
|
1283
1283
|
height: 100%;
|
|
1284
|
-
`;var xf=h(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Sf=h(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),_f=h(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Af=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),
|
|
1284
|
+
`;var xf=h(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Sf=h(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),_f=h(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Af=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Ki=require("react");var we=require("react/jsx-runtime"),kf=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=(0,Ki.useState)(!1),s=(0,Ki.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=(0,Ki.useCallback)(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),g=new Blob([yw(r,o)],{type:"text/plain"}),w=URL.createObjectURL(g);u.href=w,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(w)},5e3)},[o]);return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(k,{backFn:i,title:"Save Password",closeable:!1}),(0,we.jsx)(oe,{}),(0,we.jsxs)(No,{children:[(0,we.jsxs)(Fo,{children:[(0,we.jsx)(Af.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,we.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,we.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset if you lose your device. Make sure to secure it to keep your assets safe."})]}),(0,we.jsx)(Uo,{centered:!0,children:(0,we.jsx)(rf,{children:o})}),(0,we.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,we.jsx)(Nc,{onClick:s,children:a?(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(Sf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(_f.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,we.jsxs)(Nc,{onClick:c,children:[(0,we.jsx)(xf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,we.jsx)(Do,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,we.jsx)(ie,{}),(0,we.jsx)($,{protectedByPrivy:!0})]})},yw=(e,t)=>`Your wallet recovery password for ${e} is
|
|
1285
1285
|
|
|
1286
1286
|
${t}
|
|
1287
1287
|
|
|
1288
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Rf=h(require("@heroicons/react/24/solid/CheckCircleIcon")),If=h(require("@heroicons/react/24/solid/XCircleIcon"));var ft=require("react/jsx-runtime"),Mf=({error:e,onClose:t})=>(0,ft.jsxs)(ft.Fragment,{children:[(0,ft.jsx)(k,{closeable:!1}),(0,ft.jsx)(
|
|
1288
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Rf=h(require("@heroicons/react/24/solid/CheckCircleIcon")),If=h(require("@heroicons/react/24/solid/XCircleIcon"));var ft=require("react/jsx-runtime"),Mf=({error:e,onClose:t})=>(0,ft.jsxs)(ft.Fragment,{children:[(0,ft.jsx)(k,{closeable:!1}),(0,ft.jsx)(oe,{}),e?(0,ft.jsxs)(br,{children:[(0,ft.jsx)(If.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,ft.jsx)(Fe,{title:"Something went wrong",description:e})]}):(0,ft.jsxs)(br,{children:[(0,ft.jsx)(Rf.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,ft.jsx)(Fe,{title:"Success"})]}),(0,ft.jsx)(U,{onClick:t,children:"Close"}),(0,ft.jsx)(ie,{}),(0,ft.jsx)($,{protectedByPrivy:!0})]});var Wf=require("react"),gw=(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}},Lf=()=>{let[e,t]=(0,Wf.useReducer)(gw,"creating");return{send:t,state:e}};var ii=require("react/jsx-runtime"),$s=({onSubmit:e,...t})=>{let{send:r,state:o}=Lf(),n=(0,Yi.useCallback)(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);(0,Yi.useEffect)(()=>{let a;return o==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),wt)),()=>{a&&clearTimeout(a)}},[o,t.config.initiatedBy,t.onClose]);let i=(0,Yi.useCallback)(()=>{r("back")},[r]);return o==="creating"?(0,ii.jsx)(Tf,{...t,onSubmit:n}):o==="saving"?(0,ii.jsx)(kf,{...t,onSubmit:n,onBack:i}):o==="confirming"?(0,ii.jsx)(sf,{...t,onSubmit:n,onBack:i}):o==="finalizing"?(0,ii.jsx)(ff,{...t,onSubmit:n,onBack:i}):o==="done"?(0,ii.jsx)(Mf,{...t,onSubmit:n}):null};var Vt=require("react/jsx-runtime"),Df=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=(0,Sr.useState)(""),[a,l]=(0,Sr.useState)(!1),[s,c]=(0,Sr.useState)(),[u,f]=(0,Sr.useState)(null),[g,w]=(0,Sr.useState)(null),P=(0,Sr.useRef)(!1),{authenticated:C,getAccessToken:S}=G(),{refreshUser:b,closePrivyModal:x,createAnalyticsEvent:I,isNewUserThisSession:M,initializeWalletProxy:A}=L(),{onSuccess:B,onFailure:F,callAuthOnSuccessOnClose:H}=r.createWallet,R=e?.embeddedWallets.requireUserPasswordOnCreate===!0,K=!!(!n||P.current)&&!R,O=new Ct(async()=>ce());(0,Sr.useEffect)(()=>{u||A(3e4).then(re=>f(re))},[u]),(0,Sr.useEffect)(()=>{if(!C){t("LANDING"),F(new Error("User must be authenticated before creating a Privy wallet"));return}!R&&!a&&!P.current&&(l(!0),O.execute().finally(()=>l(!1)))},[R,C]);let Q=()=>{R&&g&&g?.recoveryMethod!=="user-passcode"?(F(new Ft("User created a wallet but failed to set a password for it")),x({shouldCallAuthOnSuccess:!1})):g?(B(g),x({shouldCallAuthOnSuccess:H})):(F(new Ft("User wallet creation failed")),x({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ce=async function(){let re=await S();if(re)try{I("embedded_wallet_creation_started");let Y=await A(Tn);if(!Y)throw new Error("walletProxy does not exist.");let Ne=1e4,Ie=new Promise((xe,Dt)=>{setTimeout(()=>{Dt(new Error("walletProxy.create timed out."))},Ne)});if(!await Promise.race([Y.create({accessToken:re,recoveryPassword:s}),Ie]))throw new Error("walletProxy.create did not send a response.");let Nt=await b();if(!Nt)throw new Error("Failed to refresh user.");let ze=Me(Nt);if(!ze)throw new Error("Updated user is missing embedded wallet.");w(ze),I("embedded_wallet_creation_completed",{walletAddress:ze.address}),i(""),P.current=!0,R?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):ze&&(B(ze),x({shouldCallAuthOnSuccess:H}))}catch(Y){if(P.current)return;I("embedded_wallet_creation_failed",{error:Y.toString()}),i("An error has occurred, please try again."),console.warn(Y)}else i("An error has occured, please login again."),I("embedded_wallet_creation_failed",{error:"Missing access token for user."})},ne=async()=>{if(!R)return x({shouldCallAuthOnSuccess:H});l(!0);let re=250;return O.execute().then(()=>new Promise(Y=>setTimeout(Y,re))).finally(()=>l(!1))};return!R&&n?(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsx)(k,{closeable:!1}),(0,Vt.jsxs)(br,{children:[(0,Vt.jsx)(Of.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Vt.jsx)(Fe,{title:"Something went wrong",description:n})]}),(0,Vt.jsx)(U,{onClick:Q,children:"Close"}),(0,Vt.jsx)(vw,{})]}):K?(0,Vt.jsx)(Zn,{}):(0,Vt.jsx)($s,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:K||!u,buttonLoading:a,buttonHideAnimations:!g&&a,error:n,password:s||"",onClose:Q,onPasswordChange:c,onPasswordGenerate:()=>c(zs()),onSubmit:ne})},vw=Nf.default.div`
|
|
1289
1289
|
height: 44px;
|
|
1290
|
-
`;var sn=require("react");var Ff=require("react/jsx-runtime"),Uf=()=>{let[e,t]=(0,sn.useState)(null),[r,o]=(0,sn.useState)(!1),[n,i]=(0,sn.useState)(null),[a,l]=(0,sn.useState)(""),{authenticated:s,getAccessToken:c,user:u}=G(),{walletProxy:f,refreshUser:g,closePrivyModal:
|
|
1290
|
+
`;var sn=require("react");var Ff=require("react/jsx-runtime"),Uf=()=>{let[e,t]=(0,sn.useState)(null),[r,o]=(0,sn.useState)(!1),[n,i]=(0,sn.useState)(null),[a,l]=(0,sn.useState)(""),{authenticated:s,getAccessToken:c,user:u}=G(),{walletProxy:f,refreshUser:g,closePrivyModal:w,createAnalyticsEvent:P}=L(),{app:C,navigate:S,data:b,onUserCloseViaDialogOrKeybindRef:x}=_(),{onSuccess:I,onFailure:M}=b.createWallet,A=Me(u),B=e?.recoveryMethod==="user-passcode";(0,sn.useEffect)(()=>{s||(S("LANDING"),M(new Ta("User must be authenticated before setting a password on a Privy wallet")))},[s]);let F=()=>{if(n){M(n),w({shouldCallAuthOnSuccess:!1});return}if(!B){M(new Ft("Exited before password was added to wallet")),w({shouldCallAuthOnSuccess:!1});return}I(e),w({shouldCallAuthOnSuccess:!1})};x.current=F;let H=async()=>{let K=await c();if(K&&A?.address&&a&&f)try{if(P("embedded_wallet_set_password_started",{walletAddress:A.address}),!(await f.setRecoveryPassword({accessToken:K,address:A.address,recoveryPassword:a})).address){i(new Ft("Error setting password on privy wallet")),P("embedded_wallet_set_password_failed",{walletAddress:A.address,reason:"error setting password"});return}let Q=await g(),ce=Me(Q);if(!ce){i(new Ft("Error setting password on privy wallet")),P("embedded_wallet_set_password_failed",{walletAddress:A.address,reason:"wallet disconnected"});return}t(ce),P("embedded_wallet_set_password_completed",{walletAddress:A.address})}catch(O){console.warn(O),i(O instanceof Error?O:new Error("Error setting password on privy wallet")),P("embedded_wallet_set_password_failed",{walletAddress:A.address,reason:O})}},R=async()=>{B?(I(e),w({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await H(),o(!1))};return(0,Ff.jsx)($s,{appName:C?.name||"privy",config:{initiatedBy:"user",onCancel:F},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(zs()),onPasswordChange:l,onSubmit:R,onClose:F})};var Bf=h(require("@heroicons/react/24/outline/UserCircleIcon")),Hf=h(require("@heroicons/react/24/solid/LockClosedIcon"));var nt=require("react/jsx-runtime"),Gf=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=L(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new Ft("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)(k,{onClose:c}),(0,nt.jsx)(oe,{}),(0,nt.jsxs)(br,{children:[(0,nt.jsxs)(em,{children:[(0,nt.jsx)(Bf.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,nt.jsx)(tm,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,nt.jsx)(Hf.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,nt.jsxs)(Fe,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,nt.jsx)("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),(0,nt.jsx)(U,{onClick:()=>{let f=Me(e);r("embedded_wallet_set_password_started",{walletAddress:f?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,nt.jsx)(ie,{}),(0,nt.jsx)($,{protectedByPrivy:!0})]})};var Vf=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),ln=require("react"),cn=h(require("styled-components"));var Pe=require("react/jsx-runtime"),zf=()=>{let[e,t]=(0,ln.useState)(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=L(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,f]=(0,ln.useState)(void 0),[g,w]=(0,ln.useState)(""),[P,C]=(0,ln.useState)(!1),{privyWallet:S,onCompleteNavigateTo:b,onSuccess:x,onFailure:I}=s.recoverWallet,M=(F="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),I(typeof F=="string"?new Ft(F):F)};c.current=M,(0,ln.useEffect)(()=>{if(!r||!S)return M("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let A=F=>{F&&f(F)};return(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(k,{onClose:M}),(0,Pe.jsx)(oe,{}),(0,Pe.jsxs)(Cw,{children:[(0,Pe.jsxs)(ww,{children:[(0,Pe.jsx)(Vf.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Pe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,Pe.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,Pe.jsxs)("div",{children:[(0,Pe.jsxs)(Uo,{children:[(0,Pe.jsx)(ei,{type:e?"password":"text",onChange:F=>A(F.target.value),disabled:P,style:{paddingRight:"2.3rem"}}),(0,Pe.jsx)(ti,{style:{right:"0.75rem"},children:e?(0,Pe.jsx)(ri,{onClick:()=>t(!1)}):(0,Pe.jsx)(oi,{onClick:()=>t(!0)})})]}),!!g&&(0,Pe.jsx)(bw,{children:g})]}),(0,Pe.jsxs)("div",{children:[(0,Pe.jsxs)(Xu,{children:[(0,Pe.jsx)("h4",{children:"Why is this necessary?"}),(0,Pe.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Pe.jsx)(Ew,{loading:P||!n,disabled:!u,onClick:async()=>{C(!0);let F=await o();if(F&&S&&u!==null)try{a("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:F,recoveryPin:u}),w(""),b?l(b):i({shouldCallAuthOnSuccess:!1}),x?.(S),a("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(H){Fm(H)?w("Invalid recovery password, please try again."):w("An error has occurred, please try again.")}finally{C(!1)}else return M("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&P,children:"Recover your account"})]})]}),(0,Pe.jsx)(ie,{}),(0,Pe.jsx)($,{protectedByPrivy:!0})]})},ww=cn.default.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
flex-direction: column;
|
|
1293
1293
|
align-items: center;
|
|
@@ -1309,18 +1309,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1309
1309
|
font-weight: 400;
|
|
1310
1310
|
line-height: 20px;
|
|
1311
1311
|
}
|
|
1312
|
-
`,
|
|
1312
|
+
`,Cw=cn.default.div`
|
|
1313
1313
|
display: flex;
|
|
1314
1314
|
flex-direction: column;
|
|
1315
1315
|
justify-content: space-between;
|
|
1316
|
-
`,
|
|
1316
|
+
`,bw=cn.default.div`
|
|
1317
1317
|
line-height: 20px;
|
|
1318
1318
|
height: 20px;
|
|
1319
1319
|
font-size: 13px;
|
|
1320
1320
|
color: var(--privy-color-error);
|
|
1321
1321
|
text-align: left;
|
|
1322
1322
|
margin-top: 0.5rem;
|
|
1323
|
-
`,
|
|
1323
|
+
`,Ew=(0,cn.default)(U)`
|
|
1324
1324
|
${e=>e.hideAnimations&&cn.css`
|
|
1325
1325
|
&& {
|
|
1326
1326
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
@@ -1328,7 +1328,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1328
1328
|
transition: none;
|
|
1329
1329
|
}
|
|
1330
1330
|
`}
|
|
1331
|
-
`;var $f=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),qf=h(require("@heroicons/react/24/outline/PhoneIcon")),
|
|
1331
|
+
`;var $f=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),qf=h(require("@heroicons/react/24/outline/PhoneIcon")),qs=h(require("styled-components"));var je=require("react/jsx-runtime"),Pw=e=>{let t=(0,je.jsx)($f.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof T)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof qe&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,je.jsx)(qf.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof lt)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,je.jsx)(Ds,{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,je.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,je.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};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Nr&&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}}},jf=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:i}=Ee(),a=r?.errorModalData,l=Pw(a?.error||new Error),s=c=>{if(c instanceof lt)switch(c.privyErrorCode){case"invalid_captcha":return()=>i()}return()=>{}};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(k,{backFn:!o||n===o?void 0:t}),(0,je.jsxs)(Tw,{children:[(0,je.jsx)(Sw,{children:(0,je.jsxs)("div",{children:[(0,je.jsx)(Ns,{color:"var(--privy-color-error)"}),l.icon]})}),(0,je.jsxs)(xw,{children:[(0,je.jsx)("h3",{children:l.title}),(0,je.jsx)("p",{children:l.detail})]}),(0,je.jsx)(U,{color:"var(--privy-color-error)",onClick:()=>{s(a?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},Tw=qs.default.div`
|
|
1332
1332
|
display: flex;
|
|
1333
1333
|
flex-direction: column;
|
|
1334
1334
|
align-items: center;
|
|
@@ -1336,11 +1336,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1336
1336
|
gap: 24px;
|
|
1337
1337
|
width: 100%;
|
|
1338
1338
|
padding-bottom: 16px;
|
|
1339
|
-
`,
|
|
1339
|
+
`,xw=qs.default.div`
|
|
1340
1340
|
display: flex;
|
|
1341
1341
|
flex-direction: column;
|
|
1342
1342
|
gap: 8px;
|
|
1343
|
-
`,
|
|
1343
|
+
`,Sw=qs.default.div`
|
|
1344
1344
|
display: flex;
|
|
1345
1345
|
flex-direction: column;
|
|
1346
1346
|
justify-content: center;
|
|
@@ -1363,7 +1363,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1363
1363
|
left: -19px;
|
|
1364
1364
|
top: -19px;
|
|
1365
1365
|
}
|
|
1366
|
-
`;var
|
|
1366
|
+
`;var go=require("react"),Zi=require("react-device-detect"),Js=h(require("styled-components"));var Yf=require("react"),Jf=h(require("styled-components"));var Fc=require("react/jsx-runtime"),js=({style:e,color:t,...r})=>(0,Fc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,Fc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var Ks=require("react/jsx-runtime"),Kf=({color:e,...t})=>(0,Ks.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,Ks.jsx)("g",{children:(0,Ks.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var Ji=require("react/jsx-runtime"),ai=e=>{let[t,r]=(0,Yf.useState)(!1);return(0,Ji.jsxs)(_w,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,Ji.jsx)(js,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,Ji.jsx)(Kf,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},_w=Jf.default.button`
|
|
1367
1367
|
display: flex;
|
|
1368
1368
|
align-items: center;
|
|
1369
1369
|
gap: 6px;
|
|
@@ -1401,7 +1401,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1401
1401
|
width: 14px;
|
|
1402
1402
|
height: 14px;
|
|
1403
1403
|
}
|
|
1404
|
-
`;var Zf=require("react"),Qf=h(require("styled-components")),eh=require("react/jsx-runtime"),Xf=e=>{let[t,r]=(0,Zf.useState)(!1);return(0,eh.jsx)(
|
|
1404
|
+
`;var Zf=require("react"),Qf=h(require("styled-components")),eh=require("react/jsx-runtime"),Xf=e=>{let[t,r]=(0,Zf.useState)(!1);return(0,eh.jsx)(Aw,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Aw=Qf.default.a`
|
|
1405
1405
|
display: flex;
|
|
1406
1406
|
align-items: center;
|
|
1407
1407
|
gap: 6px;
|
|
@@ -1439,7 +1439,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1439
1439
|
width: 14px;
|
|
1440
1440
|
height: 14px;
|
|
1441
1441
|
}
|
|
1442
|
-
`;var oh=h(require("qrcode")),nh=h(require("react")),ih=h(require("styled-components"));var
|
|
1442
|
+
`;var oh=h(require("qrcode")),nh=h(require("react")),ih=h(require("styled-components"));var Bc=require("react/jsx-runtime"),th=()=>(0,Bc.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,Bc.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var Ae=require("react/jsx-runtime"),zt=7,Hc=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},kw=e=>{let t=oh.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Tp(Array.from(t.data),t.size);return r=Hc(r,0,0,zt,zt),r=Hc(r,r.length-zt,0,zt,zt),r=Hc(r,0,r.length-zt,zt,zt),r},Rw=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,Ae.jsx)(Ae.Fragment,{children:[0,1,2].map(i=>(0,Ae.jsx)("circle",{r:r*(zt-i*2)/2,cx:e+r*zt/2,cy:t+r*zt/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),Iw=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-zt)*e,0],[0,(t-zt)*e]];return(0,Ae.jsx)(Ae.Fragment,{children:n.map(([i,a])=>(0,Ae.jsx)(Rw,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},Mw=({matrix:e,cellSize:t,color:r})=>(0,Ae.jsx)(Ae.Fragment,{children:e.map((o,n)=>o.map((i,a)=>i?(0,Ae.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):(0,Ae.jsx)(nh.default.Fragment,{},`circle-${n}-${a}`)))}),rh=(e,t)=>e-e%t,Ww=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return(0,Ae.jsx)(Ae.Fragment,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)("rect",{x:rh(c,t),y:rh(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),(0,Ae.jsx)(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Lw=e=>{let t=e.outputSize,r=kw(e.url),o=t/r.length;return(0,Ae.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,Ae.jsx)(Mw,{matrix:r,cellSize:o,color:e.fgColor}),(0,Ae.jsx)(Iw,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,Ae.jsx)(Ww,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},Ow=ih.default.div`
|
|
1443
1443
|
display: flex;
|
|
1444
1444
|
justify-content: center;
|
|
1445
1445
|
align-items: center;
|
|
@@ -1454,7 +1454,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1454
1454
|
border-color: ${e=>e.fgColor};
|
|
1455
1455
|
border-radius: var(--privy-border-radius-md);
|
|
1456
1456
|
}
|
|
1457
|
-
`,
|
|
1457
|
+
`,Ys=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return(0,Ae.jsx)(Ow,{size:o,bgColor:t,fgColor:r,children:(0,Ae.jsx)(Lw,{url:e.url,logo:{element:e.squareLogoElement??th},outputSize:o,bgColor:t,fgColor:r})})};var dn=require("react/jsx-runtime"),si=({style:e,...t})=>(0,dn.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,dn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,dn.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,dn.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,dn.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 j=require("react/jsx-runtime"),ah="#8a63d2",ch=1e3,Nw=ch*2,Dw=ch*120,dh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:g}=L(),[w,P]=(0,go.useState)(void 0),[C,S]=(0,go.useState)(!1),[b,x]=(0,go.useState)(!1),I=(0,go.useRef)([]),M=s?.render.inDialog?wt:0,A=c(),B=A?.meta.connectUri;return(0,go.useEffect)(()=>{let F=Date.now(),H=setInterval(async()=>{let R=await A.pollForReady.execute(),K=Date.now()-F;if(R){clearInterval(H),S(!0);try{await u(),x(!0)}catch(O){let Q={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?Q.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(Q.retryable=!0,Q.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(Q.detail="Too many requests. Please wait before trying again.");P(Q)}}else K>Dw&&(clearInterval(H),P({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},Nw);return()=>{clearInterval(H),I.current.forEach(R=>clearTimeout(R))}},[]),(0,go.useEffect)(()=>{if(r&&e&&b&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(H)}b&&(Qt(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),g("embedded_wallet_creation_failure_logout",{error:H,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M)):I.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M)))}},[b,r,e,o]),Zi.isMobile||C?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{backFn:n?a:void 0,onClose:f},"header"),(0,j.jsx)(oe,{}),Zi.isIOS?(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(Uw,{children:[(0,j.jsx)(lh,{children:(0,j.jsxs)("div",{children:[(0,j.jsx)(lo,{success:b,fail:!!w}),(0,j.jsx)(si,{style:{width:"38px",height:"38px"}})]})}),(0,j.jsxs)(Ht,{children:[(0,j.jsx)(Le,{children:w?w.message:"Sign in with Farcaster"}),(0,j.jsx)(Re,{children:w?w.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),B&&(0,j.jsx)(U,{onClick:F=>{F.preventDefault(),window.location.href=B},children:"Open Warpcast app"})]})}):(0,j.jsx)(j.Fragment,{children:(0,j.jsxs)(sh,{children:[(0,j.jsx)(lh,{children:(0,j.jsxs)("div",{children:[(0,j.jsx)(lo,{success:b,fail:!!w}),(0,j.jsx)(si,{style:{width:"38px",height:"38px"}})]})}),(0,j.jsxs)(Ht,{children:[(0,j.jsx)(Le,{children:w?w.message:"Signing in with Farcaster"}),(0,j.jsx)(Re,{children:w?w.detail:"This should only take a moment"}),(0,j.jsx)(sr,{children:B&&Zi.isMobile&&(0,j.jsx)(Xf,{text:"Take me to Warpcast",url:B,color:ah})})]})]})}),(0,j.jsx)(se,{})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{backFn:n?a:void 0,onClose:f},"header"),(0,j.jsx)(oe,{}),(0,j.jsx)(sh,{children:(0,j.jsxs)("div",{children:[(0,j.jsx)(Le,{children:"Sign in with Farcaster"}),(0,j.jsx)(Re,{children:"Scan with your phone's camera to continue."}),(0,j.jsx)(Fs,{children:B?(0,j.jsx)(Ys,{url:B,size:275,squareLogoElement:si}):(0,j.jsx)(or,{})}),(0,j.jsxs)(sr,{children:[(0,j.jsx)(Re,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),B&&(0,j.jsx)(ai,{text:B,itemName:"link",color:ah})]})]})}),(0,j.jsx)(se,{})]})},sh=Js.default.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
align-items: center;
|
|
@@ -1462,7 +1462,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1462
1462
|
margin-left: 27px;
|
|
1463
1463
|
margin-right: 27px;
|
|
1464
1464
|
gap: 24px;
|
|
1465
|
-
`,
|
|
1465
|
+
`,Uw=Js.default.div`
|
|
1466
|
+
display: flex;
|
|
1467
|
+
flex-direction: column;
|
|
1468
|
+
align-items: center;
|
|
1469
|
+
justify-content: center;
|
|
1470
|
+
gap: 24px;
|
|
1471
|
+
width: 100%;
|
|
1472
|
+
`,lh=Js.default.div`
|
|
1466
1473
|
display: flex;
|
|
1467
1474
|
flex-direction: column;
|
|
1468
1475
|
justify-content: center;
|
|
@@ -1485,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1485
1492
|
left: -19px;
|
|
1486
1493
|
top: -19px;
|
|
1487
1494
|
}
|
|
1488
|
-
`;var
|
|
1495
|
+
`;var ph=h(require("@heroicons/react/24/outline/ClockIcon")),uh=h(require("@heroicons/react/24/outline/EyeSlashIcon")),mh=h(require("@heroicons/react/24/outline/LinkIcon")),_r=h(require("styled-components"));var li=require("react/jsx-runtime"),Zs=({size:e=61,...t})=>(0,li.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,li.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,li.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,li.jsx)("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});var Ce=require("react/jsx-runtime"),Gc=({title:e,desc:t,icon:r})=>(0,Ce.jsxs)(zw,{children:[(0,Ce.jsx)(qw,{children:r}),(0,Ce.jsxs)($w,{children:[(0,Ce.jsx)(Gw,{children:e}),(0,Ce.jsx)(Vw,{children:t})]})]}),fh=({app:e,signedUrl:t,onContinue:r})=>(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)(Bw,{children:[(0,Ce.jsx)(Zs,{size:"3.75rem"}),(0,Ce.jsxs)(Hw,{children:[e?.name," uses ",(0,Ce.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,Ce.jsxs)(jw,{children:[(0,Ce.jsx)(Gc,{icon:(0,Ce.jsx)(mh.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,Ce.jsxs)(Ce.Fragment,{children:["Connect a payment method (",(0,Ce.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,Ce.jsx)(Gc,{icon:(0,Ce.jsx)(ph.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,Ce.jsx)(Gc,{icon:(0,Ce.jsx)(uh.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,Ce.jsx)(Kw,{className:"mobile-only"})]}),(0,Ce.jsx)(Fw,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,Ce.jsx)(_s,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),Fw=_r.default.span`
|
|
1489
1496
|
display: inline-block;
|
|
1490
1497
|
color: var(--privy-color-foreground-3);
|
|
1491
1498
|
text-align: center;
|
|
@@ -1494,13 +1501,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1494
1501
|
font-weight: 400;
|
|
1495
1502
|
line-height: 140%; /* 0.875rem */
|
|
1496
1503
|
margin-bottom: 0.25rem;
|
|
1497
|
-
`,
|
|
1504
|
+
`,Bw=_r.default.div`
|
|
1498
1505
|
display: flex;
|
|
1499
1506
|
flex-direction: column;
|
|
1500
1507
|
align-items: center;
|
|
1501
1508
|
justify-content: center;
|
|
1502
1509
|
padding: 1.5rem 0;
|
|
1503
|
-
`,
|
|
1510
|
+
`,Hw=_r.default.span`
|
|
1504
1511
|
color: var(--privy-color-foreground);
|
|
1505
1512
|
text-align: center;
|
|
1506
1513
|
font-size: 1.125rem;
|
|
@@ -1509,46 +1516,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1509
1516
|
margin: 1.5rem 0;
|
|
1510
1517
|
text-align: center;
|
|
1511
1518
|
max-width: 19.5rem;
|
|
1512
|
-
`,
|
|
1519
|
+
`,Gw=_r.default.span`
|
|
1513
1520
|
color: var(--privy-color-foreground);
|
|
1514
1521
|
font-size: 0.875rem;
|
|
1515
1522
|
font-weight: 500;
|
|
1516
1523
|
line-height: 1.225rem;
|
|
1517
1524
|
width: 100%;
|
|
1518
|
-
`,
|
|
1525
|
+
`,Vw=_r.default.span`
|
|
1519
1526
|
color: var(--privy-color-foreground-2);
|
|
1520
1527
|
font-size: 0.875rem;
|
|
1521
1528
|
font-weight: 400;
|
|
1522
1529
|
line-height: 1.225rem;
|
|
1523
|
-
`,
|
|
1530
|
+
`,zw=_r.default.div`
|
|
1524
1531
|
display: flex;
|
|
1525
1532
|
align-items: flex-start;
|
|
1526
1533
|
gap: 0.5rem;
|
|
1527
1534
|
align-self: stretch;
|
|
1528
|
-
|
|
1535
|
+
`,$w=_r.default.div`
|
|
1529
1536
|
display: flex;
|
|
1530
1537
|
flex-direction: column;
|
|
1531
1538
|
gap: 0.25rem;
|
|
1532
1539
|
align-items: flex-start;
|
|
1533
1540
|
text-align: left;
|
|
1534
1541
|
flex: 1 0 0;
|
|
1535
|
-
`,$w=_r.default.div`
|
|
1536
|
-
padding-top: 2px;
|
|
1537
1542
|
`,qw=_r.default.div`
|
|
1543
|
+
padding-top: 2px;
|
|
1544
|
+
`,jw=_r.default.div`
|
|
1538
1545
|
display: flex;
|
|
1539
1546
|
flex-direction: column;
|
|
1540
1547
|
gap: 1.25rem;
|
|
1541
1548
|
margin: 0 0.5rem;
|
|
1542
|
-
`,
|
|
1549
|
+
`,Kw=_r.default.div`
|
|
1543
1550
|
margin: 30px 0;
|
|
1544
|
-
`;var
|
|
1551
|
+
`;var yh=require("ofetch"),ci=require("react");var Qs="moonpay",hh="sdk_fiat_on_ramp_completed_with_status";async function gh(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function Yw(e,t){let r=t?vp:gp,o=t?Cp:wp;return(0,yh.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function vh(e,t=!1){let[r,o]=(0,ci.useState)(null),{createAnalyticsEvent:n}=L(),i=(0,ci.useRef)(0);return(0,ci.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await Yw(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(hh,{status:s,provider:Qs,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n(hh,{status:"serviceFailure",provider:Qs}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}var Ho=require("react/jsx-runtime"),wh=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=L(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,Ho.jsxs)(Ho.Fragment,{children:[(0,Ho.jsx)(k,{title:"Fund account"},"header"),(0,Ho.jsx)(fh,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:Qs}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,Ho.jsx)($,{protectedByPrivy:!0})]})};var Ch=h(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),bh=h(require("@heroicons/react/24/solid/CheckCircleIcon")),Eh=h(require("@heroicons/react/24/solid/XCircleIcon")),Ph=require("react"),Vc=h(require("styled-components"));var ye=require("react/jsx-runtime"),Th=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=L(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=vh(o||null,e.fiatOnRamp.useSandbox);return(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(k,{title:"Fund account"},"header"),(0,ye.jsx)(Zw,{status:n,onClickCta:r}),(0,ye.jsx)($,{protectedByPrivy:!0})]})},Jw=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,ye.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,ye.jsx)("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},Zw=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,Ph.useMemo)(()=>Jw(e),[e]);return(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsxs)(r0,{children:[(0,ye.jsx)(e0,{status:e}),(0,ye.jsxs)(Ht,{children:[(0,ye.jsx)("h3",{children:r}),(0,ye.jsx)(t0,{children:o})]})]}),n&&(0,ye.jsx)(U,{onClick:t,children:n})]})},Qw=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",Xw=e=>{switch(e){case"serviceFailure":case"failed":return Eh.default;case"completed":return bh.default;case"waitingAuthorization":return()=>(0,ye.jsx)(Ch.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},e0=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,ye.jsxs)("div",{style:{position:"relative"},children:[(0,ye.jsx)(or,{color:o,style:{position:"absolute"}}),(0,ye.jsx)(gc,{color:o}),(0,ye.jsx)(Zs,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=Xw(e),r=Qw(e);return(0,ye.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,ye.jsx)(t,{width:"4rem",height:"4rem",color:r})})},t0=Vc.default.p`
|
|
1545
1552
|
font-size: 1rem;
|
|
1546
1553
|
color: var(--privy-color-foreground-3);
|
|
1547
1554
|
margin-bottom: 1rem;
|
|
1548
1555
|
display: flex;
|
|
1549
1556
|
flex-direction: column;
|
|
1550
1557
|
gap: 1rem;
|
|
1551
|
-
`,
|
|
1558
|
+
`,r0=Vc.default.div`
|
|
1552
1559
|
display: flex;
|
|
1553
1560
|
flex-direction: column;
|
|
1554
1561
|
align-items: center;
|
|
@@ -1556,7 +1563,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1556
1563
|
margin-left: 1.75rem;
|
|
1557
1564
|
margin-right: 1.75rem;
|
|
1558
1565
|
padding: 2rem 0;
|
|
1559
|
-
`;var
|
|
1566
|
+
`;var xh=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Sh=h(require("styled-components"));var $t=require("react/jsx-runtime"),_h=()=>{let{closePrivyModal:e}=L();return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(k,{},"header"),(0,$t.jsx)(o0,{children:(0,$t.jsx)(xh.default,{style:{width:32,height:32}})}),(0,$t.jsx)(Gr,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,$t.jsx)(ar,{children:(0,$t.jsx)(U,{onClick:()=>e(),children:"Close"})}),(0,$t.jsx)(ie,{}),(0,$t.jsx)($,{protectedByPrivy:!0})]})},o0=Sh.default.div`
|
|
1560
1567
|
border-radius: 50%;
|
|
1561
1568
|
height: 68px;
|
|
1562
1569
|
width: 68px;
|
|
@@ -1566,18 +1573,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1566
1573
|
background-color: var(--privy-color-accent);
|
|
1567
1574
|
color: white;
|
|
1568
1575
|
margin: 0 auto 24px auto;
|
|
1569
|
-
`;var
|
|
1576
|
+
`;var Rh=h(require("react-device-detect")),Ih=h(require("styled-components"));var Xs=h(require("styled-components"));var zc=require("react/jsx-runtime"),Ah=({style:e,...t})=>(0,zc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,zc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});var tl=require("react/jsx-runtime"),kh=Xs.default.div`
|
|
1570
1577
|
display: flex;
|
|
1571
1578
|
flex-direction: column;
|
|
1572
1579
|
justify-content: flex-start;
|
|
1573
1580
|
gap: 4px;
|
|
1574
|
-
|
|
1581
|
+
`,$c=Xs.default.div`
|
|
1575
1582
|
&&& {
|
|
1576
1583
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1577
1584
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1578
1585
|
height: 12px;
|
|
1579
1586
|
}
|
|
1580
|
-
`,
|
|
1587
|
+
`,el=({children:e})=>(0,tl.jsxs)(n0,{children:[(0,tl.jsx)(Ah,{style:{width:"16px",height:"16px"}}),e]}),n0=Xs.default.div`
|
|
1581
1588
|
display: flex;
|
|
1582
1589
|
justify-content: flex-start;
|
|
1583
1590
|
justify-items: center;
|
|
@@ -1595,15 +1602,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1595
1602
|
margin-bottom: auto;
|
|
1596
1603
|
}
|
|
1597
1604
|
}
|
|
1598
|
-
`;var Te=require("react/jsx-runtime"),
|
|
1605
|
+
`;var Te=require("react/jsx-runtime"),i0=()=>(0,Te.jsxs)(a0,{children:[(0,Te.jsx)(Gi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,Te.jsx)(sr,{children:(0,Te.jsx)(Ur,{style:{width:"152px",height:"152px"}})}),(0,Te.jsxs)(kh,{children:[(0,Te.jsx)(el,{children:(0,Te.jsxs)("div",{children:[(0,Te.jsx)("span",{children:"Install the "}),(0,Te.jsx)("a",{href:Rh.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),(0,Te.jsx)($c,{}),(0,Te.jsx)(el,{children:"Set up your first wallet"}),(0,Te.jsx)($c,{}),(0,Te.jsx)(el,{children:"Store your recovery phrase in a safe place!"})]}),(0,Te.jsx)(As,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Mh=()=>{let{navigateBack:e}=_();return(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(k,{backFn:e},"header"),(0,Te.jsx)(oe,{}),(0,Te.jsx)(i0,{}),(0,Te.jsx)(ie,{}),(0,Te.jsxs)(se,{children:[(0,Te.jsx)("span",{children:"Still not sure? "}),(0,Te.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},a0=(0,Ih.default)(sr)`
|
|
1599
1606
|
gap: 30px;
|
|
1600
1607
|
|
|
1601
1608
|
> :first-child > svg {
|
|
1602
1609
|
margin-top: 20px;
|
|
1603
1610
|
}
|
|
1604
|
-
`;var
|
|
1611
|
+
`;var qh=h(require("@heroicons/react/24/outline/UserCircleIcon")),na=require("react"),jh=require("react-device-detect"),Kh=h(require("styled-components"));var Lh=h(require("@heroicons/react/24/outline/EnvelopeIcon")),Oh=require("react");var Wh=h(require("@heroicons/react/24/outline/EnvelopeIcon")),Qi=require("react"),qc=h(require("styled-components"));var Ar=require("react/jsx-runtime"),rl=(0,Qi.forwardRef)((e,t)=>{let[r,o]=(0,Qi.useState)(""),[n,i]=(0,Qi.useState)(!1),{authenticated:a}=G(),{initLoginWithEmail:l}=L(),{navigate:s,setModalData:c,currentScreen:u}=_(),{enabled:f,token:g}=Ee(),w=Na(r),P=n,C=n||!w,S=x=>{i(!0),l(r,x).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{c({errorModalData:{error:I,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},b=()=>{f&&!g&&!a?(c({captchaModalData:{callback:x=>l(r,x),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(g)};return(0,Ar.jsxs)(Ar.Fragment,{children:[(0,Ar.jsx)(s0,{children:(0,Ar.jsxs)(l0,{stacked:e.stacked,children:[(0,Ar.jsx)(Wh.default,{}),(0,Ar.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:x=>o(x.target.value),onKeyUp:x=>{x.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,Ar.jsx)(Hn,{isSubmitting:P,onClick:b,disabled:C,children:"Submit"})]})}),e.stacked?(0,Ar.jsx)(U,{loadingText:null,loading:P,disabled:C,onClick:b,children:"Submit"}):null]})}),s0=qc.default.div`
|
|
1605
1612
|
width: 100%;
|
|
1606
|
-
`,
|
|
1613
|
+
`,l0=qc.default.label`
|
|
1607
1614
|
display: block;
|
|
1608
1615
|
position: relative;
|
|
1609
1616
|
width: 100%;
|
|
@@ -1666,9 +1673,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1666
1673
|
&& > input::placeholder {
|
|
1667
1674
|
color: var(--privy-color-foreground-3);
|
|
1668
1675
|
}
|
|
1669
|
-
`;var $r=require("react/jsx-runtime"),
|
|
1676
|
+
`;var $r=require("react/jsx-runtime"),ol=({isEditable:e,setIsEditable:t})=>{let r=(0,Oh.useRef)(null);return(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)(po,{if:!e,children:(0,$r.jsx)(rl,{ref:r})}),(0,$r.jsx)(po,{if:e,children:(0,$r.jsxs)(Ue,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,$r.jsx)(Lh.default,{})," Continue with Email"]})})]})};var Nh=require("react");var di=require("react/jsx-runtime"),nl=()=>{let[e,t]=(0,Nh.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=Ee(),{initLoginWithFarcaster:l}=L();return(0,di.jsxs)(Ue,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[(0,di.jsx)(si,{})," Farcaster",e&&(0,di.jsx)("span",{children:(0,di.jsx)(tn,{})})]})};var Gh=h(require("@heroicons/react/24/outline/PhoneIcon")),Vh=require("react");var pi=require("react"),jc=h(require("styled-components"));var Dh=h(require("libphonenumber-js/examples.mobile.json")),qt=require("libphonenumber-js/min"),al=require("react/jsx-runtime");var Xi=(e,t)=>(0,qt.isPossiblePhoneNumber)(String(e),t),il=(e,t)=>`+${(0,qt.getCountryCallingCode)(t)} ${e}`,Uh=e=>`*${e.replaceAll("-","").slice(-4)}`,Fh=e=>new qt.AsYouType(e),c0=(0,qt.getCountries)().map(e=>({code:e,callCode:(0,qt.getCountryCallingCode)(e)})),Bh=e=>{let t=(0,qt.getExampleNumber)(e,Dh.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Hh=({value:e,onChange:t})=>(0,al.jsx)("select",{value:e,onChange:t,children:c0.map(r=>(0,al.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var kr=require("react/jsx-runtime"),ui=(0,pi.forwardRef)((e,t)=>{let{app:r}=_(),[o,n]=(0,pi.useState)(""),[i,a]=(0,pi.useState)(r?.intl.defaultCountry??"US"),l=Xi(o,i),s=Fh(i),c=Bh(i),u=(0,qt.getCountryCallingCode)(i),f=!l,[g,w]=(0,pi.useState)(!1),P=u.length,C=x=>{let I=x.target.value;a(I),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:il(o,I),countryCode:I,isValid:Xi(o,i)})},S=x=>{try{let I=x.replace(/\D/g,""),M=o.replace(/\D/g,""),A=I===M?x:s.input(x);n(A),e.onChange&&e.onChange({rawPhoneNumber:A,qualifiedPhoneNumber:il(x,i),countryCode:i,isValid:Xi(x,i)})}catch(I){console.error("Error processing phone number:",I)}},b=()=>{w(!0);let x=il(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:x,countryCode:i,isValid:Xi(o,i)}).finally(()=>w(!1))};return(0,kr.jsxs)(kr.Fragment,{children:[(0,kr.jsx)(d0,{children:(0,kr.jsxs)(p0,{callingCodeLength:P,stacked:e.stacked,children:[(0,kr.jsx)(Hh,{value:i,onChange:C}),(0,kr.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:x=>{S(x.target.value)},onKeyUp:x=>{x.key==="Enter"&&b()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,kr.jsx)(Hn,{isSubmitting:g,onClick:b,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,kr.jsx)(U,{loading:g,loadingText:null,onClick:b,disabled:f,children:"Submit"}):null]})}),d0=jc.default.div`
|
|
1670
1677
|
width: 100%;
|
|
1671
|
-
`,
|
|
1678
|
+
`,p0=jc.default.label`
|
|
1672
1679
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1673
1680
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1674
1681
|
display: block;
|
|
@@ -1759,11 +1766,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1759
1766
|
&& > input::placeholder {
|
|
1760
1767
|
color: var(--privy-color-foreground-3);
|
|
1761
1768
|
}
|
|
1762
|
-
`;var qr=require("react/jsx-runtime"),nl=({isEditable:e,setIsEditable:t})=>{let r=(0,Gh.useRef)(null),{authenticated:o}=G(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=L(),{enabled:s,token:c}=Ee();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:g=>l(f,g),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(g){i({errorModalData:{error:g,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,qr.jsxs)(qr.Fragment,{children:[(0,qr.jsx)(co,{if:!e,children:(0,qr.jsx)(pi,{ref:r,onSubmit:u})}),(0,qr.jsx)(co,{if:e,children:(0,qr.jsxs)(De,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,qr.jsx)(Hh.default,{})," Continue with SMS"]})})]})};var Vh=require("react");var Xi=require("react/jsx-runtime"),il=({style:e,...t})=>(0,Xi.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,Xi.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,Xi.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 Go=require("react/jsx-runtime"),al=({style:e,...t})=>(0,Go.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,Go.jsx)("g",{clipPath:"url(#clip0)",children:(0,Go.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,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:"clip0",children:(0,Go.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var jc=require("react/jsx-runtime"),sl=({style:e,...t})=>(0,jc.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,jc.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:"#171515"})});var pn=require("react/jsx-runtime"),ll=({style:e,...t})=>(0,pn.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,pn.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,pn.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,pn.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,pn.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 ea=require("react/jsx-runtime");function cl({style:e,...t}){return(0,ea.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,ea.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,ea.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,ea.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 ta=require("react/jsx-runtime");function dl(e){return(0,ta.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,ta.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,ta.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 ui=require("react/jsx-runtime");function pl(e){return(0,ui.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,ui.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,ui.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,ui.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 Kc=require("react/jsx-runtime"),ul=({style:e,...t})=>(0,Kc.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,Kc.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:"#000000"})});var Rr=require("react/jsx-runtime"),p0={apple:{logo:(0,Rr.jsx)(il,{}),displayName:"Apple"},discord:{logo:(0,Rr.jsx)(al,{}),displayName:"Discord"},github:{logo:(0,Rr.jsx)(sl,{}),displayName:"GitHub"},google:{logo:(0,Rr.jsx)(ll,{}),displayName:"Google"},linkedin:{logo:(0,Rr.jsx)(cl,{}),displayName:"LinkedIn"},spotify:{logo:(0,Rr.jsx)(dl,{}),displayName:"Spotify"},twitter:{logo:(0,Rr.jsx)(ul,{}),displayName:"Twitter"},tiktok:{logo:(0,Rr.jsx)(pl,{}),displayName:"TikTok"}},it=({provider:e})=>{let{enabled:t,token:r}=Ee(),{navigate:o,setModalData:n}=_(),[i,a]=(0,Vh.useState)(!1),{initLoginWithOAuth:l}=L(),{displayName:s,logo:c}=p0[e];return(0,Rr.jsxs)(De,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>l(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};var zh=h(require("@heroicons/react/24/outline/ChevronRightIcon"));var ra=require("react/jsx-runtime"),ml=({onClick:e,text:t,icon:r})=>(0,ra.jsxs)(De,{onClick:e,children:[r,(0,ra.jsx)(As,{children:t}),(0,ra.jsx)(zh.default,{})]});var be=require("react/jsx-runtime"),hl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),i=o.loginMethodsAndOrder?.primary??[],a=o.loginMethodsAndOrder?.overflow??[],l=[...i,...a],[s,c]=(0,oa.useState)("default"),[u,f]=(0,oa.useState)("email");(0,oa.useEffect)(()=>{let A=l.indexOf("sms"),B=l.indexOf("email");A>-1&&A<B&&f("sms")},[i,a]);let g=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{c("default")},150)};n.current=g;let C=A=>A==="email"?(0,be.jsx)(el,{isEditable:u==="email",setIsEditable:()=>{f("email")}},A):A==="sms"?(0,be.jsx)(nl,{isEditable:u==="sms",setIsEditable:()=>{f("sms")}},A):A==="apple"?(0,be.jsx)(it,{provider:"apple"},A):A==="discord"?(0,be.jsx)(it,{provider:"discord"},A):A==="farcaster"?(0,be.jsx)(tl,{},A):A==="github"?(0,be.jsx)(it,{provider:"github"},A):A==="google"?(0,be.jsx)(it,{provider:"google"},A):A==="linkedin"?(0,be.jsx)(it,{provider:"linkedin"},A):A==="tiktok"?(0,be.jsx)(it,{provider:"tiktok"},A):A==="twitter"&&(!qh.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,be.jsx)(it,{provider:"twitter"},A):Gi([A],r,e,l),P=i.map(C).flat(),w=a.map(C).flat(),S=[...P,...w],b=u0({primary:P.length,overflow:w.length}),[x,I]=Ep(S,b);return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(k,{title:"Log in or sign up",onClose:g,backFn:s==="default"?void 0:()=>{c("default")}}),s==="default"&&(0,be.jsx)(m0,{}),(0,be.jsx)(ks,{style:{overflow:"hidden",padding:2},children:(0,be.jsxs)(nr,{children:[s==="default"&&(0,be.jsxs)(be.Fragment,{children:[...x,I.length>0&&(0,be.jsx)(ml,{text:"More options",icon:(0,be.jsx)($h.default,{}),onClick:()=>c("overflow")})]}),s==="overflow"&&(0,be.jsxs)(be.Fragment,{children:[...I]})]})}),o&&(0,be.jsx)(Gn,{app:o}),(0,be.jsx)($,{protectedByPrivy:!0})]})},fl=5,u0=({primary:e,overflow:t})=>e<fl?e:e===fl&&t===0?fl:fl-1,m0=(0,jh.default)(qn)`
|
|
1769
|
+
`;var qr=require("react/jsx-runtime"),sl=({isEditable:e,setIsEditable:t})=>{let r=(0,Vh.useRef)(null),{authenticated:o}=G(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=L(),{enabled:s,token:c}=Ee();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:g=>l(f,g),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(g){i({errorModalData:{error:g,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,qr.jsxs)(qr.Fragment,{children:[(0,qr.jsx)(po,{if:!e,children:(0,qr.jsx)(ui,{ref:r,onSubmit:u})}),(0,qr.jsx)(po,{if:e,children:(0,qr.jsxs)(Ue,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,qr.jsx)(Gh.default,{})," Continue with SMS"]})})]})};var zh=require("react");var ea=require("react/jsx-runtime"),ll=({style:e,...t})=>(0,ea.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,ea.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,ea.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 Go=require("react/jsx-runtime"),cl=({style:e,...t})=>(0,Go.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,Go.jsx)("g",{clipPath:"url(#clip0)",children:(0,Go.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,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:"clip0",children:(0,Go.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var Kc=require("react/jsx-runtime"),dl=({style:e,...t})=>(0,Kc.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,Kc.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:"#171515"})});var pn=require("react/jsx-runtime"),pl=({style:e,...t})=>(0,pn.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,pn.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,pn.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,pn.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,pn.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 ta=require("react/jsx-runtime");function ul({style:e,...t}){return(0,ta.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,ta.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,ta.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,ta.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var ra=require("react/jsx-runtime");function ml(e){return(0,ra.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,ra.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,ra.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var mi=require("react/jsx-runtime");function fl(e){return(0,mi.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,mi.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,mi.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,mi.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 Yc=require("react/jsx-runtime"),hl=({style:e,...t})=>(0,Yc.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,Yc.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:"#000000"})});var Rr=require("react/jsx-runtime"),u0={apple:{logo:(0,Rr.jsx)(ll,{}),displayName:"Apple"},discord:{logo:(0,Rr.jsx)(cl,{}),displayName:"Discord"},github:{logo:(0,Rr.jsx)(dl,{}),displayName:"GitHub"},google:{logo:(0,Rr.jsx)(pl,{}),displayName:"Google"},linkedin:{logo:(0,Rr.jsx)(ul,{}),displayName:"LinkedIn"},spotify:{logo:(0,Rr.jsx)(ml,{}),displayName:"Spotify"},twitter:{logo:(0,Rr.jsx)(hl,{}),displayName:"Twitter"},tiktok:{logo:(0,Rr.jsx)(fl,{}),displayName:"TikTok"}},it=({provider:e})=>{let{enabled:t,token:r}=Ee(),{navigate:o,setModalData:n}=_(),[i,a]=(0,zh.useState)(!1),{initLoginWithOAuth:l}=L(),{displayName:s,logo:c}=u0[e];return(0,Rr.jsxs)(Ue,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>l(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};var $h=h(require("@heroicons/react/24/outline/ChevronRightIcon"));var oa=require("react/jsx-runtime"),yl=({onClick:e,text:t,icon:r})=>(0,oa.jsxs)(Ue,{onClick:e,children:[r,(0,oa.jsx)(Rs,{children:t}),(0,oa.jsx)($h.default,{})]});var be=require("react/jsx-runtime"),vl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),i=o.loginMethodsAndOrder?.primary??[],a=o.loginMethodsAndOrder?.overflow??[],l=[...i,...a],[s,c]=(0,na.useState)("default"),[u,f]=(0,na.useState)("email");(0,na.useEffect)(()=>{let A=l.indexOf("sms"),B=l.indexOf("email");A>-1&&A<B&&f("sms")},[i,a]);let g=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{c("default")},150)};n.current=g;let w=A=>A==="email"?(0,be.jsx)(ol,{isEditable:u==="email",setIsEditable:()=>{f("email")}},A):A==="sms"?(0,be.jsx)(sl,{isEditable:u==="sms",setIsEditable:()=>{f("sms")}},A):A==="apple"?(0,be.jsx)(it,{provider:"apple"},A):A==="discord"?(0,be.jsx)(it,{provider:"discord"},A):A==="farcaster"?(0,be.jsx)(nl,{},A):A==="github"?(0,be.jsx)(it,{provider:"github"},A):A==="google"?(0,be.jsx)(it,{provider:"google"},A):A==="linkedin"?(0,be.jsx)(it,{provider:"linkedin"},A):A==="tiktok"?(0,be.jsx)(it,{provider:"tiktok"},A):A==="twitter"&&(!jh.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,be.jsx)(it,{provider:"twitter"},A):Vi([A],r,e,l),P=i.map(w).flat(),C=a.map(w).flat(),S=[...P,...C],b=m0({primary:P.length,overflow:C.length}),[x,I]=Pp(S,b);return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(k,{title:"Log in or sign up",onClose:g,backFn:s==="default"?void 0:()=>{c("default")}}),s==="default"&&(0,be.jsx)(f0,{}),(0,be.jsx)(Is,{style:{overflow:"hidden",padding:2},children:(0,be.jsxs)(ir,{children:[s==="default"&&(0,be.jsxs)(be.Fragment,{children:[...x,I.length>0&&(0,be.jsx)(yl,{text:"More options",icon:(0,be.jsx)(qh.default,{}),onClick:()=>c("overflow")})]}),s==="overflow"&&(0,be.jsxs)(be.Fragment,{children:[...I]})]})}),o&&(0,be.jsx)(Gn,{app:o}),(0,be.jsx)($,{protectedByPrivy:!0})]})},gl=5,m0=({primary:e,overflow:t})=>e<gl?e:e===gl&&t===0?gl:gl-1,f0=(0,Kh.default)(qn)`
|
|
1763
1770
|
margin-bottom: 16px;
|
|
1764
|
-
`;var
|
|
1771
|
+
`;var Xh=h(require("@heroicons/react/24/outline/EnvelopeIcon")),ey=h(require("@heroicons/react/24/outline/PhoneIcon")),ty=h(require("@heroicons/react/24/outline/UserCircleIcon")),ia=require("react"),ry=require("react-device-detect"),oy=h(require("styled-components"));var vo=require("react/jsx-runtime"),Yh=({...e})=>(0,vo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,vo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,vo.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,vo.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,vo.jsx)("defs",{children:(0,vo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,vo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var Jh=h(require("@heroicons/react/24/outline/ChevronRightIcon")),Zh=h(require("@heroicons/react/24/outline/WalletIcon"));var fi=require("react/jsx-runtime"),Qh=({onClick:e,text:t})=>(0,fi.jsxs)(Ue,{onClick:e,children:[(0,fi.jsx)(Zh.default,{}),(0,fi.jsx)(Rs,{children:t}),(0,fi.jsx)(Jh.default,{})]});var ae=require("react/jsx-runtime"),wl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,tiktok:g,linkedin:w,apple:P,wallet:C,farcaster:S}=o?.loginMethods??{},b=o?.appearance.loginGroupPriority||"web2-first",x=o?.appearance.hideDirectWeb2Inputs,[I,M]=(0,ia.useState)("default"),[A,B]=(0,ia.useState)(i?"email":"sms");(0,ia.useEffect)(()=>{B(i?"email":"sms")},[i]);let F=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=F;let H=[i&&(0,ae.jsx)(ol,{isEditable:A==="email",setIsEditable:()=>{B("email")}}),a&&(0,ae.jsx)(sl,{isEditable:A==="sms",setIsEditable:()=>{B("sms")}})].filter(Boolean),R=[l&&(0,ae.jsx)(it,{provider:"google"}),s&&(!ry.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,ae.jsx)(it,{provider:"twitter"}),c&&(0,ae.jsx)(it,{provider:"discord"}),u&&(0,ae.jsx)(it,{provider:"github"}),f&&(0,ae.jsx)(it,{provider:"spotify"}),g&&(0,ae.jsx)(it,{provider:"tiktok"}),w&&(0,ae.jsx)(it,{provider:"linkedin"}),P&&(0,ae.jsx)(it,{provider:"apple"}),S&&(0,ae.jsx)(nl,{})].filter(Boolean),K=Vi(o.appearance.walletList,r,e,o.appearance.walletList),O=I==="default"?void 0:()=>{M("default")},Q=y0({priority:b,email:i,sms:a,social:R}),ce=g0({priority:b,email:i,sms:a,social:R}),ne=v0({priority:b,email:i,sms:a,social:R}),re=(0,ae.jsx)(Qh,{text:ne,onClick:()=>M("web3-overflow")}),Y=(0,ae.jsx)(yl,{text:Q,icon:ce,onClick:()=>M("web2-overflow")}),Ne=x?0:1;return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(k,{title:"Log in or sign up",onClose:F,backFn:O}),I==="default"&&(0,ae.jsx)(h0,{}),(0,ae.jsx)(Is,{style:{overflow:"hidden",padding:2},children:(0,ae.jsxs)(ir,{children:[I==="default"&&b==="web2-first"&&(0,ae.jsxs)(ae.Fragment,{children:[...H,...R.length+H.length>4?R.slice(0,3-H.length):R,H.length+R.length>4&&Y,C&&re]}),I==="default"&&b==="web3-first"&&(0,ae.jsxs)(ae.Fragment,{children:[C&&(0,ae.jsxs)(ae.Fragment,{children:[...K.length>4?K.slice(0,3):K,K.length>4&&re]}),H.length+R.length>Ne&&Y,H.length+R.length===Ne&&H.length?H[0]:null,H.length+R.length===Ne&&R.length?R[0]:null]}),I==="web2-overflow"&&(0,ae.jsxs)(ae.Fragment,{children:[...b==="web3-first"?H:[],...R]}),...I==="web3-overflow"?K:[]]})}),o&&(0,ae.jsx)(Gn,{app:o}),(0,ae.jsx)($,{protectedByPrivy:!0})]})},h0=(0,oy.default)(qn)`
|
|
1765
1772
|
margin-bottom: 16px;
|
|
1766
|
-
`,
|
|
1773
|
+
`,y0=({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",g0=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,ae.jsx)(ty.default,{}):t&&r?(0,ae.jsx)(Yh,{}):t?(0,ae.jsx)(Xh.default,{}):r?(0,ae.jsx)(ey.default,{}):null,v0=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Jc=require("react/jsx-runtime"),ny=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Jc.jsx)(vl,{connectOnly:!0}):(0,Jc.jsx)(wl,{connectOnly:!0})};var Zc=require("react/jsx-runtime"),iy=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Zc.jsx)(vl,{connectOnly:!1}):(0,Zc.jsx)(wl,{connectOnly:!1})};var ay=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var jt=require("react/jsx-runtime"),sy=()=>{let{app:e}=_();return(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)(k,{},"header"),(0,jt.jsx)(oe,{}),(0,jt.jsx)(Fe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,jt.jsx)(ay.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,jt.jsx)(ar,{children:(0,jt.jsx)(rl,{stacked:!0})}),(0,jt.jsx)(ie,{}),(0,jt.jsx)($,{protectedByPrivy:!0})]})};var ly=h(require("@heroicons/react/24/outline/PhoneIcon"));var Kt=require("react/jsx-runtime"),cy=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:i}=L();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(k,{},"header"),(0,Kt.jsx)(oe,{}),(0,Kt.jsx)(Fe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Kt.jsx)(ly.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Kt.jsx)(ar,{children:(0,Kt.jsx)(ui,{stacked:!0,onSubmit:a})}),(0,Kt.jsx)(ie,{}),(0,Kt.jsx)($,{protectedByPrivy:!0})]})};var jr=require("react/jsx-runtime"),dy=()=>{let{linkingHint:e}=L(),{app:t}=_(),r=e?`Select the wallet with ${So(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,jr.jsxs)(jr.Fragment,{children:[(0,jr.jsx)(k,{},"header"),(0,jr.jsx)(Gr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,jr.jsx)(ir,{children:(0,jr.jsx)($n,{connectOnly:!1})}),(0,jr.jsx)($,{protectedByPrivy:!0})]})};var aa=require("react/jsx-runtime"),py=({style:e,...t})=>(0,aa.jsxs)("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,aa.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,aa.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var Wt=require("react/jsx-runtime"),uy=()=>{let{closePrivyModal:e}=L(),{navigate:t}=_();return(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(k,{},"header"),(0,Wt.jsx)(oe,{}),(0,Wt.jsx)(py,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,Wt.jsx)(Gr,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Wt.jsxs)(ar,{children:[(0,Wt.jsx)(U,{onClick:()=>t("LANDING"),children:"Try again"}),(0,Wt.jsx)(Cr,{onClick:()=>e(),children:"Cancel"})]}),(0,Wt.jsx)(ie,{}),(0,Wt.jsx)($,{protectedByPrivy:!0})]})};var ed=h(require("@heroicons/react/20/solid/CheckIcon")),Ty=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),xy=h(require("@heroicons/react/24/outline/FingerPrintIcon")),Sy=h(require("@heroicons/react/24/outline/PhoneIcon")),td=h(require("@heroicons/react/24/outline/TrashIcon")),_y=h(require("@heroicons/react/24/solid/CheckBadgeIcon")),rd=h(require("@heroicons/react/24/solid/CheckCircleIcon")),od=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Ay=h(require("@heroicons/react/24/solid/IdentificationIcon")),Pl=h(require("@heroicons/react/24/solid/PhoneIcon")),El=h(require("@heroicons/react/24/solid/ShieldCheckIcon")),Yt=require("react");var bl=require("react"),yy=require("react-device-detect"),Xc=h(require("styled-components"));var un=require("@headlessui/react"),Cl=h(require("react")),mn=h(require("styled-components")),wo=require("react/jsx-runtime"),my=({children:e,open:t,onClick:r,...o})=>(0,wo.jsx)(un.Transition,{show:t,as:Cl.default.Fragment,children:(0,wo.jsxs)(un.Dialog,{onClose:r,...o,as:C0,children:[(0,wo.jsx)(un.Transition.Child,{as:Cl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,wo.jsx)(w0,{"aria-hidden":"true"})}),(0,wo.jsx)(b0,{children:(0,wo.jsx)(un.Transition.Child,{as:Cl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,wo.jsx)(un.Dialog.Panel,{as:E0,children:e})})})]})}),hi=mn.default.div`
|
|
1767
1774
|
display: flex;
|
|
1768
1775
|
flex-direction: column;
|
|
1769
1776
|
text-align: center;
|
|
@@ -1786,7 +1793,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1786
1793
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1787
1794
|
border-radius: var(--privy-border-radius-lg);
|
|
1788
1795
|
}
|
|
1789
|
-
`,
|
|
1796
|
+
`,w0=mn.default.div`
|
|
1790
1797
|
position: fixed;
|
|
1791
1798
|
inset: 0;
|
|
1792
1799
|
|
|
@@ -1799,10 +1806,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1799
1806
|
backdrop-filter: unset;
|
|
1800
1807
|
-webkit-backdrop-filter: unset;
|
|
1801
1808
|
}
|
|
1802
|
-
`,
|
|
1809
|
+
`,C0=mn.default.div`
|
|
1803
1810
|
position: relative;
|
|
1804
1811
|
z-index: 999999;
|
|
1805
|
-
`,
|
|
1812
|
+
`,b0=mn.default.div`
|
|
1806
1813
|
position: fixed;
|
|
1807
1814
|
inset: 0;
|
|
1808
1815
|
display: flex;
|
|
@@ -1810,7 +1817,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1810
1817
|
justify-content: center;
|
|
1811
1818
|
width: 100vw;
|
|
1812
1819
|
min-height: 100vh;
|
|
1813
|
-
`,
|
|
1820
|
+
`,E0=mn.default.div`
|
|
1814
1821
|
// reset some default dialog styles
|
|
1815
1822
|
padding: 0;
|
|
1816
1823
|
background: transparent;
|
|
@@ -1857,19 +1864,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1857
1864
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1858
1865
|
border-radius: var(--privy-border-radius-lg);
|
|
1859
1866
|
}
|
|
1860
|
-
`,
|
|
1867
|
+
`,fy=mn.default.div`
|
|
1861
1868
|
display: flex;
|
|
1862
1869
|
flex-direction: column;
|
|
1863
1870
|
align-items: center;
|
|
1864
1871
|
justify-content: center;
|
|
1865
1872
|
height: 100%;
|
|
1866
|
-
`;var Kr=require("react/jsx-runtime"),
|
|
1873
|
+
`;var Kr=require("react/jsx-runtime"),sa=6,P0=new Array(sa).fill("");function T0(e){return e.replace(/\s+/g,"")}function Qc(e){return/^[0-9]{1}$/.test(e)}function hy(e){return e.length===sa&&e.every(Qc)}function x0(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var yi=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=(0,bl.useState)(P0),[a,l]=(0,bl.useState)(null),[s,c]=(0,bl.useState)(null),u=async P=>{P.preventDefault();let C=T0(P.currentTarget.value);if(C==="")return;let S=x0(n,Qc),b=C.split(""),x=!b.every(Qc),I=b.length+S>sa;if(x){l("Passcode can only be numbers"),c(1);return}if(I){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let M=Number(P.currentTarget.name?.charAt(4)),A=[...C||[""]].slice(0,sa-M),B=[...n.slice(0,M),...A,...n.slice(M+A.length)];i(B);let F=A.length,H=Math.min(Math.max(M+F,0),sa-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),hy(B))try{await e(B.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(K){c(1),l(K.message)}else try{await e(null)}catch(K){c(1),l(K.message)}},f=P=>{s===1&&(l(null),c(null));let C=[...n.slice(0,P),"",...n.slice(P+1)];i(C),P>0&&document.querySelector(`input[name=pin-${P-1}]`)?.focus(),hy(C)?e(C.join("")):e(null)},w=o?"success":!!(r||a)?"fail":"";return(0,Kr.jsx)(Kr.Fragment,{children:(0,Kr.jsxs)(S0,{children:[(0,Kr.jsx)("div",{children:n.map((P,C)=>(0,Kr.jsx)("input",{name:`pin-${C}`,type:"text",value:n[C],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&f(C)},inputMode:"numeric",autoFocus:C===0,pattern:"[0-9]",className:w,autoComplete:yy.isMobile?"one-time-code":"off",disabled:t},C))}),(0,Kr.jsx)("div",{children:(0,Kr.jsx)(_0,{fail:!!r||!!a,children:r||a})})]})})},S0=Xc.default.div`
|
|
1867
1874
|
display: flex;
|
|
1868
1875
|
flex-direction: column;
|
|
1869
1876
|
width: 100%;
|
|
1870
1877
|
gap: 8px;
|
|
1871
1878
|
|
|
1872
|
-
${
|
|
1879
|
+
${hi}[data-height='medium'] & {
|
|
1873
1880
|
margin-top: 22px;
|
|
1874
1881
|
}
|
|
1875
1882
|
|
|
@@ -1934,7 +1941,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1934
1941
|
transform: translate(1px, 0px);
|
|
1935
1942
|
}
|
|
1936
1943
|
}
|
|
1937
|
-
`,
|
|
1944
|
+
`,_0=Xc.default.div`
|
|
1938
1945
|
line-height: 20px;
|
|
1939
1946
|
font-size: 13px;
|
|
1940
1947
|
display: flex;
|
|
@@ -1942,7 +1949,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1942
1949
|
width: 100%;
|
|
1943
1950
|
|
|
1944
1951
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1945
|
-
`;var
|
|
1952
|
+
`;var gy=require("react");function fn(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,gy.useContext)(ue);return{promptMfa:e,init:t,submit:r,cancel:o}}var vy=require("react");function gi(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:i}=(0,vy.useContext)(ue);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}var wy=h(require("styled-components")),la=require("react/jsx-runtime"),Cy=e=>(0,la.jsxs)(A0,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,la.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,la.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),A0=wy.default.svg`
|
|
1946
1953
|
height: 90px;
|
|
1947
1954
|
width: 90px;
|
|
1948
1955
|
|
|
@@ -1953,7 +1960,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1953
1960
|
> path {
|
|
1954
1961
|
fill: white;
|
|
1955
1962
|
}
|
|
1956
|
-
`;var Cy=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Ey=require("react/jsx-runtime");var by=({size:e,authUrl:t})=>(0,Ey.jsx)(js,{url:t,squareLogoElement:Cy.default,size:e,fgColor:"#1F1F1F"});var m=require("react/jsx-runtime"),Ay=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=(0,Kt.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i}=yi(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=L(),{promptMfa:f}=fn(),[g,C]=(0,Kt.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[P,w]=(0,Kt.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),w(null)},500)};c.current=S;let b=e?.mfaMethods.includes("sms"),x=!!e?.phone,I=e?.mfaMethods.includes("totp"),M=b||I;(0,Kt.useEffect)(()=>{M&&C(!0)},[M]);function A(){o(null),w(null)}function B(){C(!1)}async function F(O){await f(),w(O)}if(!l||!e||!a)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(wy,{})}),(0,m.jsx)(Wo,{children:(0,m.jsx)(rr,{})}),(0,m.jsx)(ae,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function R(){o(null);try{await i()}catch{o(null)}}if(r==="sms")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:A,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Cl.default,{})})}),(0,m.jsx)(Ue,{children:"Remove SMS verification?"}),(0,m.jsxs)(Me,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),(0,m.jsx)(ae,{})]});if(r==="totp")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:A,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(rd.default,{})})}),(0,m.jsx)(Ue,{children:"Remove Authenticator App verification?"}),(0,m.jsxs)(Me,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{warn:!0,onClick:R,children:"Remove Authenticator App for MFA"})}),(0,m.jsx)(ae,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(wl.default,{})})}),(0,m.jsx)(Ue,{children:"Add more security"}),(0,m.jsxs)(Me,{children:[a?.name," does not have any verification methods enabled."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:S,children:"Close"})}),(0,m.jsx)(ae,{})]});let j=!M&&!g;if(j)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(wl.default,{})})}),(0,m.jsx)(Ue,{children:"Transaction Protection"}),(0,m.jsx)(Me,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,m.jsxs)($u,{children:[(0,m.jsxs)(wc,{children:[(0,m.jsx)(vc,{children:(0,m.jsx)(Sy.default,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),(0,m.jsxs)(wc,{children:[(0,m.jsx)(vc,{children:(0,m.jsx)(_y.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(U,{onClick:()=>C(!0),children:"Continue"}),(0,m.jsx)(Cr,{onClick:S,children:"Not now"})]}),(0,m.jsx)(ae,{})]});switch(P){case"sms":return(0,m.jsx)(A0,{onComplete:S,onReset:A,onClose:S});case"totp":return(0,m.jsx)(k0,{onComplete:S,onClose:S,onReset:A});default:return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:j?B:void 0,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(wl.default,{})})}),(0,m.jsx)(Ue,{children:"Choose a verification method"}),M?(0,m.jsx)(Me,{children:"To add or delete verification methods, verification is required."}):(0,m.jsx)(Me,{children:"How would you like to verify your identity? You can change this later."}),(0,m.jsxs)(Rs,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||I)&&(0,m.jsxs)(Is,{children:[(0,m.jsx)(De,{disabled:I,onClick:()=>F("totp"),children:(0,m.jsxs)(Ws,{children:[(0,m.jsxs)(Ms,{children:[(0,m.jsx)(Py.default,{}),"Authenticator App"]}),I?(0,m.jsxs)(Vn,{children:[(0,m.jsx)(Xc.default,{}),"Added"]}):(0,m.jsx)(Vn,{children:"Recommended"})]})}),I&&(0,m.jsx)(Cc,{id:"remove",onClick:()=>o("totp"),children:(0,m.jsx)(ed.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||b)&&(0,m.jsxs)(Is,{children:[(0,m.jsx)(De,{disabled:b||x,onClick:()=>F("sms"),children:(0,m.jsxs)(Ws,{children:[(0,m.jsxs)(Ms,{children:[(0,m.jsx)(xy.default,{}),"SMS"]}),b&&(0,m.jsxs)(Vn,{children:[(0,m.jsx)(Xc.default,{}),"Added"]}),x&&(0,m.jsx)(Vn,{children:"Disabled"})]})}),b&&(0,m.jsx)(Cc,{id:"remove",onClick:()=>o("sms"),children:(0,m.jsx)(ed.default,{})})]},"sms"),(0,m.jsx)(Is,{children:(0,m.jsx)(De,{disabled:!0,children:(0,m.jsxs)(Ws,{children:[(0,m.jsxs)(Ms,{children:[(0,m.jsx)(Ty.default,{}),"Passkey"]}),(0,m.jsx)(Vn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,m.jsx)(ae,{})]})}},A0=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,Kt.useState)(""),[i,a]=(0,Kt.useState)(!1),[l,s]=(0,Kt.useState)("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=yi(),{app:f,data:g,currentScreen:C,navigate:P,setModalData:w}=_();function S(){g?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:M}){try{await c({phoneNumber:M}),n(M),s("verify")}catch(A){w({mfaEnrollmentFlow:g?.mfaEnrollmentFlow?{...g?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:A,previousScreen:C||"MFA_ENROLLMENT_FLOW_SCREEN"}}),P("ERROR_SCREEN")}}async function x(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),a(!0)}catch(A){throw Ic(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(A)?new Error("The code you entered is not valid"):nn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Mc(A)?new Error("Verification canceled"):new Error("Unknown error")}}function I(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:t,onClose:r},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Cl.default,{})})}),(0,m.jsx)(Ue,{children:"Set up SMS verification"}),(0,m.jsx)(Me,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,m.jsxs)(Wo,{children:[(0,m.jsx)(pi,{onSubmit:b}),(0,m.jsxs)(qu,{children:["By providing your mobile number, you agree to receive text messages from ",f?.name,". Some carrier charges may apply"]})]}),(0,m.jsx)(ae,{})]}):i?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{status:"success",children:(0,m.jsx)(td.default,{})})}),(0,m.jsx)(Ue,{children:"SMS verification added"}),(0,m.jsx)(Me,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:S,children:"Done"})}),(0,m.jsx)(ae,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:I,onClose:r},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Cl.default,{})})}),(0,m.jsx)(Ue,{children:"Enter enrollment code"}),(0,m.jsxs)(Wo,{children:[(0,m.jsx)(hi,{onChange:x}),(0,m.jsxs)(Me,{children:["To continue, enter the 6-digit code sent to ",(0,m.jsx)("strong",{children:Dh(o)})]})]}),(0,m.jsx)(ae,{})]})},k0=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=(0,Kt.useState)("enroll"),[i,a]=(0,Kt.useState)(null),[l,s]=(0,Kt.useState)(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=yi(),{data:f}=_();(0,Kt.useEffect)(()=>{a(null),c().then(S=>{a(S)}).catch(()=>{a(null),r()})},[]);function g(){f?.mfaEnrollmentFlow?.onSuccess(),e()}function C(){n("verify")}async function P(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(b){throw Ic(b)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(b)?new Error("The code you entered is not valid"):nn(b)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Mc(b)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){o==="verify"?n("enroll"):r()}return o==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:r,onClose:t},"header"),(0,m.jsx)(Ue,{children:"Scan QR code"}),(0,m.jsx)(Me,{children:"Open your authenticator app and scan the QR code to continue."}),(0,m.jsx)(Ds,{children:i?.authUrl?(0,m.jsx)(by,{authUrl:i.authUrl,size:200}):(0,m.jsx)(rr,{})}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(ar,{children:i?.secret&&(0,m.jsx)(ai,{itemName:"secret",text:i.secret})}),(0,m.jsx)(U,{onClick:C,children:"Continue"})]}),(0,m.jsx)(ae,{})]}):l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:g},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{status:"success",children:(0,m.jsx)(td.default,{})})}),(0,m.jsx)(Ue,{children:"Authenticator app verification added"}),(0,m.jsx)(Me,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:g,children:"Done"})}),(0,m.jsx)(ae,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:w,onClose:t},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(rd.default,{})})}),(0,m.jsx)(Ue,{children:"Enter enrollment code"}),(0,m.jsx)(Wo,{children:(0,m.jsx)(hi,{onChange:P})}),(0,m.jsxs)(Me,{children:["To continue, enter the 6-digit code generated from your ",(0,m.jsx)("strong",{children:"authenticator app"})]}),(0,m.jsx)(ae,{})]})};var dg=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),pg=h(require("@heroicons/react/24/outline/PhoneIcon")),ug=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),mg=h(require("@heroicons/react/24/solid/PhoneIcon")),fg=h(require("@heroicons/react/24/solid/ShieldCheckIcon")),xi=require("react");var gn=require("react"),cg=h(require("styled-components"));var cd=h(require("styled-components"));var od=h(require("styled-components")),la=require("react/jsx-runtime"),bl=({label:e,children:t,valueStyles:r})=>(0,la.jsxs)(R0,{children:[(0,la.jsx)("div",{children:e}),(0,la.jsx)(I0,{style:{...r},children:t})]}),R0=od.default.div`
|
|
1963
|
+
`;var by=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Py=require("react/jsx-runtime");var Ey=({size:e,authUrl:t})=>(0,Py.jsx)(Ys,{url:t,squareLogoElement:by.default,size:e,fgColor:"#1F1F1F"});var m=require("react/jsx-runtime"),ky=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=(0,Yt.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i}=gi(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=L(),{promptMfa:f}=fn(),[g,w]=(0,Yt.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[P,C]=(0,Yt.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),C(null)},500)};c.current=S;let b=e?.mfaMethods.includes("sms"),x=!!e?.phone,I=e?.mfaMethods.includes("totp"),M=b||I;(0,Yt.useEffect)(()=>{M&&w(!0)},[M]);function A(){o(null),C(null)}function B(){w(!1)}async function F(O){await f(),C(O)}if(!l||!e||!a)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Cy,{})}),(0,m.jsx)(Wo,{children:(0,m.jsx)(or,{})}),(0,m.jsx)(se,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function R(){o(null);try{await i()}catch{o(null)}}if(r==="sms")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:A,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Pl.default,{})})}),(0,m.jsx)(Le,{children:"Remove SMS verification?"}),(0,m.jsxs)(Re,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),(0,m.jsx)(se,{})]});if(r==="totp")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:A,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(od.default,{})})}),(0,m.jsx)(Le,{children:"Remove Authenticator App verification?"}),(0,m.jsxs)(Re,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{warn:!0,onClick:R,children:"Remove Authenticator App for MFA"})}),(0,m.jsx)(se,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(El.default,{})})}),(0,m.jsx)(Le,{children:"Add more security"}),(0,m.jsxs)(Re,{children:[a?.name," does not have any verification methods enabled."]}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:S,children:"Close"})}),(0,m.jsx)(se,{})]});let K=!M&&!g;if(K)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(El.default,{})})}),(0,m.jsx)(Le,{children:"Transaction Protection"}),(0,m.jsx)(Re,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,m.jsxs)($u,{children:[(0,m.jsxs)(Ec,{children:[(0,m.jsx)(bc,{children:(0,m.jsx)(_y.default,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),(0,m.jsxs)(Ec,{children:[(0,m.jsx)(bc,{children:(0,m.jsx)(Ay.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(U,{onClick:()=>w(!0),children:"Continue"}),(0,m.jsx)(Cr,{onClick:S,children:"Not now"})]}),(0,m.jsx)(se,{})]});switch(P){case"sms":return(0,m.jsx)(k0,{onComplete:S,onReset:A,onClose:S});case"totp":return(0,m.jsx)(R0,{onComplete:S,onClose:S,onReset:A});default:return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:K?B:void 0,onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(El.default,{})})}),(0,m.jsx)(Le,{children:"Choose a verification method"}),M?(0,m.jsx)(Re,{children:"To add or delete verification methods, verification is required."}):(0,m.jsx)(Re,{children:"How would you like to verify your identity? You can change this later."}),(0,m.jsxs)(Ms,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||I)&&(0,m.jsxs)(Ws,{children:[(0,m.jsx)(Ue,{disabled:I,onClick:()=>F("totp"),children:(0,m.jsxs)(Os,{children:[(0,m.jsxs)(Ls,{children:[(0,m.jsx)(Ty.default,{}),"Authenticator App"]}),I?(0,m.jsxs)(Vn,{children:[(0,m.jsx)(ed.default,{}),"Added"]}):(0,m.jsx)(Vn,{children:"Recommended"})]})}),I&&(0,m.jsx)(Pc,{id:"remove",onClick:()=>o("totp"),children:(0,m.jsx)(td.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||b)&&(0,m.jsxs)(Ws,{children:[(0,m.jsx)(Ue,{disabled:b||x,onClick:()=>F("sms"),children:(0,m.jsxs)(Os,{children:[(0,m.jsxs)(Ls,{children:[(0,m.jsx)(Sy.default,{}),"SMS"]}),b&&(0,m.jsxs)(Vn,{children:[(0,m.jsx)(ed.default,{}),"Added"]}),x&&(0,m.jsx)(Vn,{children:"Disabled"})]})}),b&&(0,m.jsx)(Pc,{id:"remove",onClick:()=>o("sms"),children:(0,m.jsx)(td.default,{})})]},"sms"),(0,m.jsx)(Ws,{children:(0,m.jsx)(Ue,{disabled:!0,children:(0,m.jsxs)(Os,{children:[(0,m.jsxs)(Ls,{children:[(0,m.jsx)(xy.default,{}),"Passkey"]}),(0,m.jsx)(Vn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,m.jsx)(se,{})]})}},k0=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,Yt.useState)(""),[i,a]=(0,Yt.useState)(!1),[l,s]=(0,Yt.useState)("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=gi(),{app:f,data:g,currentScreen:w,navigate:P,setModalData:C}=_();function S(){g?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:M}){try{await c({phoneNumber:M}),n(M),s("verify")}catch(A){C({mfaEnrollmentFlow:g?.mfaEnrollmentFlow?{...g?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:A,previousScreen:w||"MFA_ENROLLMENT_FLOW_SCREEN"}}),P("ERROR_SCREEN")}}async function x(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),a(!0)}catch(A){throw Lc(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(A)?new Error("The code you entered is not valid"):nn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Oc(A)?new Error("Verification canceled"):new Error("Unknown error")}}function I(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:t,onClose:r},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Pl.default,{})})}),(0,m.jsx)(Le,{children:"Set up SMS verification"}),(0,m.jsx)(Re,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,m.jsxs)(Wo,{children:[(0,m.jsx)(ui,{onSubmit:b}),(0,m.jsxs)(qu,{children:["By providing your mobile number, you agree to receive text messages from ",f?.name,". Some carrier charges may apply"]})]}),(0,m.jsx)(se,{})]}):i?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{status:"success",children:(0,m.jsx)(rd.default,{})})}),(0,m.jsx)(Le,{children:"SMS verification added"}),(0,m.jsx)(Re,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:S,children:"Done"})}),(0,m.jsx)(se,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:I,onClose:r},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(Pl.default,{})})}),(0,m.jsx)(Le,{children:"Enter enrollment code"}),(0,m.jsxs)(Wo,{children:[(0,m.jsx)(yi,{onChange:x}),(0,m.jsxs)(Re,{children:["To continue, enter the 6-digit code sent to ",(0,m.jsx)("strong",{children:Uh(o)})]})]}),(0,m.jsx)(se,{})]})},R0=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=(0,Yt.useState)("enroll"),[i,a]=(0,Yt.useState)(null),[l,s]=(0,Yt.useState)(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=gi(),{data:f}=_();(0,Yt.useEffect)(()=>{a(null),c().then(S=>{a(S)}).catch(()=>{a(null),r()})},[]);function g(){f?.mfaEnrollmentFlow?.onSuccess(),e()}function w(){n("verify")}async function P(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(b){throw Lc(b)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(b)?new Error("The code you entered is not valid"):nn(b)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Oc(b)?new Error("Verification canceled"):new Error("Unknown error")}}function C(){o==="verify"?n("enroll"):r()}return o==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:r,onClose:t},"header"),(0,m.jsx)(Le,{children:"Scan QR code"}),(0,m.jsx)(Re,{children:"Open your authenticator app and scan the QR code to continue."}),(0,m.jsx)(Fs,{children:i?.authUrl?(0,m.jsx)(Ey,{authUrl:i.authUrl,size:200}):(0,m.jsx)(or,{})}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(sr,{children:i?.secret&&(0,m.jsx)(ai,{itemName:"secret",text:i.secret})}),(0,m.jsx)(U,{onClick:w,children:"Continue"})]}),(0,m.jsx)(se,{})]}):l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:g},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{status:"success",children:(0,m.jsx)(rd.default,{})})}),(0,m.jsx)(Le,{children:"Authenticator app verification added"}),(0,m.jsx)(Re,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,m.jsx)(Lo,{children:(0,m.jsx)(U,{onClick:g,children:"Done"})}),(0,m.jsx)(se,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:C,onClose:t},"header"),(0,m.jsx)(ut,{children:(0,m.jsx)(Tt,{children:(0,m.jsx)(od.default,{})})}),(0,m.jsx)(Le,{children:"Enter enrollment code"}),(0,m.jsx)(Wo,{children:(0,m.jsx)(yi,{onChange:P})}),(0,m.jsxs)(Re,{children:["To continue, enter the 6-digit code generated from your ",(0,m.jsx)("strong",{children:"authenticator app"})]}),(0,m.jsx)(se,{})]})};var pg=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),ug=h(require("@heroicons/react/24/outline/PhoneIcon")),mg=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),fg=h(require("@heroicons/react/24/solid/PhoneIcon")),hg=h(require("@heroicons/react/24/solid/ShieldCheckIcon")),Si=require("react");var gn=require("react"),dg=h(require("styled-components"));var dd=h(require("styled-components"));var nd=h(require("styled-components")),ca=require("react/jsx-runtime"),Tl=({label:e,children:t,valueStyles:r})=>(0,ca.jsxs)(I0,{children:[(0,ca.jsx)("div",{children:e}),(0,ca.jsx)(M0,{style:{...r},children:t})]}),I0=nd.default.div`
|
|
1957
1964
|
display: flex;
|
|
1958
1965
|
align-items: center;
|
|
1959
1966
|
justify-content: space-between;
|
|
@@ -1968,7 +1975,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1968
1975
|
color: var(--privy-color-foreground-2);
|
|
1969
1976
|
text-align: right;
|
|
1970
1977
|
}
|
|
1971
|
-
`,
|
|
1978
|
+
`,M0=nd.default.div`
|
|
1972
1979
|
font-size: 14px;
|
|
1973
1980
|
line-height: 100%;
|
|
1974
1981
|
display: flex;
|
|
@@ -1977,28 +1984,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1977
1984
|
border-radius: var(--privy-border-radius-full);
|
|
1978
1985
|
background-color: var(--privy-color-background-2);
|
|
1979
1986
|
padding: 4px 8px;
|
|
1980
|
-
`;var
|
|
1987
|
+
`;var pa=h(require("styled-components"));var id=require("@ethersproject/bignumber"),ad=require("@ethersproject/units");var da=(e,t)=>{let r=(t*parseFloat((0,ad.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},Yr=(e,t,r=6,o=!1)=>{let i=parseFloat((0,ad.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},sd=e=>e.map(ht).reduce((t,r)=>t.add(r),id.BigNumber.from(0)).toHexString(),Ry=(e,t)=>{let{chains:r}=L(),o=`https://etherscan.io/address/${t}`,n=`${kp(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},ht=e=>id.BigNumber.from(e);var Jr=require("react/jsx-runtime"),Iy=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=sd(e),n=t?da(o,t):void 0,i=Yr(o,r);return(0,Jr.jsx)(My,{children:n||i})},ld=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=sd(e),n=t?da(o,t):void 0,i=Yr(o,r);return(0,Jr.jsx)(My,{children:n?(0,Jr.jsxs)(Jr.Fragment,{children:[(0,Jr.jsx)(W0,{children:"USD"}),n==="<$0.01"?(0,Jr.jsxs)(O0,{children:[(0,Jr.jsx)(L0,{children:"<"}),"$0.01"]}):n]}):i})},My=pa.default.span`
|
|
1981
1988
|
font-size: 14px;
|
|
1982
1989
|
line-height: 140%;
|
|
1983
1990
|
display: flex;
|
|
1984
1991
|
gap: 4px;
|
|
1985
1992
|
align-items: center;
|
|
1986
|
-
`,
|
|
1993
|
+
`,W0=pa.default.span`
|
|
1987
1994
|
font-size: 12px;
|
|
1988
1995
|
line-height: 12px;
|
|
1989
1996
|
color: var(--privy-color-foreground-3);
|
|
1990
|
-
`,
|
|
1997
|
+
`,L0=pa.default.span`
|
|
1991
1998
|
font-size: 10px;
|
|
1992
|
-
`,
|
|
1999
|
+
`,O0=pa.default.span`
|
|
1993
2000
|
display: flex;
|
|
1994
2001
|
align-items: center;
|
|
1995
|
-
`;var
|
|
2002
|
+
`;var xl=h(require("styled-components"));var Lt=require("react/jsx-runtime"),Wy=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,Lt.jsxs)(_c,{style:{paddingBottom:"12px"},children:[(0,Lt.jsxs)(Oy,{children:[(0,Lt.jsx)(Dy,{children:"Est. Fees"}),(0,Lt.jsx)("div",{children:(0,Lt.jsx)(ld,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,Lt.jsx)(Ny,{children:`${Yr(e,r)}`})]}),Ly=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=ht(e.value||0).add(ht(t)).toHexString();return(0,Lt.jsxs)(_c,{children:[(0,Lt.jsxs)(Oy,{children:[(0,Lt.jsx)(Dy,{children:"Total (including fees)"}),(0,Lt.jsx)("div",{children:(0,Lt.jsx)(ld,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,Lt.jsx)(Ny,{children:Yr(n,o)})]})},Oy=xl.default.div`
|
|
1996
2003
|
display: flex;
|
|
1997
2004
|
flex-direction: row;
|
|
1998
2005
|
justify-content: space-between;
|
|
1999
2006
|
align-items: center;
|
|
2000
2007
|
padding-top: 4px;
|
|
2001
|
-
`,
|
|
2008
|
+
`,Ny=xl.default.div`
|
|
2002
2009
|
display: flex;
|
|
2003
2010
|
flex-direction: row;
|
|
2004
2011
|
height: 12px;
|
|
@@ -2007,23 +2014,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2007
2014
|
line-height: 12px;
|
|
2008
2015
|
color: var(--privy-color-foreground-3);
|
|
2009
2016
|
font-weight: 400;
|
|
2010
|
-
`,
|
|
2017
|
+
`,Dy=xl.default.div`
|
|
2011
2018
|
font-size: 14px;
|
|
2012
2019
|
line-height: 22.4px;
|
|
2013
2020
|
font-weight: 400;
|
|
2014
|
-
`;var
|
|
2021
|
+
`;var Uy=h(require("@heroicons/react/24/outline/ChevronDownIcon")),Zr=require("react"),Co=h(require("styled-components"));var Sl=require("react"),vi=(0,Sl.createContext)(void 0);var ua=(0,Sl.createContext)(void 0);var at=require("react/jsx-runtime"),Fy=({defaultValue:e,children:t})=>{let[r,o]=(0,Zr.useState)(e||null),n=i=>{o(r===i?null:i)};return(0,at.jsx)(vi.Provider,{value:{activePanel:r,togglePanel:n},children:(0,at.jsx)(N0,{children:t})})},By=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,Zr.useContext)(vi),n=r===e;return(0,at.jsx)(ua.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,at.jsx)(B0,{isActive:n,"data-open":n,children:t})})},Hy=({children:e})=>{let{activePanel:t}=(0,Zr.useContext)(vi),{onToggle:r,value:o}=(0,Zr.useContext)(ua),n=t===o;return(0,at.jsxs)(at.Fragment,{children:[(0,at.jsxs)(D0,{onClick:r,"data-open":n,children:[(0,at.jsx)(F0,{children:e}),(0,at.jsx)(G0,{isactive:n,children:(0,at.jsx)(Uy.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,at.jsx)(U0,{})]})},Gy=({children:e})=>{let{activePanel:t}=(0,Zr.useContext)(vi),{value:r}=(0,Zr.useContext)(ua);return(0,at.jsx)(H0,{"data-open":t===r,children:(0,at.jsx)(zy,{children:e})})},Vy=({children:e})=>{let{activePanel:t}=(0,Zr.useContext)(vi),{value:r}=(0,Zr.useContext)(ua);return(0,at.jsx)(zy,{children:typeof e=="function"?e({isActive:t===r}):e})},N0=Co.default.div`
|
|
2015
2022
|
display: flex;
|
|
2016
2023
|
flex-direction: column;
|
|
2017
2024
|
width: 100%;
|
|
2018
2025
|
gap: 8px;
|
|
2019
|
-
`,
|
|
2026
|
+
`,D0=Co.default.div`
|
|
2020
2027
|
display: flex;
|
|
2021
2028
|
justify-content: space-between;
|
|
2022
2029
|
align-items: center;
|
|
2023
2030
|
width: 100%;
|
|
2024
2031
|
cursor: pointer;
|
|
2025
2032
|
padding-bottom: 8px;
|
|
2026
|
-
`,
|
|
2033
|
+
`,U0=Co.default.div`
|
|
2027
2034
|
width: 100%;
|
|
2028
2035
|
|
|
2029
2036
|
&& {
|
|
@@ -2031,13 +2038,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2031
2038
|
border-color: var(--privy-color-foreground-4);
|
|
2032
2039
|
}
|
|
2033
2040
|
padding-bottom: 12px;
|
|
2034
|
-
`,
|
|
2041
|
+
`,F0=Co.default.div`
|
|
2035
2042
|
font-size: 14px;
|
|
2036
2043
|
font-weight: 500;
|
|
2037
2044
|
line-height: 19.6px;
|
|
2038
2045
|
width: 100%;
|
|
2039
2046
|
padding-right: 8px;
|
|
2040
|
-
`,
|
|
2047
|
+
`,B0=Co.default.div`
|
|
2041
2048
|
display: flex;
|
|
2042
2049
|
flex-direction: column;
|
|
2043
2050
|
width: 100%;
|
|
@@ -2049,7 +2056,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2049
2056
|
border-color: var(--privy-color-foreground-4);
|
|
2050
2057
|
border-radius: var(--privy-border-radius-md);
|
|
2051
2058
|
}
|
|
2052
|
-
`,
|
|
2059
|
+
`,H0=Co.default.div`
|
|
2053
2060
|
position: relative;
|
|
2054
2061
|
overflow: hidden;
|
|
2055
2062
|
transition: max-height 25ms ease-out;
|
|
@@ -2061,38 +2068,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2061
2068
|
&[data-open='false'] {
|
|
2062
2069
|
max-height: 0;
|
|
2063
2070
|
}
|
|
2064
|
-
`,
|
|
2071
|
+
`,zy=Co.default.div`
|
|
2065
2072
|
display: flex;
|
|
2066
2073
|
flex-direction: column;
|
|
2067
2074
|
gap: 12px;
|
|
2068
2075
|
flex: 1 1 auto;
|
|
2069
2076
|
min-height: 1px;
|
|
2070
|
-
`,
|
|
2077
|
+
`,G0=Co.default.div`
|
|
2071
2078
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2072
|
-
`;var
|
|
2079
|
+
`;var $y=h(require("styled-components"));var qy=require("react/jsx-runtime"),cd=({walletAddress:e,chainId:t=no})=>(0,qy.jsx)(V0,{href:Ry(t,e),target:"_blank",children:So(e)}),V0=$y.default.a`
|
|
2073
2080
|
&:hover {
|
|
2074
2081
|
text-decoration: underline;
|
|
2075
2082
|
}
|
|
2076
|
-
`;var et=require("react/jsx-runtime"),
|
|
2083
|
+
`;var et=require("react/jsx-runtime"),wi=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return(0,et.jsx)(Fy,{children:(0,et.jsxs)(By,{value:"details",children:[(0,et.jsx)(Hy,{children:(0,et.jsxs)(z0,{children:[(0,et.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,et.jsx)($0,{children:(0,et.jsx)(Iy,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,et.jsxs)(Gy,{children:[(0,et.jsx)(Tl,{label:"From",children:(0,et.jsx)(cd,{walletAddress:e,chainId:r.chainId||no})}),(0,et.jsx)(Tl,{label:"To",children:(0,et.jsx)(cd,{walletAddress:t,chainId:r.chainId||no})}),o&&o.action&&(0,et.jsx)(Tl,{label:"Action",children:o.action}),i&&(0,et.jsx)(Wy,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,et.jsx)(Vy,{children:({isActive:s})=>(0,et.jsx)(Ly,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},z0=dd.default.div`
|
|
2077
2084
|
display: flex;
|
|
2078
2085
|
flex-direction: row;
|
|
2079
2086
|
justify-content: space-between;
|
|
2080
|
-
|
|
2087
|
+
`,$0=dd.default.div`
|
|
2081
2088
|
flex-shrink: 0;
|
|
2082
2089
|
padding-left: 8px;
|
|
2083
|
-
`;var
|
|
2090
|
+
`;var Ci=h(require("styled-components")),Vo=require("react/jsx-runtime"),pd=({description:e,contractInfo:t})=>(0,Vo.jsxs)(q0,{children:[t.imgUrl&&(0,Vo.jsx)(j0,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,Vo.jsx)(K0,{children:(0,Vo.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,Vo.jsx)(Y0,{children:t.name}),(0,Vo.jsx)(J0,{children:e||t.actionText})]}),q0=Ci.default.div`
|
|
2084
2091
|
display: flex;
|
|
2085
2092
|
flex-direction: column;
|
|
2086
2093
|
align-items: center;
|
|
2087
2094
|
margin-bottom: 8px;
|
|
2088
|
-
`,
|
|
2095
|
+
`,j0=Ci.default.img`
|
|
2089
2096
|
&& {
|
|
2090
2097
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2091
2098
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2092
2099
|
border-radius: 16px;
|
|
2093
2100
|
margin-bottom: 12px;
|
|
2094
2101
|
}
|
|
2095
|
-
`,
|
|
2102
|
+
`,K0=Ci.default.div`
|
|
2096
2103
|
font-size: 12px;
|
|
2097
2104
|
line-height: 12px;
|
|
2098
2105
|
padding: 7px;
|
|
@@ -2105,7 +2112,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2105
2112
|
text-decoration: underline;
|
|
2106
2113
|
}
|
|
2107
2114
|
}
|
|
2108
|
-
`,
|
|
2115
|
+
`,Y0=Ci.default.div`
|
|
2109
2116
|
font-size: 18px;
|
|
2110
2117
|
line-height: 18px;
|
|
2111
2118
|
font-weight: 500;
|
|
@@ -2113,7 +2120,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2113
2120
|
white-space: nowrap;
|
|
2114
2121
|
max-width: 275px;
|
|
2115
2122
|
text-overflow: ellipsis;
|
|
2116
|
-
`,
|
|
2123
|
+
`,J0=Ci.default.div`
|
|
2117
2124
|
font-size: 16px;
|
|
2118
2125
|
line-height: 140%;
|
|
2119
2126
|
font-weight: 400;
|
|
@@ -2121,7 +2128,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2121
2128
|
overflow: hidden;
|
|
2122
2129
|
max-width: 275px;
|
|
2123
2130
|
text-overflow: ellipsis;
|
|
2124
|
-
`;var
|
|
2131
|
+
`;var jy=h(require("@heroicons/react/24/outline/WalletIcon")),_l=h(require("styled-components"));var hn=require("react/jsx-runtime"),Ky=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=L(),a=i(t.chainId)||"ETH";return(0,hn.jsxs)(Z0,{children:[(0,hn.jsxs)(Q0,{children:[(0,hn.jsx)(jy.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,hn.jsx)("div",{children:So(e)})]}),(0,hn.jsxs)(X0,{displayBalanceColor:n,hasFunds:o,children:[r?Yr(r,a,6,!0):0," available"]})]})},Z0=_l.default.div`
|
|
2125
2132
|
display: flex;
|
|
2126
2133
|
flex-direction: row;
|
|
2127
2134
|
justify-content: space-between;
|
|
@@ -2134,12 +2141,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2134
2141
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2135
2142
|
border-radius: var(--privy-border-radius-md);
|
|
2136
2143
|
}
|
|
2137
|
-
`,
|
|
2144
|
+
`,Q0=_l.default.div`
|
|
2138
2145
|
display: flex;
|
|
2139
2146
|
flex-direction: row;
|
|
2140
2147
|
align-items: center;
|
|
2141
2148
|
gap: 8px;
|
|
2142
|
-
`,
|
|
2149
|
+
`,X0=_l.default.div`
|
|
2143
2150
|
display: flex;
|
|
2144
2151
|
align-items: center;
|
|
2145
2152
|
justify-content: center;
|
|
@@ -2149,35 +2156,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2149
2156
|
background-color: var(--privy-color-background-2);
|
|
2150
2157
|
padding: 5px 8px;
|
|
2151
2158
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2152
|
-
`;var
|
|
2159
|
+
`;var ma=h(require("styled-components"));var dr=require("react/jsx-runtime"),Jy=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?da(n,o):void 0,a=Yr(n,r);return(0,dr.jsxs)(e2,{children:[i?(0,dr.jsxs)(dr.Fragment,{children:[(0,dr.jsx)(Yy,{children:i}),(0,dr.jsx)(t2,{children:a})]}):(0,dr.jsx)(dr.Fragment,{children:(0,dr.jsx)(Yy,{children:a})}),(0,dr.jsx)(r2,{children:e})]})},e2=ma.default.div`
|
|
2153
2160
|
display: flex;
|
|
2154
2161
|
flex-direction: column;
|
|
2155
2162
|
align-items: center;
|
|
2156
2163
|
margin-bottom: 20px;
|
|
2157
|
-
`,
|
|
2164
|
+
`,Yy=ma.default.h2`
|
|
2158
2165
|
&& {
|
|
2159
2166
|
font-size: 48px;
|
|
2160
2167
|
line-height: 48px;
|
|
2161
2168
|
margin: 8px auto;
|
|
2162
2169
|
}
|
|
2163
|
-
`,
|
|
2170
|
+
`,t2=ma.default.p`
|
|
2164
2171
|
margin-bottom: 12px;
|
|
2165
2172
|
&& {
|
|
2166
2173
|
font-size: 17px;
|
|
2167
2174
|
line-height: 17px;
|
|
2168
2175
|
color: var(--privy-color-foreground-3);
|
|
2169
2176
|
}
|
|
2170
|
-
`,
|
|
2177
|
+
`,r2=ma.default.div`
|
|
2171
2178
|
font-size: 16px;
|
|
2172
2179
|
line-height: 22.4px;
|
|
2173
2180
|
font-weight: 400;
|
|
2174
2181
|
overflow: hidden;
|
|
2175
2182
|
max-width: 275px;
|
|
2176
2183
|
text-overflow: ellipsis;
|
|
2177
|
-
`;var
|
|
2184
|
+
`;var lg=require("@ethersproject/abstract-signer"),i2=require("@ethersproject/providers");var ud=require("@ethersproject/bignumber");var yn=require("@ethersproject/bignumber"),Zy=require("@ethersproject/contracts"),Qy=require("@ethersproject/transactions");var bi=e=>[ns.id,is.id,as.id,ss.id,ls.id,cs.id,ds.id,us.id,ps.id].includes(e),Xy=async(e,t)=>{if(!bi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(e.type===void 0&&(e.type=2),!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=yn.BigNumber.from(r).mul(yn.BigNumber.from(126)).div(yn.BigNumber.from(100)).add(yn.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=fa(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function eg(e,t){if(!e.chainId||e.chainId&&!bi(e.chainId))return yn.BigNumber.from(0);let r=yn.BigNumber.from(0);try{let o=new Zy.Contract(bp,Ep,t),n=tg(e),i=(0,Qy.serialize)(n);r=await o.getL1Fee(i)}catch{}return r}async function rg(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var og=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Ei(e,t){if(!e.gasLimit)throw new De("gasLimit was not successfully set for transaction.");let r=ht(e.gasLimit),o=ud.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=ht(e.maxFeePerGas);else throw new De("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=ht(e.gasPrice);else throw new De("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=ud.BigNumber.from(0);if(e.chainId&&bi(e.chainId))try{i=await eg(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}var Al=require("@ethersproject/bignumber");var md=e=>[ts.id,rs.id,os.id].includes(e),ng=async(e,t)=>{if(!md(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.maxFeePerGas)return e;e.type===void 0&&(e.type=2);try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Al.BigNumber.from(120)).div(Al.BigNumber.from(100));e.maxFeePerGas=fa(o),e.maxPriorityFeePerGas=fa(Al.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var fd=e=>[56,97].includes(e),ig=async(e,t)=>{if(!fd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};var yd=require("@ethersproject/units"),ag=require("ofetch");var gd=e=>[Fi.id,Bi.id].includes(e),hd=e=>({maxPriorityFee:(0,yd.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,yd.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),o2=e=>({safeLow:hd(e.safeLow),standard:hd(e.standard),fast:hd(e.fast)}),n2=async e=>{let t="";switch(e){case Fi.id:t="https://gasstation.polygon.technology/v2";break;case Bi.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return o2(await(0,ag.ofetch)(t))};async function sg(e){if(!gd(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;e.type===void 0&&(e.type=2);try{let{standard:t}=await n2(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function fa(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function tg(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=ht(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=ht(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=ht(e.gasPrice)),e.value!==void 0&&(t.value=ht(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=ht(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=ht(e.maxPriorityFeePerGas)),t}async function Pi(e,t,r){if(t.chainId=Number(t.chainId),cg(t),!t.nonce){let o=new lg.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await rg(t,r)),t.from||(t.from=e),gd(t.chainId)?t=await sg(t):md(t.chainId)?t=await ng(t,r):bi(t.chainId)?t=await Xy(t,r):fd(t.chainId)?t=await ig(t,r):t=await og(t,r),t}async function kl(e,t,r,o,n){o=Object.assign({chainId:no},o),cg(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function Rl(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(ht(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function cg(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!a2(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 a2(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&s2(e);return t||r||o}function s2(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Il(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var Ti=require("react");var Ml=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=L(),[n,i]=(0,Ti.useState)(!0),[a,l]=(0,Ti.useState)(void 0),[s,c]=(0,Ti.useState)(void 0);return(0,Ti.useEffect)(()=>{let u=e.chainId||no,f=o.find(w=>w.id===Number(u));if(!f)throw new ee(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let w=await r(f);w?c(w):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(w){l(w)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};var Wl=require("react"),vd=(0,Wl.createContext)(null);function xi(){let e=(0,Wl.useContext)(vd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var wd=require("react/jsx-runtime"),Cd=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=xi(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=L(),[s,c]=(0,gn.useState)(null),[u,f]=(0,gn.useState)(e),{tokenPrice:g}=Ml(u),w=l(e.chainId)||"ETH",P=(0,gn.useMemo)(()=>r.find(C=>C.walletClientType==="privy"),[r]);return(0,gn.useEffect)(()=>{async function C(){if(!await t()||!o||!P)return u;let b=io(u.chainId,i,n,{appId:a}),x=await Pi(P.address,u,b),{totalGasEstimate:I}=await Ei(x,b);return c(I.toHexString()),x}C().then(S=>{f(S)})},[o]),P?(0,wd.jsx)(l2,{children:(0,wd.jsx)(wi,{from:P.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:g,tokenSymbol:w})}):null},l2=dg.default.div`
|
|
2178
2185
|
width: 100%;
|
|
2179
2186
|
padding: 1rem 0;
|
|
2180
|
-
`;var q=require("react/jsx-runtime"),
|
|
2187
|
+
`;var q=require("react/jsx-runtime"),bd=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=(0,Si.useState)(null),{init:i,cancel:a}=fn();(0,Si.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await i(c)}catch(u){console.error(u)}}let s=()=>{n(null),a(),t()};return!e||!r?null:o?(0,q.jsx)(c2,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(k,{onClose:s},"header"),(0,q.jsx)(ut,{children:(0,q.jsx)(Tt,{children:(0,q.jsx)(hg.default,{})})}),(0,q.jsx)(Le,{children:"Verify your identity"}),(0,q.jsx)(Re,{children:"Choose a verification method"}),(0,q.jsxs)(Ms,{children:[r.mfaMethods.includes("totp")&&(0,q.jsxs)(Ue,{onClick:()=>l("totp"),children:[(0,q.jsx)(pg.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,q.jsxs)(Ue,{onClick:()=>l("sms"),children:[(0,q.jsx)(ug.default,{}),"SMS"]},"sms")]}),(0,q.jsx)(se,{})]})},c2=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=L(),[i,a]=(0,Si.useState)(!1),[l,s]=(0,Si.useState)(!1),{submit:c}=fn();async function u(f){try{if(!f)return;await c(e,f),s(!0),a(!1),t()}catch(g){throw Gs(g)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):an(g)?(a(!1),new Error("The code you entered is not valid")):nn(g)?(a(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(a(!1),new Error("Unknown error"))}}switch(e){case"sms":return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(k,{onClose:t},"header"),(0,q.jsx)(ut,{children:(0,q.jsx)(Tt,{children:(0,q.jsx)(fg.default,{})})}),(0,q.jsx)(Le,{children:"Enter verification code"}),(0,q.jsxs)(Wo,{children:[(0,q.jsx)(yi,{success:l,disabled:i,onChange:u}),(0,q.jsxs)(Re,{children:["To continue, please enter the 6-digit code sent to your ",(0,q.jsx)("strong",{children:"mobile device"})]}),n&&(0,q.jsx)(Cd,{pendingTransaction:n})]}),r&&(0,q.jsx)(Tc,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,q.jsx)(Cr,{onClick:t,children:"Not now"}),(0,q.jsx)(se,{})]});case"totp":return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(k,{onClose:t},"header"),(0,q.jsx)(ut,{children:(0,q.jsx)(Tt,{children:(0,q.jsx)(mg.default,{})})}),(0,q.jsx)(Le,{children:"Enter verification code"}),(0,q.jsxs)(Wo,{children:[(0,q.jsx)(yi,{success:l,disabled:i,onChange:u}),(0,q.jsxs)(Re,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,q.jsx)("strong",{children:"authenticator app"})]}),n&&(0,q.jsx)(Cd,{pendingTransaction:n})]}),r&&(0,q.jsx)(Tc,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,q.jsx)(Cr,{onClick:t,children:"Not now"}),(0,q.jsx)(se,{})]});default:return null}};var _i=require("react"),Ed=h(require("styled-components"));var tt=require("react/jsx-runtime"),yg={google:{name:"Google",component:pl},discord:{name:"Discord",component:cl},github:{name:"Github",component:dl},linkedin:{name:"LinkedIn",component:ul},twitter:{name:"Twitter",component:hl},spotify:{name:"Spotify",component:ml},tiktok:{name:"Tiktok",component:fl},apple:{name:"Apple",component:ll}},gg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:g,closePrivyModal:w,createAnalyticsEvent:P}=L(),[C,S]=(0,_i.useState)(!1),[b,x]=(0,_i.useState)(void 0),I=s()?.provider||"google",M=yg[I].name,A=yg[I].component,B=n?.render.inDialog?wt:0;(0,_i.useEffect)(()=>{u(I).then(()=>{S(!0)}).catch(R=>{if(R?.privyErrorCode==="allowlist_rejected"){x(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:K,detail:O}=Hp(R,I);x({retryable:K,detail:O,message:"Authentication failed"})}).finally(()=>{Ni(),g()})},[M,I]),(0,_i.useEffect)(()=>{if(r&&e&&C&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let K=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},B);return()=>clearTimeout(K)}if(Qt(o,n?.embeddedWallets?.createOnLogin)){let K=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:O=>{console.error(O),P("embedded_wallet_creation_failure_logout",{error:O,provider:I,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},B);return()=>clearTimeout(K)}else{let K=setTimeout(()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0}),B);return f(),()=>clearTimeout(K)}}},[r,e,C,o]);let F=C?`Successfully connected with ${M}`:b?b.message:`Verifying connection to ${M}`,H="";return C?H="You\u2019re good to go!":b?H=b.detail:H="Just a few moments more",(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(k,{}),(0,tt.jsx)(oe,{}),(0,tt.jsxs)(d2,{children:[(0,tt.jsx)(p2,{children:(0,tt.jsxs)("div",{children:[(0,tt.jsx)(lo,{success:C,fail:!!b}),(0,tt.jsx)(A,{style:{width:"38px",height:"38px"}})]})}),(0,tt.jsxs)(Ht,{children:[(0,tt.jsx)("h3",{children:F}),(0,tt.jsx)("p",{children:H})]}),b&&b?.retryable?(0,tt.jsx)(As,{onClick:()=>{Ni(),c(I),x(void 0)},disabled:!C&&!b?.retryable,children:"Retry"}):null]}),(0,tt.jsx)(ie,{}),(0,tt.jsx)(se,{})]})},d2=Ed.default.div`
|
|
2181
2188
|
display: flex;
|
|
2182
2189
|
flex-direction: column;
|
|
2183
2190
|
align-items: center;
|
|
@@ -2185,7 +2192,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2185
2192
|
margin-left: 27px;
|
|
2186
2193
|
margin-right: 27px;
|
|
2187
2194
|
gap: 24px;
|
|
2188
|
-
`,
|
|
2195
|
+
`,p2=Ed.default.div`
|
|
2189
2196
|
display: flex;
|
|
2190
2197
|
flex-direction: column;
|
|
2191
2198
|
justify-content: center;
|
|
@@ -2208,55 +2215,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2208
2215
|
left: -19px;
|
|
2209
2216
|
top: -19px;
|
|
2210
2217
|
}
|
|
2211
|
-
`;var
|
|
2218
|
+
`;var ha=require("react"),Cg=h(require("styled-components"));var vg=require("react-device-detect");var wg=(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(!xo()&&vg.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var St=require("react/jsx-runtime"),bg=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=(0,ha.useState)(""),[i,a]=(0,ha.useState)(!1);(0,ha.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=wg(o,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,St.jsxs)(St.Fragment,{children:[(0,St.jsx)(k,{},"header"),(0,St.jsx)(oe,{}),(0,St.jsx)(Gr,{title:s.title,description:s.description}),(0,St.jsxs)(ar,{children:[(0,St.jsx)(u2,{children:(0,St.jsx)(Ur,{style:{width:"72px",height:"72px"}})}),(0,St.jsx)(_s,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,St.jsx)("p",{children:s.footnote}):null]}),(0,St.jsx)(ie,{}),(0,St.jsx)($,{protectedByPrivy:!0})]})},u2=(0,Cg.default)(sr)`
|
|
2212
2219
|
margin: 16px auto;
|
|
2213
|
-
`;var
|
|
2220
|
+
`;var Pd=require("@ethersproject/bignumber"),Ke=require("react"),vn=h(require("styled-components"));function Eg(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var Ll=require("@ethersproject/bignumber"),Pg=h(require("styled-components"));var Qr=require("react/jsx-runtime"),m2=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Ll.BigNumber.from(e.gasUsed),o=Ll.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Ll.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},Tg=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>(0,Qr.jsxs)(Qr.Fragment,{children:[(0,Qr.jsx)(k,{onClose:o}),(0,Qr.jsx)(Gi,{title:"Transaction complete!",description:"You're all set."}),(0,Qr.jsx)(wi,{tokenPrice:n,from:t.from,to:t.to,gas:m2(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),(0,Qr.jsx)(f2,{loading:!1,onClick:o,children:"All Done"}),(0,Qr.jsx)(se,{})]}),f2=(0,Pg.default)(U)`
|
|
2214
2221
|
&& {
|
|
2215
2222
|
margin-top: 24px;
|
|
2216
2223
|
}
|
|
2217
2224
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2218
|
-
`;var ge=require("react/jsx-runtime");var
|
|
2225
|
+
`;var ge=require("react/jsx-runtime");var h2=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,ge.jsx)(pd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,ge.jsx)(pd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,ge.jsx)(ge.Fragment,{children:(0,ge.jsx)(Jy,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},Sg=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=xi(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=L(),{app:u,navigate:f,data:g,onUserCloseViaDialogOrKeybindRef:w,setModalData:P}=_(),{transactionRequest:C,onSuccess:S,onFailure:b,uiOptions:x,fundWalletConfig:I}=g.sendTransaction,[M,A]=(0,Ke.useState)(null),[B,F]=(0,Ke.useState)(null),[H,R]=(0,Ke.useState)(""),[K,O]=(0,Ke.useState)(),[Q,ce]=(0,Ke.useState)(!1),ne=()=>{R(""),O(void 0)},re=(Ut,st,Or)=>{R(Ut),O(new De(new Xt(st??Ut,Or??dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Y,Ne]=(0,Ke.useState)(!1),[Ie,to]=(0,Ke.useState)(!0),[Nt,ze]=(0,Ke.useState)(null),[xe,Dt]=(0,Ke.useState)(C),{tokenPrice:pr,isTokenPriceLoading:Eo}=Ml(xe),Lr=s(C.chainId)||"ETH",[W,X]=(0,Ke.useState)(null),[te,ki]=(0,Ke.useState)(null),[J,rt]=(0,Ke.useState)(!0);(0,Ke.useEffect)(()=>{e||(f("LANDING"),b(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let _t=(0,Ke.useMemo)(()=>r.find(Ut=>Ut.walletClientType==="privy"),[r]),$o=async()=>{if(!_t)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ut,externalTransactionId:st}=await i(_t.address,{config:I?.config||{}});P({fiatOnRampPrompt:{signedUrl:Ut},fiatOnRampStatus:{externalTransactionId:st}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},ur=(0,Ke.useMemo)(()=>io(xe.chainId,l,a,{appId:c}),[xe.chainId,a]);(0,Ke.useEffect)(()=>{async function Ut(){let st=xe;if(!await t()||!o||!_t)return;try{st=await Pi(_t.address,xe,ur),Dt(st)}catch(ro){re("There was an error preparing your transaction. Please try again.",ro.reason)}let Po=Pd.BigNumber.from(0),Ca=Pd.BigNumber.from(0);try{({totalGasEstimate:Po,l1ExecutionFeeEstimate:Ca}=await Ei(st,ur)),X(Po.toHexString()),ki(Ca.toHexString())}catch{X(null)}try{let{balance:ro,hasSufficientFunds:Hl}=await Rl(_t.address,st,Po,ur);ze(ro.toHexString()),Hl||(to(!1),re("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ce(!0))}catch(ro){console.warn(`Failed to fetch wallet balance with error: ${ro}`)}rt(!1)}Ut()},[o]);let qo=Eg(xe),Bl=qo==="SEND"?`Send ${Lr}`:"Review transaction",ot={modalTitle:x.header||x.modalTitle||Bl,buttonText:x.buttonText||"Submit"},jo=()=>{Y||(B?S(B):b(K||new De(new Xt("The user rejected the request",dt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w.current=jo,pr===void 0&&Eo||J?(0,ge.jsxs)(ge.Fragment,{children:[x.transactionInfo?.contractInfo?.imgUrl&&(0,ge.jsx)(es,{src:x.transactionInfo?.contractInfo?.imgUrl}),(0,ge.jsx)(k,{title:ot.modalTitle,onClose:jo}),(0,ge.jsx)(xg,{children:(0,ge.jsx)(Zn,{})})]}):M!==null?(0,ge.jsx)(Tg,{txn:xe,onClose:jo,receipt:M,transactionInfo:x.transactionInfo,tokenPrice:pr,tokenSymbol:Lr,l1GasEstimate:te}):(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(k,{title:ot.modalTitle,onClose:jo}),(0,ge.jsxs)(xg,{children:[(0,ge.jsxs)(w2,{children:[(0,ge.jsx)(h2,{txn:xe,txnFamily:qo,uiOptions:x,tokenSymbol:Lr,tokenPrice:pr}),_t?(0,ge.jsx)(wi,{from:_t.address,to:xe.to,txn:xe,transactionInfo:x.transactionInfo,gas:W||void 0,tokenPrice:pr,tokenSymbol:Lr}):null]}),(0,ge.jsxs)(C2,{children:[(0,ge.jsx)(y2,{children:H}),(0,ge.jsx)(Ky,{txn:xe,address:_t?.address??"",hasFunds:Ie,balance:Nt}),(0,ge.jsxs)(g2,{children:[Q&&(0,ge.jsx)(U,{onClick:$o,children:"Add Funds"}),(0,ge.jsx)(v2,{disabled:Y||!Ie,loading:!o||Y,loadingText:Y?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{Ne(!0);let Ut=await t();if(Ut&&!Y&&_t)try{let st=await kl(Ut,_t.address,o,xe,ur);F(st);let Or=await st.wait();A(Il(Or)),ne()}catch(st){let Or="There was an error processing your transaction. Please contact support.";console.warn({transaction:xe,error:st}),re(Or,st.reason)}finally{Ne(!1)}},children:ot.buttonText})]})]})]})]})},xg=vn.default.div`
|
|
2219
2226
|
display: flex;
|
|
2220
2227
|
flex-direction: column;
|
|
2221
2228
|
justify-content: space-between;
|
|
2222
2229
|
flex-grow: 1;
|
|
2223
2230
|
padding-bottom: 16px;
|
|
2224
|
-
`,
|
|
2231
|
+
`,y2=vn.default.div`
|
|
2225
2232
|
font-size: 13px;
|
|
2226
2233
|
color: var(--privy-color-error);
|
|
2227
2234
|
width: 100%;
|
|
2228
2235
|
margin-top: 16px;
|
|
2229
|
-
`,
|
|
2236
|
+
`,g2=vn.default.div`
|
|
2230
2237
|
display: flex;
|
|
2231
2238
|
direction: row;
|
|
2232
2239
|
justify-content: space-between;
|
|
2233
2240
|
align-items: center;
|
|
2234
2241
|
gap: 8px;
|
|
2235
|
-
`,
|
|
2242
|
+
`,v2=(0,vn.default)(U)`
|
|
2236
2243
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2237
|
-
`,
|
|
2244
|
+
`,w2=vn.default.div`
|
|
2238
2245
|
height: 100%;
|
|
2239
2246
|
display: flex;
|
|
2240
2247
|
flex-direction: column;
|
|
2241
2248
|
justify-content: space-evenly;
|
|
2242
2249
|
flex-grow: 1;
|
|
2243
|
-
`,
|
|
2250
|
+
`,C2=vn.default.div`
|
|
2244
2251
|
display: flex;
|
|
2245
2252
|
flex-direction: column;
|
|
2246
2253
|
gap: 8px;
|
|
2247
|
-
`;var
|
|
2254
|
+
`;var _g=require("@ethersproject/bytes"),Ag=require("@ethersproject/strings"),zo=require("react"),Ir=h(require("styled-components"));var me=require("react/jsx-runtime"),b2=e=>{if(!(0,_g.isHexString)(e))return e;try{return(0,Ag.toUtf8String)(e)}catch{return e}},E2=e=>JSON.stringify(e,null,2),P2=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,me.jsx)(A2,{children:Object.entries(r).map(([o,n])=>(0,me.jsxs)("li",{children:[(0,me.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,me.jsx)("span",{children:String(r)});return(0,me.jsx)("div",{children:t(e)})},T2=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Rg,{children:(0,me.jsx)(P2,{data:o})}),(0,me.jsx)(ai,{text:E2(e.typedData),itemName:"full payload to clipboard"})," "]})},kg=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=L(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=(0,zo.useState)(!0),[s,c]=(0,zo.useState)(""),[u,f]=(0,zo.useState)(),[g,w]=(0,zo.useState)(null),P=g!==null;(0,zo.useEffect)(()=>{e||o("LANDING")},[e]),(0,zo.useEffect)(()=>{t(Tn).then(F=>{l(!1),F||(c("An error has occurred, please try again."),f(new De(new Xt(s,dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:C,data:S,confirmAndSign:b,onSuccess:x,onFailure:I,uiOptions:M}=n.signMessage,A={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=F=>{F?x(F):I(u||new De(new Xt("The user rejected the request.",dt.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),w(null),c(""),f(void 0)};return i.current=()=>{B(g)},(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(k,{onClose:()=>B(g)}),(0,me.jsx)(oe,{}),(0,me.jsxs)(x2,{children:[(0,me.jsx)(S2,{children:A.title}),(0,me.jsx)(_2,{children:A.description}),C==="personal_sign"&&(0,me.jsx)(Rg,{children:b2(S)}),C==="eth_signTypedData_v4"&&(0,me.jsx)(T2,{typedData:S}),(0,me.jsx)(k2,{fail:!0,children:s}),(0,me.jsx)(I2,{success:P,loading:a,disabled:P,onClick:async()=>{try{let F=await b();w(F),c(""),setTimeout(()=>{B(F)},wt)}catch{c("An error has occurred, please try again."),f(new De(new Xt(s,dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:P?(0,me.jsxs)(R2,{children:[(0,me.jsx)(js,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,me.jsx)("span",{children:"Success"})]}):A.buttonText})]}),(0,me.jsx)(ie,{}),(0,me.jsx)($,{protectedByPrivy:!0})]})},x2=Ir.default.div`
|
|
2248
2255
|
display: flex;
|
|
2249
2256
|
flex-direction: column;
|
|
2250
2257
|
align-items: center;
|
|
2251
2258
|
justify-content: center;
|
|
2252
|
-
`,
|
|
2259
|
+
`,S2=Ir.default.span`
|
|
2253
2260
|
color: var(--privy-color-foreground);
|
|
2254
2261
|
text-align: center;
|
|
2255
2262
|
font-size: 1.125rem;
|
|
2256
2263
|
font-weight: 500;
|
|
2257
2264
|
line-height: 1.25rem; /* 111.111% */
|
|
2258
2265
|
text-align: center;
|
|
2259
|
-
`,
|
|
2266
|
+
`,_2=Ir.default.span`
|
|
2260
2267
|
margin-top: 4px;
|
|
2261
2268
|
color: var(--privy-color-foreground);
|
|
2262
2269
|
text-align: center;
|
|
@@ -2266,7 +2273,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2266
2273
|
font-weight: 400;
|
|
2267
2274
|
line-height: 20px; /* 142.857% */
|
|
2268
2275
|
letter-spacing: -0.008px;
|
|
2269
|
-
`,
|
|
2276
|
+
`,Rg=Ir.default.div`
|
|
2270
2277
|
margin-top: 1.5rem;
|
|
2271
2278
|
background-color: var(--privy-color-background-2);
|
|
2272
2279
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2285,7 +2292,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2285
2292
|
display: none; /* Safari and Chrome */
|
|
2286
2293
|
}
|
|
2287
2294
|
}
|
|
2288
|
-
`,
|
|
2295
|
+
`,A2=Ir.default.ul`
|
|
2289
2296
|
margin-left: 12px !important;
|
|
2290
2297
|
white-space: nowrap;
|
|
2291
2298
|
|
|
@@ -2297,7 +2304,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2297
2304
|
font-weight: 500 !important;
|
|
2298
2305
|
}
|
|
2299
2306
|
}
|
|
2300
|
-
`,
|
|
2307
|
+
`,k2=Ir.default.div`
|
|
2301
2308
|
line-height: 20px;
|
|
2302
2309
|
height: 20px;
|
|
2303
2310
|
font-size: 13px;
|
|
@@ -2307,11 +2314,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2307
2314
|
width: 100%;
|
|
2308
2315
|
margin-top: 16px;
|
|
2309
2316
|
margin-bottom: 4px;
|
|
2310
|
-
`,
|
|
2317
|
+
`,R2=Ir.default.span`
|
|
2311
2318
|
display: flex;
|
|
2312
2319
|
align-items: center;
|
|
2313
2320
|
gap: 8px;
|
|
2314
|
-
`,
|
|
2321
|
+
`,I2=(0,Ir.default)(U)`
|
|
2315
2322
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2316
2323
|
|
|
2317
2324
|
${e=>e.success&&Ir.css`
|
|
@@ -2320,9 +2327,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2320
2327
|
color: #ffffff;
|
|
2321
2328
|
}
|
|
2322
2329
|
`}
|
|
2323
|
-
`;var
|
|
2330
|
+
`;var Wg=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var Ig=h(require("@heroicons/react/24/outline/EnvelopeIcon")),ya=require("react"),Td=h(require("styled-components"));var Mr=require("react/jsx-runtime"),Mg=(0,ya.forwardRef)((e,t)=>{let[r,o]=(0,ya.useState)(""),[n,i]=(0,ya.useState)(!1),{authenticated:a,user:l}=G(),{initUpdateEmail:s}=L(),{navigate:c,setModalData:u,currentScreen:f}=_(),{enabled:g,token:w}=Ee(),P=Na(r),C=n,S=n||!P,b=async I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,I),c("AWAITING_PASSWORDLESS_CODE")}catch(M){u({errorModalData:{error:M,previousScreen:f||"LANDING"}})}i(!1)},x=()=>{g&&!w&&!a?(u({captchaModalData:{callback:I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,I)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):b(w)};return(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)(M2,{children:(0,Mr.jsxs)(W2,{children:[(0,Mr.jsx)(Ig.default,{}),(0,Mr.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:I=>o(I.target.value),onKeyUp:I=>{I.key==="Enter"&&x()},value:r,autoComplete:"email"}),e.stacked?null:(0,Mr.jsx)(Hn,{isSubmitting:C,onClick:x,disabled:S,children:"Submit"})]})}),e.stacked?(0,Mr.jsx)(U,{loadingText:null,loading:C,disabled:S,onClick:x,children:"Submit"}):null]})}),M2=Td.default.div`
|
|
2324
2331
|
width: 100%;
|
|
2325
|
-
`,
|
|
2332
|
+
`,W2=Td.default.label`
|
|
2326
2333
|
display: block;
|
|
2327
2334
|
position: relative;
|
|
2328
2335
|
width: 100%;
|
|
@@ -2380,7 +2387,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2380
2387
|
&& > input::placeholder {
|
|
2381
2388
|
color: var(--privy-color-foreground-3);
|
|
2382
2389
|
}
|
|
2383
|
-
`;var
|
|
2390
|
+
`;var Jt=require("react/jsx-runtime"),Lg=()=>(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(k,{},"header"),(0,Jt.jsx)(oe,{}),(0,Jt.jsx)(Fe,{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,Jt.jsx)(Wg.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Jt.jsx)(ar,{children:(0,Jt.jsx)(Mg,{stacked:!0})}),(0,Jt.jsx)(ie,{}),(0,Jt.jsx)($,{protectedByPrivy:!0})]});var Ol=h(require("styled-components"));var L2=`
|
|
2384
2391
|
*,
|
|
2385
2392
|
::before,
|
|
2386
2393
|
::after {
|
|
@@ -2610,7 +2617,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2610
2617
|
[hidden] {
|
|
2611
2618
|
display: none;
|
|
2612
2619
|
}
|
|
2613
|
-
`,
|
|
2620
|
+
`,Og=L2;var Ng=Ol.createGlobalStyle`
|
|
2614
2621
|
:root {
|
|
2615
2622
|
// Borders
|
|
2616
2623
|
--privy-border-radius-sm: 6px;
|
|
@@ -2642,10 +2649,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2642
2649
|
--privy-height-modal-full: 620px;
|
|
2643
2650
|
--privy-height-modal-compact: 480px;
|
|
2644
2651
|
};
|
|
2645
|
-
`,
|
|
2652
|
+
`,Dg=Ol.default.div`
|
|
2646
2653
|
// css normalize only the privy application to avoid conflicts
|
|
2647
2654
|
// with consuming application
|
|
2648
|
-
${
|
|
2655
|
+
${Og}
|
|
2649
2656
|
|
|
2650
2657
|
// Privy styles
|
|
2651
2658
|
color: var(--privy-color-foreground-2);
|
|
@@ -2704,4 +2711,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2704
2711
|
opacity: 1;
|
|
2705
2712
|
}
|
|
2706
2713
|
}
|
|
2707
|
-
`;var Ge=require("react/jsx-runtime"),L2={["LANDING"]:ny,["CONNECT_OR_CREATE"]:oy,["AWAITING_PASSWORDLESS_CODE"]:lm,["AWAITING_CONNECTION"]:Lm,["AWAITING_CONNECT_ONLY_CONNECTION"]:Dm,["AWAITING_FARCASTER_CONNECTION"]:ch,["PHANTOM_INTERSTITIAL_SCREEN"]:Cg,["LOGIN_FAILED_SCREEN"]:py,["AWAITING_OAUTH_SCREEN"]:yg,["ALLOWLIST_REJECTION_SCREEN"]:Zu,["INSTALL_PHANTOM_SCREEN"]:Ih,["LINK_EMAIL_SCREEN"]:ay,["LINK_PHONE_SCREEN"]:ly,["LINK_WALLET_SCREEN"]:cy,["UPDATE_EMAIL_SCREEN"]:Wg,["CONNECT_ONLY_LANDING_SCREEN"]:Im,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:xm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Df,["EMBEDDED_WALLET_CREATED_SCREEN"]:qm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Vm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:zf,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Zm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Ag,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:xg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:vh,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ph,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Gf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Uf,["MFA_ENROLLMENT_FLOW_SCREEN"]:Ay,["CAPTCHA_SCREEN"]:ym,["ERROR_SCREEN"]:jf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Sh,["AFFIRMATIVE_CONSENT_SCREEN"]:Yu},O2=["LANDING","AWAITING_CONNECTION"],N2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=L(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=Ee(),f=(0,Co.useRef)(null),g=Ou(f),C=o&&a&&O2.includes(a)&&!n&&l==="ready";if((0,Co.useEffect)(()=>{C&&s()},[C]),(0,Co.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,Ge.jsxs)(fi,{children:[(0,Ge.jsx)(k,{}),(0,Ge.jsx)(re,{}),(0,Ge.jsx)(my,{children:(0,Ge.jsx)(rr,{})}),(0,Ge.jsx)(ne,{}),(0,Ge.jsx)(ae,{})]});if(!a&&e)return(0,Ge.jsx)(fi,{style:{height:g},children:(0,Ge.jsx)("div",{ref:f,children:(0,Ge.jsx)(Cd,{open:e,onClose:t})})});if(!a)return null;let P=L2[a];return(0,Ge.jsx)(fi,{style:{height:g},children:(0,Ge.jsxs)("div",{ref:f,children:[(0,Ge.jsx)(co,{if:!!e,children:(0,Ge.jsx)(P,{})}),(0,Ge.jsx)(co,{if:!e,children:(0,Ge.jsx)(Cd,{open:e,onClose:t})})]})})},D2=()=>{let{closePrivyModal:e}=L(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,Co.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Ug=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=D2(),[o,n]=(0,Co.useState)(!1);Es({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,Ge.jsx)(Ng,{children:(0,Ge.jsx)(N2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,Ge.jsx)(uy,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Dg.default.createPortal(l,s)}return l};var ya=require("react");var Wl=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function wn(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new qe("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((g,C)=>{r.current={resolve:g,reject:C};let P=1e3*60*5;setTimeout(()=>{let w=new qe("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(w),C(w)},P)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let u=new qe("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var Bg=require("react/jsx-runtime"),U2=function(e){return()=>`id-${e++}`}(0);function F2(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Xr(e){return e.error!==void 0}var Wr=new Wl,Td=new Map,B2=(e,t)=>typeof t=="bigint"?t.toString():t,H2=(e,t)=>`${e}${JSON.stringify(t,B2)}`;function eo(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=H2(e,t);if(e==="privy:wallet:create"){let l=Td.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=U2();Wr.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{Td.delete(i)});return Td.set(i,a),a}function G2(e){switch(e.event){case"privy:iframe:ready":let t=Wr.dequeue(e.event,e.id);return Xr(e)?t.reject(new qe(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Wr.dequeue(e.event,e.id);return Xr(e)?r.reject(new qe(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Wr.dequeue(e.event,e.id);return Xr(e)?o.reject(new qe(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Wr.dequeue(e.event,e.id);return Xr(e)?n.reject(new qe(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Wr.dequeue(e.event,e.id);return Xr(e)?i.reject(new qe(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Wr.dequeue(e.event,e.id);return Xr(e)?a.reject(new qe(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Wr.dequeue(e.event,e.id);return Xr(e)?l.reject(new qe(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Fg(e){let t=(0,ya.useRef)(null),r=(0,ya.useRef)(e.mfaMethods),o=Uu();return(0,ya.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,Bg.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>{let i=t.current;if(!i)return;function a(f){f&&f.origin===e.origin&&F2(f.data)&&G2(f.data)}let l={create(f){return eo("privy:wallet:create",f,i,e.origin)},connect(f){return eo("privy:wallet:connect",f,i,e.origin)},recover(f){return wn(g=>eo("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return wn(g=>eo("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return wn(g=>eo("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return wn(g=>eo("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return wn(g=>eo("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return eo("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return wn(g=>eo("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",a);let s=()=>e.onLoad(l),c=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},u=new AbortController;return xp(()=>eo("privy:iframe:ready",{},i,e.origin),{abortSignal:u.signal}).then(s,c),()=>{window.removeEventListener("message",a),u.abort()}},src:Na(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Ll(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Ol=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set when initialzing authentication.");try{await this.api.post(np,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Mfa flow has no API instance");if(!this.meta.smsCode)throw new T("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ip,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Bt(t)}catch(t){throw fe(t)}}};var Ot=require("react/jsx-runtime"),_i;function V2(e){return typeof e=="string"&&e.length===25}function Ye(){if(!_i){let e=he.get(Ko);return Promise.resolve(e||null)}return _i.getAccessToken()}var Gg,$p=(e,t)=>Gg(e,t),Vg,qp=(e,t)=>Vg(e,t),zg,jp=(e,t)=>zg(e,t),$g,Kp=()=>$g(),z2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;he.put(ki,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},qg=({config:e,...t})=>{if(!V2(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");_i||(_i=new Fn({appId:t.appId,apiUrl:t.apiUrl||Ra}));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,Ot.jsx)(Cu,{client:_i,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Ot.jsx)($2,{...t,config:r,client:_i})})},$2=e=>{let t=e.client,[r,o]=(0,J.useState)(!1),[n,i]=(0,J.useState)(!1),[a,l]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[u,f]=(0,J.useState)([]),g=(0,J.useRef)(u),[C,P]=(0,J.useState)(!1),[w,S]=(0,J.useState)(null),[b,x]=(0,J.useState)(!1),[I,M]=(0,J.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[A,B]=(0,J.useState)(null),[F,H]=(0,J.useState)(null),[R,j]=(0,J.useState)(null),O=ps(),Z=us(),[ce,oe]=(0,J.useState)(!0),[te,K]=(0,J.useState)({}),[Oe,Re]=(0,J.useState)(null),[to,Nt]=(0,J.useState)(null),[ze,xe]=(0,J.useState)(!1),[Dt,pr]=(0,J.useState)(!1),bo=(0,J.useRef)(null),Lr=(0,J.useRef)(null),W=(0,J.useRef)(Nu);t.onStoreToken=d=>{d&&D(W,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{D(W,"accessToken","onAccessTokenRemoved")};let Q=(0,J.useRef)(null),ee=(0,J.useRef)(null),Ai=(0,J.useCallback)(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(v=>v.type==="wallet"&&v.walletClientType==="privy")?p&&d?.some(v=>v?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),Y=d=>{S(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},rt=d=>{O.embeddedWallets.createOnLogin!=="off"&&oe(!0),Y(d)};(0,J.useEffect)(()=>{if(!R||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(R,p,O.defaultChain,e.appId)}},[R,s]),(0,J.useEffect)(()=>{R&&to?.(R)},[R]),(0,J.useEffect)(()=>{(async()=>{if(!O.customAuth?.enabled)return;oe(!0);let{getCustomAccessToken:p,isLoading:y}=O.customAuth;if(!(!n||y))try{let v=await p();if(!v){await Cn.logout();return}if(a)return;t.startAuthFlow(new En(v));let{user:N,isNewUser:V}=await t.authenticate();N||await Cn.logout(),c(N||null),P(V||!1),l(!0),pr(!0)}catch(v){console.warn(v),a&&await Cn.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,a]),(0,J.useEffect)(()=>{Dt&&R&&s&&Zt(s,e.config?.embeddedWallets?.createOnLogin)&&(pr(!1),ro(s,Tn).catch(console.error))},[Dt&&R&&s]),(0,J.useEffect)(()=>{async function d(){let p=_t();z2();let y=(0,Hg.createStore)();B(y),t.initializeConnectorManager(O.walletConnectCloudProjectId,O.rpcConfig,O.chains,O.defaultChain,y,O.appearance.walletList,O.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{Dl()});let v=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!v),v&&D(W,"login","onComplete",v,!1,!0,null),c(v)),p||Se.setReadyToTrue(),p&&(v?ee.current="link":ee.current="login")}!n&&Z&&d()},[t,Oe,n,Z]);let _t=()=>{let d=Li();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Dr(d)),rt("AWAITING_OAUTH_SCREEN"),!0)},$o=async(d,p,y,v)=>{let N=await t.connectors?.createWalletConnector(d,p)||null;ur(N,p,y,v)};async function ur(d,p,y,v){if(d)M({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new X("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,y);d instanceof Br&&p&&await d.resetConnection(p),M({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ur(d,p,y,v)});try{let N=await d.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(V=>V.id===Number(N?.chainId))&&!(N?.connectorType==="wallet_connect_v2"&&N?.walletClientType==="metamask")){M(V=>({...V,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await N?.switchChain(O.defaultChain.id),N&&(N.chainId=xn(Qo(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(V=>({...V,status:"connected",connectedWallet:N,connectError:null,connectRetry:E})),N&&!ee.current&&D(W,"connectWallet","onSuccess",N),v?.(N,y)}catch(N){return N instanceof lt?(console.warn(N.cause?N.cause:N.message),ee.current||D(W,"connectWallet","onError",N.privyErrorCode||"generic_connect_wallet_error")):(console.warn(N),ee.current||D(W,"connectWallet","onError","unknown_connect_wallet_error")),M(V=>({...V,status:"disconnected",connectedWallet:null,connectError:N})),v?.(null,y)}}let qo=async(d,p)=>{if(d===null)return;let y=new Xo(d,p);t.startAuthFlow(y)},Dl=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),y=d.get("privy_wallet_client");if(!p||!y)return;if(y==="phantom"&&!To()&&rt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");Y("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),$o(p,y,void 0,qo)};(0,J.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let ot=()=>{if(!a)throw D(W,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},jo=()=>{ot(),Q.current="siwe",ee.current="link",Y("LINK_WALLET_SCREEN")},Ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},st=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(M(y=>({...y,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),O.captchaEnabled&&!a){let y={callback:v=>qo(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};K({captchaModalData:y}),rt("CAPTCHA_SCREEN")}else await qo(d),rt("AWAITING_CONNECTION")},Or=async(d,p)=>{if(!O.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:y,externalTransactionId:v}=await yh(t,d,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:y,externalTransactionId:v}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Eo=()=>{f(d=>{let p=t.connectors?.wallets.map(y=>({...y,linked:Ut(y),loginOrLink:async()=>{if(!await y.isConnected())throw new T("Wallet is not connected");if(y.connectorType==="embedded"&&y.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");st(y)},fund:async v=>{let{signedUrl:N,externalTransactionId:V}=await Or(y.address,v);K({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:V}}),Y("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new T("User is not authenticated.");if(y.connectorType==="embedded"&&y.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(y.address);c(v)}}))||[];return xe(Ai(p)),za(d,p)?d:p})};(0,J.useEffect)(()=>{Eo()},[s?.linkedAccounts,a,n]),(0,J.useEffect)(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Eo(),t.connectors.on("walletsUpdated",Eo)}},[n]);let wa=()=>{Y(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,J.useEffect)(()=>{if(!u[0])return;let d=u[0],p=g.current.find(v=>v.address===d.address),y;if(d.walletClientType==="privy"?y=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):y=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&y){let v=Object.assign({},s);v.wallet=y&&{address:y.address,chainType:y.chainType,chainId:y.chainId,walletClient:y.walletClient,walletClientType:y.walletClientType,connectorType:y.connectorType},c(v)}g.current=u},[u]);let ro=async(d,p)=>{if(Ie(d))throw D(W,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,N]=await Promise.all([Se.initializeWalletProxy(p),Ye()]);if(!v&&e.config?.customAuth?.enabled)throw D(W,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((V,_e)=>{oe(!0),K({createWallet:{onSuccess:At=>{D(W,"createWallet","onSuccess",At),V(At)},onFailure:At=>{D(W,"createWallet","onError","unknown_embedded_wallet_error"),_e(At)},callAuthOnSuccessOnClose:!1}}),Y("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:N});let V=await Se.refreshUser(),_e=Ie(V);if(!_e)throw D(W,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(W,"createWallet","onSuccess",_e),_e}},Ul=d=>{if(!O.chains.map(p=>p.id).includes(d))throw new X(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},_d=(d,p,y)=>new Promise(async(v,N)=>{if(!a||!s){D(W,"sendTransaction","onError","must_be_authenticated"),N(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=Ie(s);if(!V){D(W,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have a Privy wallet before signing"));return}oe(!0);let _e=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,yt=d.chainId?Number(d.chainId):_e.chainId;Ul(yt);let At=Object.assign({},d,{chainId:yt}),oo=async()=>{let gt=await Ye();if(!gt||!R){D(W,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Se.recoverEmbeddedWallet()){D(W,"sendTransaction","onError","unknown_connect_wallet_error"),N(new Error("Unable to connect to wallet"));return}let hr=io(At.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Fl=await Ei(V.address,At,hr);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:b1}=await bi(Fl,hr),{hasSufficientFunds:E1}=await _l(V.address,Fl,b1,hr);if(!E1)throw new Ne(new Qt("Wallet has insufficient funds for this transaction.",dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Rd=await Sl(gt,V.address,R,Fl,hr);D(W,"sendTransaction","onSuccess",Rd),v(Rd)}catch(fr){D(W,"sendTransaction","onError","transaction_failure"),N(fr)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),oo();else{let gt={transactionRequest:At,onSuccess:hr=>{D(W,"sendTransaction","onSuccess",hr),v(hr)},onFailure:hr=>{D(W,"sendTransaction","onError","transaction_failure"),N(hr)},uiOptions:p||{},fundWalletConfig:y},fr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:hr=>{D(W,"sendTransaction","onError","unknown_connect_wallet_error"),N(hr)}};K({connectWallet:fr,sendTransaction:gt}),Y("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ad(){return new Promise(async(d,p)=>{let y=await Ye();if(!y||!R)throw new Error("Must have valid access token to enroll in MFA");try{await R.verifyMfa({accessToken:y}),d()}catch(v){p(v)}})}let mr=d=>{if(s?.[d])throw D(W,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},Cn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:wa,linkWallet:jo,linkEmail:()=>{ot(),mr("email"),Q.current="email",ee.current="link",Y("LINK_EMAIL_SCREEN")},linkPhone:()=>{ot(),mr("phone"),Q.current="sms",ee.current="link",Y("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ot(),mr("google"),ee.current="link",await Se.initLoginWithOAuth("google")},linkTwitter:async()=>{ot(),mr("twitter"),ee.current="link",await Se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ot(),mr("discord"),ee.current="link",await Se.initLoginWithOAuth("discord")},linkGithub:async()=>{ot(),mr("github"),ee.current="link",await Se.initLoginWithOAuth("github")},linkSpotify:async()=>{ot(),mr("spotify"),ee.current="link",await Se.initLoginWithOAuth("spotify")},linkTiktok:async()=>{ot(),mr("tiktok"),ee.current="link",await Se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ot(),mr("linkedin"),ee.current="link",await Se.initLoginWithOAuth("linkedin")},linkApple:async()=>{ot(),mr("apple"),ee.current="link",await Se.initLoginWithOAuth("apple")},linkFarcaster:async()=>{ot(),mr("farcaster"),await Se.initLoginWithFarcaster(),ee.current="link",Q.current="farcaster",Y("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ot(),!s?.email)throw new T("User does not have an email linked to their account.");ee.current="link",Q.current="email",Y("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(d=>{Re(()=>d)}),Re(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}ee.current="login",rt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Re(()=>d)}),Re(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}rt("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),c(null),l(!1),S(null),D(W,"logout","onSuccess"),ee.current=null,Q.current=null,o(!1),he.del(Ri)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new ke;let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new ke:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Nl.Web3Provider(new gr(new ke));let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new Nl.Web3Provider(new gr(new ke)):new Nl.Web3Provider(new gr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new _o(new ke);let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new _o(new ke):new _o(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(v=>(0,ga.getAddress)(v.address)===(0,ga.getAddress)(d)),y=s?.linkedAccounts.find(v=>v.type==="wallet"&&(0,ga.getAddress)(v.address)===(0,ga.getAddress)(d));if(!p||!await p.isConnected())H(d),jo();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=y&&{address:y.address,chainType:y.chainType,chainId:y.chainId,walletClient:y.walletClient,walletClientType:y.walletClientType,connectorType:y.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw D(W,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ro(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw D(W,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Ie(s);if(!d||!R)throw D(W,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw D(W,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Ad()}catch(p){throw D(W,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,y)=>{oe(!0);let v={onSuccess:V=>{D(W,"setWalletPassword","onSuccess",V),p(V)},onFailure:V=>{D(W,"setWalletPassword","onError","user_exited_set_password_flow"),y(V)},callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:V=>{D(W,"setWalletPassword","onError","unknown_connect_wallet_error"),y(V)}};K({setWalletPassword:v,connectWallet:N}),Y("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(y,v)=>{if(!a||!s){D(W,"signMessage","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Ie(s);if(!N){D(W,"signMessage","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){D(W,"signMessage","onError","invalid_message"),v(new Error("Message must be a non-empty string"));return}oe(!0);let V=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let _e=await Ye();if(!R||!_e)throw new Error("Unable to connect to wallet");if(!await Se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:At}=await R.rpc({accessToken:_e,address:N.address,request:{method:"personal_sign",params:[d,N.address]}}),oo=At.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address}),oo};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let _e=await V();D(W,"signMessage","onSuccess",_e),y(_e)}catch(_e){D(W,"signMessage","onError","unable_to_sign"),v(_e??new Ne("Unable to sign message"))}}else{let At={method:"personal_sign",data:d,confirmAndSign:V,onSuccess:gt=>{D(W,"signMessage","onSuccess",gt),y(gt)},onFailure:gt=>{D(W,"signMessage","onError","unable_to_sign"),v(gt)},uiOptions:p||{}},oo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:gt=>{D(W,"signMessage","onError","unknown_connect_wallet_error"),v(gt)}};K({signMessage:At,connectWallet:oo}),Y("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(y,v)=>{if(!a||!s){D(W,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Ie(s);if(!N){D(W,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}oe(!0);let V=Ua(d),_e=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let yt=await Ye();if(!R||!yt)throw new Error("Unable to connect to wallet");if(!await Se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:N.address});let{response:oo}=await R.rpc({accessToken:yt,address:N.address,request:{method:"eth_signTypedData_v4",params:[N.address,V]}}),gt=oo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:N.address}),gt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let yt=await _e();D(W,"signTypedData","onSuccess",yt),y(yt)}catch(yt){D(W,"signTypedData","onError","unable_to_sign"),v(yt??new Ne("Unable to sign message"))}}else{let oo={method:"eth_signTypedData_v4",data:V,confirmAndSign:_e,onSuccess:fr=>{D(W,"signTypedData","onSuccess",fr),y(fr)},onFailure:fr=>{D(W,"signTypedData","onError","unable_to_sign"),v(fr)},uiOptions:p||{}},gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:fr=>{D(W,"signMessage","onError","unknown_connect_wallet_error"),v(fr)}};K({signMessage:oo,connectWallet:gt}),Y("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,y)=>{let N=await(await _d(d,p,y)).wait();return Al(N)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let y=Ie(s);if(!y){p(new Error("Must have a Privy wallet before exporting"));return}oe(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},N=await Ye();if(!N||!R){p(new Error("Must have valid access token to enroll in MFA"));return}if(!R){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await R.connect({accessToken:N,address:y.address}),await R.verifyMfa({accessToken:N})}catch(_e){if(on(_e))await Se.recoverEmbeddedWallet();else throw _e}}catch(_e){p(_e);return}let V={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};K({keyExport:V,connectWallet:v}),Y("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ad,async init(d){let p;switch(d){case"sms":p=new Ol("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":bo.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((y,v)=>{Lr.current={resolve:y,reject:v}});break;default:throw bo.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){bo.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,y)=>{if(!d){Se.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),K({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:y}}),Y("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ye();if(!d||!R)throw new Error("Must have valid access token to enroll in MFA");let p=await R.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let y=await t.getAuthenticatedUser();c(y)},async submitEnrollmentWithTotp(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let y=await t.getAuthenticatedUser();c(y)},async unenroll(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to remove MFA");await R.unenrollMfa({method:d,accessToken:p});let y=await t.getAuthenticatedUser();c(y)},isHeadlessOAuthLoading:b,loginWithCode(d){return Se.loginWithCode(d)},initLoginWithEmail(d){return Se.initLoginWithEmail(d)},initLoginWithSms(d){return Se.initLoginWithSms(d)},fundWallet(d,p){return Se.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Se.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Se.loginWithHeadlessOAuth(d)},isModalOpen:r};Gg=Cn.signMessage,Vg=Cn.signTypedData,zg=async(...d)=>{let p=await _d(...d);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let kd=!!e.config?.headless,Se=(()=>({headless:kd,isNewUserThisSession:C,linkingHint:F,pendingTransaction:null,walletConnectionStatus:I,mipdStore:A,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>O.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(R)return R;let p=new Promise(N=>{Nt(()=>V=>N(V))}),y=new Promise(N=>setTimeout(()=>N(null),d)),v=await Promise.race([p,y]);return Nt(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s;ee.current==="login"?d.shouldCallAuthOnSuccess&&p?(D(W,"login","onComplete",s,C,!1,Q.current??null),e.onSuccess?.(s,C)):D(W,"login","onError","exited_auth_flow"):ee.current==="link"&&Q.current&&(d.isSuccess&&p?D(W,"linkAccount","onSuccess",s,Q.current):D(W,"linkAccount","onError","exited_link_flow")),H(null),ee.current=null,Q.current=null,P(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:Y,connectWallet:ur,initLoginWithWallet:async(d,p)=>{Q.current="siwe",qo(d,p)},loginWithWallet:async()=>{if(!n)throw new bn;if(!(t.authFlow instanceof Xo))throw new T("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),Q.current="siwe"}catch(y){throw D(W,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:d,isNewUser:p}=await t.authenticate()),Q.current="siwe"}catch(y){throw D(W,"login","onError",y.privyErrorCode||"generic_connect_wallet_error"),y}c(d||s||null),P(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Mi(d);t.startAuthFlow(p);try{Q.current="farcaster",await p.initializeFarcasterConnect()}catch(y){throw ee.current==="login"?D(W,"login","onError",y.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&D(W,"linkAccount","onError",y.privyErrorCode||"unknown_auth_error"),y}},loginWithFarcaster:async()=>{if(!n)throw new bn;if(!(t.authFlow instanceof Mi))throw new T("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),Q.current="farcaster"}catch(y){throw D(W,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:d,isNewUser:p}=await t.authenticate()),Q.current="farcaster"}catch(y){throw D(W,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}c(d||null),P(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(Q.current=d,zl()){if(d==="google"&&Ll(window.navigator.userAgent)){rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let y=new Dr({provider:d});p&&y.addCaptchaToken(p),t.startAuthFlow(y);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof Dr))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=ct.get(Yo),y=t.authFlow.meta.stateCode;if(p!==y)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:y??""}),new T("Unexpected auth flow. This may be a phishing attempt.");let v,N;if(a)try{v=await t.link(),Q.current=d}catch(V){throw D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{({user:v,isNewUser:N}=await t.authenticate()),Q.current=d}catch(V){throw ee.current==="login"?D(W,"login","onError",V.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}c(v),P(N||!1),l(!0)},async initLoginWithHeadlessOAuth(d,p){if(zl()){if(d==="google"&&Ll(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 y=new Dr({provider:d,headless:!0});p&&y.addCaptchaToken(p);let v=await t.startAuthFlow(y).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){x(!0),t.startAuthFlow(new Dr(d));let p=ct.get(Yo),y=d.stateCode;if(p!==y)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d.provider,storedStateCode:p??"",returnedStateCode:y??""}),x(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let v,N;if(a)try{v=await t.link(),Q.current=d.provider}catch(V){throw D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{({user:v,isNewUser:N}=await t.authenticate()),Q.current=d.provider}catch(V){throw ee.current==="login"?D(W,"login","onError",V.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}return c(v),P(N||!1),l(!0),x(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let y=new Po(d,p);t.startAuthFlow(y);try{Q.current="email",await y.sendCodeEmail()}catch(v){throw ee.current==="login"?D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},initUpdateEmail:async(d,p,y)=>{let v=new _a(d,p,y);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{let y=new en(d,p);t.startAuthFlow(y);try{Q.current="sms",await y.sendSmsCode()}catch(v){throw ee.current==="login"?D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new bn;if(t.authFlow instanceof Po)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof en)t.authFlow.meta.smsCode=d.trim();else throw new T("Must initialize a passwordless code flow first");let p,y;if(a)try{p=await t.link()}catch(v){throw D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}else try{({user:p,isNewUser:y}=await t.authenticate())}catch(v){throw D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),P(y||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:R,createAnalyticsEvent:(d,p,y)=>t.createAnalyticsEvent(d,p,y),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let y=s?.linkedAccounts.find(N=>N.type==="wallet"&&N.walletClientType==="privy"),v=await Ye();if(!v||!R||!y){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}oe(!0);try{await R.connect({accessToken:v,address:y.address}),d(!0)}catch(N){on(N)&&y.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:y.address}),(await R.recover({address:y.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:y.address}),d(!0)):on(N)?(K({recoverWallet:{privyWallet:y,onFailure:p,onSuccess:()=>d(!0)}}),Y("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(N)}}),getFiatOnRampConfig:Or,setReadyToTrue:()=>{i(!0),Oe?.()},updateWallets:()=>Eo(),fundWallet:async(d,p)=>{let{signedUrl:y,externalTransactionId:v}=await Or(d,p);K({fiatOnRampPrompt:{signedUrl:y},fiatOnRampStatus:{externalTransactionId:v}}),Y("FIAT_ON_RAMP_PROMPT_SCREEN")}}))();$g=Se.recoverEmbeddedWallet;let C1=(0,J.useMemo)(()=>({wallets:u,ready:ze}),[u,ze]);return(0,Ot.jsx)(ue.Provider,{value:Cn,children:(0,Ot.jsx)(mc.Provider,{value:W,children:(0,Ot.jsx)(gd.Provider,{value:C1,children:(0,Ot.jsxs)(Mu,{...O,children:[e.children,(0,Ot.jsxs)(uc.Provider,{value:Se,children:[!kd&&O.captchaEnabled&&n&&!a&&(0,Ot.jsx)(vs,{delayedExecution:!1}),(0,Ot.jsx)(Og,{theme:{...O.appearance.palette||{}}}),(0,Ot.jsx)(Pu,{data:te,setModalData:K,setInitialScreen:S,initialScreen:w,authenticated:a,open:r,children:(0,Ot.jsx)(Ug,{open:r})}),ce&&Z?(0,Ot.jsx)(Fg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:bo,mfaSubmitPromise:Lr,onLoad:j,onLoadFailed:()=>null}):null]})]})})})})};var jg=require("react");function Kg(e){let{login:t}=(0,jg.useContext)(ue);return We("login",e),{login:t}}var Yg=require("react");function Jg(e){let{logout:t}=(0,Yg.useContext)(ue);return We("logout",e),{logout:t}}var va=require("react");function Zg(){let e=Ee(),t=us(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=G(),l=(0,va.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new wr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,va.useCallback)(async()=>{let c=Li();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{Oi()}},[o]);return(0,va.useEffect)(()=>{let c=Li();i&&t&&c.inProgress&&c.headless&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var xd=require("react");var Qg=()=>{let e=Ee(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=(0,xd.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,xd.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new wr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var Sd=require("react");var Xg=()=>{let e=Ee(),{initLoginWithSms:t,loginWithCode:r}=G(),o=(0,Sd.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),n=(0,Sd.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new wr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var e1=require("react");function t1(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkFarcaster:g}=(0,e1.useContext)(ue);return We("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkFarcaster:g}}var r1=require("react");function o1(e){let{connectWallet:t}=(0,r1.useContext)(ue);return We("connectWallet",e),{connectWallet:t}}var n1=require("react");function i1(e){let{createWallet:t}=(0,n1.useContext)(ue);return We("createWallet",e),{createWallet:t}}var a1=()=>{let{fundWallet:e}=G();return{fundWallet:e}};var s1=require("react");function l1(e){let{sendTransaction:t}=(0,s1.useContext)(ue);return We("sendTransaction",e),{sendTransaction:t}}var c1=require("react");function d1(e){let{setWalletPassword:t}=(0,c1.useContext)(ue);return We("setWalletPassword",e),{setWalletPassword:t}}var p1=require("react");function u1(e){let{signMessage:t}=(0,p1.useContext)(ue);return We("signMessage",e),{signMessage:t}}var m1=require("react");function f1(e){let{signTypedData:t}=(0,m1.useContext)(ue);return We("signTypedData",e),{signTypedData:t}}var h1=require("react");var y1=()=>{let{isModalOpen:e}=(0,h1.useContext)(ue);return{isOpen:e}};var g1=require("react");function v1(e){let{getAccessToken:t}=(0,g1.useContext)(ue);return We("accessToken",e),{getAccessToken:t}}function w1(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
|
|
2714
|
+
`;var Ge=require("react/jsx-runtime"),O2={["LANDING"]:iy,["CONNECT_OR_CREATE"]:ny,["AWAITING_PASSWORDLESS_CODE"]:lm,["AWAITING_CONNECTION"]:Lm,["AWAITING_CONNECT_ONLY_CONNECTION"]:Dm,["AWAITING_FARCASTER_CONNECTION"]:dh,["PHANTOM_INTERSTITIAL_SCREEN"]:bg,["LOGIN_FAILED_SCREEN"]:uy,["AWAITING_OAUTH_SCREEN"]:gg,["ALLOWLIST_REJECTION_SCREEN"]:Zu,["INSTALL_PHANTOM_SCREEN"]:Mh,["LINK_EMAIL_SCREEN"]:sy,["LINK_PHONE_SCREEN"]:cy,["LINK_WALLET_SCREEN"]:dy,["UPDATE_EMAIL_SCREEN"]:Lg,["CONNECT_ONLY_LANDING_SCREEN"]:Im,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:xm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Df,["EMBEDDED_WALLET_CREATED_SCREEN"]:qm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Vm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:zf,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Zm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:kg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Sg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:wh,["FIAT_ON_RAMP_STATUS_SCREEN"]:Th,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Gf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Uf,["MFA_ENROLLMENT_FLOW_SCREEN"]:ky,["CAPTCHA_SCREEN"]:ym,["ERROR_SCREEN"]:jf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:_h,["AFFIRMATIVE_CONSENT_SCREEN"]:Yu},N2=["LANDING","AWAITING_CONNECTION"],D2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=L(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=Ee(),f=(0,bo.useRef)(null),g=Ou(f),w=o&&a&&N2.includes(a)&&!n&&l==="ready";if((0,bo.useEffect)(()=>{w&&s()},[w]),(0,bo.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,Ge.jsxs)(hi,{children:[(0,Ge.jsx)(k,{}),(0,Ge.jsx)(oe,{}),(0,Ge.jsx)(fy,{children:(0,Ge.jsx)(or,{})}),(0,Ge.jsx)(ie,{}),(0,Ge.jsx)(se,{})]});if(!a&&e)return(0,Ge.jsx)(hi,{style:{height:g},children:(0,Ge.jsx)("div",{ref:f,children:(0,Ge.jsx)(bd,{open:e,onClose:t})})});if(!a)return null;let P=O2[a];return(0,Ge.jsx)(hi,{style:{height:g},children:(0,Ge.jsxs)("div",{ref:f,children:[(0,Ge.jsx)(po,{if:!!e,children:(0,Ge.jsx)(P,{})}),(0,Ge.jsx)(po,{if:!e,children:(0,Ge.jsx)(bd,{open:e,onClose:t})})]})})},U2=()=>{let{closePrivyModal:e}=L(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,bo.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Fg=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=U2(),[o,n]=(0,bo.useState)(!1);Ts({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,Ge.jsx)(Dg,{children:(0,Ge.jsx)(D2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,Ge.jsx)(my,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Ug.default.createPortal(l,s)}return l};var ga=require("react");var Nl=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function wn(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new qe("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((g,w)=>{r.current={resolve:g,reject:w};let P=1e3*60*5;setTimeout(()=>{let C=new qe("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(C),w(C)},P)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let u=new qe("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var Hg=require("react/jsx-runtime"),F2=function(e){return()=>`id-${e++}`}(0);function B2(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Xr(e){return e.error!==void 0}var Wr=new Nl,xd=new Map,H2=(e,t)=>typeof t=="bigint"?t.toString():t,G2=(e,t)=>`${e}${JSON.stringify(t,H2)}`;function eo(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=G2(e,t);if(e==="privy:wallet:create"){let l=xd.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=F2();Wr.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{xd.delete(i)});return xd.set(i,a),a}function V2(e){switch(e.event){case"privy:iframe:ready":let t=Wr.dequeue(e.event,e.id);return Xr(e)?t.reject(new qe(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Wr.dequeue(e.event,e.id);return Xr(e)?r.reject(new qe(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Wr.dequeue(e.event,e.id);return Xr(e)?o.reject(new qe(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Wr.dequeue(e.event,e.id);return Xr(e)?n.reject(new qe(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Wr.dequeue(e.event,e.id);return Xr(e)?i.reject(new qe(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Wr.dequeue(e.event,e.id);return Xr(e)?a.reject(new qe(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Wr.dequeue(e.event,e.id);return Xr(e)?l.reject(new qe(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Wr.dequeue(e.event,e.id);return Xr(e)?s.reject(new qe(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Bg(e){let t=(0,ga.useRef)(null),r=(0,ga.useRef)(e.mfaMethods),o=Uu();return(0,ga.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,Hg.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>{let i=t.current;if(!i)return;function a(f){f&&f.origin===e.origin&&B2(f.data)&&V2(f.data)}let l={create(f){return eo("privy:wallet:create",f,i,e.origin)},connect(f){return eo("privy:wallet:connect",f,i,e.origin)},recover(f){return wn(g=>eo("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return wn(g=>eo("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return wn(g=>eo("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return wn(g=>eo("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return wn(g=>eo("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return eo("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return wn(g=>eo("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",a);let s=()=>e.onLoad(l),c=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},u=new AbortController;return Sp(()=>eo("privy:iframe:ready",{},i,e.origin),{abortSignal:u.signal}).then(s,c),()=>{window.removeEventListener("message",a),u.abort()}},src:Da(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Dl(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Ul=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set when initialzing authentication.");try{await this.api.post(ip,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Mfa flow has no API instance");if(!this.meta.smsCode)throw new T("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ap,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Bt(t)}catch(t){throw fe(t)}}};var Ot=require("react/jsx-runtime"),Ai;function z2(e){return typeof e=="string"&&e.length===25}function Ye(){if(!Ai){let e=he.get(Ko);return Promise.resolve(e||null)}return Ai.getAccessToken()}var Vg,$p=(e,t)=>Vg(e,t),zg,qp=(e,t)=>zg(e,t),$g,jp=(e,t)=>$g(e,t),qg,Kp=()=>qg(),$2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;he.put(Ri,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},jg=({config:e,...t})=>{if(!z2(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");Ai||(Ai=new Fn({appId:t.appId,apiUrl:t.apiUrl||Ia}));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,Ot.jsx)(Cu,{client:Ai,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Ot.jsx)(q2,{...t,config:r,client:Ai})})},q2=e=>{let t=e.client,[r,o]=(0,Z.useState)(!1),[n,i]=(0,Z.useState)(!1),[a,l]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[u,f]=(0,Z.useState)([]),g=(0,Z.useRef)(u),[w,P]=(0,Z.useState)(!1),[C,S]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),[I,M]=(0,Z.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[A,B]=(0,Z.useState)(null),[F,H]=(0,Z.useState)(null),[R,K]=(0,Z.useState)(null),O=ms(),Q=fs(),[ce,ne]=(0,Z.useState)(!0),[re,Y]=(0,Z.useState)({}),[Ne,Ie]=(0,Z.useState)(null),[to,Nt]=(0,Z.useState)(null),[ze,xe]=(0,Z.useState)(!1),[Dt,pr]=(0,Z.useState)(!1),Eo=(0,Z.useRef)(null),Lr=(0,Z.useRef)(null),W=(0,Z.useRef)(Nu);t.onStoreToken=d=>{d&&D(W,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{D(W,"accessToken","onAccessTokenRemoved")};let X=(0,Z.useRef)(null),te=(0,Z.useRef)(null),ki=(0,Z.useCallback)(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(v=>v.type==="wallet"&&v.walletClientType==="privy")?p&&d?.some(v=>v?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),J=d=>{S(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},rt=d=>{O.embeddedWallets.createOnLogin!=="off"&&ne(!0),J(d)};(0,Z.useEffect)(()=>{if(!R||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(R,p,O.defaultChain,e.appId)}},[R,s]),(0,Z.useEffect)(()=>{R&&to?.(R)},[R]),(0,Z.useEffect)(()=>{(async()=>{if(!O.customAuth?.enabled)return;ne(!0);let{getCustomAccessToken:p,isLoading:y}=O.customAuth;if(!(!n||y))try{let v=await p();if(!v){await Cn.logout();return}if(a)return;t.startAuthFlow(new En(v));let{user:N,isNewUser:V}=await t.authenticate();N||await Cn.logout(),c(N||null),P(V||!1),l(!0),pr(!0)}catch(v){console.warn(v),a&&await Cn.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,a]),(0,Z.useEffect)(()=>{Dt&&R&&s&&Qt(s,e.config?.embeddedWallets?.createOnLogin)&&(pr(!1),ro(s,Tn).catch(console.error))},[Dt&&R&&s]),(0,Z.useEffect)(()=>{async function d(){let p=_t();$2();let y=(0,Gg.createStore)();B(y),t.initializeConnectorManager(O.walletConnectCloudProjectId,O.rpcConfig,O.chains,O.defaultChain,y,O.appearance.walletList,O.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{Bl()});let v=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!v),v&&D(W,"login","onComplete",v,!1,!0,null),c(v)),p||Se.setReadyToTrue(),p&&(v?te.current="link":te.current="login")}!n&&Q&&d()},[t,Ne,n,Q]);let _t=()=>{let d=Oi();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Dr(d)),rt("AWAITING_OAUTH_SCREEN"),!0)},$o=async(d,p,y,v)=>{let N=await t.connectors?.createWalletConnector(d,p)||null;ur(N,p,y,v)};async function ur(d,p,y,v){if(d)M({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new ee("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,y);d instanceof Br&&p&&await d.resetConnection(p),M({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ur(d,p,y,v)});try{let N=await d.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(V=>V.id===Number(N?.chainId))&&!(N?.connectorType==="wallet_connect_v2"&&N?.walletClientType==="metamask")){M(V=>({...V,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await N?.switchChain(O.defaultChain.id),N&&(N.chainId=xn(Qo(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(V=>({...V,status:"connected",connectedWallet:N,connectError:null,connectRetry:E})),N&&!te.current&&D(W,"connectWallet","onSuccess",N),v?.(N,y)}catch(N){return N instanceof lt?(console.warn(N.cause?N.cause:N.message),te.current||D(W,"connectWallet","onError",N.privyErrorCode||"generic_connect_wallet_error")):(console.warn(N),te.current||D(W,"connectWallet","onError","unknown_connect_wallet_error")),M(V=>({...V,status:"disconnected",connectedWallet:null,connectError:N})),v?.(null,y)}}let qo=async(d,p)=>{if(d===null)return;let y=new Xo(d,p);t.startAuthFlow(y)},Bl=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),y=d.get("privy_wallet_client");if(!p||!y)return;if(y==="phantom"&&!xo()&&rt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");J("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),$o(p,y,void 0,qo)};(0,Z.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let ot=()=>{if(!a)throw D(W,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},jo=()=>{ot(),X.current="siwe",te.current="link",J("LINK_WALLET_SCREEN")},Ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},st=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(M(y=>({...y,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),O.captchaEnabled&&!a){let y={callback:v=>qo(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Y({captchaModalData:y}),rt("CAPTCHA_SCREEN")}else await qo(d),rt("AWAITING_CONNECTION")},Or=async(d,p)=>{if(!O.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:y,externalTransactionId:v}=await gh(t,d,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:y,externalTransactionId:v}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Po=()=>{f(d=>{let p=t.connectors?.wallets.map(y=>({...y,linked:Ut(y),loginOrLink:async()=>{if(!await y.isConnected())throw new T("Wallet is not connected");if(y.connectorType==="embedded"&&y.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");st(y)},fund:async v=>{let{signedUrl:N,externalTransactionId:V}=await Or(y.address,v);Y({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:V}}),J("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new T("User is not authenticated.");if(y.connectorType==="embedded"&&y.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(y.address);c(v)}}))||[];return xe(ki(p)),qa(d,p)?d:p})};(0,Z.useEffect)(()=>{Po()},[s?.linkedAccounts,a,n]),(0,Z.useEffect)(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Po(),t.connectors.on("walletsUpdated",Po)}},[n]);let Ca=()=>{J(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,Z.useEffect)(()=>{if(!u[0])return;let d=u[0],p=g.current.find(v=>v.address===d.address),y;if(d.walletClientType==="privy"?y=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):y=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&y){let v=Object.assign({},s);v.wallet=y&&{address:y.address,chainType:y.chainType,chainId:y.chainId,walletClient:y.walletClient,walletClientType:y.walletClientType,connectorType:y.connectorType},c(v)}g.current=u},[u]);let ro=async(d,p)=>{if(Me(d))throw D(W,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,N]=await Promise.all([Se.initializeWalletProxy(p),Ye()]);if(!v&&e.config?.customAuth?.enabled)throw D(W,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((V,_e)=>{ne(!0),Y({createWallet:{onSuccess:At=>{D(W,"createWallet","onSuccess",At),V(At)},onFailure:At=>{D(W,"createWallet","onError","unknown_embedded_wallet_error"),_e(At)},callAuthOnSuccessOnClose:!1}}),J("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:N});let V=await Se.refreshUser(),_e=Me(V);if(!_e)throw D(W,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(W,"createWallet","onSuccess",_e),_e}},Hl=d=>{if(!O.chains.map(p=>p.id).includes(d))throw new ee(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Ad=(d,p,y)=>new Promise(async(v,N)=>{if(!a||!s){D(W,"sendTransaction","onError","must_be_authenticated"),N(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=Me(s);if(!V){D(W,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have a Privy wallet before signing"));return}ne(!0);let _e=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,yt=d.chainId?Number(d.chainId):_e.chainId;Hl(yt);let At=Object.assign({},d,{chainId:yt}),oo=async()=>{let gt=await Ye();if(!gt||!R){D(W,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Se.recoverEmbeddedWallet()){D(W,"sendTransaction","onError","unknown_connect_wallet_error"),N(new Error("Unable to connect to wallet"));return}let hr=io(At.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Gl=await Pi(V.address,At,hr);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:E1}=await Ei(Gl,hr),{hasSufficientFunds:P1}=await Rl(V.address,Gl,E1,hr);if(!P1)throw new De(new Xt("Wallet has insufficient funds for this transaction.",dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Id=await kl(gt,V.address,R,Gl,hr);D(W,"sendTransaction","onSuccess",Id),v(Id)}catch(fr){D(W,"sendTransaction","onError","transaction_failure"),N(fr)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),oo();else{let gt={transactionRequest:At,onSuccess:hr=>{D(W,"sendTransaction","onSuccess",hr),v(hr)},onFailure:hr=>{D(W,"sendTransaction","onError","transaction_failure"),N(hr)},uiOptions:p||{},fundWalletConfig:y},fr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:hr=>{D(W,"sendTransaction","onError","unknown_connect_wallet_error"),N(hr)}};Y({connectWallet:fr,sendTransaction:gt}),J("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function kd(){return new Promise(async(d,p)=>{let y=await Ye();if(!y||!R)throw new Error("Must have valid access token to enroll in MFA");try{await R.verifyMfa({accessToken:y}),d()}catch(v){p(v)}})}let mr=d=>{if(s?.[d])throw D(W,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},Cn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Ca,linkWallet:jo,linkEmail:()=>{ot(),mr("email"),X.current="email",te.current="link",J("LINK_EMAIL_SCREEN")},linkPhone:()=>{ot(),mr("phone"),X.current="sms",te.current="link",J("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ot(),mr("google"),te.current="link",await Se.initLoginWithOAuth("google")},linkTwitter:async()=>{ot(),mr("twitter"),te.current="link",await Se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ot(),mr("discord"),te.current="link",await Se.initLoginWithOAuth("discord")},linkGithub:async()=>{ot(),mr("github"),te.current="link",await Se.initLoginWithOAuth("github")},linkSpotify:async()=>{ot(),mr("spotify"),te.current="link",await Se.initLoginWithOAuth("spotify")},linkTiktok:async()=>{ot(),mr("tiktok"),te.current="link",await Se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ot(),mr("linkedin"),te.current="link",await Se.initLoginWithOAuth("linkedin")},linkApple:async()=>{ot(),mr("apple"),te.current="link",await Se.initLoginWithOAuth("apple")},linkFarcaster:async()=>{ot(),mr("farcaster"),await Se.initLoginWithFarcaster(),te.current="link",X.current="farcaster",J("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ot(),!s?.email)throw new T("User does not have an email linked to their account.");te.current="link",X.current="email",J("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(d=>{Ie(()=>d)}),Ie(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}te.current="login",rt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Ie(()=>d)}),Ie(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}rt("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),c(null),l(!1),S(null),D(W,"logout","onSuccess"),te.current=null,X.current=null,o(!1),he.del(Ii)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new ke;let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new ke:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Fl.Web3Provider(new gr(new ke));let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new Fl.Web3Provider(new gr(new ke)):new Fl.Web3Provider(new gr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Ao(new ke);let d=u.find(y=>s.wallet&&y.address===s.wallet.address),p=t.connectors?.walletConnectors.find(y=>y.wallets.find(v=>v.address===d?.address));return!d||!p?new Ao(new ke):new Ao(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(v=>(0,va.getAddress)(v.address)===(0,va.getAddress)(d)),y=s?.linkedAccounts.find(v=>v.type==="wallet"&&(0,va.getAddress)(v.address)===(0,va.getAddress)(d));if(!p||!await p.isConnected())H(d),jo();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=y&&{address:y.address,chainType:y.chainType,chainId:y.chainId,walletClient:y.walletClient,walletClientType:y.walletClientType,connectorType:y.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw D(W,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ro(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw D(W,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Me(s);if(!d||!R)throw D(W,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw D(W,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await kd()}catch(p){throw D(W,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,y)=>{ne(!0);let v={onSuccess:V=>{D(W,"setWalletPassword","onSuccess",V),p(V)},onFailure:V=>{D(W,"setWalletPassword","onError","user_exited_set_password_flow"),y(V)},callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:V=>{D(W,"setWalletPassword","onError","unknown_connect_wallet_error"),y(V)}};Y({setWalletPassword:v,connectWallet:N}),J("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(y,v)=>{if(!a||!s){D(W,"signMessage","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Me(s);if(!N){D(W,"signMessage","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){D(W,"signMessage","onError","invalid_message"),v(new Error("Message must be a non-empty string"));return}ne(!0);let V=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let _e=await Ye();if(!R||!_e)throw new Error("Unable to connect to wallet");if(!await Se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:At}=await R.rpc({accessToken:_e,address:N.address,request:{method:"personal_sign",params:[d,N.address]}}),oo=At.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address}),oo};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let _e=await V();D(W,"signMessage","onSuccess",_e),y(_e)}catch(_e){D(W,"signMessage","onError","unable_to_sign"),v(_e??new De("Unable to sign message"))}}else{let At={method:"personal_sign",data:d,confirmAndSign:V,onSuccess:gt=>{D(W,"signMessage","onSuccess",gt),y(gt)},onFailure:gt=>{D(W,"signMessage","onError","unable_to_sign"),v(gt)},uiOptions:p||{}},oo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:gt=>{D(W,"signMessage","onError","unknown_connect_wallet_error"),v(gt)}};Y({signMessage:At,connectWallet:oo}),J("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(y,v)=>{if(!a||!s){D(W,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Me(s);if(!N){D(W,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}ne(!0);let V=Fa(d),_e=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let yt=await Ye();if(!R||!yt)throw new Error("Unable to connect to wallet");if(!await Se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:N.address});let{response:oo}=await R.rpc({accessToken:yt,address:N.address,request:{method:"eth_signTypedData_v4",params:[N.address,V]}}),gt=oo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:N.address}),gt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let yt=await _e();D(W,"signTypedData","onSuccess",yt),y(yt)}catch(yt){D(W,"signTypedData","onError","unable_to_sign"),v(yt??new De("Unable to sign message"))}}else{let oo={method:"eth_signTypedData_v4",data:V,confirmAndSign:_e,onSuccess:fr=>{D(W,"signTypedData","onSuccess",fr),y(fr)},onFailure:fr=>{D(W,"signTypedData","onError","unable_to_sign"),v(fr)},uiOptions:p||{}},gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:fr=>{D(W,"signMessage","onError","unknown_connect_wallet_error"),v(fr)}};Y({signMessage:oo,connectWallet:gt}),J("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,y)=>{let N=await(await Ad(d,p,y)).wait();return Il(N)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let y=Me(s);if(!y){p(new Error("Must have a Privy wallet before exporting"));return}ne(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},N=await Ye();if(!N||!R){p(new Error("Must have valid access token to enroll in MFA"));return}if(!R){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await R.connect({accessToken:N,address:y.address}),await R.verifyMfa({accessToken:N})}catch(_e){if(on(_e))await Se.recoverEmbeddedWallet();else throw _e}}catch(_e){p(_e);return}let V={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};Y({keyExport:V,connectWallet:v}),J("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:kd,async init(d){let p;switch(d){case"sms":p=new Ul("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":Eo.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((y,v)=>{Lr.current={resolve:y,reject:v}});break;default:throw Eo.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){Eo.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,y)=>{if(!d){Se.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Y({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:y}}),J("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ye();if(!d||!R)throw new Error("Must have valid access token to enroll in MFA");let p=await R.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let y=await t.getAuthenticatedUser();c(y)},async submitEnrollmentWithTotp(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to enroll in MFA");await R.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let y=await t.getAuthenticatedUser();c(y)},async unenroll(d){let p=await Ye();if(!p||!R)throw new Error("Must have valid access token to remove MFA");await R.unenrollMfa({method:d,accessToken:p});let y=await t.getAuthenticatedUser();c(y)},isHeadlessOAuthLoading:b,loginWithCode(d){return Se.loginWithCode(d)},initLoginWithEmail(d){return Se.initLoginWithEmail(d)},initLoginWithSms(d){return Se.initLoginWithSms(d)},fundWallet(d,p){return Se.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Se.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Se.loginWithHeadlessOAuth(d)},isModalOpen:r};Vg=Cn.signMessage,zg=Cn.signTypedData,$g=async(...d)=>{let p=await Ad(...d);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Rd=!!e.config?.headless,Se=(()=>({headless:Rd,isNewUserThisSession:w,linkingHint:F,pendingTransaction:null,walletConnectionStatus:I,mipdStore:A,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>O.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(R)return R;let p=new Promise(N=>{Nt(()=>V=>N(V))}),y=new Promise(N=>setTimeout(()=>N(null),d)),v=await Promise.race([p,y]);return Nt(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s;te.current==="login"?d.shouldCallAuthOnSuccess&&p?(D(W,"login","onComplete",s,w,!1,X.current??null),e.onSuccess?.(s,w)):D(W,"login","onError","exited_auth_flow"):te.current==="link"&&X.current&&(d.isSuccess&&p?D(W,"linkAccount","onSuccess",s,X.current):D(W,"linkAccount","onError","exited_link_flow")),H(null),te.current=null,X.current=null,P(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:J,connectWallet:ur,initLoginWithWallet:async(d,p)=>{X.current="siwe",qo(d,p)},loginWithWallet:async()=>{if(!n)throw new bn;if(!(t.authFlow instanceof Xo))throw new T("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),X.current="siwe"}catch(y){throw D(W,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:d,isNewUser:p}=await t.authenticate()),X.current="siwe"}catch(y){throw D(W,"login","onError",y.privyErrorCode||"generic_connect_wallet_error"),y}c(d||s||null),P(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Wi(d);t.startAuthFlow(p);try{X.current="farcaster",await p.initializeFarcasterConnect()}catch(y){throw te.current==="login"?D(W,"login","onError",y.privyErrorCode||"unknown_auth_error"):te.current==="link"&&D(W,"linkAccount","onError",y.privyErrorCode||"unknown_auth_error"),y}},loginWithFarcaster:async()=>{if(!n)throw new bn;if(!(t.authFlow instanceof Wi))throw new T("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),X.current="farcaster"}catch(y){throw D(W,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:d,isNewUser:p}=await t.authenticate()),X.current="farcaster"}catch(y){throw D(W,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}c(d||null),P(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(X.current=d,jl()){if(d==="google"&&Dl(window.navigator.userAgent)){rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let y=new Dr({provider:d});p&&y.addCaptchaToken(p),t.startAuthFlow(y);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof Dr))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=ct.get(Yo),y=t.authFlow.meta.stateCode;if(p!==y)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:y??""}),new T("Unexpected auth flow. This may be a phishing attempt.");let v,N;if(a)try{v=await t.link(),X.current=d}catch(V){throw D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{({user:v,isNewUser:N}=await t.authenticate()),X.current=d}catch(V){throw te.current==="login"?D(W,"login","onError",V.privyErrorCode||"unknown_auth_error"):te.current==="link"&&D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}c(v),P(N||!1),l(!0)},async initLoginWithHeadlessOAuth(d,p){if(jl()){if(d==="google"&&Dl(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 y=new Dr({provider:d,headless:!0});p&&y.addCaptchaToken(p);let v=await t.startAuthFlow(y).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){x(!0),t.startAuthFlow(new Dr(d));let p=ct.get(Yo),y=d.stateCode;if(p!==y)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d.provider,storedStateCode:p??"",returnedStateCode:y??""}),x(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let v,N;if(a)try{v=await t.link(),X.current=d.provider}catch(V){throw D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{({user:v,isNewUser:N}=await t.authenticate()),X.current=d.provider}catch(V){throw te.current==="login"?D(W,"login","onError",V.privyErrorCode||"unknown_auth_error"):te.current==="link"&&D(W,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}return c(v),P(N||!1),l(!0),x(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let y=new To(d,p);t.startAuthFlow(y);try{X.current="email",await y.sendCodeEmail()}catch(v){throw te.current==="login"?D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"):te.current==="link"&&D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},initUpdateEmail:async(d,p,y)=>{let v=new Aa(d,p,y);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{let y=new en(d,p);t.startAuthFlow(y);try{X.current="sms",await y.sendSmsCode()}catch(v){throw te.current==="login"?D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"):te.current==="link"&&D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new bn;if(t.authFlow instanceof To)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof en)t.authFlow.meta.smsCode=d.trim();else throw new T("Must initialize a passwordless code flow first");let p,y;if(a)try{p=await t.link()}catch(v){throw D(W,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}else try{({user:p,isNewUser:y}=await t.authenticate())}catch(v){throw D(W,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),P(y||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:R,createAnalyticsEvent:(d,p,y)=>t.createAnalyticsEvent(d,p,y),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let y=s?.linkedAccounts.find(N=>N.type==="wallet"&&N.walletClientType==="privy"),v=await Ye();if(!v||!R||!y){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ne(!0);try{await R.connect({accessToken:v,address:y.address}),d(!0)}catch(N){on(N)&&y.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:y.address}),(await R.recover({address:y.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:y.address}),d(!0)):on(N)?(Y({recoverWallet:{privyWallet:y,onFailure:p,onSuccess:()=>d(!0)}}),J("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(N)}}),getFiatOnRampConfig:Or,setReadyToTrue:()=>{i(!0),Ne?.()},updateWallets:()=>Po(),fundWallet:async(d,p)=>{let{signedUrl:y,externalTransactionId:v}=await Or(d,p);Y({fiatOnRampPrompt:{signedUrl:y},fiatOnRampStatus:{externalTransactionId:v}}),J("FIAT_ON_RAMP_PROMPT_SCREEN")}}))();qg=Se.recoverEmbeddedWallet;let b1=(0,Z.useMemo)(()=>({wallets:u,ready:ze}),[u,ze]);return(0,Ot.jsx)(ue.Provider,{value:Cn,children:(0,Ot.jsx)(yc.Provider,{value:W,children:(0,Ot.jsx)(vd.Provider,{value:b1,children:(0,Ot.jsxs)(Mu,{...O,children:[e.children,(0,Ot.jsxs)(hc.Provider,{value:Se,children:[!Rd&&O.captchaEnabled&&n&&!a&&(0,Ot.jsx)(Cs,{delayedExecution:!1}),(0,Ot.jsx)(Ng,{theme:{...O.appearance.palette||{}}}),(0,Ot.jsx)(Pu,{data:re,setModalData:Y,setInitialScreen:S,initialScreen:C,authenticated:a,open:r,children:(0,Ot.jsx)(Fg,{open:r})}),ce&&Q?(0,Ot.jsx)(Bg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Eo,mfaSubmitPromise:Lr,onLoad:K,onLoadFailed:()=>null}):null]})]})})})})};var Kg=require("react");function Yg(e){let{login:t}=(0,Kg.useContext)(ue);return We("login",e),{login:t}}var Jg=require("react");function Zg(e){let{logout:t}=(0,Jg.useContext)(ue);return We("logout",e),{logout:t}}var wa=require("react");function Qg(){let e=Ee(),t=fs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=G(),l=(0,wa.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new wr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,wa.useCallback)(async()=>{let c=Oi();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{Ni()}},[o]);return(0,wa.useEffect)(()=>{let c=Oi();i&&t&&c.inProgress&&c.headless&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var Sd=require("react");var Xg=()=>{let e=Ee(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=(0,Sd.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,Sd.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new wr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var _d=require("react");var e1=()=>{let e=Ee(),{initLoginWithSms:t,loginWithCode:r}=G(),o=(0,_d.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),n=(0,_d.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new wr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var t1=require("react");function r1(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkFarcaster:g}=(0,t1.useContext)(ue);return We("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkFarcaster:g}}var o1=require("react");function n1(e){let{connectWallet:t}=(0,o1.useContext)(ue);return We("connectWallet",e),{connectWallet:t}}var i1=require("react");function a1(e){let{createWallet:t}=(0,i1.useContext)(ue);return We("createWallet",e),{createWallet:t}}var s1=()=>{let{fundWallet:e}=G();return{fundWallet:e}};var l1=require("react");function c1(e){let{sendTransaction:t}=(0,l1.useContext)(ue);return We("sendTransaction",e),{sendTransaction:t}}var d1=require("react");function p1(e){let{setWalletPassword:t}=(0,d1.useContext)(ue);return We("setWalletPassword",e),{setWalletPassword:t}}var u1=require("react");function m1(e){let{signMessage:t}=(0,u1.useContext)(ue);return We("signMessage",e),{signMessage:t}}var f1=require("react");function h1(e){let{signTypedData:t}=(0,f1.useContext)(ue);return We("signTypedData",e),{signTypedData:t}}var y1=require("react");var g1=()=>{let{isModalOpen:e}=(0,y1.useContext)(ue);return{isOpen:e}};var v1=require("react");function w1(e){let{getAccessToken:t}=(0,v1.useContext)(ue);return We("accessToken",e),{getAccessToken:t}}function C1(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
|