@privy-io/react-auth 1.59.8 → 1.59.9
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 +188 -188
- package/dist/index.d.ts +1 -1
- package/dist/index.js +183 -183
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Qs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var nd=(e,t,r)=>(Qs(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(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)},Xs=(e,t,r,o)=>(Qs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var id=(e,t,r)=>(Qs(e,t,"access private method"),r);import{getAddress as Ks}from"@ethersproject/address";import{Web3Provider as Xc}from"@ethersproject/providers";import{createStore as IE}from"mipd";import{useCallback as ME,useEffect as Or,useMemo as WE,useRef as Fn,useState as Me}from"react";import{FetchError as qy}from"ofetch";var $e=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},nr=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},S=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Fi=class extends S{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Z=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof $e)return e;if(!(e instanceof qy))return rt(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)},rt=e=>e instanceof $e?e:e instanceof Error?new S(e.message,e):new S(`Internal error: ${e}`);var Oo=class extends S{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends S{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ui=class extends S{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Bi="/api/v1/sessions",Hi="/api/v1/sessions/logout",ad="/api/v1/sessions/fork",Gi="/api/v1/sessions/fork/recover",sd="/api/v1/siwe/init",ld="/api/v1/siwe/authenticate",cd="/api/v1/siwe/link",dd="/api/v1/siwe/unlink",pd="/api/v1/farcaster/init",ud="/api/v1/farcaster/authenticate",md="/api/v1/farcaster/link",fd="/api/v1/farcaster/status",hd="/api/v1/farcaster/unlink",yd="/api/v1/passwordless/init",gd="/api/v1/passwordless/authenticate",vd="/api/v1/passwordless/link",wd="/api/v1/passwordless/unlink",Cd="/api/v1/passwordless/update",bd="/api/v1/passwordless_sms/init",Ed="/api/v1/passwordless_sms/link",Td="/api/v1/passwordless_sms/unlink",Pd="/api/v1/passwordless_sms/authenticate",xd="/api/v1/oauth/init",Sd="/api/v1/oauth/authenticate",_d="/api/v1/oauth/link",Ad="/api/v1/oauth/unlink";var kd="/api/v1/mfa/passwordless_sms/init",Rd="/api/v1/mfa/passwordless_sms/enroll";var Id="/api/v1/users/me/accept_terms",Md="/api/v1/analytics_events",Wd="/api/v1/plugins/moonpay_on_ramp/sign",Ld="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");try{let t=await this.api.post(Ld,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){throw new Error("Unimplemented")}};var Fr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(gd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(vd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(t)}}async sendCodeEmail(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new S("Email must be set when initialzing authentication.");try{return await this.api.post(yd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},Vi=class extends Fr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new S("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Cd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};import{isMobile as Jy,isIOS as Zy}from"react-device-detect";var el=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)}},zi=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function tl(){try{let e="privy:__session_storage__test",t="blobby",r=new zi;return r.put(e,t),r.del(e),!0}catch{return!1}}function $y(){return typeof window<"u"&&window.localStorage?new zi:new el}var j=$y();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Od(){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 qi=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 rl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||qi(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!rl(r))return!1}return!0},Ur=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Nd=()=>{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 Dd="1.59.8";var ol="4df5e2316331463a9130964bd6078dfa",nl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Fd="34357d3c125c2bcf2ce2bc3309d98715",$i="https://auth.privy.io",Ud=2e4,Oe=1400,Bd=2500,il=Dd;var mo="privy:token",al="privy-token",ji="privy:refresh_token",sl="privy-refresh-token",Ki="privy-session",Hn="privy:session_transfer_token",Ky="privy:wallet",Gn="privy:caid",fo="privy:state_code",Do="privy:code_verifier",ho="privy:headless_oauth",Yi=e=>`${Ky}:${e}`,ll="privy:connectors",cl="privy:connections";var yo=12e4,xr=1,dl="0x1",Fo=3e4,Hd="https://api.moonpay.com/v1",Gd="https://api.moonpay.com/v1",Vd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",zd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",qd="0x420000000000000000000000000000000000000F",$d=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var jd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ji=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,}))$/),Kd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Br=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},pl=e=>new Promise(t=>setTimeout(t,e));function Yd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Jd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await pl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Zi=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Zd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Qd(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Od()){let u=qi(d);if(!l.some(y=>y.info.name===u)){if(rl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Qi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+ol:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+nl:i=a.rpcUrls.default?.http[0];if(!i)throw new Z(`No RPC url found for ${e}`);return i},Xd=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new Z(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Sr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+ol):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+nl):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new Z(`No RPC url found for ${e}`);return i},Xi=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 ea=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function Yy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var ep=e=>e in Ho,tp=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function rp(e,t){let r=Yy(t);if(r.deepLink)return sp(r.deepLink,e);if(r.universalLink)return lp(r.universalLink,e);throw new S(`Unsupported wallet ${t.id}`)}var op="WALLETCONNECT_DEEPLINK_CHOICE";function np(){try{localStorage.removeItem(op)}catch{}}function ip({href:e,name:t}){try{localStorage.setItem(op,JSON.stringify({href:e,name:t}))}catch{}}function ap(e){return e.startsWith("http://")||e.startsWith("https://")}function sp(e,t){if(ap(e))return lp(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 lp(e,t){if(!ap(e))return sp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ta(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 Vn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");try{let t=await this.api.post(ud,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new S("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{return await this.api.post(md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new S("Auth flow has no API instance");let t=await this.api.post(pd,{token:this.captchaToken});Jy&&!Zy&&t.connect_uri&&ta(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new S("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");let t=await this.api.get(fd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as pp}from"jose";async function cp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function dp(e){return crypto.getRandomValues(new Uint8Array(e))}function ra(){return!!j.get(ho)}var Qy="S256",Xy="S256",ir=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ra();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 S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(Sd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),this.meta.headless&&j.del(ho),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ue(r);throw o.privyErrorCode?new S(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new S("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new S("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(_d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),r}catch(r){throw ue(r)}}createCodeVerifier(){return pp.encode(dp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=Qy){if(r==Xy){let o=await cp(t);return pp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.provider)throw new S("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Do,t);let r=this.createStateCode();j.put(fo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(ho,!0);try{return await this.api.post(xd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function ul(e){return e.charAt(0).toUpperCase()+e.slice(1)}function up(e,t){let r={detail:"",retryable:!1},o=ul(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 qn(){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:ra()}}function $n(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),j.del(fo),window.history.replaceState({},"",e)}var vo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
var Qs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var nd=(e,t,r)=>(Qs(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(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)},Xs=(e,t,r,o)=>(Qs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var id=(e,t,r)=>(Qs(e,t,"access private method"),r);import{getAddress as Ks}from"@ethersproject/address";import{Web3Provider as Xc}from"@ethersproject/providers";import{createStore as ME}from"mipd";import{useCallback as WE,useEffect as Or,useMemo as LE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},nr=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},S=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Fi=class extends S{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Z=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return rt(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)},rt=e=>e instanceof $e?e:e instanceof Error?new S(e.message,e):new S(`Internal error: ${e}`);var Oo=class extends S{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends S{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ui=class extends S{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Bi="/api/v1/sessions",Hi="/api/v1/sessions/logout",ad="/api/v1/sessions/fork",Gi="/api/v1/sessions/fork/recover",sd="/api/v1/siwe/init",ld="/api/v1/siwe/authenticate",cd="/api/v1/siwe/link",dd="/api/v1/siwe/unlink",pd="/api/v1/farcaster/init",ud="/api/v1/farcaster/authenticate",md="/api/v1/farcaster/link",fd="/api/v1/farcaster/status",hd="/api/v1/farcaster/unlink",yd="/api/v1/passwordless/init",gd="/api/v1/passwordless/authenticate",vd="/api/v1/passwordless/link",wd="/api/v1/passwordless/unlink",Cd="/api/v1/passwordless/update",bd="/api/v1/passwordless_sms/init",Ed="/api/v1/passwordless_sms/link",Td="/api/v1/passwordless_sms/unlink",Pd="/api/v1/passwordless_sms/authenticate",xd="/api/v1/oauth/init",Sd="/api/v1/oauth/authenticate",_d="/api/v1/oauth/link",Ad="/api/v1/oauth/unlink";var kd="/api/v1/mfa/passwordless_sms/init",Rd="/api/v1/mfa/passwordless_sms/enroll";var Id="/api/v1/users/me/accept_terms",Md="/api/v1/analytics_events",Wd="/api/v1/plugins/moonpay_on_ramp/sign",Ld="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");try{let t=await this.api.post(Ld,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){throw new Error("Unimplemented")}};var Fr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(gd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(vd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(t)}}async sendCodeEmail(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new S("Email must be set when initialzing authentication.");try{return await this.api.post(yd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},Vi=class extends Fr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new S("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Cd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};import{isMobile as Zy,isIOS as Qy}from"react-device-detect";var el=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)}},zi=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function tl(){try{let e="privy:__session_storage__test",t="blobby",r=new zi;return r.put(e,t),r.del(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new zi:new el}var j=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Od(){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 qi=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 rl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||qi(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!rl(r))return!1}return!0},Ur=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Nd=()=>{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 Dd="1.59.9";var ol="4df5e2316331463a9130964bd6078dfa",nl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Fd="34357d3c125c2bcf2ce2bc3309d98715",$i="https://auth.privy.io",Ud=2e4,Oe=1400,Bd=2500,il=Dd;var mo="privy:token",al="privy-token",ji="privy:refresh_token",sl="privy-refresh-token",Ki="privy-session",Hn="privy:session_transfer_token",Yy="privy:wallet",Gn="privy:caid",fo="privy:state_code",Do="privy:code_verifier",ho="privy:headless_oauth",Yi=e=>`${Yy}:${e}`,ll="privy:connectors",cl="privy:connections";var yo=12e4,xr=1,dl="0x1",Fo=3e4,Hd="https://api.moonpay.com/v1",Gd="https://api.moonpay.com/v1",Vd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",zd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",qd="0x420000000000000000000000000000000000000F",$d=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var jd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ji=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,}))$/),Kd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Br=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},pl=e=>new Promise(t=>setTimeout(t,e));function Yd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Jd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await pl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Zi=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Zd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Qd(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Od()){let u=qi(d);if(!l.some(y=>y.info.name===u)){if(rl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Qi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+ol:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+nl:i=a.rpcUrls.default?.http[0];if(!i)throw new Z(`No RPC url found for ${e}`);return i},Xd=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new Z(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Sr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+ol):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+nl):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new Z(`No RPC url found for ${e}`);return i},Xi=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 ea=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function Jy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var ep=e=>e in Ho,tp=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function rp(e,t){let r=Jy(t);if(r.deepLink)return sp(r.deepLink,e);if(r.universalLink)return lp(r.universalLink,e);throw new S(`Unsupported wallet ${t.id}`)}var op="WALLETCONNECT_DEEPLINK_CHOICE";function np(){try{localStorage.removeItem(op)}catch{}}function ip({href:e,name:t}){try{localStorage.setItem(op,JSON.stringify({href:e,name:t}))}catch{}}function ap(e){return e.startsWith("http://")||e.startsWith("https://")}function sp(e,t){if(ap(e))return lp(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 lp(e,t){if(!ap(e))return sp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ta(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 Vn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");try{let t=await this.api.post(ud,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new S("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{return await this.api.post(md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new S("Auth flow has no API instance");let t=await this.api.post(pd,{token:this.captchaToken});Zy&&!Qy&&t.connect_uri&&ta(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new S("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");let t=await this.api.get(fd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as pp}from"jose";async function cp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function dp(e){return crypto.getRandomValues(new Uint8Array(e))}function ra(){return!!j.get(ho)}var Xy="S256",eg="S256",ir=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ra();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 S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(Sd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),this.meta.headless&&j.del(ho),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ue(r);throw o.privyErrorCode?new S(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new S("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new S("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(_d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),r}catch(r){throw ue(r)}}createCodeVerifier(){return pp.encode(dp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=Xy){if(r==eg){let o=await cp(t);return pp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.provider)throw new S("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Do,t);let r=this.createStateCode();j.put(fo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(ho,!0);try{return await this.api.post(xd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function ul(e){return e.charAt(0).toUpperCase()+e.slice(1)}function up(e,t){let r={detail:"",retryable:!1},o=ul(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 qn(){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:ra()}}function $n(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),j.del(fo),window.history.replaceState({},"",e)}var vo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${r}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${i}
|
|
10
10
|
Issued At: ${a}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new ot(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 S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(ld,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(cd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ue(t)}}async sign(){if(!this.api)throw new S("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new S("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 S("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(sd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new S("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Ed,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(t)}}async sendSmsCode(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new S("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(bd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};import{v4 as Vg}from"uuid";function nt(e){return new Date(e*1e3)}function eg(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:nt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let a={address:r.address,type:r.type,verifiedAt:nt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:nt(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:nt(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:nt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:nt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:nt(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:nt(r.verified_at)});break;case"farcaster":let v={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:nt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function _t(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,tg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),At=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!tg(e)?.length;function Ct(e){if(!e)return null;let t=eg(e.linked_accounts),r=_t(t,"wallet"),o=_t(t,"email"),n=_t(t,"phone"),a=_t(t,"google_oauth"),i=_t(t,"twitter_oauth"),l=_t(t,"discord_oauth"),s=_t(t,"github_oauth"),d=_t(t,"spotify_oauth"),u=_t(t,"tiktok_oauth"),y=_t(t,"linkedin_oauth"),f=_t(t,"apple_oauth"),g=_t(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:nt(C)}));return{id:e.id,createdAt:nt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Kp}from"@ethersproject/address";import Ug from"eventemitter3";import pg from"@coinbase/wallet-sdk";import{jsx as mp,jsxs as rg}from"react/jsx-runtime";var oa=({style:e,...t})=>rg("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:[mp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),mp("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as sr}from"@ethersproject/address";import{Web3Provider as wp}from"@ethersproject/providers";import{default as cg}from"eventemitter3";import lg from"eventemitter3";var og=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fp=e=>og.includes(e);import{ErrorCode as ng}from"@ethersproject/logger";var Go=class extends Z{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends Z{constructor(){super("User rejected connection");this.type="wallet_error"}},zt=e=>{if(e instanceof Z)return e;if(e?.code&&e?.reason){let t=new xe(e);return e.code===ng.ACTION_REJECTED&&(t.details=je.E4001_USER_REJECTED_REQUEST),t}return e?.code?new xe(e):new Z("Unknown connector error",e)},kt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},xe=class extends kt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(je).find(a=>a.eipCode===o.code);this.details=n||je.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=je.E32002_CONNECTION_ALREADY_PENDING:this.details=je.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=je.E32002_WALLET_LOCKED))}},ig={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}},ag={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}},sg={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}},je={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...sg,...ag},_r={...ig,...je};var be=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Go,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new Z(`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 zt(r)})}},Hr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},na=class extends lg{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=Sr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Hr("Disconnected",4900);return(await gp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`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 Hr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Sr(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 hp(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 yp(Xi(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:go(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return go(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(fp(r.method)){let o=await ve();if(await vp(),!o||!this.address)throw new Hr("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 Hr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},ar=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Gr=class extends be{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var dg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},mt=class extends cg{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Bo(r),this.walletClientType==="privy"&&j.put(Yi(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>sr(i.address)===sr(r));return{address:sr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new Z("Wallet is not currently connected.");let l=this.wallets.find(f=>sr(f.address)===sr(r))?.chainId;if(!l)throw new Z("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new Z(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(dg(f,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new Z(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new wp(new ar(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new Gr(this.proxyProvider)},sign:async i=>{if(!await a())throw new Z("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=sr(n),i=[],l;if(this.walletClientType==="privy"){let d=j.get(Yi(a));this.chains.find(u=>u.id===Number(d))||(j.del(Yi(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${dl}`,d),l=dl}let s=Bo(l);if(!i.find(d=>sr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(sr(n),s,d))}ia(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>sr(n)===sr(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 wp(new ar(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var qo={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var ug=(e,t)=>{let o=Qi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},aa,sa=class extends mt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),aa||(aa=new pg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(ug(aa,a))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){aa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:oa,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 Z("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};import{jsx as Cp}from"react/jsx-runtime";var la=({...e})=>Cp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Cp("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 ca=class extends mt{constructor(r,o,n,a){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:la,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as bp}from"react/jsx-runtime";var $o=({style:e,...t})=>bp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:bp("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as bt,jsxs as mg}from"react/jsx-runtime";var jo=({style:e,...t})=>mg("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),bt("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),bt("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),bt("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),bt("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),bt("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),bt("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),bt("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),bt("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),bt("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),bt("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),bt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Ep,jsxs as fg}from"react/jsx-runtime";var lr=({style:e,...t})=>fg("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:[Ep("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Ep("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Yo=class extends mt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}},Ko,Jo=class extends mt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Di(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Xs(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&Xs(this,Ko,{name:"Phantom",icon:lr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return nd(this,Ko)??{name:"Browser Extension",icon:$o,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};Ko=new WeakMap;import{getAddress as PT}from"@ethersproject/address";import{Web3Provider as ST}from"@ethersproject/providers";import{isMobile as hg}from"react-device-detect";var da=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{hg||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 Z("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw zt(t)}}};var pa=class extends mt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var ua=class extends pa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:lr,id:"phantom"}}};import{EthereumProvider as Og,OPTIONAL_EVENTS as Ng,OPTIONAL_METHODS as Dg}from"@walletconnect/ethereum-provider";import{isMobile as Fg}from"react-device-detect";import{createContext as _g,useContext as Ag,useEffect as yl,useRef as kg,useState as Rg}from"react";import{jsx as yg}from"react/jsx-runtime";function ma({src:e,...t}){return yg("img",{src:e,...t,style:{display:"none"}})}import{useContext as Vp,useEffect as Gp,useMemo as Tg,useState as Pg}from"react";import{createContext as xg}from"react";var Rt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Fd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Tp=({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 gg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Pp=e=>gg.has(e),xp=(e,t,r)=>r.indexOf(e)===t,Sp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Pp).filter(xp):e?e.filter(Pp).filter(xp):Rt.appearance.walletList;var fa={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 ha={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 ya={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 _p={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 Ap={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 ga={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 va={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 wa={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 kp={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 Rp={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 Ip={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Ca={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 ba={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 Ea={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 jn={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 Kn={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 Dp={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 Fp={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 Ta={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 Pa={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var xa={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Yn=[fa,ha,ya,Wp,Fp,qo,Ca,ba,Ea,jn,Kn,kp,Rp,Ip,Mp,ga,va,wa,Op,Np,_p,Ap,Ta,xa,Pa,Lp,Dp],q6=new Set(Yn.map(e=>e.id));import Co from"tinycolor2";var Up="#FFFFFF",vg="#000000",wg=Up,Cg="#1E1E1D";function bg(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 Vr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Bp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Up,blackHex:i=vg}){let l;switch(e){case"light":l=wg;break;case"dark":l=Cg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=bg(s.getLuminance()),E=Vr(s,g==="light"?-.04:.11),v=Vr(s,g==="light"?-.88:.87),x=Vr(s,g==="light"?-.77:.75),C=Vr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=Vr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Vr(d,.15),M=Vr(d,-.06),k=Co(d.getLuminance()>.5?i:a),B=Vr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function ml(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,x,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),x=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,x,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=Sp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Tp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Eg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,Y=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,re=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Y?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??re:se=re,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!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:Bp({backgroundTheme:t?.appearance?.theme??Rt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Rt.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:x,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Rt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Rt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Rt.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Rt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Y?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Y?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Rt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Rt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Rt._render.inParentNodeId}}}function Hp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Eg({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:Yn.find(u=>u.id===s.id)??s)}else n=Yn.concat(e??[]);let a=t?n[0]:qo,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}import{jsx as Sg}from"react/jsx-runtime";var zp={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:""},fl=ml(zp,void 0,!1),hl=xg({appConfig:fl,isServerConfigLoaded:!1}),qp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=Pg(null),i=Tg(()=>ml(n??zp,o,!!n),[n,o]);return Gp(()=>{let l=Hp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),Gp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Sg(hl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Sa=()=>{let{appConfig:e}=Vp(hl);return e},_a=()=>{let{isServerConfigLoaded:e}=Vp(hl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Mg,jsxs as Wg}from"react/jsx-runtime";var $p=_g({ready:!1,app:fl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Ig=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],jp=e=>{let t=Sa(),r=e.authenticated,[o,n]=Rg(e.initialScreen);yl(()=>{!r&&!Ig.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=kg(null);yl(()=>{e.open||(a.current=null)},[e.open]),yl(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return Wg($p.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Mg(ma,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Ag($p);import{jsx as Zo,jsxs as Lg}from"react/jsx-runtime";var Jn=({style:e,...t})=>{let{app:r}=_();return Lg("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var cr=class extends mt{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ea(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:jo,id:"io.metamask"}:{name:Zd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Jn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Ho[r],this.walletClientType=r,this.redirectUri=void 0,np(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new Z("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ea(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(zt(i));return}o(new Z("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Qi(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Og.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Ng,optionalMethods:Dg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Fg&&this.walletEntry){let{redirect:l,href:s}=rp(i,this.walletEntry);ip({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ta(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ea(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var gl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Kp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Zn=class extends Ug{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;j.get(ll)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(ll));let r=Qd(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Ur()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new na(r,o,this.rpcConfig,this.chains,a,n.id),s=new ca(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof cr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new da(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new sa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ua(this.defaultChain):new cr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=j.get(cl);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));j.put(cl,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=Kp(r),this.emit("walletsUpdated")}};function ia(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}import{ofetch as Bg}from"ofetch";var Hg=[Bi,Gi,Hi],Aa=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=il,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Bg.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Hg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Fi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};import bo from"js-cookie";function Yp(e){return e instanceof Fr?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ir?e.meta.provider:null}import*as Jp from"jose";var dr=class{static parse(t){try{return new dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Jp.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 Gg=30,ka=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=j.get(mo);return typeof t=="string"?new dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(ji);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Ki);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=dr.parse(this.token);return t!==null&&!t.isExpired(Gg)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Yp(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Ct(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link();return Ct(r)}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new S("Session has no API instance");if(!this.client)throw new S("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Bi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Gi,{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),Ct(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 rt(n)}}async _destroy(){try{await this.api?.post(Hi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new S("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ad,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(mo);if(j.put(mo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=dr.parse(t)?.expiration;bo.set(al,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(mo),bo.remove(al)}storeRefreshToken(t){typeof t=="string"?(j.put(ji,t),this.client?.useServerCookies||(bo.set(Ki,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(sl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(ji),bo.remove(sl),bo.remove(Ki))}clearForkedToken(){j.del(Hn)}};var vl,Ra,Zp,Qn=class{constructor(t){Di(this,Ra);this.apiUrl=t.apiUrl||$i,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ud,this.appId=t.appId,this.clientAnalyticsId=id(this,Ra,Zp).call(this),vl||(vl=new ka),this.session=vl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Zn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Aa(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 S("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new S("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(wd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(Id,{});return Ct(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Td,{phoneNumber:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(dd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Ad,{provider:t,subject:r});return Ct(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(hd,{fid:t});return Ct(r)}catch(r){throw rt(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(Md,{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(Wd,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?dr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=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 rt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Ra=new WeakSet,Zp=function(){if(typeof window>"u")return null;try{let r=j.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Vg();try{return j.put(Gn,t),t}catch{return t}};import{Turnstile as Yg}from"@marsidev/react-turnstile";import{useEffect as Jg,useMemo as Zg}from"react";import{useMemo as zg,useRef as qg,useContext as $g,useState as wl,createContext as jg}from"react";import{jsx as Kg}from"react/jsx-runtime";var Qp=jg({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),qt=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Xp=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=qg(null),[a,i]=wl(),[l,s]=wl(),[d,u]=wl(!1),y=zg(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Kg(Qp.Provider,{value:{...y,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Yd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new qt("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>$g(Qp);import{jsx as eu}from"react/jsx-runtime";var Cl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=Zg(()=>r?.split("t:")||[],[r]);if(Jg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return eu("div",{className:"hidden h-0 w-0",children:eu(Yg,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as yE,useEffect as Ay,useRef as gE,useState as vE}from"react";import wE from"react-dom";import{createContext as Qg,useContext as Xg}from"react";var bl=Qg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>Xg(bl);import{createContext as e1,useContext as t1}from"react";var ce=e1({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>t1(ce);import{useEffect as r1,useState as o1}from"react";var tu=e=>{let[t,r]=o1("auto");return r1(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as n1,useContext as i1,useEffect as a1}from"react";var ru={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:[]}},El=n1(void 0),ou=()=>i1(El);function Ee(e,t){if(!t)return;let o=ou().current[e];return a1(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function nu(){let e=ou();return(t,r,...o)=>N(e,t,r,...o)}function Tl(e){Ee("configureMfa",e)}import mu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import b1 from"@heroicons/react/24/solid/DocumentCheckIcon";import E1 from"styled-components";import To,{css as _l}from"styled-components";import xl from"styled-components";import{Fragment as l1,jsx as Pl,jsxs as c1}from"react/jsx-runtime";var It=({success:e,fail:t})=>c1(l1,{children:[Pl(ft,{className:e?"success":t?"fail":""}),Pl(Sl,{className:e?"success":t?"fail":""})]}),ft=xl.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new ot(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 S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(ld,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(cd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ue(t)}}async sign(){if(!this.api)throw new S("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new S("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 S("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(sd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new S("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Ed,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(t)}}async sendSmsCode(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new S("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(bd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};import{v4 as zg}from"uuid";function nt(e){return new Date(e*1e3)}function tg(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:nt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let a={address:r.address,type:r.type,verifiedAt:nt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:nt(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:nt(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:nt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:nt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:nt(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:nt(r.verified_at)});break;case"farcaster":let v={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:nt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function _t(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,rg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),At=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!rg(e)?.length;function Ct(e){if(!e)return null;let t=tg(e.linked_accounts),r=_t(t,"wallet"),o=_t(t,"email"),n=_t(t,"phone"),a=_t(t,"google_oauth"),i=_t(t,"twitter_oauth"),l=_t(t,"discord_oauth"),s=_t(t,"github_oauth"),d=_t(t,"spotify_oauth"),u=_t(t,"tiktok_oauth"),y=_t(t,"linkedin_oauth"),f=_t(t,"apple_oauth"),g=_t(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:nt(C)}));return{id:e.id,createdAt:nt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Yp}from"@ethersproject/address";import Bg from"eventemitter3";import ug from"@coinbase/wallet-sdk";import{jsx as mp,jsxs as og}from"react/jsx-runtime";var oa=({style:e,...t})=>og("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:[mp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),mp("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as sr}from"@ethersproject/address";import{Web3Provider as wp}from"@ethersproject/providers";import{default as dg}from"eventemitter3";import cg from"eventemitter3";var ng=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fp=e=>ng.includes(e);import{ErrorCode as ig}from"@ethersproject/logger";var Go=class extends Z{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends Z{constructor(){super("User rejected connection");this.type="wallet_error"}},zt=e=>{if(e instanceof Z)return e;if(e?.code&&e?.reason){let t=new xe(e);return e.code===ig.ACTION_REJECTED&&(t.details=je.E4001_USER_REJECTED_REQUEST),t}return e?.code?new xe(e):new Z("Unknown connector error",e)},kt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},xe=class extends kt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(je).find(a=>a.eipCode===o.code);this.details=n||je.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=je.E32002_CONNECTION_ALREADY_PENDING:this.details=je.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=je.E32002_WALLET_LOCKED))}},ag={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}},sg={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}},lg={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}},je={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...lg,...sg},_r={...ag,...je};var be=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Go,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new Z(`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 zt(r)})}},Hr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},na=class extends cg{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=Sr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Hr("Disconnected",4900);return(await gp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`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 Hr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Sr(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 hp(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 yp(Xi(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:go(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return go(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(fp(r.method)){let o=await ve();if(await vp(),!o||!this.address)throw new Hr("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 Hr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},ar=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Gr=class extends be{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var pg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},mt=class extends dg{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Bo(r),this.walletClientType==="privy"&&j.put(Yi(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>sr(i.address)===sr(r));return{address:sr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new Z("Wallet is not currently connected.");let l=this.wallets.find(f=>sr(f.address)===sr(r))?.chainId;if(!l)throw new Z("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new Z(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(pg(f,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new Z(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new wp(new ar(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new Gr(this.proxyProvider)},sign:async i=>{if(!await a())throw new Z("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=sr(n),i=[],l;if(this.walletClientType==="privy"){let d=j.get(Yi(a));this.chains.find(u=>u.id===Number(d))||(j.del(Yi(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${dl}`,d),l=dl}let s=Bo(l);if(!i.find(d=>sr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(sr(n),s,d))}ia(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>sr(n)===sr(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 wp(new ar(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var qo={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var mg=(e,t)=>{let o=Qi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},aa,sa=class extends mt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),aa||(aa=new ug({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(mg(aa,a))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){aa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:oa,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 Z("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};import{jsx as Cp}from"react/jsx-runtime";var la=({...e})=>Cp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Cp("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 ca=class extends mt{constructor(r,o,n,a){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:la,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as bp}from"react/jsx-runtime";var $o=({style:e,...t})=>bp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:bp("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as bt,jsxs as fg}from"react/jsx-runtime";var jo=({style:e,...t})=>fg("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),bt("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),bt("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),bt("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),bt("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),bt("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),bt("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),bt("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),bt("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),bt("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),bt("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),bt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Ep,jsxs as hg}from"react/jsx-runtime";var lr=({style:e,...t})=>hg("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:[Ep("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Ep("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Yo=class extends mt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}},Ko,Jo=class extends mt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Di(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Xs(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&Xs(this,Ko,{name:"Phantom",icon:lr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return nd(this,Ko)??{name:"Browser Extension",icon:$o,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};Ko=new WeakMap;import{getAddress as xT}from"@ethersproject/address";import{Web3Provider as _T}from"@ethersproject/providers";import{isMobile as yg}from"react-device-detect";var da=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{yg||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 Z("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw zt(t)}}};var pa=class extends mt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var ua=class extends pa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:lr,id:"phantom"}}};import{EthereumProvider as Ng,OPTIONAL_EVENTS as Dg,OPTIONAL_METHODS as Fg}from"@walletconnect/ethereum-provider";import{isMobile as Ug}from"react-device-detect";import{createContext as Ag,useContext as kg,useEffect as yl,useRef as Rg,useState as Ig}from"react";import{jsx as gg}from"react/jsx-runtime";function ma({src:e,...t}){return gg("img",{src:e,...t,style:{display:"none"}})}import{useContext as zp,useEffect as Vp,useMemo as Pg,useState as xg}from"react";import{createContext as Sg}from"react";var Rt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Fd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Tp=({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 vg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Pp=e=>vg.has(e),xp=(e,t,r)=>r.indexOf(e)===t,Sp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Pp).filter(xp):e?e.filter(Pp).filter(xp):Rt.appearance.walletList;var fa={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 ha={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 ya={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 _p={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 Ap={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 ga={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 va={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 wa={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 kp={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]},public:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var Rp={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 Ip={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Dp={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 Ca={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 ba={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 Ea={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 jn={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 Kn={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 Fp={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 Up={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 Ta={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 Pa={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var xa={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Yn=[fa,ha,ya,Lp,Up,qo,Ca,ba,Ea,jn,Kn,Rp,Ip,Mp,Wp,ga,va,wa,kp,Np,Dp,_p,Ap,Ta,xa,Pa,Op,Fp],K6=new Set(Yn.map(e=>e.id));import Co from"tinycolor2";var Bp="#FFFFFF",wg="#000000",Cg=Bp,bg="#1E1E1D";function Eg(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 Vr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Hp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Bp,blackHex:i=wg}){let l;switch(e){case"light":l=Cg;break;case"dark":l=bg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Eg(s.getLuminance()),E=Vr(s,g==="light"?-.04:.11),v=Vr(s,g==="light"?-.88:.87),x=Vr(s,g==="light"?-.77:.75),C=Vr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=Vr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Vr(d,.15),M=Vr(d,-.06),k=Co(d.getLuminance()>.5?i:a),B=Vr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function ml(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,x,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),x=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,x,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=Sp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Tp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Tg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,Y=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,re=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Y?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??re:se=re,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!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:Hp({backgroundTheme:t?.appearance?.theme??Rt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Rt.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:x,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Rt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Rt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Rt.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Rt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Y?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Y?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Rt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Rt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Rt._render.inParentNodeId}}}function Gp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Tg({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:Yn.find(u=>u.id===s.id)??s)}else n=Yn.concat(e??[]);let a=t?n[0]:qo,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}import{jsx as _g}from"react/jsx-runtime";var qp={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:""},fl=ml(qp,void 0,!1),hl=Sg({appConfig:fl,isServerConfigLoaded:!1}),$p=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=xg(null),i=Pg(()=>ml(n??qp,o,!!n),[n,o]);return Vp(()=>{let l=Gp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),Vp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),_g(hl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Sa=()=>{let{appConfig:e}=zp(hl);return e},_a=()=>{let{isServerConfigLoaded:e}=zp(hl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Wg,jsxs as Lg}from"react/jsx-runtime";var jp=Ag({ready:!1,app:fl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Mg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Kp=e=>{let t=Sa(),r=e.authenticated,[o,n]=Ig(e.initialScreen);yl(()=>{!r&&!Mg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Rg(null);yl(()=>{e.open||(a.current=null)},[e.open]),yl(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return Lg(jp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Wg(ma,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>kg(jp);import{jsx as Zo,jsxs as Og}from"react/jsx-runtime";var Jn=({style:e,...t})=>{let{app:r}=_();return Og("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var cr=class extends mt{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ea(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:jo,id:"io.metamask"}:{name:Zd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Jn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Ho[r],this.walletClientType=r,this.redirectUri=void 0,np(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new Z("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ea(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(zt(i));return}o(new Z("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Qi(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Ng.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Dg,optionalMethods:Fg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Ug&&this.walletEntry){let{redirect:l,href:s}=rp(i,this.walletEntry);ip({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ta(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ea(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var gl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Yp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Zn=class extends Bg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;j.get(ll)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(ll));let r=Qd(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Ur()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new na(r,o,this.rpcConfig,this.chains,a,n.id),s=new ca(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof cr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new da(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new sa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ua(this.defaultChain):new cr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=j.get(cl);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));j.put(cl,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=Yp(r),this.emit("walletsUpdated")}};function ia(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}import{ofetch as Hg}from"ofetch";var Gg=[Bi,Gi,Hi],Aa=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=il,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Hg.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Gg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Fi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};import bo from"js-cookie";function Jp(e){return e instanceof Fr?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ir?e.meta.provider:null}import*as Zp from"jose";var dr=class{static parse(t){try{return new dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Zp.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 Vg=30,ka=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=j.get(mo);return typeof t=="string"?new dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(ji);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Ki);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=dr.parse(this.token);return t!==null&&!t.isExpired(Vg)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Jp(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Ct(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link();return Ct(r)}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new S("Session has no API instance");if(!this.client)throw new S("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Bi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Gi,{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),Ct(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 rt(n)}}async _destroy(){try{await this.api?.post(Hi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new S("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ad,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(mo);if(j.put(mo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=dr.parse(t)?.expiration;bo.set(al,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(mo),bo.remove(al)}storeRefreshToken(t){typeof t=="string"?(j.put(ji,t),this.client?.useServerCookies||(bo.set(Ki,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(sl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(ji),bo.remove(sl),bo.remove(Ki))}clearForkedToken(){j.del(Hn)}};var vl,Ra,Qp,Qn=class{constructor(t){Di(this,Ra);this.apiUrl=t.apiUrl||$i,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ud,this.appId=t.appId,this.clientAnalyticsId=id(this,Ra,Qp).call(this),vl||(vl=new ka),this.session=vl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Zn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Aa(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 S("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new S("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(wd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(Id,{});return Ct(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Td,{phoneNumber:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(dd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Ad,{provider:t,subject:r});return Ct(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(hd,{fid:t});return Ct(r)}catch(r){throw rt(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(Md,{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(Wd,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?dr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=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 rt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Ra=new WeakSet,Qp=function(){if(typeof window>"u")return null;try{let r=j.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=zg();try{return j.put(Gn,t),t}catch{return t}};import{Turnstile as Jg}from"@marsidev/react-turnstile";import{useEffect as Zg,useMemo as Qg}from"react";import{useMemo as qg,useRef as $g,useContext as jg,useState as wl,createContext as Kg}from"react";import{jsx as Yg}from"react/jsx-runtime";var Xp=Kg({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),qt=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},eu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=$g(null),[a,i]=wl(),[l,s]=wl(),[d,u]=wl(!1),y=qg(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Yg(Xp.Provider,{value:{...y,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Yd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new qt("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>jg(Xp);import{jsx as tu}from"react/jsx-runtime";var Cl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=Qg(()=>r?.split("t:")||[],[r]);if(Zg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return tu("div",{className:"hidden h-0 w-0",children:tu(Jg,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as gE,useEffect as ky,useRef as vE,useState as wE}from"react";import CE from"react-dom";import{createContext as Xg,useContext as e1}from"react";var bl=Xg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>e1(bl);import{createContext as t1,useContext as r1}from"react";var ce=t1({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>r1(ce);import{useEffect as o1,useState as n1}from"react";var ru=e=>{let[t,r]=n1("auto");return o1(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as i1,useContext as a1,useEffect as s1}from"react";var ou={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:[]}},El=i1(void 0),nu=()=>a1(El);function Ee(e,t){if(!t)return;let o=nu().current[e];return s1(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function iu(){let e=nu();return(t,r,...o)=>N(e,t,r,...o)}function Tl(e){Ee("configureMfa",e)}import fu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import E1 from"@heroicons/react/24/solid/DocumentCheckIcon";import T1 from"styled-components";import To,{css as _l}from"styled-components";import xl from"styled-components";import{Fragment as c1,jsx as Pl,jsxs as d1}from"react/jsx-runtime";var It=({success:e,fail:t})=>d1(c1,{children:[Pl(ft,{className:e?"success":t?"fail":""}),Pl(Sl,{className:e?"success":t?"fail":""})]}),ft=xl.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -48,7 +48,7 @@ Resources:
|
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,Eo=e=>Pl(
|
|
51
|
+
`,Eo=e=>Pl(l1,{color:e.color||"var(--privy-color-foreground-3)"}),l1=xl(ft)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -85,13 +85,13 @@ Resources:
|
|
|
85
85
|
color: var(--privy-color-foreground-3);
|
|
86
86
|
cursor: not-allowed;
|
|
87
87
|
}
|
|
88
|
-
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(
|
|
88
|
+
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(au,{disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),o8=To(F)`
|
|
89
89
|
${e=>e.hideAnimations&&_l`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,Ma=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(
|
|
94
|
+
`,Ma=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(au,{as:"a",disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),au=To(Ia)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
`,$t=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(
|
|
139
|
+
`,$t=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(p1,{disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),p1=To(Ia)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,n8=To.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,Qo=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>La(
|
|
202
|
+
`,Qo=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>La(u1,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Mt("span",{children:e}),Mt("span",{children:Mt(Eo,{})})]}),u1=To.button`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -241,7 +241,7 @@ Resources:
|
|
|
241
241
|
cursor: not-allowed;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
`;import
|
|
244
|
+
`;import su from"styled-components";import{Fragment as m1,jsx as zr,jsxs as lu}from"react/jsx-runtime";var Al=su.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 Xo(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return zr(Al,{});if(!r&&!t)return zr(Al,{});let n=!!(t&&r);return
|
|
253
|
+
`;function Xo(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return zr(Al,{});if(!r&&!t)return zr(Al,{});let n=!!(t&&r);return lu(Al,{children:["By logging in I agree to the"," ",r&&zr("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&zr("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var V=({protectedByPrivy:e})=>zr(X,{children:e?lu(m1,{children:[zr(la,{className:"hide-on-mobile"}),zr("span",{className:"hide-on-mobile",children:zr("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),X=su.div`
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
justify-content: center;
|
|
@@ -277,7 +277,7 @@ Resources:
|
|
|
277
277
|
@media all and (display-mode: standalone) {
|
|
278
278
|
padding-bottom: 30px;
|
|
279
279
|
}
|
|
280
|
-
`;import
|
|
280
|
+
`;import f1 from"@heroicons/react/24/outline/ArrowLeftIcon";import h1 from"@heroicons/react/24/outline/XMarkIcon";import kl from"styled-components";import{jsx as Wt,jsxs as C1}from"react/jsx-runtime";var cu=()=>Wt("div",{}),y1=({backFn:e})=>Wt("div",{children:Wt(du,{onClick:e,children:Wt(f1,{height:"16px",width:"16px",strokeWidth:2})})}),g1=e=>Wt("div",{children:Wt(du,{"aria-label":"close modal",onClick:e.onClose,children:Wt(h1,{height:"16px",width:"16px",strokeWidth:2})})});var A=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=W(),{app:a}=_();return C1(v1,{children:[e?Wt(y1,{backFn:e}):Wt(cu,{}),r&&Wt(w1,{id:"privy-dialog-title",children:r}),a?.render.inDialog&&o?Wt(g1,{onClose:t||(()=>n())}):Wt(cu,{})]})},du=kl.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
|
+
`,v1=kl.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,14 +318,14 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,w1=kl.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
|
-
`;import en,{css as
|
|
328
|
+
`;import en,{css as b1}from"styled-components";var Oa=en.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
331
|
`,Na=en.div`
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,pu=b1`
|
|
352
352
|
&& {
|
|
353
353
|
width: 100%;
|
|
354
354
|
font-size: 16px;
|
|
@@ -387,9 +387,9 @@ Resources:
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
`,Se=en.button`
|
|
390
|
-
${
|
|
390
|
+
${pu}
|
|
391
391
|
`,Rl=en.a`
|
|
392
|
-
${
|
|
392
|
+
${pu}
|
|
393
393
|
`,Ar=en.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
@@ -421,7 +421,7 @@ Resources:
|
|
|
421
421
|
@media (max-width: 440px) {
|
|
422
422
|
padding: 10px 10px 20px;
|
|
423
423
|
}
|
|
424
|
-
`,
|
|
424
|
+
`,uu=Ne.div`
|
|
425
425
|
display: flex;
|
|
426
426
|
flex-direction: column;
|
|
427
427
|
align-items: stretch;
|
|
@@ -516,7 +516,7 @@ Resources:
|
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,mu=Ne.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
@@ -565,10 +565,10 @@ Resources:
|
|
|
565
565
|
width: auto !important;
|
|
566
566
|
color: white;
|
|
567
567
|
}
|
|
568
|
-
`;import{Fragment as
|
|
568
|
+
`;import{Fragment as S1,jsx as pr,jsxs as Xn}from"react/jsx-runtime";var hu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=_(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=W(),d=y=>{y?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async y=>{y.preventDefault(),await i(),e&&At(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s("embedded_wallet_creation_failure_logout",{error:f,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return pr(P1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},P1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Xn(S1,{children:[pr(A,{closeable:!1}),pr(E1,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),pr(he,{style:{marginTop:24},children:"One last step"}),pr(de,{children:"By signing up, you agree to our terms and privacy policy."}),Xn(Lt,{style:{marginTop:24},children:[e&&Xn(Rl,{target:"_blank",href:e,children:["View Terms ",pr(fu,{style:{marginLeft:"auto"}})]}),t&&Xn(Rl,{target:"_blank",href:t,children:["View Privacy Policy ",pr(fu,{style:{marginLeft:"auto"}})]})]}),Xn(x1,{style:{marginTop:24},children:[pr($t,{onClick:o,children:"No thanks"}),pr(F,{onClick:r,children:"Accept"})]}),pr(V,{protectedByPrivy:!0})]}),x1=T1.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;import Nl from"styled-components";import
|
|
571
|
+
`;import Nl from"styled-components";import _1 from"styled-components";var Ha=_1.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
|
-
`;import{jsx as
|
|
586
|
+
`;import{jsx as yu}from"react/jsx-runtime";var Ga=({style:e,...t})=>yu("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:yu("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Ol,jsx as ur,jsxs as Va}from"react/jsx-runtime";var gu=()=>{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 Va(Ol,{children:[ur(A,{}),Va(A1,{children:[ur(R1,{children:Va("div",{children:[ur(Ha,{}),ur(Ga,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Va(k1,{children:[typeof r=="string"?ur("h3",{children:r}):ur(Ol,{children:r}),typeof o=="string"?ur("p",{children:o}):ur(Ol,{children:o})]}),t?.allowlistConfig.errorCtaLink?ur(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):ur(F,{onClick:()=>{e("LANDING")},children:n})]})]})},A1=Nl.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
|
+
`,k1=Nl.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,R1=Nl.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
|
-
`;import
|
|
621
|
+
`;import W1 from"@heroicons/react/24/outline/EnvelopeIcon";import L1 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Pu,useState as za}from"react";import{isMobile as O1}from"react-device-detect";import ri from"styled-components";import Et from"styled-components";var Ot=Et.div`
|
|
622
622
|
display: flex;
|
|
623
623
|
flex-direction: column;
|
|
624
624
|
align-items: flex-start;
|
|
@@ -633,7 +633,7 @@ Resources:
|
|
|
633
633
|
justify-content: center;
|
|
634
634
|
flex-grow: 1;
|
|
635
635
|
width: 100%;
|
|
636
|
-
`,
|
|
636
|
+
`,vu=Et.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
@@ -650,12 +650,12 @@ Resources:
|
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
|
|
653
|
+
`,Y8=Et.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,wu=Et.div`
|
|
659
659
|
display: flex;
|
|
660
660
|
flex-direction: column;
|
|
661
661
|
justify-content: flex-start;
|
|
@@ -682,9 +682,9 @@ Resources:
|
|
|
682
682
|
height: 16px;
|
|
683
683
|
`,oe=Et.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,wu=Et.div`
|
|
686
|
-
position: relative;
|
|
687
685
|
`,Cu=Et.div`
|
|
686
|
+
position: relative;
|
|
687
|
+
`,bu=Et.div`
|
|
688
688
|
background-color: var(--privy-color-accent);
|
|
689
689
|
display: flex;
|
|
690
690
|
justify-content: center;
|
|
@@ -692,9 +692,9 @@ Resources:
|
|
|
692
692
|
border-radius: 50%;
|
|
693
693
|
border-color: white;
|
|
694
694
|
border-width: 2px !important;
|
|
695
|
-
`;import Fl from"styled-components";import{Fragment as
|
|
695
|
+
`;import Fl from"styled-components";import{Fragment as M1,jsx as ei,jsxs as Tu}from"react/jsx-runtime";var ti=({title:e,description:t,children:r,...o})=>ei(Eu,{...o,children:Tu(M1,{children:[ei("h3",{children:e}),typeof t=="string"?ei("p",{children:t}):t,r]})}),mr=Fl(ti)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,_e=({title:e,description:t,icon:r,children:o,...n})=>
|
|
697
|
+
`,_e=({title:e,description:t,icon:r,children:o,...n})=>Tu(I1,{...n,children:[r||null,ei("h3",{children:e}),typeof t=="string"?ei("p",{children:t}):t,o]}),Eu=Fl.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
|
+
`,I1=Fl(Eu)`
|
|
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
|
-
`;import{Fragment as Ul,jsx as Je,jsxs as jr}from"react/jsx-runtime";var Bl=6,
|
|
725
|
+
`;import{Fragment as Ul,jsx as Je,jsxs as jr}from"react/jsx-runtime";var Bl=6,xu=new Array(Bl).fill(""),N1=1400;var _u=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:y}=W(),{authenticated:f,logout:g,user:E}=G(),[v,x]=za(xu),[C,P]=za(!1),[R,M]=za(null),[k,B]=za(null);n.current=()=>null;let U=s()?.email?0:1,H=e?.render.inDialog?Oe:0,T=e?.render.inDialog?H-500:0;Pu(()=>{if(f&&C&&E){if(e?.legal.requireUsersAcceptTerms&&!E.hasAcceptedTerms){let te=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},T);return()=>clearTimeout(te)}if(At(E,e?.embeddedWallets?.createOnLogin)){let te=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),y("embedded_wallet_creation_failure_logout",{error:z,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},T);return()=>clearTimeout(te)}else{u();let te=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(te)}}},[f,C,E]),Pu(()=>{if(R&&k===0){let re=setTimeout(()=>{x(xu),M(null),document.querySelector("input[name=code-0]")?.focus()},N1);return()=>clearTimeout(re)}},[R]);let q=re=>{re.preventDefault();let te=re.currentTarget.value.replace(" ","");if(te==="")return;if(isNaN(Number(te))){M("Code should be numeric"),B(1);return}M(null),B(null);let z=Number(re.currentTarget.name?.charAt(5)),Pe=[...te||[""]].slice(0,Bl-z),we=[...v.slice(0,z),...Pe,...v.slice(z+Pe.length)];x(we);let Tr=Pe.length,yt=Math.min(Math.max(z+Tr,0),Bl-1);isNaN(Number(re.currentTarget.value))||document.querySelector(`input[name=code-${yt}]`)?.focus(),we.every(Ae=>Ae&&!isNaN(+Ae))&&(document.querySelector(`input[name=code-${yt}]`)?.blur(),d(we.join("")).then(()=>P(!0)).catch(ge=>{ge?.status===422?M("Invalid or expired verification code"):ge instanceof nr&&ge.privyErrorCode==="cannot_link_more_of_type"?M(ge.message):M("Issue verifying code"),B(0)}))},O=re=>{k===1&&(M(null),B(null));let te=[...v.slice(0,re),"",...v.slice(re+1)];x(te),re>0&&document.querySelector(`input[name=code-${re-1}]`)?.focus()},Y=U==0?Je(W1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Je(L1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),se=U==0?jr("p",{children:["Please check ",Je(Su,{children:s()?.email})," for an email from privy.io and enter your code below."]}):jr("p",{children:["Please check ",Je(Su,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return jr(Ul,{children:[Je(A,{backFn:()=>r()},"header"),jr(D1,{children:[Je(_e,{title:"Enter confirmation code",description:se,icon:Y}),jr(vu,{children:[jr(F1,{children:[Je(U1,{fail:!!R,success:C,children:Je("span",{children:R||(C?"Success!":"")})}),Je("div",{children:v.map((re,te)=>Je("input",{name:`code-${te}`,type:"text",value:v[te],onChange:q,onKeyUp:z=>{z.key==="Backspace"&&O(te)},inputMode:"numeric",autoFocus:te===0,pattern:"[0-9]",className:`${C?"success":""} ${R?"fail":""}`,autoComplete:O1?"one-time-code":"off"},te))})]}),Je(B1,{children:U==0?jr(Ul,{children:[Je("span",{children:"Didn't get an email?"}),Je("button",{onClick:i,children:"Resend code"})]}):jr(Ul,{children:[Je("span",{children:"Didn't get a message?"}),Je("button",{onClick:l,children:"Resend code"})]})})]})]}),Je(V,{protectedByPrivy:!0})]})},D1=ri.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
|
+
`,F1=ri.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
|
+
`,U1=ri.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
|
+
`,B1=ri.div`
|
|
798
798
|
font-size: 13px;
|
|
799
799
|
color: var(--privy-color-foreground-3);
|
|
800
800
|
display: flex;
|
|
@@ -808,10 +808,10 @@ Resources:
|
|
|
808
808
|
> button {
|
|
809
809
|
text-decoration: underline;
|
|
810
810
|
}
|
|
811
|
-
`,
|
|
811
|
+
`,Su=ri.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;import
|
|
814
|
+
`;import q1 from"@heroicons/react/24/solid/CheckCircleIcon";import $1 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Hl,useRef as j1,useState as nn}from"react";import K1 from"styled-components";import H1 from"styled-components";import{Fragment as z1,jsx as on,jsxs as V1}from"react/jsx-runtime";var Au=({icon:e})=>{let t=e;return on(z1,{children:on(G1,{children:V1("div",{children:[on(It,{}),typeof t=="string"?on("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?on(t,{style:{width:"38px",height:"38px"}}):on("span",{})]})})})},G1=H1.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
|
-
`;import{Fragment as
|
|
837
|
+
`;import{Fragment as J1,jsx as Kt,jsxs as Gl}from"react/jsx-runtime";var Ru=500,ku=Ru*2,Iu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=_(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=fe(),y=j1([]),f=Y=>{y.current=[Y,...y.current]},[g,E]=nn(!0);Hl(()=>{let Y=setTimeout(E,ku,!1);return f(Y),()=>{y.current.forEach(se=>clearTimeout(se)),y.current=[]}},[]);let[v,x]=nn(""),[C,P]=nn("Checking that you are a human..."),[R,M]=nn(Kt(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[k,B]=nn(!1),[U,H]=nn(3),T=r?.captchaModalData,q=async Y=>{try{await T?.callback(Y),T?.onSuccessNavigateTo&&n(T?.onSuccessNavigateTo,!1)}catch(se){if(se instanceof qt)return;{let re={error:se,previousScreen:e||"LANDING"};a({errorModalData:re}),n(T?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Hl(()=>{if(i==="success"){let Y=setTimeout(async()=>{let se=await s();!se||T?.userIntentRequired||q(se)},ku);f(Y)}else if(i==="ready"){let Y=setTimeout(()=>{i==="ready"&&u()},Ru);f(Y)}},[i]),Hl(()=>{if(!g)switch(i){case"success":x("Success!"),P("CAPTCHA passed successfully."),M(Kt(F,{onClick:()=>{B(!0),q(l)},disabled:!T?.userIntentRequired,loading:k,children:T?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),P("Checking that you are a human..."),M(Kt(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),U<=0?(P("If you use an adblocker or VPN, try disabling and re-attempting."),M(null)):(P("You did not pass CAPTCHA. Please try again."),M(Kt(F,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[i,g,k]);let O=async()=>{if(U<=0)return;H(se=>se-1),d(),u();let Y=await s();!Y||T?.userIntentRequired||q(Y)};return Gl(J1,{children:[Kt(A,{backFn:!e||t===e?void 0:o}),Gl(Y1,{children:[i==="success"?Kt(q1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?Kt($1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Kt(Au,{}),Gl(Ye,{children:[v?Kt("h3",{children:v}):null,Kt("p",{children:C})]}),R]}),Kt(X,{})]})},Y1=K1.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
|
-
`;import J1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Z1}from"react-device-detect";import Q1 from"styled-components";import{jsx as Yt,jsxs as Iu}from"react/jsx-runtime";var Mu=({...e})=>Iu("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Yt("defs",{children:Iu("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:[Yt("stop",{offset:"0",stopColor:"#f1562b"}),Yt("stop",{offset:"0.3",stopColor:"#f1542b"}),Yt("stop",{offset:"0.41",stopColor:"#f04d2a"}),Yt("stop",{offset:"0.49",stopColor:"#ef4229"}),Yt("stop",{offset:"0.5",stopColor:"#ef4029"}),Yt("stop",{offset:"0.56",stopColor:"#e83e28"}),Yt("stop",{offset:"0.67",stopColor:"#e13c26"}),Yt("stop",{offset:"1",stopColor:"#df3c26"})]})}),Yt("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"}),Yt("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Jt,jsxs as oi}from"react/jsx-runtime";var Wu=({style:e,...t})=>oi("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:[Jt("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"}),Jt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Jt("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"})}),oi("g",{mask:"url(#mask0_16909_31415)",children:[Jt("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"}),Jt("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"}),Jt("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"}}),Jt("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"}})]}),oi("defs",{children:[oi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72"}),Jt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),oi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Jt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as ee,jsxs as Tt}from"react/jsx-runtime";var Lu=({style:e,...t})=>Tt("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:[ee("g",{clipPath:"url(#clip0_5_32)",children:Tt("g",{clipPath:"url(#clip1_5_32)",children:[ee("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ee("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"})}),ee("g",{mask:"url(#mask0_5_32)",children:ee("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ee("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)"}),ee("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ee("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ee("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ee("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ee("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ee("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)"}),ee("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ee("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Tt("defs",{children:[Tt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#174299"}),ee("stop",{offset:"1",stopColor:"#001E59"})]}),Tt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ee("stop",{offset:"0.770277",stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#8754C9"}),ee("stop",{offset:"1",stopColor:"#FF4000"})]}),Tt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ee("stop",{offset:"0.723929",stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ee("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("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:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),ee("clipPath",{id:"clip0_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})}),ee("clipPath",{id:"clip1_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as fr,jsxs as Ou}from"react/jsx-runtime";var Nu=({style:e,...t})=>Ou("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:[fr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Ou("g",{filter:"url(#filter0_d_12393_20043)",children:[fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as ni,jsxs as Du}from"react/jsx-runtime";var Fu=({style:e,...t})=>Du("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:[Du("g",{clipPath:"url(#clip0_1704_1423)",children:[ni("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"}),ni("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"})]}),ni("defs",{children:ni("clipPath",{id:"clip0_1704_1423",children:ni("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as an,jsxs as ov}from"react/jsx-runtime";var hr={coinbase_wallet:{logo:oa,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:jo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:lr,displayName:"Phantom"},rainbow:{logo:Lu,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Jn,displayName:"WalletConnect"},zerion:{logo:Fu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Mu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Wu,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Nu,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="}},Po=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=_(),{connectWallet:i}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Ur()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(Z1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},ov(rv,{onClick:s,children:[an(tv,{icon:ev(e,n.connectorType)??r,name:n.walletClientType}),an("span",{children:X1(e,n.connectorType)||t||n.walletClientType}),an("span",{id:"connect-text",children:"Connect"})]})},X1=(e,t)=>{if(hr[e]?.displayName)return hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},ev=(e,t)=>{if(hr[e]?.logo)return hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Jn},tv=({icon:e,name:t})=>typeof e=="string"?an("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?an(J1,{}):e?an(e,{}):null,rv=Q1(Se)`
|
|
844
|
+
`;import Z1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Q1}from"react-device-detect";import X1 from"styled-components";import{jsx as Yt,jsxs as Mu}from"react/jsx-runtime";var Wu=({...e})=>Mu("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Yt("defs",{children:Mu("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:[Yt("stop",{offset:"0",stopColor:"#f1562b"}),Yt("stop",{offset:"0.3",stopColor:"#f1542b"}),Yt("stop",{offset:"0.41",stopColor:"#f04d2a"}),Yt("stop",{offset:"0.49",stopColor:"#ef4229"}),Yt("stop",{offset:"0.5",stopColor:"#ef4029"}),Yt("stop",{offset:"0.56",stopColor:"#e83e28"}),Yt("stop",{offset:"0.67",stopColor:"#e13c26"}),Yt("stop",{offset:"1",stopColor:"#df3c26"})]})}),Yt("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"}),Yt("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Jt,jsxs as oi}from"react/jsx-runtime";var Lu=({style:e,...t})=>oi("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:[Jt("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"}),Jt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Jt("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"})}),oi("g",{mask:"url(#mask0_16909_31415)",children:[Jt("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"}),Jt("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"}),Jt("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"}}),Jt("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"}})]}),oi("defs",{children:[oi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72"}),Jt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),oi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Jt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as ee,jsxs as Tt}from"react/jsx-runtime";var Ou=({style:e,...t})=>Tt("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:[ee("g",{clipPath:"url(#clip0_5_32)",children:Tt("g",{clipPath:"url(#clip1_5_32)",children:[ee("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ee("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"})}),ee("g",{mask:"url(#mask0_5_32)",children:ee("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ee("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)"}),ee("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ee("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ee("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ee("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ee("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ee("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)"}),ee("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ee("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Tt("defs",{children:[Tt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#174299"}),ee("stop",{offset:"1",stopColor:"#001E59"})]}),Tt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ee("stop",{offset:"0.770277",stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#8754C9"}),ee("stop",{offset:"1",stopColor:"#FF4000"})]}),Tt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ee("stop",{offset:"0.723929",stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ee("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("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:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),ee("clipPath",{id:"clip0_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})}),ee("clipPath",{id:"clip1_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as fr,jsxs as Nu}from"react/jsx-runtime";var Du=({style:e,...t})=>Nu("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:[fr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Nu("g",{filter:"url(#filter0_d_12393_20043)",children:[fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as ni,jsxs as Fu}from"react/jsx-runtime";var Uu=({style:e,...t})=>Fu("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:[Fu("g",{clipPath:"url(#clip0_1704_1423)",children:[ni("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"}),ni("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"})]}),ni("defs",{children:ni("clipPath",{id:"clip0_1704_1423",children:ni("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as an,jsxs as nv}from"react/jsx-runtime";var hr={coinbase_wallet:{logo:oa,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:jo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:lr,displayName:"Phantom"},rainbow:{logo:Ou,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Jn,displayName:"WalletConnect"},zerion:{logo:Uu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Wu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Lu,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Du,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="}},Po=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=_(),{connectWallet:i}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Ur()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(Q1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},nv(ov,{onClick:s,children:[an(rv,{icon:tv(e,n.connectorType)??r,name:n.walletClientType}),an("span",{children:ev(e,n.connectorType)||t||n.walletClientType}),an("span",{id:"connect-text",children:"Connect"})]})},ev=(e,t)=>{if(hr[e]?.displayName)return hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},tv=(e,t)=>{if(hr[e]?.logo)return hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Jn},rv=({icon:e,name:t})=>typeof e=="string"?an("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?an(Z1,{}):e?an(e,{}):null,ov=X1(Se)`
|
|
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
|
-
`;import{Fragment as
|
|
866
|
+
`;import{Fragment as cv,jsx as sn,jsxs as dv}from"react/jsx-runtime";var iv=["coinbase_wallet"],av=["metamask","okx_wallet","rainbow","uniswap","zerion"],sv=["cryptocom"],lv=["phantom"],ln=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=_(),o=ii(r.appearance.walletList,t,e,r.appearance.walletList);return dv(cv,{children:[...o]})},ii=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let d=t.filter(({connectorType:u,walletClientType:y})=>y==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(y));for(let u of d){let{walletClientType:y,walletBranding:f}=u;(y==="unknown"?a:n).push(sn(Po,{connectOnly:r,provider:y,logo:f.icon,displayName:f.name,connector:u},`${s}-${y}`))}}else if(lv.includes(s)){let d=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);d&&n.push(sn(Po,{connectOnly:r,provider:s,connector:d},s))}else if(av.includes(s)){let d=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;d&&n.push(sn(Po,{connectOnly:r,provider:s,connector:d},s))}else if(iv.includes(s)){let d=t.find(({connectorType:u})=>u===s);d&&n.push(sn(Po,{connectOnly:r,provider:s,connector:d},s))}else sv.includes(s)?l&&i.push(sn(Po,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push(sn(Po,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};import{Fragment as pv,jsx as ai,jsxs as uv}from"react/jsx-runtime";var Bu=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return uv(pv,{children:[ai(A,{},"header"),ai(mr,{title:"Connect your wallet",description:t}),ai(Lt,{children:ai(ln,{connectOnly:!0})}),ai(V,{protectedByPrivy:!0})]})};import gv from"styled-components";import hv from"styled-components";import mv from"react";import{jsx as fv}from"react/jsx-runtime";var Hu=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?fv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?mv.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as Gu}from"react/jsx-runtime";var cn=e=>{let{app:t}=_();return t?.appearance.logo?Gu(yv,{...e,children:Gu(Hu,{})}):null},yv=hv.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
|
-
`;import{Fragment as
|
|
873
|
+
`;import{Fragment as wv,jsx as dn,jsxs as Cv}from"react/jsx-runtime";var Vu=()=>{let{app:e}=_();return Cv(wv,{children:[dn(A,{},"header"),dn(vv,{}),dn(Lt,{children:dn(ln,{connectOnly:!0})}),e&&dn(Xo,{app:e,alwaysShowImplicitConsent:!0}),dn(V,{protectedByPrivy:!0})]})},vv=gv(cn)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;import{useEffect as
|
|
875
|
+
`;import{useEffect as Ku,useState as Yu}from"react";import{isMobile as Av}from"react-device-detect";import kv from"styled-components";import{useEffect as Vl,useState as xo}from"react";import{isMobile as si}from"react-device-detect";import{useInterval as Pv}from"react-use";import qu from"styled-components";import{useState as bv,useEffect as Ev,useCallback as Tv}from"react";function zu(){let[e,t]=bv(!1),r=Tv(()=>{document.hidden&&t(!0)},[]);return Ev(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as ju,jsx as De,jsxs as li}from"react/jsx-runtime";var zl=2,ql=e=>e?.privyErrorCode==="linked_to_another_user"?_r.ERROR_USER_EXISTS:e instanceof xe&&!e.details.default?e.details:e instanceof Go?_r.ERROR_TIMED_OUT:e instanceof Vo?_r.ERROR_USER_REJECTED_CONNECTION:_r.ERROR_WALLET_CONNECTION,$u=()=>{let[e,t]=xo(!1),[r,o]=xo(!1),[n,a]=xo(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:d,navigateBack:u,lastScreen:y,currentScreen:f,setModalData:g}=_(),{getAuthFlow:E,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:C,loginWithWallet:P,updateWallets:R,createAnalyticsEvent:M}=W(),{walletConnectors:k}=G(),[B,U]=xo(0),{user:H}=G(),[T]=xo(H?.linkedAccounts.length||0),[q,O]=xo(""),[Y,se]=xo(!1),{hasTabbedAway:re}=zu(),{enabled:te,token:z}=fe(),Pe=si&&v?.connector?.connectorType==="wallet_connect_v2"||si&&v?.connector?.connectorType==="coinbase_wallet"||si&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",we=v?.status==="connected",Tr=v?.status==="switching_to_supported_chain";Vl(()=>{let $=E();if(we&&!$&&(te&&!z&&!i?(g({captchaModalData:{callback:We=>C(v.connectedWallet,We).then(()=>{se(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):C(v.connectedWallet,z).then(()=>{se(!0)})),$&&Pe&&we&&!$.preparedMessage){$.buildSiweMessage();return}!$||Pe||!we||r||(async()=>{o(!0),a(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await pl(2500),await Ae()}catch(We){console.warn("Auto-prompted signature failed",We)}finally{o(!1)}})()},[B,we,Y]),Vl(()=>{if(H&&e){let $=s?.render.inDialog?Oe:0,We=s?.render.inDialog?$-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let co=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},We);return()=>clearTimeout(co)}if(At(H,s?.embeddedWallets?.createOnLogin)){let co=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Bt=>{console.error(Bt),M("embedded_wallet_creation_failure_logout",{error:Bt,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},We);return()=>clearTimeout(co)}R();let pt=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Oe);return()=>clearTimeout(pt)}},[H,e]);let yt=$=>{if($?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(ql($))};async function Ae(){try{if(await P(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch($){yt($)}finally{o(!1)}}Vl(()=>{v?.connectError&&yt(v?.connectError)},[v]),Pv(()=>{let $=ge==="wallet_connect_v2"&&v?.connector instanceof cr?v.connector.redirectUri:void 0;$&&O($)},v?.connector instanceof cr&&!q?500:null);let ge=v?.connector?.connectorType||"injected",gt=v?.connector?.walletClientType||"unknown",Ut=hr[gt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",Nr=hr[gt]?.logo||v?.connector?.walletBranding.icon||($=>De($o,{...$})),tr=Ut==="Browser Extension"?Ut.toLowerCase():Ut,L;e?L=`Successfully connected with ${tr}`:n?L=n.message:Tr?L="Switching networks":we?L=r&&Pe?"Signing":"Sign to verify":L=`Waiting for ${tr}`;let J="Don\u2019t see your wallet? Check your other browser windows.";if(e){let $=H?.linkedAccounts.length||0;T===$?J="Wallet was already linked.":J="You\u2019re good to go!"}else B>=zl&&n?J="Unable to connect wallet":n?J=n.detail:Tr?J="Switch your wallet to the requested network.":we&&Pe?J="Sign the message in your wallet to verify it belongs to you.":gt==="metamask"&&si?J="Click continue to open and connect MetaMask.":gt==="metamask"?J="For the best experience, connect only one wallet at a time.":ge==="wallet_connect"?J="Open your mobile wallet app to continue":ge==="coinbase_wallet"&&(Nd()||(gl(H)?J="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":J="Open the Coinbase app on your phone to continue."));let Q=k?.walletConnectors?.find($=>$.walletClientType==="coinbase_wallet"),Bn=gt==="coinbase_wallet"&&(gl(H)||n===_r.ERROR_USER_EXISTS);return li(ju,{children:[De(A,{backFn:!y||f===y?void 0:u}),li(Sv,{children:[De($l,{walletLogo:Nr,success:e,fail:!!n}),li(Ye,{children:[De("h3",{children:L}),De("p",{children:J}),!we&&q&&!re?li("p",{children:["Still here?"," ",De("a",{href:q,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Bn?De(F,{onClick:()=>Q&&Q?.disconnect(),disabled:e,children:"Use a different wallet"}):n==_r.ERROR_USER_EXISTS&&f!==y?De(F,{onClick:u,children:"Use a different wallet"}):we&&!e&&Pe?De(F,{onClick:()=>{o(!0),Ae(),xv(gt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&B<zl?De(F,{onClick:()=>{U(B+1),a(void 0),we?(o(!0),Ae()):v?.connectRetry()},disabled:!e&&(!n?.retryable||B>=zl),children:"Retry"}):!e&&!n?De(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),De(X,{})]})},xv=e=>{if(!si||!ep(e))return;let t=tp(e);t&&window.open(t,"_self","noopener,noreferrer")},Sv=qu.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
|
+
`,_v=qu.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
|
-
`,$l=e=>{let t=e.walletLogo;return De(
|
|
905
|
+
`,$l=e=>{let t=e.walletLogo;return De(ju,{children:De(_v,{children:li("div",{children:[De(It,{success:e.success,fail:e.fail}),typeof t=="string"?De("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):De(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Iv,jsx as kr,jsxs as jl}from"react/jsx-runtime";var qa=2,Ju=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[a,i]=Yu(void 0),[l,s]=Yu(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Ku(()=>{if(d){let R=setTimeout(n,Oe);return()=>clearTimeout(R)}},[d]);let y=R=>{i(ql(R))};Ku(()=>{o?.connectError&&y(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",E=hr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=hr[g]?.logo||o?.connector?.walletBranding.icon||(R=>kr($o,{...R})),x=E==="Browser Extension"?E.toLowerCase():E,C;d?C=`Successfully connected with ${x}`:a?C=a.message:u?C="Switching networks":C=`Waiting for ${x}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return d?P="You\u2019re good to go!":l>=qa&&a?P="Unable to connect wallet":a?P=a.detail:u?P="Switch your wallet to the requested network.":g==="metamask"&&Av?P="Click to continue to open and connect MetaMask.":g==="metamask"?P="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?P="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),jl(Iv,{children:[kr(A,{backFn:r===t?void 0:e}),jl(Rv,{children:[kr($l,{walletLogo:v,success:d,fail:!!a}),jl(Ye,{children:[kr("h3",{children:C}),kr("p",{children:P})]}),a==_r.ERROR_USER_EXISTS?kr(F,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<qa?kr(F,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=qa),children:"Retry"}):!d&&a&&l>=qa?kr(F,{onClick:e,children:"Use a different wallet"}):null]}),kr(X,{})]})},Rv=kv.div`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
align-items: center;
|
|
909
909
|
justify-content: center;
|
|
910
910
|
gap: 24px;
|
|
911
911
|
width: 100%;
|
|
912
|
-
`;import
|
|
912
|
+
`;import Fv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Uv,useMemo as Bv,useState as Hv}from"react";import Gv from"styled-components";import $a from"styled-components";import{jsx as Kl,jsxs as Nv}from"react/jsx-runtime";var pn=()=>Kl(Mv,{children:Nv(Wv,{children:[Kl(Lv,{}),Kl(Ov,{})]})}),Mv=$a.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
|
+
`,Wv=$a.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
|
+
`,Lv=$a.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
|
+
`,Ov=$a.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
|
|
968
|
+
`;var Zu=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ye=class extends Error{constructor(r,o){super(o);this.type=r}};function un(e){let t=e.type;return typeof t=="string"&&Zu.includes(t)}function Dv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function So(e){return un(e)&&e.type==="wallet_not_on_device"}function Qu(e){return un(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function mn(e){return!!(un(e)&&e.type==="mfa_timeout")}function fn(e){return!!(un(e)&&e.type==="missing_or_invalid_mfa")}function Yl(e){return!!(un(e)&&e.type==="mfa_verification_max_attempts_reached")}function Jl(e){return!!(un(e)&&e.message.includes("code 429"))}function Zl(e){return!!(Dv(e)&&e.message==="MFA canceled")}import{Fragment as em,jsx as hn,jsxs as Ql}from"react/jsx-runtime";var Xu=1,tm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=W(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Bv(()=>Date.now(),[]),[y,f]=Hv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{y||(f(!0),E(typeof C=="string"?new Error(C):C))};Uv(()=>{let C=Ce(t),P;return!e||!C?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:C.address});let k=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<Xu?P=setTimeout(()=>{i(g)},(Xu-k)*1e3):i(g)}catch(k){if(So(k)&&C.recoveryMethod==="privy"){let B=await r();if(!B)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:C.address}),(await a?.recover({address:C.address,accessToken:B}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:C.address}),i(g)}catch{v("An error has occurred, please try again.")}}else So(k)?(s({...l,recoverWallet:{privyWallet:C,onCompleteNavigateTo:g,onFailure:E}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(k)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let x=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=x,Ql(em,{children:[hn(A,{onClose:x}),y?Ql(em,{children:[Ql(jt,{children:[hn(Fv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),hn(_e,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),hn(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):hn(pn,{}),hn(Vv,{})]})},Vv=Gv.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;import
|
|
970
|
+
`;import zv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as qv}from"react";import{Fragment as $v,jsx as yn,jsxs as rm}from"react/jsx-runtime";var om=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let y=Ce(e);y?(o(),l(y)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return qv(()=>{let y=setTimeout(u,Bd);return()=>clearTimeout(y)},[]),i.current=u,rm($v,{children:[yn(A,{onClose:u}),yn(K,{}),rm(jt,{children:[yn(zv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),yn(_e,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),yn(oe,{}),yn(V,{protectedByPrivy:!0})]})};import jv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Kv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as am,useRef as Yv,useState as Xl}from"react";import Kr from"styled-components";import{Fragment as nw,jsx as ke,jsxs as Zt}from"react/jsx-runtime";var sm=()=>{let[e,t]=Xl(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Ce(o)?.address,{onFailure:y,onSuccess:f,origin:g,appId:E}=s.keyExport,v=C=>{a({shouldCallAuthOnSuccess:!1}),y(typeof C=="string"?new Error(C):C)},x=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return am(()=>{let C=Ce(o);if(!r||!C)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),d.current=x,Zt(nw,{children:[ke(A,{onClose:x}),Zt(Qv,{children:[Zt(_e,{icon:ke(Kv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Zt(rw,{children:[ke(Zv,{style:{marginRight:6}}),Br(u)]}),ke("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Zt(Xv,{children:[Zt(nm,{children:[ke(im,{children:"1"}),Zt("span",{children:[ke("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Zt(nm,{children:[ke(im,{children:"2"}),ke("span",{children:"Copy this key into your other wallet"})]})]}),ke("div",{style:{width:"100%"},children:e&&ke(Jv,{origin:g,appId:E,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Zt(ow,{children:[Zt("div",{children:[ke(jv,{viewBox:"0 0 20 18"}),ke("h4",{children:"Warning"})]}),ke("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ke(V,{protectedByPrivy:!0})]})};function Jv(e){let[t,r]=Xl(e.dimensions.width),[o,n]=Xl(void 0),a=Yv(null);return am(()=>{if(a.current&&t===void 0){let{width:l}=a.current.getBoundingClientRect();r(l)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),ke("div",{ref:a,children:t&&Zt(ew,{children:[ke("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Zi(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),ke(tw,{children:"Loading..."})]})})}function Zv(e){return ke("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ke("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Qv=Kr.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,Xv=Kr.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
|
-
`,
|
|
981
|
+
`,nm=Kr.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
|
-
`,
|
|
990
|
+
`,im=Kr.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
|
+
`,ew=Kr.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,tw=Kr.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
|
+
`,rw=Kr.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
|
+
`,ow=Kr.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
|
-
`;import
|
|
1055
|
+
`;import Zw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Wm,useRef as Qw,useState as fi}from"react";import Xw from"styled-components";import{useCallback as Mm,useEffect as Jw}from"react";import cw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as dw,useState as rc}from"react";import iw from"@heroicons/react/24/outline/ArrowPathIcon";import aw from"@heroicons/react/24/outline/EyeIcon";import sw from"@heroicons/react/24/outline/EyeSlashIcon";import Ze,{css as ec}from"styled-components";var lw=ec`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1061,7 +1061,7 @@ Resources:
|
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
1063
|
`,ja=Ze.span`
|
|
1064
|
-
${
|
|
1064
|
+
${lw}
|
|
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"};
|
|
@@ -1080,7 +1080,7 @@ Resources:
|
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,lm=ec`
|
|
1084
1084
|
&& {
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
border-width: 1px;
|
|
@@ -1096,7 +1096,7 @@ Resources:
|
|
|
1096
1096
|
line-height: 22px; /* 137.5% */
|
|
1097
1097
|
}
|
|
1098
1098
|
`,gn=Ze.input`
|
|
1099
|
-
${
|
|
1099
|
+
${lm}
|
|
1100
1100
|
|
|
1101
1101
|
&::placeholder {
|
|
1102
1102
|
color: var(--privy-color-foreground-3);
|
|
@@ -1107,8 +1107,8 @@ Resources:
|
|
|
1107
1107
|
overflow: hidden;
|
|
1108
1108
|
text-overflow: ellipsis;
|
|
1109
1109
|
white-space: nowrap;
|
|
1110
|
-
`,
|
|
1111
|
-
${
|
|
1110
|
+
`,cm=Ze.div`
|
|
1111
|
+
${lm}
|
|
1112
1112
|
`,Zr=Ze.div`
|
|
1113
1113
|
position: relative;
|
|
1114
1114
|
width: 100%;
|
|
@@ -1162,7 +1162,7 @@ Resources:
|
|
|
1162
1162
|
> :first-child {
|
|
1163
1163
|
min-width: 24px;
|
|
1164
1164
|
}
|
|
1165
|
-
`,
|
|
1165
|
+
`,k_=Ze.div`
|
|
1166
1166
|
height: var(--privy-height-modal-full);
|
|
1167
1167
|
|
|
1168
1168
|
@media (max-width: 440px) {
|
|
@@ -1188,7 +1188,7 @@ Resources:
|
|
|
1188
1188
|
flex-direction: row;
|
|
1189
1189
|
justify-content: space-around;
|
|
1190
1190
|
align-items: center;
|
|
1191
|
-
`,
|
|
1191
|
+
`,dm=Ze(iw)`
|
|
1192
1192
|
height: 1.25rem;
|
|
1193
1193
|
width: 1.25rem;
|
|
1194
1194
|
stroke: var(--privy-color-accent);
|
|
@@ -1197,7 +1197,7 @@ Resources:
|
|
|
1197
1197
|
:active {
|
|
1198
1198
|
stroke: var(--privy-color-accent-light);
|
|
1199
1199
|
}
|
|
1200
|
-
`,wn=Ze(
|
|
1200
|
+
`,wn=Ze(sw)`
|
|
1201
1201
|
height: 1.25rem;
|
|
1202
1202
|
width: 1.25rem;
|
|
1203
1203
|
stroke: var(--privy-color-accent);
|
|
@@ -1206,7 +1206,7 @@ Resources:
|
|
|
1206
1206
|
:active {
|
|
1207
1207
|
stroke: var(--privy-color-accent-light);
|
|
1208
1208
|
}
|
|
1209
|
-
`,Cn=Ze(
|
|
1209
|
+
`,Cn=Ze(aw)`
|
|
1210
1210
|
height: 1.25rem;
|
|
1211
1211
|
width: 1.25rem;
|
|
1212
1212
|
stroke: var(--privy-color-accent);
|
|
@@ -1215,7 +1215,7 @@ Resources:
|
|
|
1215
1215
|
:active {
|
|
1216
1216
|
stroke: var(--privy-color-accent-light);
|
|
1217
1217
|
}
|
|
1218
|
-
`,
|
|
1218
|
+
`,pm=Ze.progress`
|
|
1219
1219
|
height: 4px;
|
|
1220
1220
|
width: 100%;
|
|
1221
1221
|
margin: 8px 0;
|
|
@@ -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
|
-
`;import{Fragment as
|
|
1234
|
+
`;import{Fragment as pw,jsx as Pt,jsxs as Ka}from"react/jsx-runtime";var um=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=rc(!0),[l,s]=rc(!1),[d,u]=rc(""),y=r===d;return dw(()=>{d&&!l&&s(!0)},[d]),Ka(pw,{children:[Pt(A,{title:"Confirm Password",closeable:!1,backFn:n}),Pt(K,{}),Ka(Yr,{children:[Ka(Qr,{children:[Pt(cw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Pt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Ka(Zr,{children:[Pt(gn,{value:d,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),Pt(vn,{style:{right:"0.75rem"},children:a?Pt(wn,{onClick:()=>i(!1)}):Pt(Cn,{onClick:()=>i(!0)})})]}),Pt(ja,{"aria-hidden":!l||y,error:!0,children:"Passwords do not match"})]}),Pt(Jr,{onClick:o,loading:t,disabled:!y,hideAnimations:e,children:"Continue"}),Pt(oe,{}),Pt(V,{protectedByPrivy:!0})]})};import hw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as yw}from"react";import gw from"styled-components";import Ya from"styled-components";import{jsx as pi,jsxs as fw}from"react/jsx-runtime";var mm=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>pi("label",{children:fw(uw,{className:e,children:[pi(hm,{checked:t,...o}),pi(mw,{color:r,checked:t,children:pi(fm,{viewBox:"0 0 24 24",children:pi("polyline",{points:"20 6 9 17 4 12"})})})]})}),uw=Ya.div`
|
|
1235
1235
|
display: inline-block;
|
|
1236
1236
|
vertical-align: middle;
|
|
1237
|
-
`,
|
|
1237
|
+
`,fm=Ya.svg`
|
|
1238
1238
|
fill: none;
|
|
1239
1239
|
stroke: white;
|
|
1240
1240
|
stroke-width: 3px;
|
|
1241
|
-
`,
|
|
1241
|
+
`,hm=Ya.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
|
+
`,mw=Ya.div`
|
|
1253
1253
|
display: inline-block;
|
|
1254
1254
|
width: 18px;
|
|
1255
1255
|
height: 18px;
|
|
@@ -1264,30 +1264,30 @@ Resources:
|
|
|
1264
1264
|
border-width: 1px;
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
-
${
|
|
1267
|
+
${hm}:focus + & {
|
|
1268
1268
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
|
-
${
|
|
1271
|
+
${fm} {
|
|
1272
1272
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1273
1273
|
}
|
|
1274
|
-
`;import{Fragment as
|
|
1274
|
+
`;import{Fragment as ym,jsx as Nt,jsxs as ui}from"react/jsx-runtime";var gm=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=yw(!1);return ui(ym,{children:[Nt(A,{title:"Confirm Password",closeable:!1,backFn:o}),Nt(K,{}),ui(Yr,{children:[ui(Qr,{children:[Nt(hw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Nt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Nt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Nt(ci,{children:ui(di,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[Nt(mm,{color:"var(--privy-color-error)",checked:a}),Nt(ym,{children:"I understand losing my password means losing my account."})]})})]}),ui(vw,{children:[n.initiatedBy==="user"&&Nt($t,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Nt(Jr,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),Nt(oe,{}),Nt(V,{protectedByPrivy:!0})]})},vw=gw.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
gap: 10px;
|
|
1277
|
-
`;import
|
|
1277
|
+
`;import Lw from"@heroicons/react/24/outline/KeyIcon";import Pm from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as xm,useMemo as oc,useEffect as Ow}from"react";import Sm from"styled-components";import ww from"fast-password-entropy";import*as vm from"secure-password-utilities";import{DEFAULT_WORDLIST as Cw}from"secure-password-utilities/wordlists";var bw=95,Ew=8,Tw=3,Pw=.3,xw=/[a-z]/,Sw=/[A-Z]/,_w=/[0-9]/,Aw="a-zA-Z0-9",wm="!@#$%^&*()\\-_+.",Cm=`${Aw}${wm}`,kw=new RegExp(`[${wm}]`),Rw=new RegExp(`[${Cm}]`),bm=new RegExp(`^[${Cm}]{6,}$`),Em=(e="")=>{let t=e.split("").filter(r=>!Rw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Ja=()=>vm.generatePassphrase(4,Cw);function Iw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Mw(e){if(e.length<Ew)return 0;let t=0;xw.test(e)&&(t+=1),Sw.test(e)&&(t+=1),_w.test(e)&&(t+=1),kw.test(e)&&(t+=1);let r=t/Tw;return Math.max(0,Math.min(1,r))}function Ww(e=""){let t=Mw(e),r=ww(e)/bw;return(t*Pw+r)/2}function Tm(e=""){let t=Ww(e);return{value:t,label:Iw(t)}}import{Fragment as Fw,jsx as Fe,jsxs as Rr}from"react/jsx-runtime";var _m=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,d]=xm(!1),[u,y]=xm(!1);Ow(()=>{r&&!u&&y(!0)},[r]);let f=oc(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":bm.test(r||"")?null:`Invalid characters used ( ${Em(r).join(" ")} )`:null,[r,u]),g=oc(()=>f?{value:0,label:"Weak"}:Tm(r),[r,f]),E=oc(()=>!!(!r?.length||f),[f,r]);return Rr(Fw,{children:[Fe(A,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),Fe(K,{}),Rr(Yr,{children:[Rr(Qr,{children:[Fe(Lw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Fe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Fe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Rr(Zr,{children:[Fe(gn,{value:r,onChange:v=>i(v.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),Rr(vn,{style:{width:"3.5rem"},children:[s?Fe(wn,{onClick:()=>d(!1)}):Fe(Cn,{onClick:()=>d(!0)}),Fe(dm,{onClick:l})]})]}),Fe(pm,{value:g.value===0?.01:g.value,label:g.label}),Fe(ja,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),Rr(Dw,{children:[Fe(Nw,{children:Rr(ci,{children:[Rr(di,{children:[Fe(Pm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Rr(di,{children:[Fe(Pm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Fe(Jr,{onClick:n,loading:t,disabled:E,hideAnimations:e,children:"Continue"})]})]}),Fe(oe,{}),Fe(V,{protectedByPrivy:!0})]})},Nw=Sm(ci)`
|
|
1278
1278
|
flex: 1;
|
|
1279
1279
|
padding-top: 1rem;
|
|
1280
|
-
`,
|
|
1280
|
+
`,Dw=Sm.div`
|
|
1281
1281
|
display: flex;
|
|
1282
1282
|
flex-direction: column;
|
|
1283
1283
|
height: 100%;
|
|
1284
|
-
`;import
|
|
1284
|
+
`;import Uw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Bw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Hw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Gw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Vw,useCallback as Am}from"react";import{Fragment as nc,jsx as ht,jsxs as _o}from"react/jsx-runtime";var km=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=Vw(!1),s=Am(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=Am(()=>{let u=document.createElement("a"),y=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([zw(r,o)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${y}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return _o(nc,{children:[ht(A,{backFn:a,title:"Save Password",closeable:!1}),ht(K,{}),_o(Yr,{children:[_o(Qr,{children:[ht(Gw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),ht("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),ht("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."})]}),ht(Zr,{centered:!0,children:ht(cm,{children:o})}),_o("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[ht(tc,{onClick:s,children:i?_o(nc,{children:[ht(Bw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):_o(nc,{children:[ht(Hw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),_o(tc,{onClick:d,children:[ht(Uw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),ht(Jr,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),ht(oe,{}),ht(V,{protectedByPrivy:!0})]})},zw=(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.`;import
|
|
1288
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import qw from"@heroicons/react/24/solid/CheckCircleIcon";import $w from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as jw,jsx as Ir,jsxs as ic}from"react/jsx-runtime";var Rm=({error:e,onClose:t})=>ic(jw,{children:[Ir(A,{closeable:!1}),Ir(K,{}),e?ic(jt,{children:[Ir($w,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ir(_e,{title:"Something went wrong",description:e})]}):ic(jt,{children:[Ir(qw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Ir(_e,{title:"Success"})]}),Ir(F,{onClick:t,children:"Close"}),Ir(oe,{}),Ir(V,{protectedByPrivy:!0})]});import{useReducer as Kw}from"react";var Yw=(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}},Im=()=>{let[e,t]=Kw(Yw,"creating");return{send:t,state:e}};import{jsx as mi}from"react/jsx-runtime";var Za=({onSubmit:e,...t})=>{let{send:r,state:o}=Im(),n=Mm(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);Jw(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),Oe)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=Mm(()=>{r("back")},[r]);return o==="creating"?mi(_m,{...t,onSubmit:n}):o==="saving"?mi(km,{...t,onSubmit:n,onBack:a}):o==="confirming"?mi(um,{...t,onSubmit:n,onBack:a}):o==="finalizing"?mi(gm,{...t,onSubmit:n,onBack:a}):o==="done"?mi(Rm,{...t,onSubmit:n}):null};import{Fragment as tC,jsx as Ao,jsxs as Lm}from"react/jsx-runtime";var Om=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,a]=fi(""),[i,l]=fi(!1),[s,d]=fi(),[u,y]=fi(null),[f,g]=fi(null),E=Qw(!1),{authenticated:v,getAccessToken:x}=G(),{refreshUser:C,closePrivyModal:P,createAnalyticsEvent:R,isNewUserThisSession:M,initializeWalletProxy:k}=W(),{onSuccess:B,onFailure:U,callAuthOnSuccessOnClose:H}=r.createWallet,T=e?.embeddedWallets.requireUserPasswordOnCreate===!0,q=!!(!n||E.current)&&!T,O=new ot(async()=>se());Wm(()=>{u||k(3e4).then(te=>y(te))},[u]),Wm(()=>{if(!v){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!T&&!i&&!E.current&&(l(!0),O.execute().finally(()=>l(!1)))},[T,v]);let Y=()=>{T&&f&&f?.recoveryMethod!=="user-passcode"?(U(new wt("User created a wallet but failed to set a password for it")),P({shouldCallAuthOnSuccess:!1})):f?(B(f),P({shouldCallAuthOnSuccess:H})):(U(new wt("User wallet creation failed")),P({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let se=async function(){let te=await x();if(te)try{R("embedded_wallet_creation_started");let z=await k(Fo);if(!z)throw new Error("walletProxy does not exist.");let Pe=1e4,we=new Promise((ge,gt)=>{setTimeout(()=>{gt(new Error("walletProxy.create timed out."))},Pe)});if(!await Promise.race([z.create({accessToken:te,recoveryPassword:s}),we]))throw new Error("walletProxy.create did not send a response.");let yt=await C();if(!yt)throw new Error("Failed to refresh user.");let Ae=Ce(yt);if(!Ae)throw new Error("Updated user is missing embedded wallet.");g(Ae),R("embedded_wallet_creation_completed",{walletAddress:Ae.address}),a(""),E.current=!0,T?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ae&&(B(Ae),P({shouldCallAuthOnSuccess:H}))}catch(z){if(E.current)return;R("embedded_wallet_creation_failed",{error:z.toString()}),a("An error has occurred, please try again."),console.warn(z)}else a("An error has occured, please login again."),R("embedded_wallet_creation_failed",{error:"Missing access token for user."})},re=async()=>{if(!T)return P({shouldCallAuthOnSuccess:H});l(!0);let te=250;return O.execute().then(()=>new Promise(z=>setTimeout(z,te))).finally(()=>l(!1))};return!T&&n?Lm(tC,{children:[Ao(A,{closeable:!1}),Lm(jt,{children:[Ao(Zw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ao(_e,{title:"Something went wrong",description:n})]}),Ao(F,{onClick:Y,children:"Close"}),Ao(eC,{})]}):q?Ao(pn,{}):Ao(Za,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:q||!u,buttonLoading:i,buttonHideAnimations:!f&&i,error:n,password:s||"",onClose:Y,onPasswordChange:d,onPasswordGenerate:()=>d(Ja()),onSubmit:re})},eC=Xw.div`
|
|
1289
1289
|
height: 44px;
|
|
1290
|
-
`;import{useEffect as
|
|
1290
|
+
`;import{useEffect as rC,useState as Qa}from"react";import{jsx as oC}from"react/jsx-runtime";var Nm=()=>{let[e,t]=Qa(null),[r,o]=Qa(!1),[n,a]=Qa(null),[i,l]=Qa(""),{authenticated:s,getAccessToken:d,user:u}=G(),{walletProxy:y,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),{app:v,navigate:x,data:C,onUserCloseViaDialogOrKeybindRef:P}=_(),{onSuccess:R,onFailure:M}=C.createWallet,k=Ce(u),B=e?.recoveryMethod==="user-passcode";rC(()=>{s||(x("LANDING"),M(new Ui("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){M(n),g({shouldCallAuthOnSuccess:!1});return}if(!B){M(new wt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};P.current=U;let H=async()=>{let q=await d();if(q&&k?.address&&i&&y)try{if(E("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await y.setRecoveryPassword({accessToken:q,address:k.address,recoveryPassword:i})).address){a(new wt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Y=await f(),se=Ce(Y);if(!se){a(new wt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(se),E("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(O){console.warn(O),a(O instanceof Error?O:new Error("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:O})}},T=async()=>{B?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await H(),o(!1))};return oC(Za,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:U},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(Ja()),onPasswordChange:l,onSubmit:T,onClose:U})};import nC from"@heroicons/react/24/outline/UserCircleIcon";import iC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as aC,jsx as Mr,jsxs as Xa}from"react/jsx-runtime";var Dm=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new wt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,Xa(aC,{children:[Mr(A,{onClose:d}),Mr(K,{}),Xa(jt,{children:[Xa(Cu,{children:[Mr(nC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Mr(bu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Mr(iC,{width:"12px",height:"12px",fill:"white"})})]}),Xa(_e,{title:"Secure Your Account",children:["Please set a password to secure your account.",Mr("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."})]})]}),Mr(F,{onClick:()=>{let y=Ce(e);r("embedded_wallet_set_password_started",{walletAddress:y?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Mr(oe,{}),Mr(V,{protectedByPrivy:!0})]})};import sC from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as lC,useState as es}from"react";import ts,{css as cC}from"styled-components";import{Fragment as fC,jsx as st,jsxs as ko}from"react/jsx-runtime";var Fm=()=>{let[e,t]=es(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),[u,y]=es(void 0),[f,g]=es(""),[E,v]=es(!1),{privyWallet:x,onCompleteNavigateTo:C,onSuccess:P,onFailure:R}=s.recoverWallet,M=(U="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),R(typeof U=="string"?new wt(U):U)};d.current=M,lC(()=>{if(!r||!x)return M("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let k=U=>{U&&y(U)};return ko(fC,{children:[st(A,{onClose:M}),st(K,{}),ko(pC,{children:[ko(dC,{children:[st(sC,{height:48,width:48,stroke:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),ko("div",{children:[ko(Zr,{children:[st(gn,{type:e?"password":"text",onChange:U=>k(U.target.value),disabled:E,style:{paddingRight:"2.3rem"}}),st(vn,{style:{right:"0.75rem"},children:e?st(wn,{onClick:()=>t(!1)}):st(Cn,{onClick:()=>t(!0)})})]}),!!f&&st(uC,{children:f})]}),ko("div",{children:[ko(wu,{children:[st("h4",{children:"Why is this necessary?"}),st("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),st(mC,{loading:E||!n,disabled:!u,onClick:async()=>{v(!0);let U=await o();if(U&&x&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:x.address}),await n?.recover({address:x.address,accessToken:U,recoveryPin:u}),g(""),C?l(C):a({shouldCallAuthOnSuccess:!1}),P?.(x),i("embedded_wallet_recovery_completed",{walletAddress:x.address})}catch(H){Qu(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return M("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&E,children:"Recover your account"})]})]}),st(oe,{}),st(V,{protectedByPrivy:!0})]})},dC=ts.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
flex-direction: column;
|
|
1293
1293
|
align-items: center;
|
|
@@ -1309,26 +1309,26 @@ 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
|
+
`,pC=ts.div`
|
|
1313
1313
|
display: flex;
|
|
1314
1314
|
flex-direction: column;
|
|
1315
1315
|
justify-content: space-between;
|
|
1316
|
-
`,
|
|
1316
|
+
`,uC=ts.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
|
-
`,
|
|
1324
|
-
${e=>e.hideAnimations&&
|
|
1323
|
+
`,mC=ts(F)`
|
|
1324
|
+
${e=>e.hideAnimations&&cC`
|
|
1325
1325
|
&& {
|
|
1326
1326
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1327
1327
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1328
1328
|
transition: none;
|
|
1329
1329
|
}
|
|
1330
1330
|
`}
|
|
1331
|
-
`;import
|
|
1331
|
+
`;import hC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import yC from"@heroicons/react/24/outline/PhoneIcon";import ac from"styled-components";import{Fragment as bC,jsx as Qt,jsxs as rs}from"react/jsx-runtime";var gC=e=>{let t=Qt(hC,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof S)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ye&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Qt(yC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof $e)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:Qt(Ga,{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:Qt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Qt("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}}},Um=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:a}=fe(),i=r?.errorModalData,l=gC(i?.error||new Error),s=d=>{if(d instanceof $e)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return rs(bC,{children:[Qt(A,{backFn:!o||n===o?void 0:t}),rs(vC,{children:[Qt(CC,{children:rs("div",{children:[Qt(Ha,{color:"var(--privy-color-error)"}),l.icon]})}),rs(wC,{children:[Qt("h3",{children:l.title}),Qt("p",{children:l.detail})]}),Qt(F,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},vC=ac.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
|
+
`,wC=ac.div`
|
|
1340
1340
|
display: flex;
|
|
1341
1341
|
flex-direction: column;
|
|
1342
1342
|
gap: 8px;
|
|
1343
|
-
`,
|
|
1343
|
+
`,CC=ac.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
|
-
`;import{useEffect as
|
|
1366
|
+
`;import{useEffect as jm,useRef as HC,useState as cc}from"react";import{isIOS as GC,isMobile as Km}from"react-device-detect";import dc from"styled-components";import{useState as EC}from"react";import TC from"styled-components";import{jsx as Bm}from"react/jsx-runtime";var os=({style:e,color:t,...r})=>Bm("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:Bm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as sc}from"react/jsx-runtime";var Hm=({color:e,...t})=>sc("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:sc("g",{children:sc("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as Gm,jsxs as xC}from"react/jsx-runtime";var Xr=e=>{let[t,r]=EC(!1);return xC(PC,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Gm(os,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Gm(Hm,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},PC=TC.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
|
-
`;import{useState as
|
|
1404
|
+
`;import{useState as SC}from"react";import _C from"styled-components";import{jsx as kC}from"react/jsx-runtime";var ns=e=>{let[t,r]=SC(!1);return kC(AC,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},AC=_C.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
|
-
`;import
|
|
1442
|
+
`;import RC from"qrcode";import IC from"react";import MC from"styled-components";import{jsx as Vm}from"react/jsx-runtime";var zm=()=>Vm("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:Vm("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as hi,jsx as lt,jsxs as $m}from"react/jsx-runtime";var xt=7,lc=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},WC=e=>{let t=RC.create(e,{errorCorrectionLevel:"high"}).modules,r=Kd(Array.from(t.data),t.size);return r=lc(r,0,0,xt,xt),r=lc(r,r.length-xt,0,xt,xt),r=lc(r,0,r.length-xt,xt,xt),r},LC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>lt(hi,{children:[0,1,2].map(a=>lt("circle",{r:r*(xt-a*2)/2,cx:e+r*xt/2,cy:t+r*xt/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),OC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-xt)*e,0],[0,(t-xt)*e]];return lt(hi,{children:n.map(([a,i])=>lt(LC,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},NC=({matrix:e,cellSize:t,color:r})=>lt(hi,{children:e.map((o,n)=>o.map((a,i)=>a?lt("circle",{r:t/2.5,cx:n*t+t/2,cy:i*t+t/2,fill:r},`circle-${n}-${i}`):lt(IC.Fragment,{},`circle-${n}-${i}`)))}),qm=(e,t)=>e-e%t,DC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:a})=>{if(!r)return lt(hi,{});let i=o||40,l=n||4,s=r,d=e/2-i/2-l;return $m(hi,{children:[lt("rect",{x:qm(d,t),y:qm(d,t),width:i+l*2+(d%t?t+.5:.5),height:i+l*2+(d%t?t+.5:.5),fill:a}),lt(s,{x:e/2-i/2,y:e/2-i/2,height:i,width:i})]})},FC=e=>{let t=e.outputSize,r=WC(e.url),o=t/r.length;return $m("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[lt(NC,{matrix:r,cellSize:o,color:e.fgColor}),lt(OC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),lt(DC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},UC=MC.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
|
-
`,bn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return lt(
|
|
1457
|
+
`,bn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return lt(UC,{size:o,bgColor:t,fgColor:r,children:lt(FC,{url:e.url,logo:{element:e.squareLogoElement??zm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as is,jsxs as BC}from"react/jsx-runtime";var yr=({style:e,...t})=>BC("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:[is("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),is("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"}),is("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"}),is("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as as,jsx as pe,jsxs as gr}from"react/jsx-runtime";var Ym="#8a63d2",Qm=1e3,VC=Qm*2,zC=Qm*120,Xm=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=_(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:y,createAnalyticsEvent:f}=W(),[g,E]=cc(void 0),[v,x]=cc(!1),[C,P]=cc(!1),R=HC([]),M=s?.render.inDialog?Oe:0,k=d(),B=k?.meta.connectUri;return jm(()=>{let U=Date.now(),H=setInterval(async()=>{let T=await k.pollForReady.execute(),q=Date.now()-U;if(T){clearInterval(H),x(!0);try{await u(),P(!0)}catch(O){let Y={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?Y.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(Y.retryable=!0,Y.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(Y.detail="Too many requests. Please wait before trying again.");E(Y)}}else q>zC&&(clearInterval(H),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},VC);return()=>{clearInterval(H),R.current.forEach(T=>clearTimeout(T))}},[]),jm(()=>{if(r&&e&&C&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(H)}C&&(At(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f("embedded_wallet_creation_failure_logout",{error:H,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M)):R.current.push(setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M)))}},[C,r,e,o]),Km||v?gr(as,{children:[pe(A,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),GC?pe(as,{children:gr(qC,{children:[pe(Zm,{children:gr("div",{children:[pe(It,{success:C,fail:!!g}),pe(yr,{style:{width:"38px",height:"38px"}})]})}),gr(Ye,{children:[pe(he,{children:g?g.message:"Sign in with Farcaster"}),pe(de,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),B&&pe(F,{onClick:U=>{U.preventDefault(),window.location.href=B},children:"Open Warpcast app"})]})}):pe(as,{children:gr(Jm,{children:[pe(Zm,{children:gr("div",{children:[pe(It,{success:C,fail:!!g}),pe(yr,{style:{width:"38px",height:"38px"}})]})}),gr(Ye,{children:[pe(he,{children:g?g.message:"Signing in with Farcaster"}),pe(de,{children:g?g.detail:"This should only take a moment"}),pe(at,{children:B&&Km&&pe(ns,{text:"Take me to Warpcast",url:B,color:Ym})})]})]})}),pe(X,{})]}):gr(as,{children:[pe(A,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),pe(Jm,{children:gr("div",{children:[pe(he,{children:"Sign in with Farcaster"}),pe(de,{children:"Scan with your phone's camera to continue."}),pe(rn,{children:B?pe(bn,{url:B,size:275,squareLogoElement:yr}):pe(ft,{})}),gr(at,{children:[pe(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),B&&pe(Xr,{text:B,itemName:"link",color:Ym})]})]})}),pe(X,{})]})},Jm=dc.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
align-items: center;
|
|
@@ -1462,14 +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
|
+
`,qC=dc.div`
|
|
1466
1466
|
display: flex;
|
|
1467
1467
|
flex-direction: column;
|
|
1468
1468
|
align-items: center;
|
|
1469
1469
|
justify-content: center;
|
|
1470
1470
|
gap: 24px;
|
|
1471
1471
|
width: 100%;
|
|
1472
|
-
`,
|
|
1472
|
+
`,Zm=dc.div`
|
|
1473
1473
|
display: flex;
|
|
1474
1474
|
flex-direction: column;
|
|
1475
1475
|
justify-content: center;
|
|
@@ -1492,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1492
1492
|
left: -19px;
|
|
1493
1493
|
top: -19px;
|
|
1494
1494
|
}
|
|
1495
|
-
`;import{useEffect as
|
|
1495
|
+
`;import{useEffect as $C,useRef as jC,useState as pc}from"react";import{isIOS as KC,isMobile as ef}from"react-device-detect";import uc from"styled-components";import{Fragment as ss,jsx as me,jsxs as Xt}from"react/jsx-runtime";var tf="#8a63d2",nf=1e3,YC=nf*2,JC=nf*300,af=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=W(),[i,l]=pc(void 0),[s,d]=pc(!1),[u,y]=pc(!1),f=jC([]),g=o?.render.inDialog?Oe:0,E=r?.farcasterSigner;$C(()=>{let x=Date.now(),C=setInterval(async()=>{if(!E?.public_key){clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}E.status==="approved"&&(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let P=await n(E?.public_key),R=Date.now()-x;P.status==="approved"?(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):R>JC?(clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):P.status==="revoked"&&(clearInterval(C),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},YC);return()=>{clearInterval(C),f.current.forEach(P=>clearTimeout(P))}},[]);let v=E?.status==="pending_approval"?E.signer_approval_url:void 0;return ef||s?Xt(ss,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),KC?me(ss,{children:Xt(ZC,{children:[me(of,{children:Xt("div",{children:[me(It,{success:u,fail:!!i}),me(yr,{style:{width:"38px",height:"38px"}})]})}),Xt(Ye,{children:[me(he,{children:i?i.message:"Add a signer to Farcaster"}),me(de,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&me(F,{onClick:x=>{x.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):me(ss,{children:Xt(rf,{children:[me(of,{children:Xt("div",{children:[me(It,{success:u,fail:!!i}),me(yr,{style:{width:"38px",height:"38px"}})]})}),Xt(Ye,{children:[me(he,{children:i?i.message:"Requesting signer from Farcaster"}),me(de,{children:i?i.detail:"This should only take a moment"}),me(at,{children:v&&ef&&me(ns,{text:"Take me to Warpcast",url:v,color:tf})})]})]})}),me(X,{})]}):Xt(ss,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),me(rf,{children:Xt("div",{children:[me(he,{children:"Add a signer to Farcaster"}),Xt(de,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),me(rn,{children:E?.status==="pending_approval"?me(bn,{url:E.signer_approval_url,size:275,squareLogoElement:yr}):me(ft,{})}),Xt(at,{children:[me(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),E?.status==="pending_approval"&&me(Xr,{text:E.signer_approval_url,itemName:"link",color:tf})]})]})}),me(X,{})]})},rf=uc.div`
|
|
1496
1496
|
display: flex;
|
|
1497
1497
|
flex-direction: column;
|
|
1498
1498
|
align-items: center;
|
|
@@ -1500,14 +1500,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1500
1500
|
margin-left: 27px;
|
|
1501
1501
|
margin-right: 27px;
|
|
1502
1502
|
gap: 24px;
|
|
1503
|
-
`,
|
|
1503
|
+
`,ZC=uc.div`
|
|
1504
1504
|
display: flex;
|
|
1505
1505
|
flex-direction: column;
|
|
1506
1506
|
align-items: center;
|
|
1507
1507
|
justify-content: center;
|
|
1508
1508
|
gap: 24px;
|
|
1509
1509
|
width: 100%;
|
|
1510
|
-
`,
|
|
1510
|
+
`,of=uc.div`
|
|
1511
1511
|
display: flex;
|
|
1512
1512
|
flex-direction: column;
|
|
1513
1513
|
justify-content: center;
|
|
@@ -1530,7 +1530,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1530
1530
|
left: -19px;
|
|
1531
1531
|
top: -19px;
|
|
1532
1532
|
}
|
|
1533
|
-
`;import
|
|
1533
|
+
`;import XC from"@heroicons/react/24/outline/ClockIcon";import e0 from"@heroicons/react/24/outline/EyeSlashIcon";import t0 from"@heroicons/react/24/outline/LinkIcon";import vr from"styled-components";import{jsx as mc,jsxs as QC}from"react/jsx-runtime";var ls=({size:e=61,...t})=>mc("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:QC("g",{id:"moonpay_symbol_wht 2",children:[mc("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),mc("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as sf,jsx as ct,jsxs as Ro}from"react/jsx-runtime";var fc=({title:e,desc:t,icon:r})=>Ro(s0,{children:[ct(c0,{children:r}),Ro(l0,{children:[ct(i0,{children:e}),ct(a0,{children:t})]})]}),lf=({app:e,signedUrl:t,onContinue:r})=>Ro(sf,{children:[Ro(o0,{children:[ct(ls,{size:"3.75rem"}),Ro(n0,{children:[e?.name," uses ",ct("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Ro(d0,{children:[ct(fc,{icon:ct(t0,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Ro(sf,{children:["Connect a payment method (",ct("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),ct(fc,{icon:ct(XC,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),ct(fc,{icon:ct(e0,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),ct(p0,{className:"mobile-only"})]}),ct(r0,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),ct(Ma,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),r0=vr.span`
|
|
1534
1534
|
display: inline-block;
|
|
1535
1535
|
color: var(--privy-color-foreground-3);
|
|
1536
1536
|
text-align: center;
|
|
@@ -1539,13 +1539,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1539
1539
|
font-weight: 400;
|
|
1540
1540
|
line-height: 140%; /* 0.875rem */
|
|
1541
1541
|
margin-bottom: 0.25rem;
|
|
1542
|
-
`,
|
|
1542
|
+
`,o0=vr.div`
|
|
1543
1543
|
display: flex;
|
|
1544
1544
|
flex-direction: column;
|
|
1545
1545
|
align-items: center;
|
|
1546
1546
|
justify-content: center;
|
|
1547
1547
|
padding: 1.5rem 0;
|
|
1548
|
-
`,
|
|
1548
|
+
`,n0=vr.span`
|
|
1549
1549
|
color: var(--privy-color-foreground);
|
|
1550
1550
|
text-align: center;
|
|
1551
1551
|
font-size: 1.125rem;
|
|
@@ -1554,46 +1554,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1554
1554
|
margin: 1.5rem 0;
|
|
1555
1555
|
text-align: center;
|
|
1556
1556
|
max-width: 19.5rem;
|
|
1557
|
-
`,
|
|
1557
|
+
`,i0=vr.span`
|
|
1558
1558
|
color: var(--privy-color-foreground);
|
|
1559
1559
|
font-size: 0.875rem;
|
|
1560
1560
|
font-weight: 500;
|
|
1561
1561
|
line-height: 1.225rem;
|
|
1562
1562
|
width: 100%;
|
|
1563
|
-
`,
|
|
1563
|
+
`,a0=vr.span`
|
|
1564
1564
|
color: var(--privy-color-foreground-2);
|
|
1565
1565
|
font-size: 0.875rem;
|
|
1566
1566
|
font-weight: 400;
|
|
1567
1567
|
line-height: 1.225rem;
|
|
1568
|
-
`,
|
|
1568
|
+
`,s0=vr.div`
|
|
1569
1569
|
display: flex;
|
|
1570
1570
|
align-items: flex-start;
|
|
1571
1571
|
gap: 0.5rem;
|
|
1572
1572
|
align-self: stretch;
|
|
1573
|
-
`,
|
|
1573
|
+
`,l0=vr.div`
|
|
1574
1574
|
display: flex;
|
|
1575
1575
|
flex-direction: column;
|
|
1576
1576
|
gap: 0.25rem;
|
|
1577
1577
|
align-items: flex-start;
|
|
1578
1578
|
text-align: left;
|
|
1579
1579
|
flex: 1 0 0;
|
|
1580
|
-
`,l0=vr.div`
|
|
1581
|
-
padding-top: 2px;
|
|
1582
1580
|
`,c0=vr.div`
|
|
1581
|
+
padding-top: 2px;
|
|
1582
|
+
`,d0=vr.div`
|
|
1583
1583
|
display: flex;
|
|
1584
1584
|
flex-direction: column;
|
|
1585
1585
|
gap: 1.25rem;
|
|
1586
1586
|
margin: 0 0.5rem;
|
|
1587
|
-
`,
|
|
1587
|
+
`,p0=vr.div`
|
|
1588
1588
|
margin: 30px 0;
|
|
1589
|
-
`;import{ofetch as
|
|
1589
|
+
`;import{ofetch as u0}from"ofetch";import{useEffect as m0,useRef as f0,useState as h0}from"react";var cs="moonpay",cf="sdk_fiat_on_ramp_completed_with_status";async function df(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function y0(e,t){let r=t?Gd:Hd,o=t?zd:Vd;return u0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function pf(e,t=!1){let[r,o]=h0(null),{createAnalyticsEvent:n}=W(),a=f0(0);return m0(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await y0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(cf,{status:s,provider:cs,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}),clearInterval(i))}catch(l){l.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n(cf,{status:"serviceFailure",provider:cs}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as g0,jsx as hc,jsxs as v0}from"react/jsx-runtime";var uf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:v0(g0,{children:[hc(A,{title:"Fund account"},"header"),hc(lf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:cs}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),hc(V,{protectedByPrivy:!0})]})};import w0 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import C0 from"@heroicons/react/24/solid/CheckCircleIcon";import b0 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as E0}from"react";import mf from"styled-components";import{Fragment as yc,jsx as dt,jsxs as Io}from"react/jsx-runtime";var ff=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=pf(o||null,e.fiatOnRamp.useSandbox);return Io(yc,{children:[dt(A,{title:"Fund account"},"header"),dt(P0,{status:n,onClickCta:r}),dt(V,{protectedByPrivy:!0})]})},T0=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:Io(yc,{children:[Io("p",{children:["It looks like there was an issue with your payment. Please contact"," ",dt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),dt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},P0=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=E0(()=>T0(e),[e]);return Io(yc,{children:[Io(k0,{children:[dt(_0,{status:e}),Io(Ye,{children:[dt("h3",{children:r}),dt(A0,{children:o})]})]}),n&&dt(F,{onClick:t,children:n})]})},x0=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",S0=e=>{switch(e){case"serviceFailure":case"failed":return b0;case"completed":return C0;case"waitingAuthorization":return()=>dt(w0,{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}},_0=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Io("div",{style:{position:"relative"},children:[dt(ft,{color:o,style:{position:"absolute"}}),dt(Sl,{color:o}),dt(ls,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=S0(e),r=x0(e);return dt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&dt(t,{width:"4rem",height:"4rem",color:r})})},A0=mf.p`
|
|
1590
1590
|
font-size: 1rem;
|
|
1591
1591
|
color: var(--privy-color-foreground-3);
|
|
1592
1592
|
margin-bottom: 1rem;
|
|
1593
1593
|
display: flex;
|
|
1594
1594
|
flex-direction: column;
|
|
1595
1595
|
gap: 1rem;
|
|
1596
|
-
`,
|
|
1596
|
+
`,k0=mf.div`
|
|
1597
1597
|
display: flex;
|
|
1598
1598
|
flex-direction: column;
|
|
1599
1599
|
align-items: center;
|
|
@@ -1601,7 +1601,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1601
1601
|
margin-left: 1.75rem;
|
|
1602
1602
|
margin-right: 1.75rem;
|
|
1603
1603
|
padding: 2rem 0;
|
|
1604
|
-
`;import
|
|
1604
|
+
`;import R0 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import I0 from"styled-components";import{Fragment as W0,jsx as eo,jsxs as L0}from"react/jsx-runtime";var hf=()=>{let{closePrivyModal:e}=W();return L0(W0,{children:[eo(A,{},"header"),eo(M0,{children:eo(R0,{style:{width:32,height:32}})}),eo(mr,{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"}}),eo(Ot,{children:eo(F,{onClick:()=>e(),children:"Close"})}),eo(oe,{}),eo(V,{protectedByPrivy:!0})]})},M0=I0.div`
|
|
1605
1605
|
border-radius: 50%;
|
|
1606
1606
|
height: 68px;
|
|
1607
1607
|
width: 68px;
|
|
@@ -1611,7 +1611,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1611
1611
|
background-color: var(--privy-color-accent);
|
|
1612
1612
|
color: white;
|
|
1613
1613
|
margin: 0 auto 24px auto;
|
|
1614
|
-
`;import*as
|
|
1614
|
+
`;import*as wf from"react-device-detect";import F0 from"styled-components";import gc from"styled-components";import{jsx as yf}from"react/jsx-runtime";var gf=({style:e,...t})=>yf("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:yf("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as N0,jsxs as D0}from"react/jsx-runtime";var vf=gc.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
flex-direction: column;
|
|
1617
1617
|
justify-content: flex-start;
|
|
@@ -1622,7 +1622,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1622
1622
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1623
1623
|
height: 12px;
|
|
1624
1624
|
}
|
|
1625
|
-
`,ds=({children:e})=>
|
|
1625
|
+
`,ds=({children:e})=>D0(O0,{children:[N0(gf,{style:{width:"16px",height:"16px"}}),e]}),O0=gc.div`
|
|
1626
1626
|
display: flex;
|
|
1627
1627
|
justify-content: flex-start;
|
|
1628
1628
|
justify-items: center;
|
|
@@ -1640,15 +1640,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1640
1640
|
margin-bottom: auto;
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
`;import{Fragment as
|
|
1643
|
+
`;import{Fragment as H0,jsx as Ue,jsxs as yi}from"react/jsx-runtime";var U0=()=>yi(B0,{children:[Ue(ti,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),Ue(at,{children:Ue(lr,{style:{width:"152px",height:"152px"}})}),yi(vf,{children:[Ue(ds,{children:yi("div",{children:[Ue("span",{children:"Install the "}),Ue("a",{href:wf.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"})]})}),Ue(vc,{}),Ue(ds,{children:"Set up your first wallet"}),Ue(vc,{}),Ue(ds,{children:"Store your recovery phrase in a safe place!"})]}),Ue(Wa,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Cf=()=>{let{navigateBack:e}=_();return yi(H0,{children:[Ue(A,{backFn:e},"header"),Ue(K,{}),Ue(U0,{}),Ue(oe,{}),yi(X,{children:[Ue("span",{children:"Still not sure? "}),Ue("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},B0=F0(at)`
|
|
1644
1644
|
gap: 30px;
|
|
1645
1645
|
|
|
1646
1646
|
> :first-child > svg {
|
|
1647
1647
|
margin-top: 20px;
|
|
1648
1648
|
}
|
|
1649
|
-
`;import
|
|
1649
|
+
`;import T2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as P2,useState as Df}from"react";import{isMobile as x2}from"react-device-detect";import S2 from"styled-components";import j0 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as K0}from"react";import G0 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as V0,useState as bf}from"react";import Tf from"styled-components";import{Fragment as $0,jsx as gi,jsxs as Ef}from"react/jsx-runtime";var ps=V0((e,t)=>{let[r,o]=bf(""),[n,a]=bf(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:d,currentScreen:u}=_(),{enabled:y,token:f}=fe(),g=Ji(r),E=n,v=n||!g,x=P=>{a(!0),l(r,P).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{d({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},C=()=>{y&&!f&&!i?(d({captchaModalData:{callback:P=>l(r,P),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(f)};return Ef($0,{children:[gi(z0,{children:Ef(q0,{stacked:e.stacked,children:[gi(G0,{}),gi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:P=>o(P.target.value),onKeyUp:P=>{P.key==="Enter"&&C()},value:r,autoComplete:"email"}),e.stacked?null:gi(Qo,{isSubmitting:E,onClick:C,disabled:v,children:"Submit"})]})}),e.stacked?gi(F,{loadingText:null,loading:E,disabled:v,onClick:C,children:"Submit"}):null]})}),z0=Tf.div`
|
|
1650
1650
|
width: 100%;
|
|
1651
|
-
`,
|
|
1651
|
+
`,q0=Tf.label`
|
|
1652
1652
|
display: block;
|
|
1653
1653
|
position: relative;
|
|
1654
1654
|
width: 100%;
|
|
@@ -1709,9 +1709,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1709
1709
|
&& > input::placeholder {
|
|
1710
1710
|
color: var(--privy-color-foreground-3);
|
|
1711
1711
|
}
|
|
1712
|
-
`;import{Fragment as
|
|
1712
|
+
`;import{Fragment as Y0,jsx as us,jsxs as Pf}from"react/jsx-runtime";var ms=({isEditable:e,setIsEditable:t})=>{let r=K0(null);return Pf(Y0,{children:[us(Ar,{if:!e,children:us(ps,{ref:r})}),us(Ar,{if:e,children:Pf(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[us(j0,{})," Continue with Email"]})})]})};import{useState as J0}from"react";import{jsx as wc,jsxs as Z0}from"react/jsx-runtime";var fs=()=>{let[e,t]=J0(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=fe(),{initLoginWithFarcaster:l}=W();return Z0(Se,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[wc(yr,{})," Farcaster",e&&wc("span",{children:wc(Eo,{})})]})};import d2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as p2}from"react";import{forwardRef as a2,useState as Cc}from"react";import Rf from"styled-components";import Q0 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as X0,AsYouType as e2,getCountries as t2,getCountryCallingCode as hs,getExampleNumber as r2}from"libphonenumber-js/min";import{jsx as i2,jsxs as n2}from"react/jsx-runtime";var vi=(e,t)=>X0(String(e),t),ys=(e,t)=>`+${hs(t)} ${e}`,xf=e=>`*${e.replaceAll("-","").slice(-4)}`,Sf=e=>new e2(e),o2=t2().map(e=>({code:e,callCode:hs(e)})),_f=e=>{let t=r2(e,Q0)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Af=({value:e,onChange:t})=>i2("select",{value:e,onChange:t,children:o2.map(r=>n2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as c2,jsx as wi,jsxs as kf}from"react/jsx-runtime";var En=a2((e,t)=>{let{app:r}=_(),[o,n]=Cc(""),[a,i]=Cc(r?.intl.defaultCountry??"US"),l=vi(o,a),s=Sf(a),d=_f(a),u=hs(a),y=!l,[f,g]=Cc(!1),E=u.length,v=P=>{let R=P.target.value;i(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:ys(o,R),countryCode:R,isValid:vi(o,a)})},x=P=>{try{let R=P.replace(/\D/g,""),M=o.replace(/\D/g,""),k=R===M?P:s.input(P);n(k),e.onChange&&e.onChange({rawPhoneNumber:k,qualifiedPhoneNumber:ys(P,a),countryCode:a,isValid:vi(P,a)})}catch(R){console.error("Error processing phone number:",R)}},C=()=>{g(!0);let P=ys(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:P,countryCode:a,isValid:vi(o,a)}).finally(()=>g(!1))};return kf(c2,{children:[wi(s2,{children:kf(l2,{callingCodeLength:E,stacked:e.stacked,children:[wi(Af,{value:a,onChange:v}),wi("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:P=>{x(P.target.value)},onKeyUp:P=>{P.key==="Enter"&&C()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?wi(Qo,{isSubmitting:f,onClick:C,disabled:y,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?wi(F,{loading:f,loadingText:null,onClick:C,disabled:y,children:"Submit"}):null]})}),s2=Rf.div`
|
|
1713
1713
|
width: 100%;
|
|
1714
|
-
`,
|
|
1714
|
+
`,l2=Rf.label`
|
|
1715
1715
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1716
1716
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1717
1717
|
display: block;
|
|
@@ -1800,11 +1800,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1800
1800
|
&& > input::placeholder {
|
|
1801
1801
|
color: var(--privy-color-foreground-3);
|
|
1802
1802
|
}
|
|
1803
|
-
`;import{Fragment as p2,jsx as gs,jsxs as Rf}from"react/jsx-runtime";var vs=({isEditable:e,setIsEditable:t})=>{let r=d2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Rf(p2,{children:[gs(Ar,{if:!e,children:gs(En,{ref:r,onSubmit:u})}),gs(Ar,{if:e,children:Rf(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[gs(c2,{})," Continue with SMS"]})})]})};import{useState as g2}from"react";import{jsx as If,jsxs as u2}from"react/jsx-runtime";var ws=({style:e,...t})=>u2("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:[If("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"}),If("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as Ci,jsxs as m2}from"react/jsx-runtime";var Cs=({style:e,...t})=>m2("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:[Ci("g",{clipPath:"url(#clip0)",children:Ci("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"})}),Ci("defs",{children:Ci("clipPath",{id:"clip0",children:Ci("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Mf}from"react/jsx-runtime";var bs=({style:e,...t})=>Mf("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:Mf("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});import{jsx as Es,jsxs as f2}from"react/jsx-runtime";var Ts=({style:e,...t})=>f2("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:[Es("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"}),Es("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"}),Es("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"}),Es("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Ps}from"react/jsx-runtime";function xs({style:e,...t}){return Ps("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:Ps("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ps("g",{transform:"scale(5.12,5.12)",children:Ps("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Wf,jsxs as h2}from"react/jsx-runtime";function Ss(e){return h2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Wf("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"}),Wf("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as bc,jsxs as y2}from"react/jsx-runtime";function _s(e){return y2("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[bc("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),bc("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),bc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Lf}from"react/jsx-runtime";var As=({style:e,...t})=>Lf("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:Lf("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});import{jsx as to,jsxs as w2}from"react/jsx-runtime";var v2={apple:{logo:to(ws,{}),displayName:"Apple"},discord:{logo:to(Cs,{}),displayName:"Discord"},github:{logo:to(bs,{}),displayName:"GitHub"},google:{logo:to(Ts,{}),displayName:"Google"},linkedin:{logo:to(xs,{}),displayName:"LinkedIn"},spotify:{logo:to(Ss,{}),displayName:"Spotify"},twitter:{logo:to(As,{}),displayName:"Twitter"},tiktok:{logo:to(_s,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[a,i]=g2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=v2[e];return w2(Se,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import C2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Of,jsxs as b2}from"react/jsx-runtime";var ks=({onClick:e,text:t,icon:r})=>b2(Se,{onClick:e,children:[r,Of(Oa,{children:t}),Of(C2,{})]});import{Fragment as Ec,jsx as He,jsxs as Is}from"react/jsx-runtime";var Ms=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Nf("default"),[u,y]=Nf("email");T2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(ms,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(vs,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(fs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!P2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ii([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),x=[...E,...v],C=S2({primary:E.length,overflow:v.length}),[P,R]=jd(x,C);return Is(Ec,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(_2,{}),He(Na,{style:{overflow:"hidden",padding:2},children:Is(Lt,{children:[s==="default"&&Is(Ec,{children:[...P,R.length>0&&He(ks,{text:"More options",icon:He(E2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Is(Ec,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Rs=5,S2=({primary:e,overflow:t})=>e<Rs?e:e===Rs&&t===0?Rs:Rs-1,_2=x2(cn)`
|
|
1803
|
+
`;import{Fragment as u2,jsx as gs,jsxs as If}from"react/jsx-runtime";var vs=({isEditable:e,setIsEditable:t})=>{let r=p2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return If(u2,{children:[gs(Ar,{if:!e,children:gs(En,{ref:r,onSubmit:u})}),gs(Ar,{if:e,children:If(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[gs(d2,{})," Continue with SMS"]})})]})};import{useState as v2}from"react";import{jsx as Mf,jsxs as m2}from"react/jsx-runtime";var ws=({style:e,...t})=>m2("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:[Mf("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"}),Mf("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as Ci,jsxs as f2}from"react/jsx-runtime";var Cs=({style:e,...t})=>f2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[Ci("g",{clipPath:"url(#clip0)",children:Ci("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"})}),Ci("defs",{children:Ci("clipPath",{id:"clip0",children:Ci("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Wf}from"react/jsx-runtime";var bs=({style:e,...t})=>Wf("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:Wf("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});import{jsx as Es,jsxs as h2}from"react/jsx-runtime";var Ts=({style:e,...t})=>h2("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:[Es("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"}),Es("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"}),Es("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"}),Es("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Ps}from"react/jsx-runtime";function xs({style:e,...t}){return Ps("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:Ps("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ps("g",{transform:"scale(5.12,5.12)",children:Ps("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Lf,jsxs as y2}from"react/jsx-runtime";function Ss(e){return y2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Lf("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"}),Lf("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as bc,jsxs as g2}from"react/jsx-runtime";function _s(e){return g2("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[bc("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),bc("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),bc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Of}from"react/jsx-runtime";var As=({style:e,...t})=>Of("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:Of("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});import{jsx as to,jsxs as C2}from"react/jsx-runtime";var w2={apple:{logo:to(ws,{}),displayName:"Apple"},discord:{logo:to(Cs,{}),displayName:"Discord"},github:{logo:to(bs,{}),displayName:"GitHub"},google:{logo:to(Ts,{}),displayName:"Google"},linkedin:{logo:to(xs,{}),displayName:"LinkedIn"},spotify:{logo:to(Ss,{}),displayName:"Spotify"},twitter:{logo:to(As,{}),displayName:"Twitter"},tiktok:{logo:to(_s,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[a,i]=v2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=w2[e];return C2(Se,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import b2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Nf,jsxs as E2}from"react/jsx-runtime";var ks=({onClick:e,text:t,icon:r})=>E2(Se,{onClick:e,children:[r,Nf(Oa,{children:t}),Nf(b2,{})]});import{Fragment as Ec,jsx as He,jsxs as Is}from"react/jsx-runtime";var Ms=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Df("default"),[u,y]=Df("email");P2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(ms,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(vs,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(fs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!x2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ii([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),x=[...E,...v],C=_2({primary:E.length,overflow:v.length}),[P,R]=jd(x,C);return Is(Ec,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(A2,{}),He(Na,{style:{overflow:"hidden",padding:2},children:Is(Lt,{children:[s==="default"&&Is(Ec,{children:[...P,R.length>0&&He(ks,{text:"More options",icon:He(T2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Is(Ec,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Rs=5,_2=({primary:e,overflow:t})=>e<Rs?e:e===Rs&&t===0?Rs:Rs-1,A2=S2(cn)`
|
|
1804
1804
|
margin-bottom: 16px;
|
|
1805
|
-
`;import
|
|
1805
|
+
`;import M2 from"@heroicons/react/24/outline/EnvelopeIcon";import W2 from"@heroicons/react/24/outline/PhoneIcon";import L2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as O2,useState as Hf}from"react";import{isMobile as N2}from"react-device-detect";import D2 from"styled-components";import{jsx as bi,jsxs as Ff}from"react/jsx-runtime";var Uf=({...e})=>Ff("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Ff("g",{clipPath:"url(#clip0_2856_1743)",children:[bi("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"}),bi("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"})]}),bi("defs",{children:bi("clipPath",{id:"clip0_2856_1743",children:bi("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import k2 from"@heroicons/react/24/outline/ChevronRightIcon";import R2 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Tc,jsxs as I2}from"react/jsx-runtime";var Bf=({onClick:e,text:t})=>I2(Se,{onClick:e,children:[Tc(R2,{}),Tc(Oa,{children:t}),Tc(k2,{})]});import{Fragment as Ei,jsx as Te,jsxs as Tn}from"react/jsx-runtime";var Ws=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:y,tiktok:f,linkedin:g,apple:E,wallet:v,farcaster:x}=o?.loginMethods??{},C=o?.appearance.loginGroupPriority||"web2-first",P=o?.appearance.hideDirectWeb2Inputs,[R,M]=Hf("default"),[k,B]=Hf(a?"email":"sms");O2(()=>{B(a?"email":"sms")},[a]);let U=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=U;let H=[a&&Te(ms,{isEditable:k==="email",setIsEditable:()=>{B("email")}}),i&&Te(vs,{isEditable:k==="sms",setIsEditable:()=>{B("sms")}})].filter(Boolean),T=[l&&Te(Be,{provider:"google"}),s&&(!N2||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Te(Be,{provider:"twitter"}),d&&Te(Be,{provider:"discord"}),u&&Te(Be,{provider:"github"}),y&&Te(Be,{provider:"spotify"}),f&&Te(Be,{provider:"tiktok"}),g&&Te(Be,{provider:"linkedin"}),E&&Te(Be,{provider:"apple"}),x&&Te(fs,{})].filter(Boolean),q=ii(o.appearance.walletList,r,e,o.appearance.walletList),O=R==="default"?void 0:()=>{M("default")},Y=U2({priority:C,email:a,sms:i,social:T}),se=B2({priority:C,email:a,sms:i,social:T}),re=H2({priority:C,email:a,sms:i,social:T}),te=Te(Bf,{text:re,onClick:()=>M("web3-overflow")}),z=Te(ks,{text:Y,icon:se,onClick:()=>M("web2-overflow")}),Pe=P?0:1;return Tn(Ei,{children:[Te(A,{title:"Log in or sign up",onClose:U,backFn:O}),R==="default"&&Te(F2,{}),Te(Na,{style:{overflow:"hidden",padding:2},children:Tn(Lt,{children:[R==="default"&&C==="web2-first"&&Tn(Ei,{children:[...H,...T.length+H.length>4?T.slice(0,3-H.length):T,H.length+T.length>4&&z,v&&te]}),R==="default"&&C==="web3-first"&&Tn(Ei,{children:[v&&Tn(Ei,{children:[...q.length>4?q.slice(0,3):q,q.length>4&&te]}),H.length+T.length>Pe&&z,H.length+T.length===Pe&&H.length?H[0]:null,H.length+T.length===Pe&&T.length?T[0]:null]}),R==="web2-overflow"&&Tn(Ei,{children:[...C==="web3-first"?H:[],...T]}),...R==="web3-overflow"?q:[]]})}),o&&Te(Xo,{app:o}),Te(V,{protectedByPrivy:!0})]})},F2=D2(cn)`
|
|
1806
1806
|
margin-bottom: 16px;
|
|
1807
|
-
`,
|
|
1807
|
+
`,U2=({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",B2=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Te(L2,{}):t&&r?Te(Uf,{}):t?Te(M2,{}):r?Te(W2,{}):null,H2=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Gf}from"react/jsx-runtime";var Vf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Gf(Ms,{connectOnly:!0}):Gf(Ws,{connectOnly:!0})};import{jsx as zf}from"react/jsx-runtime";var qf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?zf(Ms,{connectOnly:!1}):zf(Ws,{connectOnly:!1})};import G2 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as V2,jsx as ro,jsxs as z2}from"react/jsx-runtime";var $f=()=>{let{app:e}=_();return z2(V2,{children:[ro(A,{},"header"),ro(K,{}),ro(_e,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ro(G2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ro(Ot,{children:ro(ps,{stacked:!0})}),ro(oe,{}),ro(V,{protectedByPrivy:!0})]})};import q2 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as $2,jsx as oo,jsxs as j2}from"react/jsx-runtime";var jf=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:a}=W();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return j2($2,{children:[oo(A,{},"header"),oo(K,{}),oo(_e,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:oo(q2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),oo(Ot,{children:oo(En,{stacked:!0,onSubmit:i})}),oo(oe,{}),oo(V,{protectedByPrivy:!0})]})};import{Fragment as K2,jsx as Ti,jsxs as Y2}from"react/jsx-runtime";var Kf=()=>{let{linkingHint:e}=W(),{app:t}=_(),r=e?`Select the wallet with ${Br(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Y2(K2,{children:[Ti(A,{},"header"),Ti(mr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Ti(Lt,{children:Ti(ln,{connectOnly:!1})}),Ti(V,{protectedByPrivy:!0})]})};import{jsx as Yf,jsxs as J2}from"react/jsx-runtime";var Jf=({style:e,...t})=>J2("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:[Yf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Yf("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as Z2,jsx as no,jsxs as Zf}from"react/jsx-runtime";var Qf=()=>{let{closePrivyModal:e}=W(),{navigate:t}=_();return Zf(Z2,{children:[no(A,{},"header"),no(K,{}),no(Jf,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),no(mr,{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"}}),Zf(Ot,{children:[no(F,{onClick:()=>t("LANDING"),children:"Try again"}),no($t,{onClick:()=>e(),children:"Cancel"})]}),no(oe,{}),no(V,{protectedByPrivy:!0})]})};import sh from"@heroicons/react/20/solid/CheckIcon";import v3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import w3 from"@heroicons/react/24/outline/FingerPrintIcon";import C3 from"@heroicons/react/24/outline/PhoneIcon";import lh from"@heroicons/react/24/outline/TrashIcon";import b3 from"@heroicons/react/24/solid/CheckBadgeIcon";import ch from"@heroicons/react/24/solid/CheckCircleIcon";import dh from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import E3 from"@heroicons/react/24/solid/IdentificationIcon";import kc from"@heroicons/react/24/solid/PhoneIcon";import Ac from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as ph,useState as Wr}from"react";import{useState as Sc}from"react";import{isMobile as o3}from"react-device-detect";import oh from"styled-components";import{Dialog as Xf,Transition as Pc}from"@headlessui/react";import xc from"react";import xn from"styled-components";import{jsx as Pn,jsxs as r3}from"react/jsx-runtime";var eh=({children:e,open:t,onClick:r,...o})=>Pn(Pc,{show:t,as:xc.Fragment,children:r3(Xf,{onClose:r,...o,as:X2,children:[Pn(Pc.Child,{as:xc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(Q2,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Pn(e3,{children:Pn(Pc.Child,{as:xc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(Xf.Panel,{as:t3,children:e})})})]})}),Sn=xn.div`
|
|
1808
1808
|
display: flex;
|
|
1809
1809
|
flex-direction: column;
|
|
1810
1810
|
text-align: center;
|
|
@@ -1827,7 +1827,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1827
1827
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1828
1828
|
border-radius: var(--privy-border-radius-lg);
|
|
1829
1829
|
}
|
|
1830
|
-
`,
|
|
1830
|
+
`,Q2=xn.div`
|
|
1831
1831
|
position: fixed;
|
|
1832
1832
|
inset: 0;
|
|
1833
1833
|
|
|
@@ -1840,10 +1840,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1840
1840
|
backdrop-filter: unset;
|
|
1841
1841
|
-webkit-backdrop-filter: unset;
|
|
1842
1842
|
}
|
|
1843
|
-
`,
|
|
1843
|
+
`,X2=xn.div`
|
|
1844
1844
|
position: relative;
|
|
1845
1845
|
z-index: 999999;
|
|
1846
|
-
`,
|
|
1846
|
+
`,e3=xn.div`
|
|
1847
1847
|
position: fixed;
|
|
1848
1848
|
inset: 0;
|
|
1849
1849
|
display: flex;
|
|
@@ -1851,7 +1851,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1851
1851
|
justify-content: center;
|
|
1852
1852
|
width: 100vw;
|
|
1853
1853
|
min-height: 100vh;
|
|
1854
|
-
`,
|
|
1854
|
+
`,t3=xn.div`
|
|
1855
1855
|
// reset some default dialog styles
|
|
1856
1856
|
padding: 0;
|
|
1857
1857
|
background: transparent;
|
|
@@ -1898,13 +1898,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1898
1898
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1899
1899
|
border-radius: var(--privy-border-radius-lg);
|
|
1900
1900
|
}
|
|
1901
|
-
`,
|
|
1901
|
+
`,th=xn.div`
|
|
1902
1902
|
display: flex;
|
|
1903
1903
|
flex-direction: column;
|
|
1904
1904
|
align-items: center;
|
|
1905
1905
|
justify-content: center;
|
|
1906
1906
|
height: 100%;
|
|
1907
|
-
`;import{Fragment as
|
|
1907
|
+
`;import{Fragment as d3,jsx as Pi,jsxs as c3}from"react/jsx-runtime";var xi=6,n3=new Array(xi).fill("");function i3(e){return e.replace(/\s+/g,"")}function _c(e){return/^[0-9]{1}$/.test(e)}function rh(e){return e.length===xi&&e.every(_c)}function a3(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var _n=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=Sc(n3),[i,l]=Sc(null),[s,d]=Sc(null),u=async E=>{E.preventDefault();let v=i3(E.currentTarget.value);if(v==="")return;let x=a3(n,_c),C=v.split(""),P=!C.every(_c),R=C.length+x>xi;if(P){l("Passcode can only be numbers"),d(1);return}if(R){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let M=Number(E.currentTarget.name?.charAt(4)),k=[...v||[""]].slice(0,xi-M),B=[...n.slice(0,M),...k,...n.slice(M+k.length)];a(B);let U=k.length,H=Math.min(Math.max(M+U,0),xi-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),rh(B))try{await e(B.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(q){d(1),l(q.message)}else try{await e(null)}catch(q){d(1),l(q.message)}},y=E=>{s===1&&(l(null),d(null));let v=[...n.slice(0,E),"",...n.slice(E+1)];a(v),E>0&&document.querySelector(`input[name=pin-${E-1}]`)?.focus(),rh(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Pi(d3,{children:c3(s3,{children:[Pi("div",{children:n.map((E,v)=>Pi("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&y(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:o3?"one-time-code":"off",disabled:t},v))}),Pi("div",{children:Pi(l3,{fail:!!r||!!i,children:r||i})})]})})},s3=oh.div`
|
|
1908
1908
|
display: flex;
|
|
1909
1909
|
flex-direction: column;
|
|
1910
1910
|
width: 100%;
|
|
@@ -1975,7 +1975,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1975
1975
|
transform: translate(1px, 0px);
|
|
1976
1976
|
}
|
|
1977
1977
|
}
|
|
1978
|
-
`,
|
|
1978
|
+
`,l3=oh.div`
|
|
1979
1979
|
line-height: 20px;
|
|
1980
1980
|
font-size: 13px;
|
|
1981
1981
|
display: flex;
|
|
@@ -1983,7 +1983,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1983
1983
|
width: 100%;
|
|
1984
1984
|
|
|
1985
1985
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1986
|
-
`;import{useContext as
|
|
1986
|
+
`;import{useContext as p3}from"react";function An(){let{promptMfa:e,init:t,submit:r,cancel:o}=p3(ce);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as u3}from"react";function Si(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=u3(ce);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import m3 from"styled-components";import{jsx as nh,jsxs as h3}from"react/jsx-runtime";var ih=e=>h3(f3,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[nh("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),nh("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"})]}),f3=m3.svg`
|
|
1987
1987
|
height: 90px;
|
|
1988
1988
|
width: 90px;
|
|
1989
1989
|
|
|
@@ -1994,7 +1994,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1994
1994
|
> path {
|
|
1995
1995
|
fill: white;
|
|
1996
1996
|
}
|
|
1997
|
-
`;import
|
|
1997
|
+
`;import y3 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as g3}from"react/jsx-runtime";var ah=({size:e,authUrl:t})=>g3(bn,{url:t,squareLogoElement:y3,size:e,fgColor:"#1F1F1F"});import{Fragment as Dt,jsx as w,jsxs as ne}from"react/jsx-runtime";var uh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=Wr(null),{unenrollWithSms:n,unenrollWithTotp:a}=Si(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),{closePrivyModal:u}=W(),{promptMfa:y}=An(),[f,g]=Wr(s?.mfaEnrollmentFlow?.seenIntro||!1),[E,v]=Wr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};d.current=x;let C=e?.mfaMethods.includes("sms"),P=!!e?.phone,R=e?.mfaMethods.includes("totp"),M=C||R;ph(()=>{M&&g(!0)},[M]);function k(){o(null),v(null)}function B(){g(!1)}async function U(O){await y(),v(O)}if(!l||!e||!i)return ne(Dt,{children:[w(A,{onClose:x},"header"),w(Ke,{children:w(ih,{})}),w(qr,{children:w(ft,{})}),w(X,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function T(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return ne(Dt,{children:[w(A,{backFn:k,onClose:x},"header"),w(Ke,{children:w(it,{children:w(kc,{})})}),w(he,{children:"Remove SMS verification?"}),ne(de,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w($r,{children:w(F,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),w(X,{})]});if(r==="totp")return ne(Dt,{children:[w(A,{backFn:k,onClose:x},"header"),w(Ke,{children:w(it,{children:w(dh,{})})}),w(he,{children:"Remove Authenticator App verification?"}),ne(de,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w($r,{children:w(F,{warn:!0,onClick:T,children:"Remove Authenticator App for MFA"})}),w(X,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return ne(Dt,{children:[w(A,{onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ac,{})})}),w(he,{children:"Add more security"}),ne(de,{children:[i?.name," does not have any verification methods enabled."]}),w($r,{children:w(F,{onClick:x,children:"Close"})}),w(X,{})]});let q=!M&&!f;if(q)return ne(Dt,{children:[w(A,{onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ac,{})})}),w(he,{children:"Transaction Protection"}),w(de,{children:"Set up transaction protection to add an extra layer of security to your account"}),ne(uu,{children:[ne(Ml,{children:[w(Il,{children:w(b3,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),ne(Ml,{children:[w(Il,{children:w(E3,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),ne($r,{children:[w(F,{onClick:()=>g(!0),children:"Continue"}),w($t,{onClick:x,children:"Not now"})]}),w(X,{})]});switch(E){case"sms":return w(T3,{onComplete:x,onReset:k,onClose:x});case"totp":return w(P3,{onComplete:x,onClose:x,onReset:k});default:return ne(Dt,{children:[w(A,{backFn:q?B:void 0,onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ac,{})})}),w(he,{children:"Choose a verification method"}),M?w(de,{children:"To add or delete verification methods, verification is required."}):w(de,{children:"How would you like to verify your identity? You can change this later."}),ne(Da,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||R)&&ne(Fa,{children:[w(Se,{disabled:R,onClick:()=>U("totp"),children:ne(Ba,{children:[ne(Ua,{children:[w(v3,{}),"Authenticator App"]}),R?ne(tn,{children:[w(sh,{}),"Added"]}):w(tn,{children:"Recommended"})]})}),R&&w(Wl,{id:"remove",onClick:()=>o("totp"),children:w(lh,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||C)&&ne(Fa,{children:[w(Se,{disabled:C||P,onClick:()=>U("sms"),children:ne(Ba,{children:[ne(Ua,{children:[w(C3,{}),"SMS"]}),C&&ne(tn,{children:[w(sh,{}),"Added"]}),P&&w(tn,{children:"Disabled"})]})}),C&&w(Wl,{id:"remove",onClick:()=>o("sms"),children:w(lh,{})})]},"sms"),w(Fa,{children:w(Se,{disabled:!0,children:ne(Ba,{children:[ne(Ua,{children:[w(w3,{}),"Passkey"]}),w(tn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(X,{})]})}},T3=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Wr(""),[a,i]=Wr(!1),[l,s]=Wr("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=Si(),{app:y,data:f,currentScreen:g,navigate:E,setModalData:v}=_();function x(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function C({qualifiedPhoneNumber:M}){try{await d({phoneNumber:M}),n(M),s("verify")}catch(k){v({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:k,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),E("ERROR_SCREEN")}}async function P(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),i(!0)}catch(k){throw Jl(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(k)?new Error("The code you entered is not valid"):mn(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Zl(k)?new Error("Verification canceled"):new Error("Unknown error")}}function R(){l==="verify"?s("enroll"):t()}return l==="enroll"?ne(Dt,{children:[w(A,{backFn:t,onClose:r},"header"),w(Ke,{children:w(it,{children:w(kc,{})})}),w(he,{children:"Set up SMS verification"}),w(de,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),ne(qr,{children:[w(En,{onSubmit:C}),ne(mu,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),w(X,{})]}):a?ne(Dt,{children:[w(A,{onClose:x},"header"),w(Ke,{children:w(it,{status:"success",children:w(ch,{})})}),w(he,{children:"SMS verification added"}),w(de,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w($r,{children:w(F,{onClick:x,children:"Done"})}),w(X,{})]}):ne(Dt,{children:[w(A,{backFn:R,onClose:r},"header"),w(Ke,{children:w(it,{children:w(kc,{})})}),w(he,{children:"Enter enrollment code"}),ne(qr,{children:[w(_n,{onChange:P}),ne(de,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:xf(o)})]})]}),w(X,{})]})},P3=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=Wr("enroll"),[a,i]=Wr(null),[l,s]=Wr(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=Si(),{data:y}=_();ph(()=>{i(null),d().then(x=>{i(x)}).catch(()=>{i(null),r()})},[]);function f(){y?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function E(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(C){throw Jl(C)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(C)?new Error("The code you entered is not valid"):mn(C)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Zl(C)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?ne(Dt,{children:[w(A,{backFn:r,onClose:t},"header"),w(he,{children:"Scan QR code"}),w(de,{children:"Open your authenticator app and scan the QR code to continue."}),w(rn,{children:a?.authUrl?w(ah,{authUrl:a.authUrl,size:200}):w(ft,{})}),ne($r,{children:[w(at,{children:a?.secret&&w(Xr,{itemName:"secret",text:a.secret})}),w(F,{onClick:g,children:"Continue"})]}),w(X,{})]}):l?ne(Dt,{children:[w(A,{onClose:f},"header"),w(Ke,{children:w(it,{status:"success",children:w(ch,{})})}),w(he,{children:"Authenticator app verification added"}),w(de,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w($r,{children:w(F,{onClick:f,children:"Done"})}),w(X,{})]}):ne(Dt,{children:[w(A,{backFn:v,onClose:t},"header"),w(Ke,{children:w(it,{children:w(dh,{})})}),w(he,{children:"Enter enrollment code"}),w(qr,{children:w(_n,{onChange:E})}),ne(de,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(X,{})]})};import Cb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import bb from"@heroicons/react/24/outline/PhoneIcon";import Eb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Tb from"@heroicons/react/24/solid/PhoneIcon";import Pb from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as xb,useState as jc}from"react";import{useMemo as yb,useEffect as gb,useState as Xh}from"react";import vb from"styled-components";import Lh from"styled-components";import fh from"styled-components";import{jsx as mh,jsxs as _3}from"react/jsx-runtime";var Ls=({label:e,children:t,valueStyles:r})=>_3(x3,{children:[mh("div",{children:e}),mh(S3,{style:{...r},children:t})]}),x3=fh.div`
|
|
1998
1998
|
display: flex;
|
|
1999
1999
|
align-items: center;
|
|
2000
2000
|
justify-content: space-between;
|
|
@@ -2009,7 +2009,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2009
2009
|
color: var(--privy-color-foreground-2);
|
|
2010
2010
|
text-align: right;
|
|
2011
2011
|
}
|
|
2012
|
-
`,
|
|
2012
|
+
`,S3=fh.div`
|
|
2013
2013
|
font-size: 14px;
|
|
2014
2014
|
line-height: 100%;
|
|
2015
2015
|
display: flex;
|
|
@@ -2018,28 +2018,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2018
2018
|
border-radius: var(--privy-border-radius-full);
|
|
2019
2019
|
background-color: var(--privy-color-background-2);
|
|
2020
2020
|
padding: 4px 8px;
|
|
2021
|
-
`;import Ns from"styled-components";import{BigNumber as
|
|
2021
|
+
`;import Ns from"styled-components";import{BigNumber as hh}from"@ethersproject/bignumber";import{formatEther as yh}from"@ethersproject/units";var _i=(e,t)=>{let r=(t*parseFloat(yh(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},wr=(e,t,r=6,o=!1)=>{let a=parseFloat(yh(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},Rc=e=>e.map(Qe).reduce((t,r)=>t.add(r),hh.from(0)).toHexString(),gh=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${Xd(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Qe=e=>hh.from(e);import{Fragment as I3,jsx as Os,jsxs as vh}from"react/jsx-runtime";var wh=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Rc(e),n=t?_i(o,t):void 0,a=wr(o,r);return Os(Ch,{children:n||a})},Ic=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Rc(e),n=t?_i(o,t):void 0,a=wr(o,r);return Os(Ch,{children:n?vh(I3,{children:[Os(A3,{children:"USD"}),n==="<$0.01"?vh(R3,{children:[Os(k3,{children:"<"}),"$0.01"]}):n]}):a})},Ch=Ns.span`
|
|
2022
2022
|
font-size: 14px;
|
|
2023
2023
|
line-height: 140%;
|
|
2024
2024
|
display: flex;
|
|
2025
2025
|
gap: 4px;
|
|
2026
2026
|
align-items: center;
|
|
2027
|
-
`,
|
|
2027
|
+
`,A3=Ns.span`
|
|
2028
2028
|
font-size: 12px;
|
|
2029
2029
|
line-height: 12px;
|
|
2030
2030
|
color: var(--privy-color-foreground-3);
|
|
2031
|
-
`,A3=Ns.span`
|
|
2032
|
-
font-size: 10px;
|
|
2033
2031
|
`,k3=Ns.span`
|
|
2032
|
+
font-size: 10px;
|
|
2033
|
+
`,R3=Ns.span`
|
|
2034
2034
|
display: flex;
|
|
2035
2035
|
align-items: center;
|
|
2036
|
-
`;import Mc from"styled-components";import{jsx as io,jsxs as Ds}from"react/jsx-runtime";var
|
|
2036
|
+
`;import Mc from"styled-components";import{jsx as io,jsxs as Ds}from"react/jsx-runtime";var bh=({gas:e,tokenPrice:t,tokenSymbol:r})=>Ds(Dl,{style:{paddingBottom:"12px"},children:[Ds(Th,{children:[io(xh,{children:"Est. Fees"}),io("div",{children:io(Ic,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&io(Ph,{children:`${wr(e,r)}`})]}),Eh=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Qe(e.value||0).add(Qe(t)).toHexString();return Ds(Dl,{children:[Ds(Th,{children:[io(xh,{children:"Total (including fees)"}),io("div",{children:io(Ic,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&io(Ph,{children:wr(n,o)})]})},Th=Mc.div`
|
|
2037
2037
|
display: flex;
|
|
2038
2038
|
flex-direction: row;
|
|
2039
2039
|
justify-content: space-between;
|
|
2040
2040
|
align-items: center;
|
|
2041
2041
|
padding-top: 4px;
|
|
2042
|
-
`,
|
|
2042
|
+
`,Ph=Mc.div`
|
|
2043
2043
|
display: flex;
|
|
2044
2044
|
flex-direction: row;
|
|
2045
2045
|
height: 12px;
|
|
@@ -2048,23 +2048,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2048
2048
|
line-height: 12px;
|
|
2049
2049
|
color: var(--privy-color-foreground-3);
|
|
2050
2050
|
font-weight: 400;
|
|
2051
|
-
`,
|
|
2051
|
+
`,xh=Mc.div`
|
|
2052
2052
|
font-size: 14px;
|
|
2053
2053
|
line-height: 22.4px;
|
|
2054
2054
|
font-weight: 400;
|
|
2055
|
-
`;import
|
|
2055
|
+
`;import M3 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Mo,useState as W3}from"react";import ao from"styled-components";import{createContext as Sh,useContext as gD}from"react";var kn=Sh(void 0);var Ai=Sh(void 0);import{Fragment as H3,jsx as er,jsxs as _h}from"react/jsx-runtime";var Ah=({defaultValue:e,children:t})=>{let[r,o]=W3(e||null),n=a=>{o(r===a?null:a)};return er(kn.Provider,{value:{activePanel:r,togglePanel:n},children:er(L3,{children:t})})},kh=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Mo(kn),n=r===e;return er(Ai.Provider,{value:{onToggle:()=>o(e),value:e},children:er(F3,{isActive:n,"data-open":n,children:t})})},Rh=({children:e})=>{let{activePanel:t}=Mo(kn),{onToggle:r,value:o}=Mo(Ai),n=t===o;return _h(H3,{children:[_h(O3,{onClick:r,"data-open":n,children:[er(D3,{children:e}),er(B3,{isactive:n,children:er(M3,{height:"16px",width:"16px",strokeWidth:"2"})})]}),er(N3,{})]})},Ih=({children:e})=>{let{activePanel:t}=Mo(kn),{value:r}=Mo(Ai);return er(U3,{"data-open":t===r,children:er(Wh,{children:e})})},Mh=({children:e})=>{let{activePanel:t}=Mo(kn),{value:r}=Mo(Ai);return er(Wh,{children:typeof e=="function"?e({isActive:t===r}):e})},L3=ao.div`
|
|
2056
2056
|
display: flex;
|
|
2057
2057
|
flex-direction: column;
|
|
2058
2058
|
width: 100%;
|
|
2059
2059
|
gap: 8px;
|
|
2060
|
-
`,
|
|
2060
|
+
`,O3=ao.div`
|
|
2061
2061
|
display: flex;
|
|
2062
2062
|
justify-content: space-between;
|
|
2063
2063
|
align-items: center;
|
|
2064
2064
|
width: 100%;
|
|
2065
2065
|
cursor: pointer;
|
|
2066
2066
|
padding-bottom: 8px;
|
|
2067
|
-
`,
|
|
2067
|
+
`,N3=ao.div`
|
|
2068
2068
|
width: 100%;
|
|
2069
2069
|
|
|
2070
2070
|
&& {
|
|
@@ -2072,13 +2072,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2072
2072
|
border-color: var(--privy-color-foreground-4);
|
|
2073
2073
|
}
|
|
2074
2074
|
padding-bottom: 12px;
|
|
2075
|
-
`,
|
|
2075
|
+
`,D3=ao.div`
|
|
2076
2076
|
font-size: 14px;
|
|
2077
2077
|
font-weight: 500;
|
|
2078
2078
|
line-height: 19.6px;
|
|
2079
2079
|
width: 100%;
|
|
2080
2080
|
padding-right: 8px;
|
|
2081
|
-
`,
|
|
2081
|
+
`,F3=ao.div`
|
|
2082
2082
|
display: flex;
|
|
2083
2083
|
flex-direction: column;
|
|
2084
2084
|
width: 100%;
|
|
@@ -2090,7 +2090,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2090
2090
|
border-color: var(--privy-color-foreground-4);
|
|
2091
2091
|
border-radius: var(--privy-border-radius-md);
|
|
2092
2092
|
}
|
|
2093
|
-
`,
|
|
2093
|
+
`,U3=ao.div`
|
|
2094
2094
|
position: relative;
|
|
2095
2095
|
overflow: hidden;
|
|
2096
2096
|
transition: max-height 25ms ease-out;
|
|
@@ -2102,38 +2102,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2102
2102
|
&[data-open='false'] {
|
|
2103
2103
|
max-height: 0;
|
|
2104
2104
|
}
|
|
2105
|
-
`,
|
|
2105
|
+
`,Wh=ao.div`
|
|
2106
2106
|
display: flex;
|
|
2107
2107
|
flex-direction: column;
|
|
2108
2108
|
gap: 12px;
|
|
2109
2109
|
flex: 1 1 auto;
|
|
2110
2110
|
min-height: 1px;
|
|
2111
|
-
`,
|
|
2111
|
+
`,B3=ao.div`
|
|
2112
2112
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2113
|
-
`;import
|
|
2113
|
+
`;import G3 from"styled-components";import{jsx as z3}from"react/jsx-runtime";var Wc=({walletAddress:e,chainId:t=xr})=>z3(V3,{href:gh(t,e),target:"_blank",children:Br(e)}),V3=G3.a`
|
|
2114
2114
|
&:hover {
|
|
2115
2115
|
text-decoration: underline;
|
|
2116
2116
|
}
|
|
2117
|
-
`;import{jsx as St,jsxs as Lc}from"react/jsx-runtime";var Rn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return St(
|
|
2117
|
+
`;import{jsx as St,jsxs as Lc}from"react/jsx-runtime";var Rn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return St(Ah,{children:Lc(kh,{value:"details",children:[St(Rh,{children:Lc(q3,{children:[St("div",{children:o?.title||o?.actionDescription||"Details"}),St($3,{children:St(wh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Lc(Ih,{children:[St(Ls,{label:"From",children:St(Wc,{walletAddress:e,chainId:r.chainId||xr})}),St(Ls,{label:"To",children:St(Wc,{walletAddress:t,chainId:r.chainId||xr})}),o&&o.action&&St(Ls,{label:"Action",children:o.action}),a&&St(bh,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),St(Mh,{children:({isActive:s})=>St(Eh,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},q3=Lh.div`
|
|
2118
2118
|
display: flex;
|
|
2119
2119
|
flex-direction: row;
|
|
2120
2120
|
justify-content: space-between;
|
|
2121
|
-
|
|
2121
|
+
`,$3=Lh.div`
|
|
2122
2122
|
flex-shrink: 0;
|
|
2123
2123
|
padding-left: 8px;
|
|
2124
|
-
`;import Ri from"styled-components";import{jsx as ki,jsxs as
|
|
2124
|
+
`;import Ri from"styled-components";import{jsx as ki,jsxs as Q3}from"react/jsx-runtime";var Oc=({description:e,contractInfo:t})=>Q3(j3,{children:[t.imgUrl&&ki(K3,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&ki(Y3,{children:ki("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&ki(J3,{children:t.name}),ki(Z3,{children:e||t.actionText})]}),j3=Ri.div`
|
|
2125
2125
|
display: flex;
|
|
2126
2126
|
flex-direction: column;
|
|
2127
2127
|
align-items: center;
|
|
2128
2128
|
margin-bottom: 8px;
|
|
2129
|
-
`,
|
|
2129
|
+
`,K3=Ri.img`
|
|
2130
2130
|
&& {
|
|
2131
2131
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2132
2132
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2133
2133
|
border-radius: 16px;
|
|
2134
2134
|
margin-bottom: 12px;
|
|
2135
2135
|
}
|
|
2136
|
-
`,
|
|
2136
|
+
`,Y3=Ri.div`
|
|
2137
2137
|
font-size: 12px;
|
|
2138
2138
|
line-height: 12px;
|
|
2139
2139
|
padding: 7px;
|
|
@@ -2146,7 +2146,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2146
2146
|
text-decoration: underline;
|
|
2147
2147
|
}
|
|
2148
2148
|
}
|
|
2149
|
-
`,
|
|
2149
|
+
`,J3=Ri.div`
|
|
2150
2150
|
font-size: 18px;
|
|
2151
2151
|
line-height: 18px;
|
|
2152
2152
|
font-weight: 500;
|
|
@@ -2154,7 +2154,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2154
2154
|
white-space: nowrap;
|
|
2155
2155
|
max-width: 275px;
|
|
2156
2156
|
text-overflow: ellipsis;
|
|
2157
|
-
`,
|
|
2157
|
+
`,Z3=Ri.div`
|
|
2158
2158
|
font-size: 16px;
|
|
2159
2159
|
line-height: 140%;
|
|
2160
2160
|
font-weight: 400;
|
|
@@ -2162,7 +2162,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2162
2162
|
overflow: hidden;
|
|
2163
2163
|
max-width: 275px;
|
|
2164
2164
|
text-overflow: ellipsis;
|
|
2165
|
-
`;import
|
|
2165
|
+
`;import X3 from"@heroicons/react/24/outline/WalletIcon";import Dc from"styled-components";import{jsx as Oh,jsxs as Nc}from"react/jsx-runtime";var Nh=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=W(),i=a(t.chainId)||"ETH";return Nc(eb,{children:[Nc(tb,{children:[Oh(X3,{strokeWidth:"2",width:"16px",height:"16px"}),Oh("div",{children:Br(e)})]}),Nc(rb,{displayBalanceColor:n,hasFunds:o,children:[r?wr(r,i,6,!0):0," available"]})]})},eb=Dc.div`
|
|
2166
2166
|
display: flex;
|
|
2167
2167
|
flex-direction: row;
|
|
2168
2168
|
justify-content: space-between;
|
|
@@ -2175,12 +2175,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2175
2175
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2176
2176
|
border-radius: var(--privy-border-radius-md);
|
|
2177
2177
|
}
|
|
2178
|
-
`,
|
|
2178
|
+
`,tb=Dc.div`
|
|
2179
2179
|
display: flex;
|
|
2180
2180
|
flex-direction: row;
|
|
2181
2181
|
align-items: center;
|
|
2182
2182
|
gap: 8px;
|
|
2183
|
-
`,
|
|
2183
|
+
`,rb=Dc.div`
|
|
2184
2184
|
display: flex;
|
|
2185
2185
|
align-items: center;
|
|
2186
2186
|
justify-content: center;
|
|
@@ -2190,35 +2190,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2190
2190
|
background-color: var(--privy-color-background-2);
|
|
2191
2191
|
padding: 5px 8px;
|
|
2192
2192
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2193
|
-
`;import Fs from"styled-components";import{Fragment as
|
|
2193
|
+
`;import Fs from"styled-components";import{Fragment as Fh,jsx as Ii,jsxs as Uh}from"react/jsx-runtime";var Bh=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?_i(n,o):void 0,i=wr(n,r);return Uh(ob,{children:[a?Uh(Fh,{children:[Ii(Dh,{children:a}),Ii(nb,{children:i})]}):Ii(Fh,{children:Ii(Dh,{children:i})}),Ii(ib,{children:e})]})},ob=Fs.div`
|
|
2194
2194
|
display: flex;
|
|
2195
2195
|
flex-direction: column;
|
|
2196
2196
|
align-items: center;
|
|
2197
2197
|
margin-bottom: 20px;
|
|
2198
|
-
`,
|
|
2198
|
+
`,Dh=Fs.h2`
|
|
2199
2199
|
&& {
|
|
2200
2200
|
font-size: 48px;
|
|
2201
2201
|
line-height: 48px;
|
|
2202
2202
|
margin: 8px auto;
|
|
2203
2203
|
}
|
|
2204
|
-
`,
|
|
2204
|
+
`,nb=Fs.p`
|
|
2205
2205
|
margin-bottom: 12px;
|
|
2206
2206
|
&& {
|
|
2207
2207
|
font-size: 17px;
|
|
2208
2208
|
line-height: 17px;
|
|
2209
2209
|
color: var(--privy-color-foreground-3);
|
|
2210
2210
|
}
|
|
2211
|
-
`,
|
|
2211
|
+
`,ib=Fs.div`
|
|
2212
2212
|
font-size: 16px;
|
|
2213
2213
|
line-height: 22.4px;
|
|
2214
2214
|
font-weight: 400;
|
|
2215
2215
|
overflow: hidden;
|
|
2216
2216
|
max-width: 275px;
|
|
2217
2217
|
text-overflow: ellipsis;
|
|
2218
|
-
`;import{VoidSigner as
|
|
2218
|
+
`;import{VoidSigner as pb}from"@ethersproject/abstract-signer";import{EtherscanProvider as DF}from"@ethersproject/providers";import{BigNumber as zh}from"@ethersproject/bignumber";import{BigNumber as In}from"@ethersproject/bignumber";import{Contract as ab}from"@ethersproject/contracts";import{serialize as sb}from"@ethersproject/transactions";var Mn=e=>[ga.id,va.id,wa.id,Ca.id,ba.id,Ea.id,Ta.id,xa.id,Pa.id].includes(e),Hh=async(e,t)=>{if(!Mn(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=In.from(r).mul(In.from(126)).div(In.from(100)).add(In.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Mi(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Gh(e,t){if(!e.chainId||e.chainId&&!Mn(e.chainId))return In.from(0);let r=In.from(0);try{let o=new ab(qd,$d,t),n=Vh(e),a=sb(n);r=await o.getL1Fee(a)}catch{}return r}async function qh(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var $h=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Wn(e,t){if(!e.gasLimit)throw new xe("gasLimit was not successfully set for transaction.");let r=Qe(e.gasLimit),o=zh.from(0);if(e.type==2)if(e.maxFeePerGas)o=Qe(e.maxFeePerGas);else throw new xe("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Qe(e.gasPrice);else throw new xe("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=zh.from(0);if(e.chainId&&Mn(e.chainId))try{a=await Gh(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Fc}from"@ethersproject/bignumber";var Uc=e=>[fa.id,ha.id,ya.id].includes(e),jh=async(e,t)=>{if(!Uc(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Fc.from(120)).div(Fc.from(100));e.maxFeePerGas=Mi(o),e.maxPriorityFeePerGas=Mi(Fc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Bc=e=>[56,97].includes(e),Kh=async(e,t)=>{if(!Bc(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as Yh}from"@ethersproject/units";import{ofetch as lb}from"ofetch";var Hc={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var Vc=e=>[jn.id,Kn.id,Hc.id].includes(e),Gc=e=>({maxPriorityFee:Yh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Yh(e.maxFee.toFixed(9),"gwei").toHexString()}),cb=e=>({safeLow:Gc(e.safeLow),standard:Gc(e.standard),fast:Gc(e.fast)}),db=async e=>{let t="";switch(e){case jn.id:t="https://gasstation.polygon.technology/v2";break;case Kn.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Hc.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return cb(await lb(t))};async function Jh(e){if(!Vc(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await db(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 Mi(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 Vh(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=Qe(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Qe(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Qe(e.gasPrice)),e.value!==void 0&&(t.value=Qe(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Qe(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Qe(e.maxPriorityFeePerGas)),t}async function Ln(e,t,r){if(t.chainId=Number(t.chainId),Zh(t),t.from||(t.from=e),!t.nonce){let o=new pb(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await qh(t,r)),typeof t.type=="string"&&Qh(t.type)&&(t.type=Number(t.type)),Vc(t.chainId)?t=await Jh(t):Uc(t.chainId)?t=await jh(t,r):Mn(t.chainId)?t=await Hh(t,r):Bc(t.chainId)?t=await Kh(t,r):t=await $h(t,r),t}async function Us(e,t,r,o,n){o=Object.assign({chainId:xr},o),Zh(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Bs(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Qe(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Zh(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!ub(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 ub(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Qh(e);return t||r||o}function Qh(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Hs(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as zc,useEffect as mb}from"react";var Gs=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,a]=zc(!0),[i,l]=zc(void 0),[s,d]=zc(void 0);return mb(()=>{let u=e.chainId||xr,y=o.find(g=>g.id===Number(u));if(!y)throw new Z(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(y);g?d(g):l(new Error(`Unable to fetch token price on chain id ${y.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as fb,useContext as hb}from"react";var qc=fb(null);function Wi(){let e=hb(qc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as ey}from"react/jsx-runtime";var $c=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Wi(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=W(),[s,d]=Xh(null),[u,y]=Xh(e),{tokenPrice:f}=Gs(u),g=l(e.chainId)||"ETH",E=yb(()=>r.find(v=>v.walletClientType==="privy"),[r]);return gb(()=>{async function v(){if(!await t()||!o||!E)return u;let C=Sr(u.chainId,a,n,{appId:i}),P=await Ln(E.address,u,C),{totalGasEstimate:R}=await Wn(P,C);return d(R.toHexString()),P}v().then(x=>{y(x)})},[o]),E?ey(wb,{children:ey(Rn,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},wb=vb.div`
|
|
2219
2219
|
width: 100%;
|
|
2220
2220
|
padding: 1rem 0;
|
|
2221
|
-
`;import{Fragment as Kc,jsx as ae,jsxs as Cr}from"react/jsx-runtime";var Yc=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=jc(null),{init:a,cancel:i}=An();
|
|
2221
|
+
`;import{Fragment as Kc,jsx as ae,jsxs as Cr}from"react/jsx-runtime";var Yc=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=jc(null),{init:a,cancel:i}=An();xb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ae(Sb,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Cr(Kc,{children:[ae(A,{onClose:s},"header"),ae(Ke,{children:ae(it,{children:ae(Pb,{})})}),ae(he,{children:"Verify your identity"}),ae(de,{children:"Choose a verification method"}),Cr(Da,{children:[r.mfaMethods.includes("totp")&&Cr(Se,{onClick:()=>l("totp"),children:[ae(Cb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Cr(Se,{onClick:()=>l("sms"),children:[ae(bb,{}),"SMS"]},"sms")]}),ae(X,{})]})},Sb=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=W(),[a,i]=jc(!1),[l,s]=jc(!1),{submit:d}=An();async function u(y){try{if(!y)return;await d(e,y),s(!0),i(!1),t()}catch(f){throw Yl(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):fn(f)?(i(!1),new Error("The code you entered is not valid")):mn(f)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return Cr(Kc,{children:[ae(A,{onClose:t},"header"),ae(Ke,{children:ae(it,{children:ae(Tb,{})})}),ae(he,{children:"Enter verification code"}),Cr(qr,{children:[ae(_n,{success:l,disabled:a,onChange:u}),Cr(de,{children:["To continue, please enter the 6-digit code sent to your ",ae("strong",{children:"mobile device"})]}),n&&ae($c,{pendingTransaction:n})]}),r&&ae(Ll,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ae($t,{onClick:t,children:"Not now"}),ae(X,{})]});case"totp":return Cr(Kc,{children:[ae(A,{onClose:t},"header"),ae(Ke,{children:ae(it,{children:ae(Eb,{})})}),ae(he,{children:"Enter verification code"}),Cr(qr,{children:[ae(_n,{success:l,disabled:a,onChange:u}),Cr(de,{children:["To continue, please enter the 6-digit code generated from your"," ",ae("strong",{children:"authenticator app"})]}),n&&ae($c,{pendingTransaction:n})]}),r&&ae(Ll,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ae($t,{onClick:t,children:"Not now"}),ae(X,{})]});default:return null}};import{useEffect as ty,useState as ry}from"react";import ny from"styled-components";import{Fragment as kb,jsx as br,jsxs as Vs}from"react/jsx-runtime";var oy={google:{name:"Google",component:Ts},discord:{name:"Discord",component:Cs},github:{name:"Github",component:bs},linkedin:{name:"LinkedIn",component:xs},twitter:{name:"Twitter",component:As},spotify:{name:"Spotify",component:Ss},tiktok:{name:"Tiktok",component:_s},apple:{name:"Apple",component:ws}},iy=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:y,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),[v,x]=ry(!1),[C,P]=ry(void 0),R=s()?.provider||"google",M=oy[R].name,k=oy[R].component,B=n?.render.inDialog?Oe:0;ty(()=>{u(R).then(()=>{x(!0)}).catch(T=>{if(T?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:q,detail:O}=up(T,R);P({retryable:q,detail:O,message:"Authentication failed"})}).finally(()=>{$n(),f()})},[M,R]),ty(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},B);return()=>clearTimeout(q)}if(At(o,n?.embeddedWallets?.createOnLogin)){let q=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:O=>{console.error(O),E("embedded_wallet_creation_failure_logout",{error:O,provider:R,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},B);return()=>clearTimeout(q)}else{let q=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),B);return y(),()=>clearTimeout(q)}}},[r,e,v,o]);let U=v?`Successfully connected with ${M}`:C?C.message:`Verifying connection to ${M}`,H="";return v?H="You\u2019re good to go!":C?H=C.detail:H="Just a few moments more",Vs(kb,{children:[br(A,{}),br(K,{}),Vs(_b,{children:[br(Ab,{children:Vs("div",{children:[br(It,{success:v,fail:!!C}),br(k,{style:{width:"38px",height:"38px"}})]})}),Vs(Ye,{children:[br("h3",{children:U}),br("p",{children:H})]}),C&&C?.retryable?br(Wa,{onClick:()=>{$n(),d(R),P(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),br(oe,{}),br(X,{})]})},_b=ny.div`
|
|
2222
2222
|
display: flex;
|
|
2223
2223
|
flex-direction: column;
|
|
2224
2224
|
align-items: center;
|
|
@@ -2226,7 +2226,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2226
2226
|
margin-left: 27px;
|
|
2227
2227
|
margin-right: 27px;
|
|
2228
2228
|
gap: 24px;
|
|
2229
|
-
`,
|
|
2229
|
+
`,Ab=ny.div`
|
|
2230
2230
|
display: flex;
|
|
2231
2231
|
flex-direction: column;
|
|
2232
2232
|
justify-content: center;
|
|
@@ -2249,55 +2249,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2249
2249
|
left: -19px;
|
|
2250
2250
|
top: -19px;
|
|
2251
2251
|
}
|
|
2252
|
-
`;import{useEffect as
|
|
2252
|
+
`;import{useEffect as Ib,useState as sy}from"react";import Mb from"styled-components";import{isMobile as Rb}from"react-device-detect";var ay=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!Ur()&&Rb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Lb,jsx as Lr,jsxs as ly}from"react/jsx-runtime";var cy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=sy(""),[a,i]=sy(!1);Ib(()=>{t&&r&&e().then(n)},[t,r]);let l=ay(o,!a),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),ly(Lb,{children:[Lr(A,{},"header"),Lr(K,{}),Lr(mr,{title:s.title,description:s.description}),ly(Ot,{children:[Lr(Wb,{children:Lr(lr,{style:{width:"72px",height:"72px"}})}),Lr(Ma,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?Lr("p",{children:s.footnote}):null]}),Lr(oe,{}),Lr(V,{protectedByPrivy:!0})]})},Wb=Mb(at)`
|
|
2253
2253
|
margin: 16px auto;
|
|
2254
|
-
`;import{BigNumber as
|
|
2254
|
+
`;import{BigNumber as uy}from"@ethersproject/bignumber";import{useMemo as my,useEffect as fy,useState as Ft}from"react";import Nn from"styled-components";function dy(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as Jc}from"@ethersproject/bignumber";import Ob from"styled-components";import{Fragment as Fb,jsx as Li,jsxs as Ub}from"react/jsx-runtime";var Nb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Jc.from(e.gasUsed),o=Jc.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Jc.from(t);n=n.add(a)}return n.toString()}catch{return}else return},py=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>Ub(Fb,{children:[Li(A,{onClose:o}),Li(ti,{title:"Transaction complete!",description:"You're all set."}),Li(Rn,{tokenPrice:n,from:t.from,to:t.to,gas:Nb(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Li(Db,{loading:!1,onClick:o,children:"All Done"}),Li(X,{})]}),Db=Ob(F)`
|
|
2255
2255
|
&& {
|
|
2256
2256
|
margin-top: 24px;
|
|
2257
2257
|
}
|
|
2258
2258
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2259
|
-
`;import{Fragment as Zc,jsx as Xe,jsxs as On}from"react/jsx-runtime";var
|
|
2259
|
+
`;import{Fragment as Zc,jsx as Xe,jsxs as On}from"react/jsx-runtime";var Bb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return Xe(Oc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return Xe(Oc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return Xe(Zc,{children:Xe(Bh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},yy=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Wi(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=W(),{app:u,navigate:y,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:E}=_(),{transactionRequest:v,onSuccess:x,onFailure:C,uiOptions:P,fundWalletConfig:R}=f.sendTransaction,[M,k]=Ft(null),[B,U]=Ft(null),[H,T]=Ft(""),[q,O]=Ft(),[Y,se]=Ft(!1),re=()=>{T(""),O(void 0)},te=(vt,qe,rr)=>{T(vt),O(new xe(new kt(qe??vt,rr??je.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[z,Pe]=Ft(!1),[we,Tr]=Ft(!0),[yt,Ae]=Ft(null),[ge,gt]=Ft(v),{tokenPrice:Ut,isTokenPriceLoading:Nr}=Gs(ge),tr=s(v.chainId)||"ETH",[L,J]=Ft(null),[Q,Bn]=Ft(null),[$,We]=Ft(!0);fy(()=>{e||(y("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let pt=my(()=>r.find(vt=>vt.walletClientType==="privy"),[r]),co=async()=>{if(!pt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:vt,externalTransactionId:qe}=await a(pt.address,{config:R?.config||{}});E({fiatOnRampPrompt:{signedUrl:vt},fiatOnRampStatus:{externalTransactionId:qe}}),y("FIAT_ON_RAMP_PROMPT_SCREEN")},Bt=my(()=>Sr(ge.chainId,l,i,{appId:d}),[ge.chainId,i]);fy(()=>{async function vt(){let qe=ge;if(!await t()||!o||!pt)return;try{qe=await Ln(pt.address,ge,Bt),gt(qe)}catch(or){console.error(or),te("There was an error preparing your transaction. Please try again.",or.reason)}let Dr=uy.from(0),Ni=uy.from(0);try{({totalGasEstimate:Dr,l1ExecutionFeeEstimate:Ni}=await Wn(qe,Bt)),J(Dr.toHexString()),Bn(Ni.toHexString())}catch{J(null)}try{let{balance:or,hasSufficientFunds:Js}=await Bs(pt.address,qe,Dr,Bt);Ae(or.toHexString()),Js||(Tr(!1),te("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&se(!0))}catch(or){console.warn(`Failed to fetch wallet balance with error: ${or}`)}We(!1)}vt()},[o]);let po=dy(ge),Ys=po==="SEND"?`Send ${tr}`:"Review transaction",Le={modalTitle:P.header||P.modalTitle||Ys,buttonText:P.buttonText||"Submit"},uo=()=>{z||(B?x(B):C(q||new xe(new kt("The user rejected the request",je.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=uo,Ut===void 0&&Nr||$?On(Zc,{children:[P.transactionInfo?.contractInfo?.imgUrl&&Xe(ma,{src:P.transactionInfo?.contractInfo?.imgUrl}),Xe(A,{title:Le.modalTitle,onClose:uo}),Xe(hy,{children:Xe(pn,{})})]}):M!==null?Xe(py,{txn:ge,onClose:uo,receipt:M,transactionInfo:P.transactionInfo,tokenPrice:Ut,tokenSymbol:tr,l1GasEstimate:Q}):On(Zc,{children:[Xe(A,{title:Le.modalTitle,onClose:uo}),On(hy,{children:[On(zb,{children:[Xe(Bb,{txn:ge,txnFamily:po,uiOptions:P,tokenSymbol:tr,tokenPrice:Ut}),pt?Xe(Rn,{from:pt.address,to:ge.to,txn:ge,transactionInfo:P.transactionInfo,gas:L||void 0,tokenPrice:Ut,tokenSymbol:tr}):null]}),On(qb,{children:[Xe(Hb,{children:H}),Xe(Nh,{txn:ge,address:pt?.address??"",hasFunds:we,balance:yt}),On(Gb,{children:[Y&&Xe(F,{onClick:co,children:"Add Funds"}),Xe(Vb,{disabled:z||!we,loading:!o||z,loadingText:z?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Pe(!0);let vt=await t();if(vt&&!z&&pt)try{let qe=await Us(vt,pt.address,o,ge,Bt);U(qe);let rr=await qe.wait();k(Hs(rr)),re()}catch(qe){let rr="There was an error processing your transaction. Please contact support.";console.warn({transaction:ge,error:qe}),te(rr,qe.reason)}finally{Pe(!1)}},children:Le.buttonText})]})]})]})]})},hy=Nn.div`
|
|
2260
2260
|
display: flex;
|
|
2261
2261
|
flex-direction: column;
|
|
2262
2262
|
justify-content: space-between;
|
|
2263
2263
|
flex-grow: 1;
|
|
2264
2264
|
padding-bottom: 16px;
|
|
2265
|
-
`,
|
|
2265
|
+
`,Hb=Nn.div`
|
|
2266
2266
|
font-size: 13px;
|
|
2267
2267
|
color: var(--privy-color-error);
|
|
2268
2268
|
width: 100%;
|
|
2269
2269
|
margin-top: 16px;
|
|
2270
|
-
`,
|
|
2270
|
+
`,Gb=Nn.div`
|
|
2271
2271
|
display: flex;
|
|
2272
2272
|
direction: row;
|
|
2273
2273
|
justify-content: space-between;
|
|
2274
2274
|
align-items: center;
|
|
2275
2275
|
gap: 8px;
|
|
2276
|
-
`,
|
|
2276
|
+
`,Vb=Nn(F)`
|
|
2277
2277
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2278
|
-
`,
|
|
2278
|
+
`,zb=Nn.div`
|
|
2279
2279
|
height: 100%;
|
|
2280
2280
|
display: flex;
|
|
2281
2281
|
flex-direction: column;
|
|
2282
2282
|
justify-content: space-evenly;
|
|
2283
2283
|
flex-grow: 1;
|
|
2284
|
-
`,
|
|
2284
|
+
`,qb=Nn.div`
|
|
2285
2285
|
display: flex;
|
|
2286
2286
|
flex-direction: column;
|
|
2287
2287
|
gap: 8px;
|
|
2288
|
-
`;import{isHexString as
|
|
2288
|
+
`;import{isHexString as $b}from"@ethersproject/bytes";import{toUtf8String as jb}from"@ethersproject/strings";import{useEffect as gy,useState as zs}from"react";import so,{css as Kb}from"styled-components";import{Fragment as Cy,jsx as Re,jsxs as Dn}from"react/jsx-runtime";var Yb=e=>{if(!$b(e))return e;try{return jb(e)}catch{return e}},Jb=e=>JSON.stringify(e,null,2),Zb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Re(rE,{children:Object.entries(r).map(([o,n])=>Dn("li",{children:[Dn("strong",{children:[o,":"]})," ",t(n)]},o))}):Re("span",{children:String(r)});return Re("div",{children:t(e)})},Qb=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Dn(Cy,{children:[Re(wy,{children:Re(Zb,{data:o})}),Re(Xr,{text:Jb(e.typedData),itemName:"full payload to clipboard"})," "]})},vy=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=_(),[i,l]=zs(!0),[s,d]=zs(""),[u,y]=zs(),[f,g]=zs(null),E=f!==null;gy(()=>{e||o("LANDING")},[e]),gy(()=>{t(Fo).then(U=>{l(!1),U||(d("An error has occurred, please try again."),y(new xe(new kt(s,je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:x,confirmAndSign:C,onSuccess:P,onFailure:R,uiOptions:M}=n.signMessage,k={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=U=>{U?P(U):R(u||new xe(new kt("The user rejected the request.",je.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),d(""),y(void 0)};return a.current=()=>{B(f)},Dn(Cy,{children:[Re(A,{onClose:()=>B(f)}),Re(K,{}),Dn(Xb,{children:[Re(eE,{children:k.title}),Re(tE,{children:k.description}),v==="personal_sign"&&Re(wy,{children:Yb(x)}),v==="eth_signTypedData_v4"&&Re(Qb,{typedData:x}),Re(oE,{fail:!0,children:s}),Re(iE,{success:E,loading:i,disabled:E,onClick:async()=>{try{let U=await C();g(U),d(""),setTimeout(()=>{B(U)},Oe)}catch{d("An error has occurred, please try again."),y(new xe(new kt(s,je.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:E?Dn(nE,{children:[Re(os,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Re("span",{children:"Success"})]}):k.buttonText})]}),Re(oe,{}),Re(V,{protectedByPrivy:!0})]})},Xb=so.div`
|
|
2289
2289
|
display: flex;
|
|
2290
2290
|
flex-direction: column;
|
|
2291
2291
|
align-items: center;
|
|
2292
2292
|
justify-content: center;
|
|
2293
|
-
`,
|
|
2293
|
+
`,eE=so.span`
|
|
2294
2294
|
color: var(--privy-color-foreground);
|
|
2295
2295
|
text-align: center;
|
|
2296
2296
|
font-size: 1.125rem;
|
|
2297
2297
|
font-weight: 500;
|
|
2298
2298
|
line-height: 1.25rem; /* 111.111% */
|
|
2299
2299
|
text-align: center;
|
|
2300
|
-
`,
|
|
2300
|
+
`,tE=so.span`
|
|
2301
2301
|
margin-top: 4px;
|
|
2302
2302
|
color: var(--privy-color-foreground);
|
|
2303
2303
|
text-align: center;
|
|
@@ -2307,7 +2307,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2307
2307
|
font-weight: 400;
|
|
2308
2308
|
line-height: 20px; /* 142.857% */
|
|
2309
2309
|
letter-spacing: -0.008px;
|
|
2310
|
-
`,
|
|
2310
|
+
`,wy=so.div`
|
|
2311
2311
|
margin-top: 1.5rem;
|
|
2312
2312
|
background-color: var(--privy-color-background-2);
|
|
2313
2313
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2326,7 +2326,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2326
2326
|
display: none; /* Safari and Chrome */
|
|
2327
2327
|
}
|
|
2328
2328
|
}
|
|
2329
|
-
`,
|
|
2329
|
+
`,rE=so.ul`
|
|
2330
2330
|
margin-left: 12px !important;
|
|
2331
2331
|
white-space: nowrap;
|
|
2332
2332
|
|
|
@@ -2338,7 +2338,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2338
2338
|
font-weight: 500 !important;
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
|
-
`,
|
|
2341
|
+
`,oE=so.div`
|
|
2342
2342
|
line-height: 20px;
|
|
2343
2343
|
height: 20px;
|
|
2344
2344
|
font-size: 13px;
|
|
@@ -2348,22 +2348,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2348
2348
|
width: 100%;
|
|
2349
2349
|
margin-top: 16px;
|
|
2350
2350
|
margin-bottom: 4px;
|
|
2351
|
-
`,
|
|
2351
|
+
`,nE=so.span`
|
|
2352
2352
|
display: flex;
|
|
2353
2353
|
align-items: center;
|
|
2354
2354
|
gap: 8px;
|
|
2355
|
-
`,
|
|
2355
|
+
`,iE=so(F)`
|
|
2356
2356
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2357
2357
|
|
|
2358
|
-
${e=>e.success&&
|
|
2358
|
+
${e=>e.success&&Kb`
|
|
2359
2359
|
&&&& {
|
|
2360
2360
|
background-color: var(--privy-color-success);
|
|
2361
2361
|
color: #ffffff;
|
|
2362
2362
|
}
|
|
2363
2363
|
`}
|
|
2364
|
-
`;import
|
|
2364
|
+
`;import pE from"@heroicons/react/24/outline/EnvelopeIcon";import aE from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as sE,useState as by}from"react";import Ty from"styled-components";import{Fragment as dE,jsx as Oi,jsxs as Ey}from"react/jsx-runtime";var Py=sE((e,t)=>{let[r,o]=by(""),[n,a]=by(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=W(),{navigate:d,setModalData:u,currentScreen:y}=_(),{enabled:f,token:g}=fe(),E=Ji(r),v=n,x=n||!E,C=async R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,R),d("AWAITING_PASSWORDLESS_CODE")}catch(M){u({errorModalData:{error:M,previousScreen:y||"LANDING"}})}a(!1)},P=()=>{f&&!g&&!i?(u({captchaModalData:{callback:R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,R)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):C(g)};return Ey(dE,{children:[Oi(lE,{children:Ey(cE,{children:[Oi(aE,{}),Oi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&P()},value:r,autoComplete:"email"}),e.stacked?null:Oi(Qo,{isSubmitting:v,onClick:P,disabled:x,children:"Submit"})]})}),e.stacked?Oi(F,{loadingText:null,loading:v,disabled:x,onClick:P,children:"Submit"}):null]})}),lE=Ty.div`
|
|
2365
2365
|
width: 100%;
|
|
2366
|
-
`,
|
|
2366
|
+
`,cE=Ty.label`
|
|
2367
2367
|
display: block;
|
|
2368
2368
|
position: relative;
|
|
2369
2369
|
width: 100%;
|
|
@@ -2421,7 +2421,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2421
2421
|
&& > input::placeholder {
|
|
2422
2422
|
color: var(--privy-color-foreground-3);
|
|
2423
2423
|
}
|
|
2424
|
-
`;import{Fragment as
|
|
2424
|
+
`;import{Fragment as uE,jsx as lo,jsxs as mE}from"react/jsx-runtime";var xy=()=>mE(uE,{children:[lo(A,{},"header"),lo(K,{}),lo(_e,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:lo(pE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),lo(Ot,{children:lo(Py,{stacked:!0})}),lo(oe,{}),lo(V,{protectedByPrivy:!0})]});import hE,{createGlobalStyle as yE}from"styled-components";var fE=`
|
|
2425
2425
|
*,
|
|
2426
2426
|
::before,
|
|
2427
2427
|
::after {
|
|
@@ -2651,7 +2651,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2651
2651
|
[hidden] {
|
|
2652
2652
|
display: none;
|
|
2653
2653
|
}
|
|
2654
|
-
`,
|
|
2654
|
+
`,Sy=fE;var _y=yE`
|
|
2655
2655
|
:root {
|
|
2656
2656
|
// Borders
|
|
2657
2657
|
--privy-border-radius-sm: 6px;
|
|
@@ -2683,10 +2683,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2683
2683
|
--privy-height-modal-full: 620px;
|
|
2684
2684
|
--privy-height-modal-compact: 480px;
|
|
2685
2685
|
};
|
|
2686
|
-
`,
|
|
2686
|
+
`,Ay=hE.div`
|
|
2687
2687
|
// css normalize only the privy application to avoid conflicts
|
|
2688
2688
|
// with consuming application
|
|
2689
|
-
${
|
|
2689
|
+
${Sy}
|
|
2690
2690
|
|
|
2691
2691
|
// Privy styles
|
|
2692
2692
|
color: var(--privy-color-foreground-2);
|
|
@@ -2745,4 +2745,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2745
2745
|
opacity: 1;
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
|
-
`;import{jsx as Ge,jsxs as ky}from"react/jsx-runtime";var CE={["LANDING"]:zf,["CONNECT_OR_CREATE"]:Gf,["AWAITING_PASSWORDLESS_CODE"]:Su,["AWAITING_CONNECTION"]:qu,["AWAITING_CONNECT_ONLY_CONNECTION"]:Yu,["AWAITING_FARCASTER_CONNECTION"]:Qm,["AWAITING_FARCASTER_SIGNER"]:nf,["PHANTOM_INTERSTITIAL_SCREEN"]:ly,["LOGIN_FAILED_SCREEN"]:Zf,["AWAITING_OAUTH_SCREEN"]:ny,["ALLOWLIST_REJECTION_SCREEN"]:yu,["INSTALL_PHANTOM_SCREEN"]:wf,["LINK_EMAIL_SCREEN"]:qf,["LINK_PHONE_SCREEN"]:$f,["LINK_WALLET_SCREEN"]:jf,["UPDATE_EMAIL_SCREEN"]:Py,["CONNECT_ONLY_LANDING_SCREEN"]:Gu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Uu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Lm,["EMBEDDED_WALLET_CREATED_SCREEN"]:rm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:em,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Dm,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:am,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:gy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:hy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:pf,["FIAT_ON_RAMP_STATUS_SCREEN"]:mf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Nm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Om,["MFA_ENROLLMENT_FLOW_SCREEN"]:ph,["CAPTCHA_SCREEN"]:Ru,["ERROR_SCREEN"]:Fm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:ff,["AFFIRMATIVE_CONSENT_SCREEN"]:fu},bE=["LANDING","AWAITING_CONNECTION"],EE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=gE(null),f=tu(y),g=o&&i&&bE.includes(i)&&!n&&l==="ready";if(Ay(()=>{g&&s()},[g]),Ay(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return ky(Sn,{id:"privy-modal-content",children:[Ge(A,{}),Ge(K,{}),Ge(eh,{children:Ge(ft,{})}),Ge(oe,{}),Ge(X,{})]});if(!i&&e)return Ge(Sn,{style:{height:f},id:"privy-modal-conent",children:Ge("div",{ref:y,children:Ge(Yc,{open:e,onClose:t})})});if(!i)return null;let E=CE[i];return Ge(Sn,{style:{height:f},id:"privy-modal-content",children:ky("div",{ref:y,children:[Ge(Ar,{if:!!e,children:Ge(E,{})}),Ge(Ar,{if:!e,children:Ge(Yc,{open:e,onClose:t})})]})})},TE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:yE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Ry=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=TE(),[o,n]=vE(!1);Tl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(_y,{children:Ge(EE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(Xf,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return wE.createPortal(l,s)}return l};import{useState as PE}from"react";import{useEffect as Iy,useRef as My}from"react";var qs=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Wo(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as RE}from"react/jsx-runtime";var xE=function(e){return()=>`id-${e++}`}(0);function SE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new qs,Qc=new Map,_E=(e,t)=>typeof t=="bigint"?t.toString():t,AE=(e,t)=>`${e}${JSON.stringify(t,_E)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=AE(e,t);if(e==="privy:wallet:create"){let l=Qc.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=xE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{Qc.delete(a)});return Qc.set(a,i),i}function kE(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Wy(e){let t=My(null),r=My(e.mfaMethods),o=nu(),[n,a]=PE(!1);return Iy(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Iy(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&SE(f.data)&&kE(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Jd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),RE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Zi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function $s(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var js=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set when initialzing authentication.");try{await this.api.post(kd,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ue(t)}}async authenticate(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Mfa flow has no API instance");if(!this.meta.smsCode)throw new S("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Rd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Ct(t)}catch(t){throw ue(t)}}};import{jsx as Er,jsxs as Ly}from"react/jsx-runtime";var Un;function LE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=j.get(mo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Oy,hp=(e,t)=>Oy(e,t),Ny,yp=(e,t)=>Ny(e,t),Dy,gp=(e,t)=>Dy(e,t),Fy,vp=()=>Fy(),OE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},NE=({config:e,...t})=>{if(!LE(t.appId))throw new S("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Qn({appId:t.appId,apiUrl:t.apiUrl||$i}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Er(qp,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Er(DE,{...t,config:r,client:Un})})},DE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,x]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=Sa(),Y=_a(),[se,re]=Me(!0),[te,z]=Me({}),[Pe,we]=Me(null),[Tr,yt]=Me(null),[Ae,ge]=Me(!1),[gt,Ut]=Me(!1),Nr=Fn(null),tr=Fn(null),L=Fn(ru);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let J=Fn(null),Q=Fn(null),Bn=ME(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{x(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&re(!0),$(c)};Or(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Or(()=>{T&&Tr?.(T)},[T]),Or(()=>{(async()=>{if(!O.customAuth?.enabled)return;re(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h&&i){await Lo.logout();return}if(!h||i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();if(!I){await Lo.logout();return}d(I||null),E(D||!1),l(!0),Ut(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Or(()=>{gt&&T&&s&&At(s,e.config?.embeddedWallets?.createOnLogin)&&(Ut(!1),or(s,Fo).catch(console.error))},[gt&&T&&s]),Or(()=>{async function c(){let p=pt();OE();let m=IE();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Ys()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ie.setReadyToTrue(),p&&(h?Q.current="link":Q.current="login")}!n&&Y&&c()},[t,Pe,n,Y]);let pt=()=>{let c=qn();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ir(c)),We("AWAITING_OAUTH_SCREEN"),!0)},co=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Bt(I,p,m,h)};async function Bt(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new Z("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof cr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Bt(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Q.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Q.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Q.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let po=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Ys=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Ur()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new S("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),co(p,m,void 0,po)};Or(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new S("User must be authenticated before linking an account.")},uo=()=>{Le(),J.current="siwe",Q.current="link",$("LINK_WALLET_SCREEN")},vt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new S("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>po(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await po(c),We("AWAITING_CONNECTION")},rr=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new S("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await cf(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new S("Unsupported fund provider. Currently supported option is `moonpay`.")},Dr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:vt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new S("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await rr(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new S("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Bn(p)),ia(c,p)?c:p})};Or(()=>{Dr()},[s?.linkedAccounts,i,n]),Or(()=>{if(n){if(!t.connectors)throw new S("Connector not initialized");Dr(),t.connectors.on("walletsUpdated",Dr)}},[n]);let Ni=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let or=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ie.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,le)=>{re(!0),z({createWallet:{onSuccess:ut=>{N(L,"createWallet","onSuccess",ut),D(ut)},onFailure:ut=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),le(ut)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ie.refreshUser(),le=Ce(D);if(!le)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",le),le}},Js=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new Z(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},ed=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=Ce(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}re(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,et=c.chainId?Number(c.chainId):le.chainId;Js(et);let ut=Object.assign({},c,{chainId:et}),Pr=async()=>{let tt=await ve();if(!tt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ie.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let Vt=Sr(ut.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Zs=await Ln(D.address,ut,Vt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Vy}=await Wn(Zs,Vt),{hasSufficientFunds:zy}=await Bs(D.address,Zs,Vy,Vt);if(!zy)throw new xe(new kt("Wallet has insufficient funds for this transaction.",je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let od=await Us(tt,D.address,T,Zs,Vt);N(L,"sendTransaction","onSuccess",od),h(od)}catch(Gt){N(L,"sendTransaction","onError","transaction_failure"),I(Gt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Pr();else{let tt={transactionRequest:ut,onSuccess:Vt=>{N(L,"sendTransaction","onSuccess",Vt),h(Vt)},onFailure:Vt=>{N(L,"sendTransaction","onError","transaction_failure"),I(Vt)},uiOptions:p||{},fundWalletConfig:m},Gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Vt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(Vt)}};z({connectWallet:Gt,sendTransaction:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function td(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Ht=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new S(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Ni,linkWallet:uo,linkEmail:()=>{Le(),Ht("email"),J.current="email",Q.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Ht("phone"),J.current="sms",Q.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Ht("google"),Q.current="link",await ie.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Ht("twitter"),Q.current="link",await ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Ht("discord"),Q.current="link",await ie.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Ht("github"),Q.current="link",await ie.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Ht("spotify"),Q.current="link",await ie.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Ht("tiktok"),Q.current="link",await ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Ht("linkedin"),Q.current="link",await ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Ht("apple"),Q.current="link",await ie.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Ht("farcaster"),await ie.initLoginWithFarcaster(),Q.current="link",J.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new S("User does not have an email linked to their account.");Q.current="link",J.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Q.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}We("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&T)try{await T.clearMfa({userId:s.id})}catch{}d(null),l(!1),x(null),N(L,"logout","onSuccess"),Q.current=null,J.current=null,o(!1),j.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Xc(new ar(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Xc(new ar(new be)):new Xc(new ar(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Gr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Gr(new be):new Gr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ks(h.address)===Ks(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ks(h.address)===Ks(c));if(!p||!await p.isConnected())H(c),uo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return or(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await td()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{re(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}re(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await ve();if(!T||!le)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:ut}=await T.rpc({accessToken:le,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Pr=ut.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Pr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await D();N(L,"signMessage","onSuccess",le),m(le)}catch(le){N(L,"signMessage","onError","unable_to_sign"),h(le??new xe("Unable to sign message"))}}else{let ut={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:tt=>{N(L,"signMessage","onSuccess",tt),m(tt)},onFailure:tt=>{N(L,"signMessage","onError","unable_to_sign"),h(tt)},uiOptions:p||{}},Pr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:tt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(tt)}};z({signMessage:ut,connectWallet:Pr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}re(!0);let D=Xi(c),le=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let et=await ve();if(!T||!et)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Pr}=await T.rpc({accessToken:et,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),tt=Pr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),tt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let et=await le();N(L,"signTypedData","onSuccess",et),m(et)}catch(et){N(L,"signTypedData","onError","unable_to_sign"),h(et??new xe("Unable to sign message"))}}else{let Pr={method:"eth_signTypedData_v4",data:D,confirmAndSign:le,onSuccess:Gt=>{N(L,"signTypedData","onSuccess",Gt),m(Gt)},onFailure:Gt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Gt)},uiOptions:p||{}},tt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Gt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Gt)}};z({signMessage:Pr,connectWallet:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await ed(c,p,m)).wait();return Hs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}re(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(le){if(So(le))await ie.recoverEmbeddedWallet();else throw le}}catch(le){p(le);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:td,async init(c){let p;switch(c){case"sms":p=new js("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Nr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{tr.current={resolve:m,reject:h}});break;default:throw Nr.current?.reject(new S("Unsupported MFA method")),new S(`Unsupported MFA method: ${c}`)}},cancel(){Nr.current?.reject(new S("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ie.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ie.loginWithCode(c)},initLoginWithEmail(c){return ie.initLoginWithEmail(c)},initLoginWithSms(c){return ie.initLoginWithSms(c)},fundWallet(c,p){return ie.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ie.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ie.loginWithHeadlessOAuth(c)},isModalOpen:r};Oy=Lo.signMessage,Ny=Lo.signTypedData,Dy=async(...c)=>{let p=await ed(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let rd=!!e.config?.headless,ie=(()=>({headless:rd,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{yt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return yt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Q.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,J.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Q.current==="link"&&J.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,J.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Q.current=null,J.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Bt,initLoginWithWallet:async(c,p)=>{J.current="siwe",po(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new S("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),J.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new Vn(c);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof Vn))throw new S("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),J.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(J.current=c,tl()){if(c==="google"&&$s(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(ho);let m=new ir({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ir))throw new S("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(fo),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(tl()){if(c==="google"&&$s(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new ir({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ir(c));let p=j.get(fo),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c.provider}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Fr(c,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new Vi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Fr)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new S("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}re(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){So(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):So(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:rr,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Dr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await rr(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();Fy=ie.recoverEmbeddedWallet;let Gy=WE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Er(ce.Provider,{value:Lo,children:Er(El.Provider,{value:L,children:Er(qc.Provider,{value:Gy,children:Ly(Xp,{...O,children:[e.children,Ly(bl.Provider,{value:ie,children:[!rd&&O.captchaEnabled&&n&&!i&&Er(Cl,{delayedExecution:!1}),Er(Sy,{theme:{...O.appearance.palette||{}}}),Er(jp,{data:te,setModalData:z,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Er(Ry,{open:r})}),se&&Y?Er(Wy,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Nr,mfaSubmitPromise:tr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as FE}from"react";function UE(e){let{login:t}=FE(ce);return Ee("login",e),{login:t}}import{useContext as BE}from"react";function HE(e){let{logout:t}=BE(ce);return Ee("logout",e),{logout:t}}import{useCallback as Uy,useEffect as GE}from"react";function VE(){let e=fe(),t=_a(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=Uy(async d=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=Uy(async()=>{let d=qn();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{$n()}},[o]);return GE(()=>{let d=qn();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as By}from"react";var zE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=By(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=By(async({code:a})=>{if(e.enabled&&e.status==="error")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Hy}from"react";var qE=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Hy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Hy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as $E}from"react";function jE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=$E(ce);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as KE}from"react";function YE(e){let{connectWallet:t}=KE(ce);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as JE}from"react";function ZE(e){let{createWallet:t}=JE(ce);return Ee("createWallet",e),{createWallet:t}}var QE=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as XE}from"react";function e4(e){let{sendTransaction:t}=XE(ce);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as t4}from"react";function r4(e){let{setWalletPassword:t}=t4(ce);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as o4}from"react";function n4(e){let{signMessage:t}=o4(ce);return Ee("signMessage",e),{signMessage:t}}import{useContext as i4}from"react";function a4(e){let{signTypedData:t}=i4(ce);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as s4}from"react";var l4=()=>{let{isModalOpen:e}=s4(ce);return{isOpen:e}};import{useContext as c4}from"react";function d4(e){let{getAccessToken:t}=c4(ce);return Ee("accessToken",e),{getAccessToken:t}}function p4(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function u4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{ar as AsExternalProvider,Cl as Captcha,Zn as ConnectorManager,Qn as PrivyClient,NE as PrivyProvider,be as PrivyProxyProvider,Yn as SUPPORTED_CHAINS,il as VERSION,mt as WalletConnector,u4 as addRpcUrlOverrideToChain,Yl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,YE as useConnectWallet,ZE as useCreateWallet,p4 as useExperimentalFarcasterSigner,QE as useFundWallet,jE as useLinkAccount,UE as useLogin,zE as useLoginWithEmail,VE as useLoginWithOAuth,qE as useLoginWithSms,HE as useLogout,An as useMfa,Si as useMfaEnrollment,l4 as useModalStatus,G as usePrivy,Tl as useRegisterMfaListener,e4 as useSendTransaction,r4 as useSetWalletPassword,n4 as useSignMessage,a4 as useSignTypedData,d4 as useToken,Wi as useWallets};
|
|
2748
|
+
`;import{jsx as Ge,jsxs as Ry}from"react/jsx-runtime";var bE={["LANDING"]:qf,["CONNECT_OR_CREATE"]:Vf,["AWAITING_PASSWORDLESS_CODE"]:_u,["AWAITING_CONNECTION"]:$u,["AWAITING_CONNECT_ONLY_CONNECTION"]:Ju,["AWAITING_FARCASTER_CONNECTION"]:Xm,["AWAITING_FARCASTER_SIGNER"]:af,["PHANTOM_INTERSTITIAL_SCREEN"]:cy,["LOGIN_FAILED_SCREEN"]:Qf,["AWAITING_OAUTH_SCREEN"]:iy,["ALLOWLIST_REJECTION_SCREEN"]:gu,["INSTALL_PHANTOM_SCREEN"]:Cf,["LINK_EMAIL_SCREEN"]:$f,["LINK_PHONE_SCREEN"]:jf,["LINK_WALLET_SCREEN"]:Kf,["UPDATE_EMAIL_SCREEN"]:xy,["CONNECT_ONLY_LANDING_SCREEN"]:Vu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Bu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Om,["EMBEDDED_WALLET_CREATED_SCREEN"]:om,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:tm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Fm,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:sm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:vy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:uf,["FIAT_ON_RAMP_STATUS_SCREEN"]:ff,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Dm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Nm,["MFA_ENROLLMENT_FLOW_SCREEN"]:uh,["CAPTCHA_SCREEN"]:Iu,["ERROR_SCREEN"]:Um,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:hf,["AFFIRMATIVE_CONSENT_SCREEN"]:hu},EE=["LANDING","AWAITING_CONNECTION"],TE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=vE(null),f=ru(y),g=o&&i&&EE.includes(i)&&!n&&l==="ready";if(ky(()=>{g&&s()},[g]),ky(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ry(Sn,{id:"privy-modal-content",children:[Ge(A,{}),Ge(K,{}),Ge(th,{children:Ge(ft,{})}),Ge(oe,{}),Ge(X,{})]});if(!i&&e)return Ge(Sn,{style:{height:f},id:"privy-modal-conent",children:Ge("div",{ref:y,children:Ge(Yc,{open:e,onClose:t})})});if(!i)return null;let E=bE[i];return Ge(Sn,{style:{height:f},id:"privy-modal-content",children:Ry("div",{ref:y,children:[Ge(Ar,{if:!!e,children:Ge(E,{})}),Ge(Ar,{if:!e,children:Ge(Yc,{open:e,onClose:t})})]})})},PE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:gE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Iy=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=PE(),[o,n]=wE(!1);Tl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Ay,{children:Ge(TE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(eh,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return CE.createPortal(l,s)}return l};import{useState as xE}from"react";import{useEffect as My,useRef as Wy}from"react";var qs=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Wo(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as IE}from"react/jsx-runtime";var SE=function(e){return()=>`id-${e++}`}(0);function _E(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new qs,Qc=new Map,AE=(e,t)=>typeof t=="bigint"?t.toString():t,kE=(e,t)=>`${e}${JSON.stringify(t,AE)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=kE(e,t);if(e==="privy:wallet:create"){let l=Qc.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=SE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{Qc.delete(a)});return Qc.set(a,i),i}function RE(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ly(e){let t=Wy(null),r=Wy(e.mfaMethods),o=iu(),[n,a]=xE(!1);return My(()=>{r.current=e.mfaMethods},[e.mfaMethods]),My(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&_E(f.data)&&RE(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Jd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),IE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Zi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function $s(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var js=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set when initialzing authentication.");try{await this.api.post(kd,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ue(t)}}async authenticate(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Mfa flow has no API instance");if(!this.meta.smsCode)throw new S("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Rd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Ct(t)}catch(t){throw ue(t)}}};import{jsx as Er,jsxs as Oy}from"react/jsx-runtime";var Un;function OE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=j.get(mo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Ny,hp=(e,t)=>Ny(e,t),Dy,yp=(e,t)=>Dy(e,t),Fy,gp=(e,t)=>Fy(e,t),Uy,vp=()=>Uy(),NE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},DE=({config:e,...t})=>{if(!OE(t.appId))throw new S("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Qn({appId:t.appId,apiUrl:t.apiUrl||$i}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Er($p,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Er(FE,{...t,config:r,client:Un})})},FE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,x]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=Sa(),Y=_a(),[se,re]=Me(!0),[te,z]=Me({}),[Pe,we]=Me(null),[Tr,yt]=Me(null),[Ae,ge]=Me(!1),[gt,Ut]=Me(!1),Nr=Fn(null),tr=Fn(null),L=Fn(ou);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let J=Fn(null),Q=Fn(null),Bn=WE(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{x(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&re(!0),$(c)};Or(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Or(()=>{T&&Tr?.(T)},[T]),Or(()=>{(async()=>{if(!O.customAuth?.enabled)return;re(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h&&i){await Lo.logout();return}if(!h||i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();if(!I){await Lo.logout();return}d(I||null),E(D||!1),l(!0),Ut(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Or(()=>{gt&&T&&s&&At(s,e.config?.embeddedWallets?.createOnLogin)&&(Ut(!1),or(s,Fo).catch(console.error))},[gt&&T&&s]),Or(()=>{async function c(){let p=pt();NE();let m=ME();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Ys()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ie.setReadyToTrue(),p&&(h?Q.current="link":Q.current="login")}!n&&Y&&c()},[t,Pe,n,Y]);let pt=()=>{let c=qn();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ir(c)),We("AWAITING_OAUTH_SCREEN"),!0)},co=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Bt(I,p,m,h)};async function Bt(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new Z("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof cr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Bt(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Q.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Q.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Q.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let po=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Ys=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Ur()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new S("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),co(p,m,void 0,po)};Or(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new S("User must be authenticated before linking an account.")},uo=()=>{Le(),J.current="siwe",Q.current="link",$("LINK_WALLET_SCREEN")},vt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new S("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>po(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await po(c),We("AWAITING_CONNECTION")},rr=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new S("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await df(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new S("Unsupported fund provider. Currently supported option is `moonpay`.")},Dr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:vt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new S("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await rr(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new S("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Bn(p)),ia(c,p)?c:p})};Or(()=>{Dr()},[s?.linkedAccounts,i,n]),Or(()=>{if(n){if(!t.connectors)throw new S("Connector not initialized");Dr(),t.connectors.on("walletsUpdated",Dr)}},[n]);let Ni=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let or=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ie.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,le)=>{re(!0),z({createWallet:{onSuccess:ut=>{N(L,"createWallet","onSuccess",ut),D(ut)},onFailure:ut=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),le(ut)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ie.refreshUser(),le=Ce(D);if(!le)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",le),le}},Js=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new Z(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},ed=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=Ce(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}re(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,et=c.chainId?Number(c.chainId):le.chainId;Js(et);let ut=Object.assign({},c,{chainId:et}),Pr=async()=>{let tt=await ve();if(!tt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ie.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let Vt=Sr(ut.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Zs=await Ln(D.address,ut,Vt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:zy}=await Wn(Zs,Vt),{hasSufficientFunds:qy}=await Bs(D.address,Zs,zy,Vt);if(!qy)throw new xe(new kt("Wallet has insufficient funds for this transaction.",je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let od=await Us(tt,D.address,T,Zs,Vt);N(L,"sendTransaction","onSuccess",od),h(od)}catch(Gt){N(L,"sendTransaction","onError","transaction_failure"),I(Gt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Pr();else{let tt={transactionRequest:ut,onSuccess:Vt=>{N(L,"sendTransaction","onSuccess",Vt),h(Vt)},onFailure:Vt=>{N(L,"sendTransaction","onError","transaction_failure"),I(Vt)},uiOptions:p||{},fundWalletConfig:m},Gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Vt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(Vt)}};z({connectWallet:Gt,sendTransaction:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function td(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Ht=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new S(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Ni,linkWallet:uo,linkEmail:()=>{Le(),Ht("email"),J.current="email",Q.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Ht("phone"),J.current="sms",Q.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Ht("google"),Q.current="link",await ie.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Ht("twitter"),Q.current="link",await ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Ht("discord"),Q.current="link",await ie.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Ht("github"),Q.current="link",await ie.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Ht("spotify"),Q.current="link",await ie.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Ht("tiktok"),Q.current="link",await ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Ht("linkedin"),Q.current="link",await ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Ht("apple"),Q.current="link",await ie.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Ht("farcaster"),await ie.initLoginWithFarcaster(),Q.current="link",J.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new S("User does not have an email linked to their account.");Q.current="link",J.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Q.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}We("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&T)try{await T.clearMfa({userId:s.id})}catch{}d(null),l(!1),x(null),N(L,"logout","onSuccess"),Q.current=null,J.current=null,o(!1),j.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Xc(new ar(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Xc(new ar(new be)):new Xc(new ar(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Gr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Gr(new be):new Gr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ks(h.address)===Ks(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ks(h.address)===Ks(c));if(!p||!await p.isConnected())H(c),uo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return or(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await td()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{re(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}re(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await ve();if(!T||!le)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:ut}=await T.rpc({accessToken:le,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Pr=ut.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Pr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await D();N(L,"signMessage","onSuccess",le),m(le)}catch(le){N(L,"signMessage","onError","unable_to_sign"),h(le??new xe("Unable to sign message"))}}else{let ut={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:tt=>{N(L,"signMessage","onSuccess",tt),m(tt)},onFailure:tt=>{N(L,"signMessage","onError","unable_to_sign"),h(tt)},uiOptions:p||{}},Pr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:tt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(tt)}};z({signMessage:ut,connectWallet:Pr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}re(!0);let D=Xi(c),le=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let et=await ve();if(!T||!et)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Pr}=await T.rpc({accessToken:et,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),tt=Pr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),tt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let et=await le();N(L,"signTypedData","onSuccess",et),m(et)}catch(et){N(L,"signTypedData","onError","unable_to_sign"),h(et??new xe("Unable to sign message"))}}else{let Pr={method:"eth_signTypedData_v4",data:D,confirmAndSign:le,onSuccess:Gt=>{N(L,"signTypedData","onSuccess",Gt),m(Gt)},onFailure:Gt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Gt)},uiOptions:p||{}},tt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Gt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Gt)}};z({signMessage:Pr,connectWallet:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await ed(c,p,m)).wait();return Hs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}re(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(le){if(So(le))await ie.recoverEmbeddedWallet();else throw le}}catch(le){p(le);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:td,async init(c){let p;switch(c){case"sms":p=new js("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Nr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{tr.current={resolve:m,reject:h}});break;default:throw Nr.current?.reject(new S("Unsupported MFA method")),new S(`Unsupported MFA method: ${c}`)}},cancel(){Nr.current?.reject(new S("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ie.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ie.loginWithCode(c)},initLoginWithEmail(c){return ie.initLoginWithEmail(c)},initLoginWithSms(c){return ie.initLoginWithSms(c)},fundWallet(c,p){return ie.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ie.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ie.loginWithHeadlessOAuth(c)},isModalOpen:r};Ny=Lo.signMessage,Dy=Lo.signTypedData,Fy=async(...c)=>{let p=await ed(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let rd=!!e.config?.headless,ie=(()=>({headless:rd,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{yt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return yt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Q.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,J.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Q.current==="link"&&J.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,J.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Q.current=null,J.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Bt,initLoginWithWallet:async(c,p)=>{J.current="siwe",po(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new S("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),J.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new Vn(c);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof Vn))throw new S("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),J.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(J.current=c,tl()){if(c==="google"&&$s(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(ho);let m=new ir({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ir))throw new S("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(fo),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(tl()){if(c==="google"&&$s(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new ir({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ir(c));let p=j.get(fo),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c.provider}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Fr(c,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new Vi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Fr)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new S("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}re(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){So(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):So(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:rr,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Dr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await rr(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();Uy=ie.recoverEmbeddedWallet;let Vy=LE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Er(ce.Provider,{value:Lo,children:Er(El.Provider,{value:L,children:Er(qc.Provider,{value:Vy,children:Oy(eu,{...O,children:[e.children,Oy(bl.Provider,{value:ie,children:[!rd&&O.captchaEnabled&&n&&!i&&Er(Cl,{delayedExecution:!1}),Er(_y,{theme:{...O.appearance.palette||{}}}),Er(Kp,{data:te,setModalData:z,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Er(Iy,{open:r})}),se&&Y?Er(Ly,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Nr,mfaSubmitPromise:tr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as UE}from"react";function BE(e){let{login:t}=UE(ce);return Ee("login",e),{login:t}}import{useContext as HE}from"react";function GE(e){let{logout:t}=HE(ce);return Ee("logout",e),{logout:t}}import{useCallback as By,useEffect as VE}from"react";function zE(){let e=fe(),t=_a(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=By(async d=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=By(async()=>{let d=qn();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{$n()}},[o]);return VE(()=>{let d=qn();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Hy}from"react";var qE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Hy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Hy(async({code:a})=>{if(e.enabled&&e.status==="error")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Gy}from"react";var $E=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Gy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Gy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as jE}from"react";function KE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=jE(ce);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as YE}from"react";function JE(e){let{connectWallet:t}=YE(ce);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as ZE}from"react";function QE(e){let{createWallet:t}=ZE(ce);return Ee("createWallet",e),{createWallet:t}}var XE=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as e4}from"react";function t4(e){let{sendTransaction:t}=e4(ce);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as r4}from"react";function o4(e){let{setWalletPassword:t}=r4(ce);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as n4}from"react";function i4(e){let{signMessage:t}=n4(ce);return Ee("signMessage",e),{signMessage:t}}import{useContext as a4}from"react";function s4(e){let{signTypedData:t}=a4(ce);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as l4}from"react";var c4=()=>{let{isModalOpen:e}=l4(ce);return{isOpen:e}};import{useContext as d4}from"react";function p4(e){let{getAccessToken:t}=d4(ce);return Ee("accessToken",e),{getAccessToken:t}}function u4(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function m4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{ar as AsExternalProvider,Cl as Captcha,Zn as ConnectorManager,Qn as PrivyClient,DE as PrivyProvider,be as PrivyProxyProvider,Yn as SUPPORTED_CHAINS,il as VERSION,mt as WalletConnector,m4 as addRpcUrlOverrideToChain,Yl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,JE as useConnectWallet,QE as useCreateWallet,u4 as useExperimentalFarcasterSigner,XE as useFundWallet,KE as useLinkAccount,BE as useLogin,qE as useLoginWithEmail,zE as useLoginWithOAuth,$E as useLoginWithSms,GE as useLogout,An as useMfa,Si as useMfaEnrollment,c4 as useModalStatus,G as usePrivy,Tl as useRegisterMfaListener,t4 as useSendTransaction,o4 as useSetWalletPassword,i4 as useSignMessage,s4 as useSignTypedData,p4 as useToken,Wi as useWallets};
|