@privy-io/react-auth 1.59.6 → 1.59.7-beta-20240326191824
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 +232 -232
- package/dist/index.js +227 -227
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Xs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ad=(e,t,r)=>(Xs(e,t,"read from private field"),r?r.call(e):t.get(e)),Fi=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},el=(e,t,r,o)=>(Xs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var sd=(e,t,r)=>(Xs(e,t,"access private method"),r);import{getAddress as Ys}from"@ethersproject/address";import{Web3Provider as td}from"@ethersproject/providers";import{createStore as LE}from"mipd";import{useCallback as OE,useEffect as Nr,useMemo as NE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},ir=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},x=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ui=class extends x{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return ot(e);if(!e.response)return new ir("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new ir(t||"ApiError",e.response.status,r||o,e,n)},ot=e=>e instanceof $e?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Oo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ct=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Bi=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hi="/api/v1/sessions",Gi="/api/v1/sessions/logout",ld="/api/v1/sessions/fork",Vi="/api/v1/sessions/fork/recover",cd="/api/v1/siwe/init",dd="/api/v1/siwe/authenticate",pd="/api/v1/siwe/link",ud="/api/v1/siwe/unlink",md="/api/v1/farcaster/init",fd="/api/v1/farcaster/authenticate",hd="/api/v1/farcaster/link",yd="/api/v1/farcaster/status",gd="/api/v1/farcaster/unlink",vd="/api/v1/passwordless/init",wd="/api/v1/passwordless/authenticate",Cd="/api/v1/passwordless/link",bd="/api/v1/passwordless/unlink",Ed="/api/v1/passwordless/update",Td="/api/v1/passwordless_sms/init",Pd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",xd="/api/v1/passwordless_sms/authenticate",_d="/api/v1/oauth/init",Ad="/api/v1/oauth/authenticate",kd="/api/v1/oauth/link",Rd="/api/v1/oauth/unlink";var Id="/api/v1/mfa/passwordless_sms/init",Md="/api/v1/mfa/passwordless_sms/enroll";var Wd="/api/v1/users/me/accept_terms",Ld="/api/v1/analytics_events",Od="/api/v1/plugins/moonpay_on_ramp/sign",Nd="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(Nd,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){throw new Error("Unimplemented")}};var Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(vd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},zi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ed,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as Qy,isIOS as Xy}from"react-device-detect";var qi=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},tl=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}},rl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ol(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new tl:new qi}function Ky(){return typeof window<"u"&&window.sessionStorage?new rl:new qi}var je=Ky(),ue=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Dd(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var $i=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var nl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||$i(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!nl(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fd=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var Ud="1.59.6";var il="4df5e2316331463a9130964bd6078dfa",al="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Bd="34357d3c125c2bcf2ce2bc3309d98715",ji="https://auth.privy.io",Hd=2e4,Oe=1400,Gd=2500,sl=Ud;var fo="privy:token",ll="privy-token",Ki="privy:refresh_token",cl="privy-refresh-token",Yi="privy-session",Hn="privy:session_transfer_token",Jy="privy:wallet",Gn="privy:caid",ho="privy:state_code",Do="privy:code_verifier",Vn="privy:headless_oauth",Ji=e=>`${Jy}:${e}`,dl="privy:connectors",pl="privy:connections";var yo=12e4,xr=1,ul="0x1",Fo=3e4,Vd="https://api.moonpay.com/v1",zd="https://api.moonpay.com/v1",qd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",$d="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",jd="0x420000000000000000000000000000000000000F",Kd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Yd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Zi=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},ml=e=>new Promise(t=>setTimeout(t,e));function Zd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Qd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await ml(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Qi=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Xd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ep(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Dd()){let u=$i(d);if(!l.some(y=>y.info.name===u)){if(nl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Xi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+il:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+al:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},_r=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+il):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+al):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ea=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ta=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function Zy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var rp=e=>e in Ho,op=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function np(e,t){let r=Zy(t);if(r.deepLink)return cp(r.deepLink,e);if(r.universalLink)return dp(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var ip="WALLETCONNECT_DEEPLINK_CHOICE";function ap(){try{localStorage.removeItem(ip)}catch{}}function sp({href:e,name:t}){try{localStorage.setItem(ip,JSON.stringify({href:e,name:t}))}catch{}}function lp(e){return e.startsWith("http://")||e.startsWith("https://")}function cp(e,t){if(lp(e))return dp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function dp(e,t){if(!lp(e))return cp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ra(e,t){window.open(e,t,"noreferrer noopener")}var nt=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var zn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(fd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{return await this.api.post(hd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new x("Auth flow has no API instance");let t=await this.api.post(md,{token:this.captchaToken});Qy&&!Xy&&t.connect_uri&&ra(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(yd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as mp}from"jose";async function pp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function up(e){return crypto.getRandomValues(new Uint8Array(e))}function oa(){return!!je.get(Vn)}var eg="S256",tg="S256",ar=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:oa();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(Ad,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),this.meta.headless&&je.del(Vn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),r}catch(r){throw pe(r)}}createCodeVerifier(){return mp.encode(up(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=eg){if(r==tg){let o=await pp(t);return mp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();je.put(Do,t);let r=this.createStateCode();je.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&je.put(Vn,!0);try{return await this.api.post(_d,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fp(e,t){let r={detail:"",retryable:!1},o=fl(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function $n(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:oa()}}function jn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),je.del(ho),window.history.replaceState({},"",e)}var vo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
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 zy}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 zy))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 Yy,isIOS as Jy}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 qy(){return typeof window<"u"&&window.localStorage?new zi:new el}var j=qy();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.7-beta-20240326191824";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",jy="privy:wallet",Gn="privy:caid",fo="privy:state_code",Do="privy:code_verifier",ho="privy:headless_oauth",Yi=e=>`${jy}:${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 Ky(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=Ky(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});Yy&&!Jy&&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 Zy="S256",Qy="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=Zy){if(r==Qy){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 nt(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(dd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(pd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw pe(t)}}async sign(){if(!this.api)throw new x("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new x("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new x("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(cd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new x("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(xd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Td,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as qg}from"uuid";function it(e){return new Date(e*1e3)}function rg(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:it(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let a={address:r.address,type:r.type,verifiedAt:it(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:it(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:it(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:it(r.verified_at)});break;case"farcaster":let v={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:it(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function At(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,og=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),kt=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!og(e)?.length;function bt(e){if(!e)return null;let t=rg(e.linked_accounts),r=At(t,"wallet"),o=At(t,"email"),n=At(t,"phone"),a=At(t,"google_oauth"),i=At(t,"twitter_oauth"),l=At(t,"discord_oauth"),s=At(t,"github_oauth"),d=At(t,"spotify_oauth"),u=At(t,"tiktok_oauth"),y=At(t,"linkedin_oauth"),f=At(t,"apple_oauth"),g=At(t,"farcaster"),E=e.mfa_methods.map(({type:S,verified_at:C})=>({type:S,verifiedAt:it(C)}));return{id:e.id,createdAt:it(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:E.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Jp}from"@ethersproject/address";import Hg from"eventemitter3";import mg from"@coinbase/wallet-sdk";import{jsx as hp,jsxs as ng}from"react/jsx-runtime";var na=({style:e,...t})=>ng("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[hp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),hp("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as lr}from"@ethersproject/address";import{Web3Provider as bp}from"@ethersproject/providers";import{default as pg}from"eventemitter3";import dg from"eventemitter3";var ig=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],yp=e=>ig.includes(e);import{ErrorCode as ag}from"@ethersproject/logger";var Go=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},qt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new Se(e);return e.code===ag.ACTION_REJECTED&&(t.details=Ke.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Se(e):new J("Unknown connector error",e)},Rt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Se=class extends Rt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Ke).find(a=>a.eipCode===o.code);this.details=n||Ke.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Ke.E32002_CONNECTION_ALREADY_PENDING:this.details=Ke.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Ke.E32002_WALLET_LOCKED))}},sg={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},lg={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},cg={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Ke={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...cg,...lg},Ar={...sg,...Ke};var be=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Go,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new J(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw qt(r)})}},Gr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ia=class extends dg{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=_r(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Gr("Disconnected",4900);return(await wp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Gr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=_r(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await gp(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await vp(ea(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:go(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return go(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(yp(r.method)){let o=await ve();if(await Cp(),!o||!this.address)throw new Gr("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Gr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},sr=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Vr=class extends be{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ug=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ft=class extends pg{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Bo(r),this.walletClientType==="privy"&&ue.put(Ji(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>lr(i.address)===lr(r));return{address:lr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>lr(f.address)===lr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new J(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(ug(f,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new bp(new sr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Vr(this.proxyProvider)},sign:async i=>{if(!await a())throw new J("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=lr(n),i=[],l;if(this.walletClientType==="privy"){let d=ue.get(Ji(a));this.chains.find(u=>u.id===Number(d))||(ue.del(Ji(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${ul}`,d),l=ul}let s=Bo(l);if(!i.find(d=>lr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(lr(n),s,d))}aa(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>lr(n)===lr(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new bp(new sr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var qo={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var fg=(e,t)=>{let o=Xi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},sa,la=class extends ft{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),sa||(sa=new mg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(fg(sa,a))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){sa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:na,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};import{jsx as Ep}from"react/jsx-runtime";var ca=({...e})=>Ep("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ep("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var da=class extends ft{constructor(r,o,n,a){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ca,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Tp}from"react/jsx-runtime";var $o=({style:e,...t})=>Tp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Tp("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Et,jsxs as hg}from"react/jsx-runtime";var jo=({style:e,...t})=>hg("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[Et("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Et("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Et("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),Et("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),Et("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),Et("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),Et("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),Et("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),Et("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),Et("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),Et("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),Et("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),Et("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Pp,jsxs as yg}from"react/jsx-runtime";var cr=({style:e,...t})=>yg("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[Pp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Pp("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Yo=class extends ft{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}},Ko,Jo=class extends ft{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Fi(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?el(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&el(this,Ko,{name:"Phantom",icon:cr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return ad(this,Ko)??{name:"Browser Extension",icon:$o,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};Ko=new WeakMap;import{getAddress as _T}from"@ethersproject/address";import{Web3Provider as kT}from"@ethersproject/providers";import{isMobile as gg}from"react-device-detect";var pa=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{gg||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw qt(t)}}};var ua=class extends ft{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var ma=class extends ua{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:cr,id:"phantom"}}};import{EthereumProvider as Dg,OPTIONAL_EVENTS as Fg,OPTIONAL_METHODS as Ug}from"@walletconnect/ethereum-provider";import{isMobile as Bg}from"react-device-detect";import{createContext as kg,useContext as Rg,useEffect as vl,useRef as Ig,useState as Mg}from"react";import{jsx as vg}from"react/jsx-runtime";function fa({src:e,...t}){return vg("img",{src:e,...t,style:{display:"none"}})}import{useContext as qp,useEffect as zp,useMemo as Sg,useState as xg}from"react";import{createContext as _g}from"react";var It={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Bd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Sp=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var wg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),xp=e=>wg.has(e),_p=(e,t,r)=>r.indexOf(e)===t,Ap=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(xp).filter(_p):e?e.filter(xp).filter(_p):It.appearance.walletList;var ha={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var ya={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ga={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var kp={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var Rp={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var va={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var wa={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Ca={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var Ip={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var Mp={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var Wp={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var Lp={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var Op={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Np={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Dp={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var Fp={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ba={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Ea={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Ta={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Kn={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Yn={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Up={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Bp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Pa={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Sa={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var xa={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Jn=[ha,ya,ga,Op,Bp,qo,ba,Ea,Ta,Kn,Yn,Ip,Mp,Wp,Lp,va,wa,Ca,Dp,Fp,kp,Rp,Pa,xa,Sa,Np,Up],K6=new Set(Jn.map(e=>e.id));import Co from"tinycolor2";var Hp="#FFFFFF",Cg="#000000",bg=Hp,Eg="#1E1E1D";function Tg(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function zr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Gp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Hp,blackHex:i=Cg}){let l;switch(e){case"light":l=bg;break;case"dark":l=Eg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Tg(s.getLuminance()),E=zr(s,g==="light"?-.04:.11),v=zr(s,g==="light"?-.88:.87),S=zr(s,g==="light"?-.77:.75),C=zr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=zr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=zr(d,.15),M=zr(d,-.06),k=Co(d.getLuminance()>.5?i:a),B=zr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:S.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function hl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,S,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),S=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,S=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,S,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=Ap({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Sp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Pg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,K=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ae,te=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?K?ae=t?.embeddedWallets?.noPromptOnSignature??!0:ae=t?.embeddedWallets?.noPromptOnSignature??te:ae=te,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ae!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Gp({backgroundTheme:t?.appearance?.theme??It.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??It.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:S,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??It.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??It.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??It.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??It.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...K?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ae},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:K?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??It.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??It._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??It._render.inParentNodeId}}}function Vp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Pg({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Jn.find(u=>u.id===s.id)??s)}else n=Jn.concat(e??[]);let a=t?n[0]:qo,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}import{jsx as Ag}from"react/jsx-runtime";var $p={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},yl=hl($p,void 0,!1),gl=_g({appConfig:yl,isServerConfigLoaded:!1}),jp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=xg(null),i=Sg(()=>hl(n??$p,o,!!n),[n,o]);return zp(()=>{let l=Vp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),zp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Ag(gl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},_a=()=>{let{appConfig:e}=qp(gl);return e},Aa=()=>{let{isServerConfigLoaded:e}=qp(gl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Lg,jsxs as Og}from"react/jsx-runtime";var Kp=kg({ready:!1,app:yl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Wg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Yp=e=>{let t=_a(),r=e.authenticated,[o,n]=Mg(e.initialScreen);vl(()=>{!r&&!Wg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Ig(null);vl(()=>{e.open||(a.current=null)},[e.open]),vl(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return Og(Kp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Lg(fa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Rg(Kp);import{jsx as Zo,jsxs as Ng}from"react/jsx-runtime";var Zn=({style:e,...t})=>{let{app:r}=_();return Ng("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var dr=class extends ft{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ta(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:jo,id:"io.metamask"}:{name:Xd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Zn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Ho[r],this.walletClientType=r,this.redirectUri=void 0,ap(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ta(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(qt(i));return}o(new J("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Xi(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Dg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fg,optionalMethods:Ug,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Bg&&this.walletEntry){let{redirect:l,href:s}=np(i,this.walletEntry);sp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ra(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ta(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var wl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Jp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Qn=class extends Hg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;ue.get(dl)&&(ue.getKeys().forEach(o=>{o.startsWith("walletconnect")&&ue.del(o)}),ue.del(dl));let r=ep(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Br()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new ia(r,o,this.rpcConfig,this.chains,a,n.id),s=new da(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof dr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new pa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new la(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ma(this.defaultChain):new dr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=ue.get(pl);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));ue.put(pl,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=Jp(r),this.emit("walletsUpdated")}};function aa(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}import{ofetch as Gg}from"ofetch";var Vg=[Hi,Vi,Gi],ka=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=sl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Gg.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Vg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Ui}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw pe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw pe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw pe(o)}}};import bo from"js-cookie";function Zp(e){return e instanceof Ur?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ar?e.meta.provider:null}import*as Qp from"jose";var pr=class{static parse(t){try{return new pr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Qp.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var zg=30,Ra=class{constructor(){this.authenticateOnce=new nt(async t=>this._authenticate(t)),this.linkOnce=new nt(async t=>this._link(t)),this.refreshOnce=new nt(this._refresh.bind(this)),this.destroyOnce=new nt(this._destroy.bind(this)),this.forkSessionOnce=new nt(this._forkSession.bind(this))}get token(){try{let t=ue.get(fo);return typeof t=="string"?new pr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ue.get(Ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ue.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Yi);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=pr.parse(this.token);return t!==null&&!t.isExpired(zg)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Zp(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:bt(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),ot(r)}}async _link(t){try{let r=await t.link();return bt(r)}catch(r){throw console.warn("Error linking account"),ot(r)}}async _refresh(){if(!this.api)throw new x("Session has no API instance");if(!this.client)throw new x("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Hi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Vi,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),bt(n.user)}catch(n){if(n instanceof ir&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ot(n)}}async _destroy(){try{await this.api?.post(Gi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new x("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ld,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw ot(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=ue.get(fo);if(ue.put(fo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=pr.parse(t)?.expiration;bo.set(ll,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else ue.del(fo),bo.remove(ll)}storeRefreshToken(t){typeof t=="string"?(ue.put(Ki,t),this.client?.useServerCookies||(bo.set(Yi,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(cl,t,{sameSite:"Strict",secure:!0,expires:30}))):(ue.del(Ki),bo.remove(cl),bo.remove(Yi))}clearForkedToken(){ue.del(Hn)}};var Cl,Ia,Xp,Xn=class{constructor(t){Fi(this,Ia);this.apiUrl=t.apiUrl||ji,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Hd,this.appId=t.appId,this.clientAnalyticsId=sd(this,Ia,Xp).call(this),Cl||(Cl=new Ra),this.session=Cl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Qn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new ka(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new x("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new x("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(bd,{address:t});return bt(r)}catch(r){throw ot(r)}}async acceptTerms(){try{let t=await this.api.post(Wd,{});return bt(t)}catch(t){throw ot(t)}}async unlinkPhone(t){try{let r=await this.api.post(Sd,{phoneNumber:t});return bt(r)}catch(r){throw ot(r)}}async unlinkWallet(t){try{let r=await this.api.post(ud,{address:t});return bt(r)}catch(r){throw ot(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Rd,{provider:t,subject:r});return bt(o)}catch(o){throw ot(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(gd,{fid:t});return bt(r)}catch(r){throw ot(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ld,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Od,t)}catch(r){throw ot(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?pr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw ot(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Ia=new WeakSet,Xp=function(){if(typeof window>"u")return null;try{let r=ue.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=qg();try{return ue.put(Gn,t),t}catch{return t}};import{Turnstile as Zg}from"@marsidev/react-turnstile";import{useEffect as Qg,useMemo as Xg}from"react";import{useMemo as $g,useRef as jg,useContext as Kg,useState as bl,createContext as Yg}from"react";import{jsx as Jg}from"react/jsx-runtime";var eu=Yg({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),$t=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},tu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=jg(null),[a,i]=bl(),[l,s]=bl(),[d,u]=bl(!1),y=$g(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Jg(eu.Provider,{value:{...y,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Zd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new $t("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>Kg(eu);import{jsx as ru}from"react/jsx-runtime";var El=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=Xg(()=>r?.split("t:")||[],[r]);if(Qg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return ru("div",{className:"hidden h-0 w-0",children:ru(Zg,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as wE,useEffect as ky,useRef as CE,useState as bE}from"react";import EE from"react-dom";import{createContext as e1,useContext as t1}from"react";var Tl=e1({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>t1(Tl);import{createContext as r1,useContext as o1}from"react";var le=r1({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>o1(le);import{useEffect as n1,useState as i1}from"react";var ou=e=>{let[t,r]=i1("auto");return n1(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as a1,useContext as s1,useEffect as l1}from"react";var nu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Pl=a1(void 0),iu=()=>s1(Pl);function Ee(e,t){if(!t)return;let o=iu().current[e];return l1(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function au(){let e=iu();return(t,r,...o)=>N(e,t,r,...o)}function Sl(e){Ee("configureMfa",e)}import hu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import T1 from"@heroicons/react/24/solid/DocumentCheckIcon";import P1 from"styled-components";import To,{css as kl}from"styled-components";import _l from"styled-components";import{Fragment as d1,jsx as xl,jsxs as p1}from"react/jsx-runtime";var Mt=({success:e,fail:t})=>p1(d1,{children:[xl(ht,{className:e?"success":t?"fail":""}),xl(Al,{className:e?"success":t?"fail":""})]}),ht=_l.span`
|
|
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 Gg}from"uuid";function nt(e){return new Date(e*1e3)}function Xy(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,eg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),At=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!eg(e)?.length;function Ct(e){if(!e)return null;let t=Xy(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 Fg from"eventemitter3";import dg from"@coinbase/wallet-sdk";import{jsx as mp,jsxs as tg}from"react/jsx-runtime";var oa=({style:e,...t})=>tg("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 lg}from"eventemitter3";import sg from"eventemitter3";var rg=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fp=e=>rg.includes(e);import{ErrorCode as og}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===og.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))}},ng={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}},ig={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}},ag={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},...ag,...ig},_r={...ng,...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 sg{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 cg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},mt=class extends lg{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(cg(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 pg=(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 dg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(pg(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 ug}from"react/jsx-runtime";var jo=({style:e,...t})=>ug("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 mg}from"react/jsx-runtime";var lr=({style:e,...t})=>mg("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 fg}from"react-device-detect";var da=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{fg||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 Lg,OPTIONAL_EVENTS as Og,OPTIONAL_METHODS as Ng}from"@walletconnect/ethereum-provider";import{isMobile as Dg}from"react-device-detect";import{createContext as Sg,useContext as _g,useEffect as yl,useRef as Ag,useState as kg}from"react";import{jsx as hg}from"react/jsx-runtime";function ma({src:e,...t}){return hg("img",{src:e,...t,style:{display:"none"}})}import{useContext as Vp,useEffect as Gp,useMemo as Eg,useState as Tg}from"react";import{createContext as Pg}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 yg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Pp=e=>yg.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",gg="#000000",vg=Up,wg="#1E1E1D";function Cg(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=gg}){let l;switch(e){case"light":l=vg;break;case"dark":l=wg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Cg(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}=bg({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 bg({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 xg}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=Pg({appConfig:fl,isServerConfigLoaded:!1}),qp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=Tg(null),i=Eg(()=>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)}})()},[]),xg(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 Ig,jsxs as Mg}from"react/jsx-runtime";var $p=Sg({ready:!1,app:fl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Rg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],jp=e=>{let t=Sa(),r=e.authenticated,[o,n]=kg(e.initialScreen);yl(()=>{!r&&!Rg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Ag(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 Mg($p.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Ig(ma,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>_g($p);import{jsx as Zo,jsxs as Wg}from"react/jsx-runtime";var Jn=({style:e,...t})=>{let{app:r}=_();return Wg("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 Lg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Og,optionalMethods:Ng,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Dg&&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 Fg{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 Ug}from"ofetch";var Bg=[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=Ug.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=!Bg.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 Hg=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(Hg)}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=Gg();try{return j.put(Gn,t),t}catch{return t}};import{Turnstile as Kg}from"@marsidev/react-turnstile";import{useEffect as Yg,useMemo as Jg}from"react";import{useMemo as Vg,useRef as zg,useContext as qg,useState as wl,createContext as $g}from"react";import{jsx as jg}from"react/jsx-runtime";var Qp=$g({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=zg(null),[a,i]=wl(),[l,s]=wl(),[d,u]=wl(!1),y=Vg(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return jg(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=()=>qg(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]=Jg(()=>r?.split("t:")||[],[r]);if(Yg(()=>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(Kg,{...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 _y,useRef as gE,useState as vE}from"react";import wE from"react-dom";import{createContext as Zg,useContext as Qg}from"react";var bl=Zg({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=()=>Qg(bl);import{createContext as Xg,useContext as e1}from"react";var ce=Xg({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=()=>e1(ce);import{useEffect as t1,useState as r1}from"react";var tu=e=>{let[t,r]=r1("auto");return t1(()=>{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 o1,useContext as n1,useEffect as i1}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=o1(void 0),ou=()=>n1(El);function Ee(e,t){if(!t)return;let o=ou().current[e];return i1(()=>{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 C1 from"@heroicons/react/24/solid/DocumentCheckIcon";import b1 from"styled-components";import To,{css as _l}from"styled-components";import xl from"styled-components";import{Fragment as s1,jsx as Pl,jsxs as l1}from"react/jsx-runtime";var It=({success:e,fail:t})=>l1(s1,{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;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,Sl=xl(ft)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,Eo=e=>
|
|
51
|
+
`,Eo=e=>Pl(a1,{color:e.color||"var(--privy-color-foreground-3)"}),a1=xl(ft)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;import{jsx as
|
|
60
|
+
`;import{jsx as Mt,jsxs as La}from"react/jsx-runtime";var Ia=To.button`
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: row;
|
|
63
63
|
align-items: center;
|
|
@@ -85,13 +85,13 @@ Resources:
|
|
|
85
85
|
color: var(--privy-color-foreground-3);
|
|
86
86
|
cursor: not-allowed;
|
|
87
87
|
}
|
|
88
|
-
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
88
|
+
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(iu,{disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),e8=To(F)`
|
|
89
|
+
${e=>e.hideAnimations&&_l`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
94
|
+
`,Ma=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(iu,{as:"a",disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),iu=To(Ia)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -117,7 +117,7 @@ Resources:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
120
|
-
${e=>e.disabled?
|
|
120
|
+
${e=>e.disabled?_l`
|
|
121
121
|
&&&,
|
|
122
122
|
&&&:hover,
|
|
123
123
|
&&&:active {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
`,$t=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(c1,{disabled:t||r,...n,children:t?La("span",{children:[Mt(Eo,{}),o?Mt("span",{children:o}):null]}):e}),c1=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)"};
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
opacity: 1;
|
|
166
166
|
animation: fadein 200ms ease;
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,Wa=To.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -178,7 +178,7 @@ Resources:
|
|
|
178
178
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
179
179
|
user-select: none;
|
|
180
180
|
|
|
181
|
-
${e=>e.invisible&&
|
|
181
|
+
${e=>e.invisible&&_l`
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
`}
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,t8=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})=>
|
|
202
|
+
`,Qo=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>La(d1,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Mt("span",{children:e}),Mt("span",{children:Mt(Eo,{})})]}),d1=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 au from"styled-components";import{Fragment as p1,jsx as zr,jsxs as su}from"react/jsx-runtime";var Al=au.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
|
|
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 su(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?su(p1,{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=au.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 u1 from"@heroicons/react/24/outline/ArrowLeftIcon";import m1 from"@heroicons/react/24/outline/XMarkIcon";import kl from"styled-components";import{jsx as Wt,jsxs as v1}from"react/jsx-runtime";var lu=()=>Wt("div",{}),f1=({backFn:e})=>Wt("div",{children:Wt(cu,{onClick:e,children:Wt(u1,{height:"16px",width:"16px",strokeWidth:2})})}),h1=e=>Wt("div",{children:Wt(cu,{"aria-label":"close modal",onClick:e.onClose,children:Wt(m1,{height:"16px",width:"16px",strokeWidth:2})})});var A=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=W(),{app:a}=_();return v1(y1,{children:[e?Wt(f1,{backFn:e}):Wt(lu,{}),r&&Wt(g1,{id:"privy-dialog-title",children:r}),a?.render.inDialog&&o?Wt(h1,{onClose:t||(()=>n())}):Wt(lu,{})]})},cu=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
|
+
`,y1=kl.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,22 +318,22 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,g1=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 w1}from"styled-components";var Oa=en.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
|
-
`,
|
|
331
|
+
`,Na=en.div`
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,
|
|
336
|
+
`,Lt=en.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 12px;
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,du=w1`
|
|
352
352
|
&& {
|
|
353
353
|
width: 100%;
|
|
354
354
|
font-size: 16px;
|
|
@@ -386,14 +386,14 @@ Resources:
|
|
|
386
386
|
max-width: 24px;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
390
|
-
${
|
|
391
|
-
`,
|
|
392
|
-
${
|
|
393
|
-
`,
|
|
389
|
+
`,Se=en.button`
|
|
390
|
+
${du}
|
|
391
|
+
`,Rl=en.a`
|
|
392
|
+
${du}
|
|
393
|
+
`,Ar=en.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
|
-
`;import Ne from"styled-components";var
|
|
396
|
+
`;import Ne from"styled-components";var Ke=Ne.div`
|
|
397
397
|
display: flex;
|
|
398
398
|
flex-direction: column;
|
|
399
399
|
align-items: center;
|
|
@@ -407,11 +407,11 @@ Resources:
|
|
|
407
407
|
text-align: center;
|
|
408
408
|
font-weight: 600;
|
|
409
409
|
margin-bottom: 10px;
|
|
410
|
-
`,
|
|
410
|
+
`,de=Ne.div`
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
414
|
-
|
|
414
|
+
`,qr=Ne.div`
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
align-items: center;
|
|
@@ -421,7 +421,7 @@ Resources:
|
|
|
421
421
|
@media (max-width: 440px) {
|
|
422
422
|
padding: 10px 10px 20px;
|
|
423
423
|
}
|
|
424
|
-
`,
|
|
424
|
+
`,pu=Ne.div`
|
|
425
425
|
display: flex;
|
|
426
426
|
flex-direction: column;
|
|
427
427
|
align-items: stretch;
|
|
@@ -429,7 +429,7 @@ Resources:
|
|
|
429
429
|
padding: 1rem 0rem 0rem;
|
|
430
430
|
flex-grow: 1;
|
|
431
431
|
width: 100%;
|
|
432
|
-
`,
|
|
432
|
+
`,Il=Ne.div`
|
|
433
433
|
width: 25px;
|
|
434
434
|
display: flex;
|
|
435
435
|
align-items: center;
|
|
@@ -441,19 +441,19 @@ Resources:
|
|
|
441
441
|
width: 25px !important;
|
|
442
442
|
color: var(--privy-color-accent);
|
|
443
443
|
}
|
|
444
|
-
`,
|
|
444
|
+
`,Ml=Ne.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-items: center;
|
|
447
447
|
gap: 10px;
|
|
448
448
|
font-size: 0.875rem;
|
|
449
449
|
line-height: 1rem;
|
|
450
450
|
text-align: left;
|
|
451
|
-
|
|
451
|
+
`,$r=Ne.div`
|
|
452
452
|
display: flex;
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
455
455
|
padding-top: 20px;
|
|
456
|
-
`,
|
|
456
|
+
`,Da=Ne.div`
|
|
457
457
|
display: flex;
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
align-items: stretch;
|
|
@@ -461,7 +461,7 @@ Resources:
|
|
|
461
461
|
padding: 1rem 0rem 0rem;
|
|
462
462
|
flex-grow: 1;
|
|
463
463
|
width: 100%;
|
|
464
|
-
`,
|
|
464
|
+
`,Fa=Ne.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
gap: 5px;
|
|
467
467
|
width: 100%;
|
|
@@ -469,7 +469,7 @@ Resources:
|
|
|
469
469
|
& > button:not(#remove) {
|
|
470
470
|
width: 100%;
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,Wl=Ne.button`
|
|
473
473
|
&& {
|
|
474
474
|
background-color: transparent;
|
|
475
475
|
color: var(--privy-color-foreground-3);
|
|
@@ -488,7 +488,7 @@ Resources:
|
|
|
488
488
|
&&:hover {
|
|
489
489
|
color: var(--privy-color-error);
|
|
490
490
|
}
|
|
491
|
-
`,
|
|
491
|
+
`,Ua=Ne.div`
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
gap: 0.5rem;
|
|
@@ -512,15 +512,15 @@ Resources:
|
|
|
512
512
|
display: flex !important;
|
|
513
513
|
align-items: flex-end;
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,Ba=Ne.div`
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,uu=Ne.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Ll=Ne.button`
|
|
524
524
|
display: flex;
|
|
525
525
|
flex-direction: row;
|
|
526
526
|
align-items: center;
|
|
@@ -550,7 +550,7 @@ Resources:
|
|
|
550
550
|
&:hover {
|
|
551
551
|
text-decoration: underline;
|
|
552
552
|
}
|
|
553
|
-
`,
|
|
553
|
+
`,it=Ne.div`
|
|
554
554
|
display: flex;
|
|
555
555
|
align-items: center;
|
|
556
556
|
justify-content: center;
|
|
@@ -565,10 +565,10 @@ Resources:
|
|
|
565
565
|
width: auto !important;
|
|
566
566
|
color: white;
|
|
567
567
|
}
|
|
568
|
-
`;import{Fragment as
|
|
568
|
+
`;import{Fragment as P1,jsx as pr,jsxs as Xn}from"react/jsx-runtime";var fu=()=>{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(E1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},E1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Xn(P1,{children:[pr(A,{closeable:!1}),pr(C1,{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(mu,{style:{marginLeft:"auto"}})]}),t&&Xn(Rl,{target:"_blank",href:t,children:["View Privacy Policy ",pr(mu,{style:{marginLeft:"auto"}})]})]}),Xn(T1,{style:{marginTop:24},children:[pr($t,{onClick:o,children:"No thanks"}),pr(F,{onClick:r,children:"Accept"})]}),pr(V,{protectedByPrivy:!0})]}),T1=b1.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;import
|
|
571
|
+
`;import Nl from"styled-components";import x1 from"styled-components";var Ha=x1.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 hu}from"react/jsx-runtime";var Ga=({style:e,...t})=>hu("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:hu("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 yu=()=>{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(S1,{children:[ur(A1,{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(_1,{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})]})]})},S1=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
|
+
`,_1=Nl.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,A1=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 I1 from"@heroicons/react/24/outline/EnvelopeIcon";import M1 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Tu,useState as za}from"react";import{isMobile as W1}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;
|
|
@@ -626,36 +626,36 @@ Resources:
|
|
|
626
626
|
margin-top: auto;
|
|
627
627
|
gap: 16px;
|
|
628
628
|
flex-grow: 100;
|
|
629
|
-
`,
|
|
629
|
+
`,at=Et.div`
|
|
630
630
|
display: flex;
|
|
631
631
|
flex-direction: column;
|
|
632
632
|
align-items: center;
|
|
633
633
|
justify-content: center;
|
|
634
634
|
flex-grow: 1;
|
|
635
635
|
width: 100%;
|
|
636
|
-
`,
|
|
636
|
+
`,gu=Et.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,rn=
|
|
641
|
+
`,rn=Et(at)`
|
|
642
642
|
padding: 20px 0;
|
|
643
|
-
`,
|
|
643
|
+
`,jt=Et(at)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,Dl=Et.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,
|
|
649
|
+
`,Ye=Et.div`
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
|
|
653
|
+
`,$8=Et.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,vu=Et.div`
|
|
659
659
|
display: flex;
|
|
660
660
|
flex-direction: column;
|
|
661
661
|
justify-content: flex-start;
|
|
@@ -678,13 +678,13 @@ Resources:
|
|
|
678
678
|
color: var(--privy-color-foreground-3);
|
|
679
679
|
font-size: 14px;
|
|
680
680
|
}
|
|
681
|
-
`,
|
|
681
|
+
`,K=Et.div`
|
|
682
682
|
height: 16px;
|
|
683
|
-
`,
|
|
683
|
+
`,oe=Et.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,
|
|
685
|
+
`,wu=Et.div`
|
|
686
686
|
position: relative;
|
|
687
|
-
`,
|
|
687
|
+
`,Cu=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
|
|
695
|
+
`;import Fl from"styled-components";import{Fragment as R1,jsx as ei,jsxs as Eu}from"react/jsx-runtime";var ti=({title:e,description:t,children:r,...o})=>ei(bu,{...o,children:Eu(R1,{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})=>Eu(k1,{...n,children:[r||null,ei("h3",{children:e}),typeof t=="string"?ei("p",{children:t}):t,o]}),bu=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
|
+
`,k1=Fl(bu)`
|
|
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
|
|
725
|
+
`;import{Fragment as Ul,jsx as Je,jsxs as jr}from"react/jsx-runtime";var Bl=6,Pu=new Array(Bl).fill(""),L1=1400;var Su=()=>{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(Pu),[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;Tu(()=>{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]),Tu(()=>{if(R&&k===0){let re=setTimeout(()=>{x(Pu),M(null),document.querySelector("input[name=code-0]")?.focus()},L1);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(I1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Je(M1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),se=U==0?jr("p",{children:["Please check ",Je(xu,{children:s()?.email})," for an email from privy.io and enter your code below."]}):jr("p",{children:["Please check ",Je(xu,{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(O1,{children:[Je(_e,{title:"Enter confirmation code",description:se,icon:Y}),jr(gu,{children:[jr(N1,{children:[Je(D1,{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:W1?"one-time-code":"off"},te))})]}),Je(F1,{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})]})},O1=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
|
+
`,N1=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
|
+
`,D1=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
|
+
`,F1=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
|
+
`,xu=ri.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;import
|
|
814
|
+
`;import V1 from"@heroicons/react/24/solid/CheckCircleIcon";import z1 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Hl,useRef as q1,useState as nn}from"react";import $1 from"styled-components";import U1 from"styled-components";import{Fragment as G1,jsx as on,jsxs as H1}from"react/jsx-runtime";var _u=({icon:e})=>{let t=e;return on(G1,{children:on(B1,{children:H1("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",{})]})})})},B1=U1.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 K1,jsx as Kt,jsxs as Gl}from"react/jsx-runtime";var ku=500,Au=ku*2,Ru=()=>{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=q1([]),f=Y=>{y.current=[Y,...y.current]},[g,E]=nn(!0);Hl(()=>{let Y=setTimeout(E,Au,!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)},Au);f(Y)}else if(i==="ready"){let Y=setTimeout(()=>{i==="ready"&&u()},ku);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(K1,{children:[Kt(A,{backFn:!e||t===e?void 0:o}),Gl(j1,{children:[i==="success"?Kt(V1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?Kt(z1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Kt(_u,{}),Gl(Ye,{children:[v?Kt("h3",{children:v}):null,Kt("p",{children:C})]}),R]}),Kt(X,{})]})},j1=$1.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 Q1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as X1}from"react-device-detect";import ev from"styled-components";import{jsx as Jt,jsxs as Wu}from"react/jsx-runtime";var Lu=({...e})=>Wu("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Jt("defs",{children:Wu("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:[Jt("stop",{offset:"0",stopColor:"#f1562b"}),Jt("stop",{offset:"0.3",stopColor:"#f1542b"}),Jt("stop",{offset:"0.41",stopColor:"#f04d2a"}),Jt("stop",{offset:"0.49",stopColor:"#ef4229"}),Jt("stop",{offset:"0.5",stopColor:"#ef4029"}),Jt("stop",{offset:"0.56",stopColor:"#e83e28"}),Jt("stop",{offset:"0.67",stopColor:"#e13c26"}),Jt("stop",{offset:"1",stopColor:"#df3c26"})]})}),Jt("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"}),Jt("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 Zt,jsxs as ni}from"react/jsx-runtime";var Ou=({style:e,...t})=>ni("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:[Zt("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"}),Zt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Zt("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"})}),ni("g",{mask:"url(#mask0_16909_31415)",children:[Zt("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"}),Zt("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"}),Zt("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"}}),Zt("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"}})]}),ni("defs",{children:[ni("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Zt("stop",{"stop-color":"#002D72"}),Zt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),ni("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Zt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Zt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as X,jsxs as Pt}from"react/jsx-runtime";var Nu=({style:e,...t})=>Pt("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:[X("g",{clipPath:"url(#clip0_5_32)",children:Pt("g",{clipPath:"url(#clip1_5_32)",children:[X("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:X("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"})}),X("g",{mask:"url(#mask0_5_32)",children:X("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),X("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)"}),X("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),X("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),X("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),X("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),X("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),X("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)"}),X("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),X("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Pt("defs",{children:[Pt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#174299"}),X("stop",{offset:"1",stopColor:"#001E59"})]}),Pt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[X("stop",{offset:"0.770277",stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),Pt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),Pt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#8754C9"}),X("stop",{offset:"1",stopColor:"#FF4000"})]}),Pt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[X("stop",{offset:"0.723929",stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),Pt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),Pt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),Pt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[X("stop",{offset:"0.59513",stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),Pt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),Pt("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:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),X("clipPath",{id:"clip0_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})}),X("clipPath",{id:"clip1_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as hr,jsxs as Du}from"react/jsx-runtime";var Fu=({style:e,...t})=>Du("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:[hr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Du("g",{filter:"url(#filter0_d_12393_20043)",children:[hr("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"}),hr("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"}),hr("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"}),hr("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"}),hr("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"}),hr("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"}),hr("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"}),hr("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"}),hr("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 ii,jsxs as Uu}from"react/jsx-runtime";var Bu=({style:e,...t})=>Uu("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:[Uu("g",{clipPath:"url(#clip0_1704_1423)",children:[ii("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"}),ii("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"})]}),ii("defs",{children:ii("clipPath",{id:"clip0_1704_1423",children:ii("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as an,jsxs as iv}from"react/jsx-runtime";var yr={coinbase_wallet:{logo:na,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:jo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:cr,displayName:"Phantom"},rainbow:{logo:Nu,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Zn,displayName:"WalletConnect"},zerion:{logo:Bu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Lu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Ou,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Fu,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=()=>{Br()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(X1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},iv(nv,{onClick:s,children:[an(ov,{icon:rv(e,n.connectorType)??r,name:n.walletClientType}),an("span",{children:tv(e,n.connectorType)||t||n.walletClientType}),an("span",{id:"connect-text",children:"Connect"})]})},tv=(e,t)=>{if(yr[e]?.displayName)return yr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},rv=(e,t)=>{if(yr[e]?.logo)return yr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Zn},ov=({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(Q1,{}):e?an(e,{}):null,nv=ev(xe)`
|
|
844
|
+
`;import Y1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as J1}from"react-device-detect";import Z1 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 rv}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(J1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},rv(tv,{onClick:s,children:[an(ev,{icon:X1(e,n.connectorType)??r,name:n.walletClientType}),an("span",{children:Q1(e,n.connectorType)||t||n.walletClientType}),an("span",{id:"connect-text",children:"Connect"})]})},Q1=(e,t)=>{if(hr[e]?.displayName)return hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},X1=(e,t)=>{if(hr[e]?.logo)return hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Jn},ev=({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(Y1,{}):e?an(e,{}):null,tv=Z1(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 sv,jsx as sn,jsxs as lv}from"react/jsx-runtime";var ov=["coinbase_wallet"],nv=["metamask","okx_wallet","rainbow","uniswap","zerion"],iv=["cryptocom"],av=["phantom"],ln=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=_(),o=ii(r.appearance.walletList,t,e,r.appearance.walletList);return lv(sv,{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(av.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(nv.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(ov.includes(s)){let d=t.find(({connectorType:u})=>u===s);d&&n.push(sn(Po,{connectOnly:r,provider:s,connector:d},s))}else iv.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 cv,jsx as ai,jsxs as dv}from"react/jsx-runtime";var Uu=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return dv(cv,{children:[ai(A,{},"header"),ai(mr,{title:"Connect your wallet",description:t}),ai(Lt,{children:ai(ln,{connectOnly:!0})}),ai(V,{protectedByPrivy:!0})]})};import hv from"styled-components";import mv from"styled-components";import pv from"react";import{jsx as uv}from"react/jsx-runtime";var Bu=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?uv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?pv.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 Hu}from"react/jsx-runtime";var cn=e=>{let{app:t}=_();return t?.appearance.logo?Hu(fv,{...e,children:Hu(Bu,{})}):null},fv=mv.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 gv,jsx as dn,jsxs as vv}from"react/jsx-runtime";var Gu=()=>{let{app:e}=_();return vv(gv,{children:[dn(A,{},"header"),dn(yv,{}),dn(Lt,{children:dn(ln,{connectOnly:!0})}),e&&dn(Xo,{app:e,alwaysShowImplicitConsent:!0}),dn(V,{protectedByPrivy:!0})]})},yv=hv(cn)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;import{useEffect as
|
|
875
|
+
`;import{useEffect as ju,useState as Ku}from"react";import{isMobile as Sv}from"react-device-detect";import _v from"styled-components";import{useEffect as Vl,useState as xo}from"react";import{isMobile as si}from"react-device-detect";import{useInterval as Ev}from"react-use";import zu from"styled-components";import{useState as wv,useEffect as Cv,useCallback as bv}from"react";function Vu(){let[e,t]=wv(!1),r=bv(()=>{document.hidden&&t(!0)},[]);return Cv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as $u,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,qu=()=>{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}=Vu(),{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]),Ev(()=>{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($u,{children:[De(A,{backFn:!y||f===y?void 0:u}),li(Pv,{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(),Tv(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,{})]})},Tv=e=>{if(!si||!ep(e))return;let t=tp(e);t&&window.open(t,"_self","noopener,noreferrer")},Pv=zu.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
|
+
`,xv=zu.div`
|
|
883
883
|
display: flex;
|
|
884
884
|
flex-direction: column;
|
|
885
885
|
justify-content: center;
|
|
@@ -902,14 +902,14 @@ Resources:
|
|
|
902
902
|
left: -19px;
|
|
903
903
|
top: -19px;
|
|
904
904
|
}
|
|
905
|
-
|
|
905
|
+
`,$l=e=>{let t=e.walletLogo;return De($u,{children:De(xv,{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 kv,jsx as kr,jsxs as jl}from"react/jsx-runtime";var qa=2,Yu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[a,i]=Ku(void 0),[l,s]=Ku(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";ju(()=>{if(d){let R=setTimeout(n,Oe);return()=>clearTimeout(R)}},[d]);let y=R=>{i(ql(R))};ju(()=>{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"&&Sv?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(kv,{children:[kr(A,{backFn:r===t?void 0:e}),jl(Av,{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,{})]})},Av=_v.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 Nv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Dv,useMemo as Fv,useState as Uv}from"react";import Bv from"styled-components";import $a from"styled-components";import{jsx as Kl,jsxs as Lv}from"react/jsx-runtime";var pn=()=>Kl(Rv,{children:Lv(Iv,{children:[Kl(Mv,{}),Kl(Wv,{})]})}),Rv=$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
|
+
`,Iv=$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
|
+
`,Mv=$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
|
+
`,Wv=$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 Ju=["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"&&Ju.includes(t)}function Ov(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 Zu(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!!(Ov(e)&&e.message==="MFA canceled")}import{Fragment as Xu,jsx as hn,jsxs as Ql}from"react/jsx-runtime";var Qu=1,em=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=W(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Fv(()=>Date.now(),[]),[y,f]=Uv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{y||(f(!0),E(typeof C=="string"?new Error(C):C))};Dv(()=>{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<Qu?P=setTimeout(()=>{i(g)},(Qu-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(Xu,{children:[hn(A,{onClose:x}),y?Ql(Xu,{children:[Ql(jt,{children:[hn(Nv,{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(Hv,{})]})},Hv=Bv.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;import
|
|
970
|
+
`;import Gv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Vv}from"react";import{Fragment as zv,jsx as yn,jsxs as tm}from"react/jsx-runtime";var rm=()=>{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 Vv(()=>{let y=setTimeout(u,Bd);return()=>clearTimeout(y)},[]),i.current=u,tm(zv,{children:[yn(A,{onClose:u}),yn(K,{}),tm(jt,{children:[yn(Gv,{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 qv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import $v from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as im,useRef as jv,useState as Xl}from"react";import Kr from"styled-components";import{Fragment as rw,jsx as ke,jsxs as Zt}from"react/jsx-runtime";var am=()=>{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 im(()=>{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(rw,{children:[ke(A,{onClose:x}),Zt(Jv,{children:[Zt(_e,{icon:ke($v,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Zt(ew,{children:[ke(Yv,{style:{marginRight:6}}),Br(u)]}),ke("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Zt(Zv,{children:[Zt(om,{children:[ke(nm,{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(om,{children:[ke(nm,{children:"2"}),ke("span",{children:"Copy this key into your other wallet"})]})]}),ke("div",{style:{width:"100%"},children:e&&ke(Kv,{origin:g,appId:E,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Zt(tw,{children:[Zt("div",{children:[ke(qv,{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 Kv(e){let[t,r]=Xl(e.dimensions.width),[o,n]=Xl(void 0),a=jv(null);return im(()=>{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(Qv,{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(Xv,{children:"Loading..."})]})})}function Yv(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 Jv=Kr.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,Zv=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
|
+
`,om=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
|
+
`,nm=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
|
+
`,Qv=Kr.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,Xv=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
|
+
`,ew=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
|
+
`,tw=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 Yw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Mm,useRef as Jw,useState as fi}from"react";import Zw from"styled-components";import{useCallback as Im,useEffect as Kw}from"react";import sw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as lw,useState as rc}from"react";import ow from"@heroicons/react/24/outline/ArrowPathIcon";import nw from"@heroicons/react/24/outline/EyeIcon";import iw from"@heroicons/react/24/outline/EyeSlashIcon";import Ze,{css as ec}from"styled-components";var aw=ec`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1060,8 +1060,8 @@ Resources:
|
|
|
1060
1060
|
letter-spacing: -0.008px;
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
|
-
`,
|
|
1064
|
-
${
|
|
1063
|
+
`,ja=Ze.span`
|
|
1064
|
+
${aw}
|
|
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"};
|
|
@@ -1069,18 +1069,18 @@ Resources:
|
|
|
1069
1069
|
&[aria-hidden='true'] {
|
|
1070
1070
|
visibility: hidden;
|
|
1071
1071
|
}
|
|
1072
|
-
`,
|
|
1072
|
+
`,Yr=Ze.div`
|
|
1073
1073
|
display: flex;
|
|
1074
1074
|
flex-direction: column;
|
|
1075
1075
|
justify-content: center;
|
|
1076
1076
|
flex-grow: 1;
|
|
1077
|
-
`,
|
|
1078
|
-
${e=>e.hideAnimations&&
|
|
1077
|
+
`,Jr=Ze(F)`
|
|
1078
|
+
${e=>e.hideAnimations&&ec`
|
|
1079
1079
|
&& {
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,sm=ec`
|
|
1084
1084
|
&& {
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
border-width: 1px;
|
|
@@ -1095,8 +1095,8 @@ Resources:
|
|
|
1095
1095
|
font-weight: 300;
|
|
1096
1096
|
line-height: 22px; /* 137.5% */
|
|
1097
1097
|
}
|
|
1098
|
-
`,gn=
|
|
1099
|
-
${
|
|
1098
|
+
`,gn=Ze.input`
|
|
1099
|
+
${sm}
|
|
1100
1100
|
|
|
1101
1101
|
&::placeholder {
|
|
1102
1102
|
color: var(--privy-color-foreground-3);
|
|
@@ -1107,15 +1107,15 @@ Resources:
|
|
|
1107
1107
|
overflow: hidden;
|
|
1108
1108
|
text-overflow: ellipsis;
|
|
1109
1109
|
white-space: nowrap;
|
|
1110
|
-
`,
|
|
1111
|
-
${
|
|
1112
|
-
`,
|
|
1110
|
+
`,lm=Ze.div`
|
|
1111
|
+
${sm}
|
|
1112
|
+
`,Zr=Ze.div`
|
|
1113
1113
|
position: relative;
|
|
1114
1114
|
width: 100%;
|
|
1115
1115
|
display: flex;
|
|
1116
1116
|
align-items: center;
|
|
1117
1117
|
justify-content: ${({centered:e})=>e?"center":"space-between"};
|
|
1118
|
-
`,
|
|
1118
|
+
`,Qr=Ze.div`
|
|
1119
1119
|
display: flex;
|
|
1120
1120
|
flex-direction: column;
|
|
1121
1121
|
align-items: center;
|
|
@@ -1137,12 +1137,12 @@ Resources:
|
|
|
1137
1137
|
font-weight: 400;
|
|
1138
1138
|
line-height: 20px;
|
|
1139
1139
|
}
|
|
1140
|
-
`,
|
|
1140
|
+
`,ci=Ze.div`
|
|
1141
1141
|
display: flex;
|
|
1142
1142
|
flex-direction: column;
|
|
1143
1143
|
gap: 10px;
|
|
1144
1144
|
padding-bottom: 1rem;
|
|
1145
|
-
`,
|
|
1145
|
+
`,di=Ze.div`
|
|
1146
1146
|
display: flex;
|
|
1147
1147
|
text-align: left;
|
|
1148
1148
|
align-items: center;
|
|
@@ -1162,13 +1162,13 @@ Resources:
|
|
|
1162
1162
|
> :first-child {
|
|
1163
1163
|
min-width: 24px;
|
|
1164
1164
|
}
|
|
1165
|
-
`,
|
|
1165
|
+
`,S_=Ze.div`
|
|
1166
1166
|
height: var(--privy-height-modal-full);
|
|
1167
1167
|
|
|
1168
1168
|
@media (max-width: 440px) {
|
|
1169
1169
|
height: var(--privy-height-modal-compact);
|
|
1170
1170
|
}
|
|
1171
|
-
`,
|
|
1171
|
+
`,tc=Ze(Ia)`
|
|
1172
1172
|
display: flex;
|
|
1173
1173
|
flex: 1;
|
|
1174
1174
|
gap: 4px;
|
|
@@ -1180,7 +1180,7 @@ Resources:
|
|
|
1180
1180
|
border-color: var(--privy-color-foreground-3);
|
|
1181
1181
|
border-width: 1px;
|
|
1182
1182
|
}
|
|
1183
|
-
`,vn=
|
|
1183
|
+
`,vn=Ze.div`
|
|
1184
1184
|
position: absolute;
|
|
1185
1185
|
right: 0.5rem;
|
|
1186
1186
|
|
|
@@ -1188,7 +1188,7 @@ Resources:
|
|
|
1188
1188
|
flex-direction: row;
|
|
1189
1189
|
justify-content: space-around;
|
|
1190
1190
|
align-items: center;
|
|
1191
|
-
`,
|
|
1191
|
+
`,cm=Ze(ow)`
|
|
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=
|
|
1200
|
+
`,wn=Ze(iw)`
|
|
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=
|
|
1209
|
+
`,Cn=Ze(nw)`
|
|
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
|
+
`,dm=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 cw,jsx as Pt,jsxs as Ka}from"react/jsx-runtime";var pm=({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 lw(()=>{d&&!l&&s(!0)},[d]),Ka(cw,{children:[Pt(A,{title:"Confirm Password",closeable:!1,backFn:n}),Pt(K,{}),Ka(Yr,{children:[Ka(Qr,{children:[Pt(sw,{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 mw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as fw}from"react";import hw from"styled-components";import Ya from"styled-components";import{jsx as pi,jsxs as uw}from"react/jsx-runtime";var um=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>pi("label",{children:uw(dw,{className:e,children:[pi(fm,{checked:t,...o}),pi(pw,{color:r,checked:t,children:pi(mm,{viewBox:"0 0 24 24",children:pi("polyline",{points:"20 6 9 17 4 12"})})})]})}),dw=Ya.div`
|
|
1235
1235
|
display: inline-block;
|
|
1236
1236
|
vertical-align: middle;
|
|
1237
|
-
`,
|
|
1237
|
+
`,mm=Ya.svg`
|
|
1238
1238
|
fill: none;
|
|
1239
1239
|
stroke: white;
|
|
1240
1240
|
stroke-width: 3px;
|
|
1241
|
-
`,
|
|
1241
|
+
`,fm=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
|
+
`,pw=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
|
+
${fm}:focus + & {
|
|
1268
1268
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
|
-
${
|
|
1271
|
+
${mm} {
|
|
1272
1272
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1273
1273
|
}
|
|
1274
|
-
`;import{Fragment as
|
|
1274
|
+
`;import{Fragment as hm,jsx as Nt,jsxs as ui}from"react/jsx-runtime";var ym=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=fw(!1);return ui(hm,{children:[Nt(A,{title:"Confirm Password",closeable:!1,backFn:o}),Nt(K,{}),ui(Yr,{children:[ui(Qr,{children:[Nt(mw,{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(um,{color:"var(--privy-color-error)",checked:a}),Nt(hm,{children:"I understand losing my password means losing my account."})]})})]}),ui(yw,{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})]})},yw=hw.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
gap: 10px;
|
|
1277
|
-
`;import
|
|
1277
|
+
`;import Mw from"@heroicons/react/24/outline/KeyIcon";import Tm from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Pm,useMemo as oc,useEffect as Ww}from"react";import xm from"styled-components";import gw from"fast-password-entropy";import*as gm from"secure-password-utilities";import{DEFAULT_WORDLIST as vw}from"secure-password-utilities/wordlists";var ww=95,Cw=8,bw=3,Ew=.3,Tw=/[a-z]/,Pw=/[A-Z]/,xw=/[0-9]/,Sw="a-zA-Z0-9",vm="!@#$%^&*()\\-_+.",wm=`${Sw}${vm}`,_w=new RegExp(`[${vm}]`),Aw=new RegExp(`[${wm}]`),Cm=new RegExp(`^[${wm}]{6,}$`),bm=(e="")=>{let t=e.split("").filter(r=>!Aw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Ja=()=>gm.generatePassphrase(4,vw);function kw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Rw(e){if(e.length<Cw)return 0;let t=0;Tw.test(e)&&(t+=1),Pw.test(e)&&(t+=1),xw.test(e)&&(t+=1),_w.test(e)&&(t+=1);let r=t/bw;return Math.max(0,Math.min(1,r))}function Iw(e=""){let t=Rw(e),r=gw(e)/ww;return(t*Ew+r)/2}function Em(e=""){let t=Iw(e);return{value:t,label:kw(t)}}import{Fragment as Nw,jsx as Fe,jsxs as Rr}from"react/jsx-runtime";var Sm=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,d]=Pm(!1),[u,y]=Pm(!1);Ww(()=>{r&&!u&&y(!0)},[r]);let f=oc(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Cm.test(r||"")?null:`Invalid characters used ( ${bm(r).join(" ")} )`:null,[r,u]),g=oc(()=>f?{value:0,label:"Weak"}:Em(r),[r,f]),E=oc(()=>!!(!r?.length||f),[f,r]);return Rr(Nw,{children:[Fe(A,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),Fe(K,{}),Rr(Yr,{children:[Rr(Qr,{children:[Fe(Mw,{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(cm,{onClick:l})]})]}),Fe(dm,{value:g.value===0?.01:g.value,label:g.label}),Fe(ja,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),Rr(Ow,{children:[Fe(Lw,{children:Rr(ci,{children:[Rr(di,{children:[Fe(Tm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Rr(di,{children:[Fe(Tm,{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})]})},Lw=xm(ci)`
|
|
1278
1278
|
flex: 1;
|
|
1279
1279
|
padding-top: 1rem;
|
|
1280
|
-
`,
|
|
1280
|
+
`,Ow=xm.div`
|
|
1281
1281
|
display: flex;
|
|
1282
1282
|
flex-direction: column;
|
|
1283
1283
|
height: 100%;
|
|
1284
|
-
`;import
|
|
1284
|
+
`;import Dw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Fw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Uw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Bw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Hw,useCallback as _m}from"react";import{Fragment as nc,jsx as ht,jsxs as _o}from"react/jsx-runtime";var Am=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=Hw(!1),s=_m(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=_m(()=>{let u=document.createElement("a"),y=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([Gw(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(Bw,{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(lm,{children:o})}),_o("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[ht(tc,{onClick:s,children:i?_o(nc,{children:[ht(Fw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):_o(nc,{children:[ht(Uw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),_o(tc,{onClick:d,children:[ht(Dw,{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})]})},Gw=(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 Vw from"@heroicons/react/24/solid/CheckCircleIcon";import zw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as qw,jsx as Ir,jsxs as ic}from"react/jsx-runtime";var km=({error:e,onClose:t})=>ic(qw,{children:[Ir(A,{closeable:!1}),Ir(K,{}),e?ic(jt,{children:[Ir(zw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ir(_e,{title:"Something went wrong",description:e})]}):ic(jt,{children:[Ir(Vw,{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 $w}from"react";var jw=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Rm=()=>{let[e,t]=$w(jw,"creating");return{send:t,state:e}};import{jsx as mi}from"react/jsx-runtime";var Za=({onSubmit:e,...t})=>{let{send:r,state:o}=Rm(),n=Im(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);Kw(()=>{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=Im(()=>{r("back")},[r]);return o==="creating"?mi(Sm,{...t,onSubmit:n}):o==="saving"?mi(Am,{...t,onSubmit:n,onBack:a}):o==="confirming"?mi(pm,{...t,onSubmit:n,onBack:a}):o==="finalizing"?mi(ym,{...t,onSubmit:n,onBack:a}):o==="done"?mi(km,{...t,onSubmit:n}):null};import{Fragment as Xw,jsx as Ao,jsxs as Wm}from"react/jsx-runtime";var Lm=()=>{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=Jw(!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());Mm(()=>{u||k(3e4).then(te=>y(te))},[u]),Mm(()=>{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?Wm(Xw,{children:[Ao(A,{closeable:!1}),Wm(jt,{children:[Ao(Yw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ao(_e,{title:"Something went wrong",description:n})]}),Ao(F,{onClick:Y,children:"Close"}),Ao(Qw,{})]}):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})},Qw=Zw.div`
|
|
1289
1289
|
height: 44px;
|
|
1290
|
-
`;import{useEffect as
|
|
1290
|
+
`;import{useEffect as eC,useState as Qa}from"react";import{jsx as tC}from"react/jsx-runtime";var Om=()=>{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";eC(()=>{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 tC(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 rC from"@heroicons/react/24/outline/UserCircleIcon";import oC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as nC,jsx as Mr,jsxs as Xa}from"react/jsx-runtime";var Nm=()=>{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(nC,{children:[Mr(A,{onClose:d}),Mr(K,{}),Xa(jt,{children:[Xa(wu,{children:[Mr(rC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Mr(Cu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Mr(oC,{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 iC from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as aC,useState as es}from"react";import ts,{css as sC}from"styled-components";import{Fragment as uC,jsx as st,jsxs as ko}from"react/jsx-runtime";var Dm=()=>{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,aC(()=>{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(uC,{children:[st(A,{onClose:M}),st(K,{}),ko(cC,{children:[ko(lC,{children:[st(iC,{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(dC,{children:f})]}),ko("div",{children:[ko(vu,{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(pC,{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){Zu(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})]})},lC=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
|
+
`,cC=ts.div`
|
|
1313
1313
|
display: flex;
|
|
1314
1314
|
flex-direction: column;
|
|
1315
1315
|
justify-content: space-between;
|
|
1316
|
-
`,
|
|
1316
|
+
`,dC=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
|
+
`,pC=ts(F)`
|
|
1324
|
+
${e=>e.hideAnimations&&sC`
|
|
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 mC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import fC from"@heroicons/react/24/outline/PhoneIcon";import ac from"styled-components";import{Fragment as wC,jsx as Qt,jsxs as rs}from"react/jsx-runtime";var hC=e=>{let t=Qt(mC,{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(fC,{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}}},Fm=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:a}=fe(),i=r?.errorModalData,l=hC(i?.error||new Error),s=d=>{if(d instanceof $e)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return rs(wC,{children:[Qt(A,{backFn:!o||n===o?void 0:t}),rs(yC,{children:[Qt(vC,{children:rs("div",{children:[Qt(Ha,{color:"var(--privy-color-error)"}),l.icon]})}),rs(gC,{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})]})]})},yC=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
|
+
`,gC=ac.div`
|
|
1340
1340
|
display: flex;
|
|
1341
1341
|
flex-direction: column;
|
|
1342
1342
|
gap: 8px;
|
|
1343
|
-
`,
|
|
1343
|
+
`,vC=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 $m,useRef as UC,useState as cc}from"react";import{isIOS as BC,isMobile as jm}from"react-device-detect";import dc from"styled-components";import{useState as CC}from"react";import bC from"styled-components";import{jsx as Um}from"react/jsx-runtime";var os=({style:e,color:t,...r})=>Um("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:Um("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as sc}from"react/jsx-runtime";var Bm=({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 Hm,jsxs as TC}from"react/jsx-runtime";var Xr=e=>{let[t,r]=CC(!1);return TC(EC,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Hm(os,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Hm(Bm,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},EC=bC.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 PC}from"react";import xC from"styled-components";import{jsx as _C}from"react/jsx-runtime";var ns=e=>{let[t,r]=PC(!1);return _C(SC,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},SC=xC.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 AC from"qrcode";import kC from"react";import RC from"styled-components";import{jsx as Gm}from"react/jsx-runtime";var Vm=()=>Gm("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:Gm("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as hi,jsx as lt,jsxs as qm}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},IC=e=>{let t=AC.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},MC=({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}`))}),WC=({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(MC,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},LC=({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(kC.Fragment,{},`circle-${n}-${i}`)))}),zm=(e,t)=>e-e%t,OC=({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 qm(hi,{children:[lt("rect",{x:zm(d,t),y:zm(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})]})},NC=e=>{let t=e.outputSize,r=IC(e.url),o=t/r.length;return qm("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[lt(LC,{matrix:r,cellSize:o,color:e.fgColor}),lt(WC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),lt(OC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},DC=RC.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
|
|
1457
|
+
`,bn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return lt(DC,{size:o,bgColor:t,fgColor:r,children:lt(NC,{url:e.url,logo:{element:e.squareLogoElement??Vm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as is,jsxs as FC}from"react/jsx-runtime";var yr=({style:e,...t})=>FC("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 Km="#8a63d2",Zm=1e3,HC=Zm*2,GC=Zm*120,Qm=()=>{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=UC([]),M=s?.render.inDialog?Oe:0,k=d(),B=k?.meta.connectUri;return $m(()=>{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>GC&&(clearInterval(H),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},HC);return()=>{clearInterval(H),R.current.forEach(T=>clearTimeout(T))}},[]),$m(()=>{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]),jm||v?gr(as,{children:[pe(A,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),BC?pe(as,{children:gr(VC,{children:[pe(Jm,{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(Ym,{children:[pe(Jm,{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&&jm&&pe(ns,{text:"Take me to Warpcast",url:B,color:Km})})]})]})}),pe(X,{})]}):gr(as,{children:[pe(A,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),pe(Ym,{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:Km})]})]})}),pe(X,{})]})},Ym=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
|
+
`,VC=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
|
+
`,Jm=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 zC,useRef as qC,useState as pc}from"react";import{isIOS as $C,isMobile as Xm}from"react-device-detect";import uc from"styled-components";import{Fragment as ss,jsx as me,jsxs as Xt}from"react/jsx-runtime";var ef="#8a63d2",of=1e3,jC=of*2,KC=of*300,nf=()=>{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=qC([]),g=o?.render.inDialog?Oe:0,E=r?.farcasterSigner;zC(()=>{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>KC?(clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):P.status==="revoked"&&(clearInterval(C),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},jC);return()=>{clearInterval(C),f.current.forEach(P=>clearTimeout(P))}},[]);let v=E?.status==="pending_approval"?E.signer_approval_url:void 0;return Xm||s?Xt(ss,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),$C?me(ss,{children:Xt(YC,{children:[me(rf,{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(tf,{children:[me(rf,{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&&Xm&&me(ns,{text:"Take me to Warpcast",url:v,color:ef})})]})]})}),me(X,{})]}):Xt(ss,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),me(tf,{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:ef})]})]})}),me(X,{})]})},tf=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
|
+
`,YC=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
|
+
`,rf=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 ZC from"@heroicons/react/24/outline/ClockIcon";import QC from"@heroicons/react/24/outline/EyeSlashIcon";import XC from"@heroicons/react/24/outline/LinkIcon";import vr from"styled-components";import{jsx as mc,jsxs as JC}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:JC("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 af,jsx as ct,jsxs as Ro}from"react/jsx-runtime";var fc=({title:e,desc:t,icon:r})=>Ro(i0,{children:[ct(s0,{children:r}),Ro(a0,{children:[ct(o0,{children:e}),ct(n0,{children:t})]})]}),sf=({app:e,signedUrl:t,onContinue:r})=>Ro(af,{children:[Ro(t0,{children:[ct(ls,{size:"3.75rem"}),Ro(r0,{children:[e?.name," uses ",ct("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Ro(l0,{children:[ct(fc,{icon:ct(XC,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Ro(af,{children:["Connect a payment method (",ct("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),ct(fc,{icon:ct(ZC,{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(QC,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),ct(c0,{className:"mobile-only"})]}),ct(e0,{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"})]}),e0=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
|
+
`,t0=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
|
+
`,r0=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
|
+
`,o0=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
|
+
`,n0=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
|
+
`,i0=vr.div`
|
|
1569
1569
|
display: flex;
|
|
1570
1570
|
align-items: flex-start;
|
|
1571
1571
|
gap: 0.5rem;
|
|
1572
1572
|
align-self: stretch;
|
|
1573
|
-
`,
|
|
1573
|
+
`,a0=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
|
-
`,
|
|
1580
|
+
`,s0=vr.div`
|
|
1581
1581
|
padding-top: 2px;
|
|
1582
|
-
`,
|
|
1582
|
+
`,l0=vr.div`
|
|
1583
1583
|
display: flex;
|
|
1584
1584
|
flex-direction: column;
|
|
1585
1585
|
gap: 1.25rem;
|
|
1586
1586
|
margin: 0 0.5rem;
|
|
1587
|
-
`,
|
|
1587
|
+
`,c0=vr.div`
|
|
1588
1588
|
margin: 30px 0;
|
|
1589
|
-
`;import{ofetch as
|
|
1589
|
+
`;import{ofetch as d0}from"ofetch";import{useEffect as p0,useRef as u0,useState as m0}from"react";var cs="moonpay",lf="sdk_fiat_on_ramp_completed_with_status";async function cf(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 f0(e,t){let r=t?Gd:Hd,o=t?zd:Vd;return d0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function df(e,t=!1){let[r,o]=m0(null),{createAnalyticsEvent:n}=W(),a=u0(0);return p0(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await f0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(lf,{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(lf,{status:"serviceFailure",provider:cs}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as h0,jsx as hc,jsxs as y0}from"react/jsx-runtime";var pf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:y0(h0,{children:[hc(A,{title:"Fund account"},"header"),hc(sf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:cs}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),hc(V,{protectedByPrivy:!0})]})};import g0 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import v0 from"@heroicons/react/24/solid/CheckCircleIcon";import w0 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as C0}from"react";import uf from"styled-components";import{Fragment as yc,jsx as dt,jsxs as Io}from"react/jsx-runtime";var mf=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=df(o||null,e.fiatOnRamp.useSandbox);return Io(yc,{children:[dt(A,{title:"Fund account"},"header"),dt(E0,{status:n,onClickCta:r}),dt(V,{protectedByPrivy:!0})]})},b0=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:""}}},E0=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=C0(()=>b0(e),[e]);return Io(yc,{children:[Io(_0,{children:[dt(x0,{status:e}),Io(Ye,{children:[dt("h3",{children:r}),dt(S0,{children:o})]})]}),n&&dt(F,{onClick:t,children:n})]})},T0=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)",P0=e=>{switch(e){case"serviceFailure":case"failed":return w0;case"completed":return v0;case"waitingAuthorization":return()=>dt(g0,{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}},x0=({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=P0(e),r=T0(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})})},S0=uf.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
|
+
`,_0=uf.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 A0 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import k0 from"styled-components";import{Fragment as I0,jsx as eo,jsxs as M0}from"react/jsx-runtime";var ff=()=>{let{closePrivyModal:e}=W();return M0(I0,{children:[eo(A,{},"header"),eo(R0,{children:eo(A0,{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})]})},R0=k0.div`
|
|
1605
1605
|
border-radius: 50%;
|
|
1606
1606
|
height: 68px;
|
|
1607
1607
|
width: 68px;
|
|
@@ -1611,18 +1611,18 @@ 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 vf from"react-device-detect";import N0 from"styled-components";import gc from"styled-components";import{jsx as hf}from"react/jsx-runtime";var yf=({style:e,...t})=>hf("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:hf("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 L0,jsxs as O0}from"react/jsx-runtime";var gf=gc.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
flex-direction: column;
|
|
1617
1617
|
justify-content: flex-start;
|
|
1618
1618
|
gap: 4px;
|
|
1619
|
-
`,
|
|
1619
|
+
`,vc=gc.div`
|
|
1620
1620
|
&&& {
|
|
1621
1621
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1622
1622
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1623
1623
|
height: 12px;
|
|
1624
1624
|
}
|
|
1625
|
-
`,
|
|
1625
|
+
`,ds=({children:e})=>O0(W0,{children:[L0(yf,{style:{width:"16px",height:"16px"}}),e]}),W0=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 U0,jsx as Ue,jsxs as yi}from"react/jsx-runtime";var D0=()=>yi(F0,{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(gf,{children:[Ue(ds,{children:yi("div",{children:[Ue("span",{children:"Install the "}),Ue("a",{href:vf.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"})]}),wf=()=>{let{navigateBack:e}=_();return yi(U0,{children:[Ue(A,{backFn:e},"header"),Ue(K,{}),Ue(D0,{}),Ue(oe,{}),yi(X,{children:[Ue("span",{children:"Still not sure? "}),Ue("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},F0=N0(at)`
|
|
1644
1644
|
gap: 30px;
|
|
1645
1645
|
|
|
1646
1646
|
> :first-child > svg {
|
|
1647
1647
|
margin-top: 20px;
|
|
1648
1648
|
}
|
|
1649
|
-
`;import
|
|
1649
|
+
`;import b2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as E2,useState as Nf}from"react";import{isMobile as T2}from"react-device-detect";import P2 from"styled-components";import q0 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as $0}from"react";import B0 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as H0,useState as Cf}from"react";import Ef from"styled-components";import{Fragment as z0,jsx as gi,jsxs as bf}from"react/jsx-runtime";var ps=H0((e,t)=>{let[r,o]=Cf(""),[n,a]=Cf(!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 bf(z0,{children:[gi(G0,{children:bf(V0,{stacked:e.stacked,children:[gi(B0,{}),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]})}),G0=Ef.div`
|
|
1650
1650
|
width: 100%;
|
|
1651
|
-
|
|
1651
|
+
`,V0=Ef.label`
|
|
1652
1652
|
display: block;
|
|
1653
1653
|
position: relative;
|
|
1654
1654
|
width: 100%;
|
|
@@ -1711,9 +1711,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1711
1711
|
&& > input::placeholder {
|
|
1712
1712
|
color: var(--privy-color-foreground-3);
|
|
1713
1713
|
}
|
|
1714
|
-
`;import{Fragment as
|
|
1714
|
+
`;import{Fragment as j0,jsx as us,jsxs as Tf}from"react/jsx-runtime";var ms=({isEditable:e,setIsEditable:t})=>{let r=$0(null);return Tf(j0,{children:[us(Ar,{if:!e,children:us(ps,{ref:r})}),us(Ar,{if:e,children:Tf(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[us(q0,{})," Continue with Email"]})})]})};import{useState as K0}from"react";import{jsx as wc,jsxs as Y0}from"react/jsx-runtime";var fs=()=>{let[e,t]=K0(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=fe(),{initLoginWithFarcaster:l}=W();return Y0(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 l2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as c2}from"react";import{forwardRef as n2,useState as Cc}from"react";import kf from"styled-components";import J0 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as Z0,AsYouType as Q0,getCountries as X0,getCountryCallingCode as hs,getExampleNumber as e2}from"libphonenumber-js/min";import{jsx as o2,jsxs as r2}from"react/jsx-runtime";var vi=(e,t)=>Z0(String(e),t),ys=(e,t)=>`+${hs(t)} ${e}`,Pf=e=>`*${e.replaceAll("-","").slice(-4)}`,xf=e=>new Q0(e),t2=X0().map(e=>({code:e,callCode:hs(e)})),Sf=e=>{let t=e2(e,J0)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},_f=({value:e,onChange:t})=>o2("select",{value:e,onChange:t,children:t2.map(r=>r2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as s2,jsx as wi,jsxs as Af}from"react/jsx-runtime";var En=n2((e,t)=>{let{app:r}=_(),[o,n]=Cc(""),[a,i]=Cc(r?.intl.defaultCountry??"US"),l=vi(o,a),s=xf(a),d=Sf(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 Af(s2,{children:[wi(i2,{children:Af(a2,{callingCodeLength:E,stacked:e.stacked,children:[wi(_f,{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]})}),i2=kf.div`
|
|
1715
1715
|
width: 100%;
|
|
1716
|
-
`,
|
|
1716
|
+
`,a2=kf.label`
|
|
1717
1717
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1718
1718
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1719
1719
|
display: block;
|
|
@@ -1804,11 +1804,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1804
1804
|
&& > input::placeholder {
|
|
1805
1805
|
color: var(--privy-color-foreground-3);
|
|
1806
1806
|
}
|
|
1807
|
-
`;import{Fragment as m2,jsx as vs,jsxs as Mf}from"react/jsx-runtime";var ws=({isEditable:e,setIsEditable:t})=>{let r=u2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Mf(m2,{children:[vs(kr,{if:!e,children:vs(En,{ref:r,onSubmit:u})}),vs(kr,{if:e,children:Mf(xe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[vs(p2,{})," Continue with SMS"]})})]})};import{useState as w2}from"react";import{jsx as Wf,jsxs as f2}from"react/jsx-runtime";var Cs=({style:e,...t})=>f2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Wf("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Wf("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as bi,jsxs as h2}from"react/jsx-runtime";var bs=({style:e,...t})=>h2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[bi("g",{clipPath:"url(#clip0)",children:bi("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),bi("defs",{children:bi("clipPath",{id:"clip0",children:bi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Lf}from"react/jsx-runtime";var Es=({style:e,...t})=>Lf("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Lf("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});import{jsx as Ts,jsxs as y2}from"react/jsx-runtime";var Ps=({style:e,...t})=>y2("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ts("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ts("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ts("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ts("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Ss}from"react/jsx-runtime";function xs({style:e,...t}){return Ss("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Ss("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ss("g",{transform:"scale(5.12,5.12)",children:Ss("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Of,jsxs as g2}from"react/jsx-runtime";function _s(e){return g2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Of("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),Of("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as Tc,jsxs as v2}from"react/jsx-runtime";function As(e){return v2("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Tc("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Tc("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Tc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Nf}from"react/jsx-runtime";var ks=({style:e,...t})=>Nf("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:Nf("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});import{jsx as ro,jsxs as b2}from"react/jsx-runtime";var C2={apple:{logo:ro(Cs,{}),displayName:"Apple"},discord:{logo:ro(bs,{}),displayName:"Discord"},github:{logo:ro(Es,{}),displayName:"GitHub"},google:{logo:ro(Ps,{}),displayName:"Google"},linkedin:{logo:ro(xs,{}),displayName:"LinkedIn"},spotify:{logo:ro(_s,{}),displayName:"Spotify"},twitter:{logo:ro(ks,{}),displayName:"Twitter"},tiktok:{logo:ro(As,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[a,i]=w2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=C2[e];return b2(xe,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import E2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Df,jsxs as T2}from"react/jsx-runtime";var Rs=({onClick:e,text:t,icon:r})=>T2(xe,{onClick:e,children:[r,Df(Na,{children:t}),Df(E2,{})]});import{Fragment as Pc,jsx as He,jsxs as Ms}from"react/jsx-runtime";var Ws=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Ff("default"),[u,y]=Ff("email");S2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(fs,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(ws,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(hs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!x2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ai([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),S=[...E,...v],C=A2({primary:E.length,overflow:v.length}),[P,R]=Yd(S,C);return Ms(Pc,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(k2,{}),He(Da,{style:{overflow:"hidden",padding:2},children:Ms(Ot,{children:[s==="default"&&Ms(Pc,{children:[...P,R.length>0&&He(Rs,{text:"More options",icon:He(P2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Ms(Pc,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Is=5,A2=({primary:e,overflow:t})=>e<Is?e:e===Is&&t===0?Is:Is-1,k2=_2(cn)`
|
|
1807
|
+
`;import{Fragment as d2,jsx as gs,jsxs as Rf}from"react/jsx-runtime";var vs=({isEditable:e,setIsEditable:t})=>{let r=c2(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(d2,{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(l2,{})," Continue with SMS"]})})]})};import{useState as y2}from"react";import{jsx as If,jsxs as p2}from"react/jsx-runtime";var ws=({style:e,...t})=>p2("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 u2}from"react/jsx-runtime";var Cs=({style:e,...t})=>u2("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 m2}from"react/jsx-runtime";var Ts=({style:e,...t})=>m2("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 f2}from"react/jsx-runtime";function Ss(e){return f2("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 h2}from"react/jsx-runtime";function _s(e){return h2("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 v2}from"react/jsx-runtime";var g2={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]=y2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=g2[e];return v2(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 w2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Of,jsxs as C2}from"react/jsx-runtime";var ks=({onClick:e,text:t,icon:r})=>C2(Se,{onClick:e,children:[r,Of(Oa,{children:t}),Of(w2,{})]});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");E2(()=>{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"&&(!T2||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=x2({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(S2,{}),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(b2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Is(Ec,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Rs=5,x2=({primary:e,overflow:t})=>e<Rs?e:e===Rs&&t===0?Rs:Rs-1,S2=P2(cn)`
|
|
1808
1808
|
margin-bottom: 16px;
|
|
1809
|
-
`;import
|
|
1809
|
+
`;import R2 from"@heroicons/react/24/outline/EnvelopeIcon";import I2 from"@heroicons/react/24/outline/PhoneIcon";import M2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as W2,useState as Bf}from"react";import{isMobile as L2}from"react-device-detect";import O2 from"styled-components";import{jsx as bi,jsxs as Df}from"react/jsx-runtime";var Ff=({...e})=>Df("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Df("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 _2 from"@heroicons/react/24/outline/ChevronRightIcon";import A2 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Tc,jsxs as k2}from"react/jsx-runtime";var Uf=({onClick:e,text:t})=>k2(Se,{onClick:e,children:[Tc(A2,{}),Tc(Oa,{children:t}),Tc(_2,{})]});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]=Bf("default"),[k,B]=Bf(a?"email":"sms");W2(()=>{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&&(!L2||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=D2({priority:C,email:a,sms:i,social:T}),se=F2({priority:C,email:a,sms:i,social:T}),re=U2({priority:C,email:a,sms:i,social:T}),te=Te(Uf,{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(N2,{}),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})]})},N2=O2(cn)`
|
|
1810
1810
|
margin-bottom: 16px;
|
|
1811
|
-
`,
|
|
1811
|
+
`,D2=({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",F2=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Te(M2,{}):t&&r?Te(Ff,{}):t?Te(R2,{}):r?Te(I2,{}):null,U2=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Hf}from"react/jsx-runtime";var Gf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Hf(Ms,{connectOnly:!0}):Hf(Ws,{connectOnly:!0})};import{jsx as Vf}from"react/jsx-runtime";var zf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Vf(Ms,{connectOnly:!1}):Vf(Ws,{connectOnly:!1})};import B2 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as H2,jsx as ro,jsxs as G2}from"react/jsx-runtime";var qf=()=>{let{app:e}=_();return G2(H2,{children:[ro(A,{},"header"),ro(K,{}),ro(_e,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ro(B2,{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 V2 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as z2,jsx as oo,jsxs as q2}from"react/jsx-runtime";var $f=()=>{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 q2(z2,{children:[oo(A,{},"header"),oo(K,{}),oo(_e,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:oo(V2,{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 $2,jsx as Ti,jsxs as j2}from"react/jsx-runtime";var jf=()=>{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 j2($2,{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 Kf,jsxs as K2}from"react/jsx-runtime";var Yf=({style:e,...t})=>K2("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:[Kf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Kf("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 Y2,jsx as no,jsxs as Jf}from"react/jsx-runtime";var Zf=()=>{let{closePrivyModal:e}=W(),{navigate:t}=_();return Jf(Y2,{children:[no(A,{},"header"),no(K,{}),no(Yf,{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"}}),Jf(Ot,{children:[no(F,{onClick:()=>t("LANDING"),children:"Try again"}),no($t,{onClick:()=>e(),children:"Cancel"})]}),no(oe,{}),no(V,{protectedByPrivy:!0})]})};import ah from"@heroicons/react/20/solid/CheckIcon";import y3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import g3 from"@heroicons/react/24/outline/FingerPrintIcon";import v3 from"@heroicons/react/24/outline/PhoneIcon";import sh from"@heroicons/react/24/outline/TrashIcon";import w3 from"@heroicons/react/24/solid/CheckBadgeIcon";import lh from"@heroicons/react/24/solid/CheckCircleIcon";import ch from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import C3 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 dh,useState as Wr}from"react";import{useState as Sc}from"react";import{isMobile as t3}from"react-device-detect";import rh from"styled-components";import{Dialog as Qf,Transition as Pc}from"@headlessui/react";import xc from"react";import xn from"styled-components";import{jsx as Pn,jsxs as e3}from"react/jsx-runtime";var Xf=({children:e,open:t,onClick:r,...o})=>Pn(Pc,{show:t,as:xc.Fragment,children:e3(Qf,{onClose:r,...o,as:Z2,children:[Pn(Pc.Child,{as:xc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(J2,{"aria-hidden":"true"})}),Pn(Q2,{children:Pn(Pc.Child,{as:xc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(Qf.Panel,{as:X2,children:e})})})]})}),Sn=xn.div`
|
|
1812
1812
|
display: flex;
|
|
1813
1813
|
flex-direction: column;
|
|
1814
1814
|
text-align: center;
|
|
@@ -1831,7 +1831,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1831
1831
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1832
1832
|
border-radius: var(--privy-border-radius-lg);
|
|
1833
1833
|
}
|
|
1834
|
-
`,
|
|
1834
|
+
`,J2=xn.div`
|
|
1835
1835
|
position: fixed;
|
|
1836
1836
|
inset: 0;
|
|
1837
1837
|
|
|
@@ -1844,10 +1844,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1844
1844
|
backdrop-filter: unset;
|
|
1845
1845
|
-webkit-backdrop-filter: unset;
|
|
1846
1846
|
}
|
|
1847
|
-
`,
|
|
1847
|
+
`,Z2=xn.div`
|
|
1848
1848
|
position: relative;
|
|
1849
1849
|
z-index: 999999;
|
|
1850
|
-
`,
|
|
1850
|
+
`,Q2=xn.div`
|
|
1851
1851
|
position: fixed;
|
|
1852
1852
|
inset: 0;
|
|
1853
1853
|
display: flex;
|
|
@@ -1855,7 +1855,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1855
1855
|
justify-content: center;
|
|
1856
1856
|
width: 100vw;
|
|
1857
1857
|
min-height: 100vh;
|
|
1858
|
-
`,
|
|
1858
|
+
`,X2=xn.div`
|
|
1859
1859
|
// reset some default dialog styles
|
|
1860
1860
|
padding: 0;
|
|
1861
1861
|
background: transparent;
|
|
@@ -1902,19 +1902,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1902
1902
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1903
1903
|
border-radius: var(--privy-border-radius-lg);
|
|
1904
1904
|
}
|
|
1905
|
-
`,
|
|
1905
|
+
`,eh=xn.div`
|
|
1906
1906
|
display: flex;
|
|
1907
1907
|
flex-direction: column;
|
|
1908
1908
|
align-items: center;
|
|
1909
1909
|
justify-content: center;
|
|
1910
1910
|
height: 100%;
|
|
1911
|
-
`;import{Fragment as
|
|
1911
|
+
`;import{Fragment as l3,jsx as Pi,jsxs as s3}from"react/jsx-runtime";var xi=6,r3=new Array(xi).fill("");function o3(e){return e.replace(/\s+/g,"")}function _c(e){return/^[0-9]{1}$/.test(e)}function th(e){return e.length===xi&&e.every(_c)}function n3(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(r3),[i,l]=Sc(null),[s,d]=Sc(null),u=async E=>{E.preventDefault();let v=o3(E.currentTarget.value);if(v==="")return;let x=n3(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(),th(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(),th(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Pi(l3,{children:s3(i3,{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:t3?"one-time-code":"off",disabled:t},v))}),Pi("div",{children:Pi(a3,{fail:!!r||!!i,children:r||i})})]})})},i3=rh.div`
|
|
1912
1912
|
display: flex;
|
|
1913
1913
|
flex-direction: column;
|
|
1914
1914
|
width: 100%;
|
|
1915
1915
|
gap: 8px;
|
|
1916
1916
|
|
|
1917
|
-
${
|
|
1917
|
+
${Sn}[data-height='medium'] & {
|
|
1918
1918
|
margin-top: 22px;
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
@@ -1979,7 +1979,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1979
1979
|
transform: translate(1px, 0px);
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
`,
|
|
1982
|
+
`,a3=rh.div`
|
|
1983
1983
|
line-height: 20px;
|
|
1984
1984
|
font-size: 13px;
|
|
1985
1985
|
display: flex;
|
|
@@ -1987,7 +1987,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1987
1987
|
width: 100%;
|
|
1988
1988
|
|
|
1989
1989
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1990
|
-
`;import{useContext as
|
|
1990
|
+
`;import{useContext as c3}from"react";function An(){let{promptMfa:e,init:t,submit:r,cancel:o}=c3(ce);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as d3}from"react";function Si(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=d3(ce);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import p3 from"styled-components";import{jsx as oh,jsxs as m3}from"react/jsx-runtime";var nh=e=>m3(u3,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[oh("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),oh("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"})]}),u3=p3.svg`
|
|
1991
1991
|
height: 90px;
|
|
1992
1992
|
width: 90px;
|
|
1993
1993
|
|
|
@@ -1998,7 +1998,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1998
1998
|
> path {
|
|
1999
1999
|
fill: white;
|
|
2000
2000
|
}
|
|
2001
|
-
`;import
|
|
2001
|
+
`;import f3 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as h3}from"react/jsx-runtime";var ih=({size:e,authUrl:t})=>h3(bn,{url:t,squareLogoElement:f3,size:e,fgColor:"#1F1F1F"});import{Fragment as Dt,jsx as w,jsxs as ne}from"react/jsx-runtime";var ph=()=>{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;dh(()=>{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(nh,{})}),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(ch,{})})}),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(pu,{children:[ne(Ml,{children:[w(Il,{children:w(w3,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),ne(Ml,{children:[w(Il,{children:w(C3,{})}),"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(b3,{onComplete:x,onReset:k,onClose:x});case"totp":return w(E3,{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(y3,{}),"Authenticator App"]}),R?ne(tn,{children:[w(ah,{}),"Added"]}):w(tn,{children:"Recommended"})]})}),R&&w(Wl,{id:"remove",onClick:()=>o("totp"),children:w(sh,{})})]},"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(v3,{}),"SMS"]}),C&&ne(tn,{children:[w(ah,{}),"Added"]}),P&&w(tn,{children:"Disabled"})]})}),C&&w(Wl,{id:"remove",onClick:()=>o("sms"),children:w(sh,{})})]},"sms"),w(Fa,{children:w(Se,{disabled:!0,children:ne(Ba,{children:[ne(Ua,{children:[w(g3,{}),"Passkey"]}),w(tn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(X,{})]})}},b3=({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(uu,{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(lh,{})})}),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:Pf(o)})]})]}),w(X,{})]})},E3=({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}=_();dh(()=>{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(ih,{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(lh,{})})}),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(ch,{})})}),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 wb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Cb from"@heroicons/react/24/outline/PhoneIcon";import bb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Eb from"@heroicons/react/24/solid/PhoneIcon";import Tb from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as Pb,useState as jc}from"react";import{useMemo as hb,useEffect as yb,useState as Zh}from"react";import gb from"styled-components";import Wh from"styled-components";import mh from"styled-components";import{jsx as uh,jsxs as x3}from"react/jsx-runtime";var Ls=({label:e,children:t,valueStyles:r})=>x3(T3,{children:[uh("div",{children:e}),uh(P3,{style:{...r},children:t})]}),T3=mh.div`
|
|
2002
2002
|
display: flex;
|
|
2003
2003
|
align-items: center;
|
|
2004
2004
|
justify-content: space-between;
|
|
@@ -2013,7 +2013,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2013
2013
|
color: var(--privy-color-foreground-2);
|
|
2014
2014
|
text-align: right;
|
|
2015
2015
|
}
|
|
2016
|
-
`,
|
|
2016
|
+
`,P3=mh.div`
|
|
2017
2017
|
font-size: 14px;
|
|
2018
2018
|
line-height: 100%;
|
|
2019
2019
|
display: flex;
|
|
@@ -2022,28 +2022,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2022
2022
|
border-radius: var(--privy-border-radius-full);
|
|
2023
2023
|
background-color: var(--privy-color-background-2);
|
|
2024
2024
|
padding: 4px 8px;
|
|
2025
|
-
`;import
|
|
2025
|
+
`;import Ns from"styled-components";import{BigNumber as fh}from"@ethersproject/bignumber";import{formatEther as hh}from"@ethersproject/units";var _i=(e,t)=>{let r=(t*parseFloat(hh(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},wr=(e,t,r=6,o=!1)=>{let a=parseFloat(hh(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),fh.from(0)).toHexString(),yh=(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=>fh.from(e);import{Fragment as k3,jsx as Os,jsxs as gh}from"react/jsx-runtime";var vh=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Rc(e),n=t?_i(o,t):void 0,a=wr(o,r);return Os(wh,{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(wh,{children:n?gh(k3,{children:[Os(S3,{children:"USD"}),n==="<$0.01"?gh(A3,{children:[Os(_3,{children:"<"}),"$0.01"]}):n]}):a})},wh=Ns.span`
|
|
2026
2026
|
font-size: 14px;
|
|
2027
2027
|
line-height: 140%;
|
|
2028
2028
|
display: flex;
|
|
2029
2029
|
gap: 4px;
|
|
2030
2030
|
align-items: center;
|
|
2031
|
-
`,
|
|
2031
|
+
`,S3=Ns.span`
|
|
2032
2032
|
font-size: 12px;
|
|
2033
2033
|
line-height: 12px;
|
|
2034
2034
|
color: var(--privy-color-foreground-3);
|
|
2035
|
-
`,
|
|
2035
|
+
`,_3=Ns.span`
|
|
2036
2036
|
font-size: 10px;
|
|
2037
|
-
`,
|
|
2037
|
+
`,A3=Ns.span`
|
|
2038
2038
|
display: flex;
|
|
2039
2039
|
align-items: center;
|
|
2040
|
-
`;import
|
|
2040
|
+
`;import Mc from"styled-components";import{jsx as io,jsxs as Ds}from"react/jsx-runtime";var Ch=({gas:e,tokenPrice:t,tokenSymbol:r})=>Ds(Dl,{style:{paddingBottom:"12px"},children:[Ds(Eh,{children:[io(Ph,{children:"Est. Fees"}),io("div",{children:io(Ic,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&io(Th,{children:`${wr(e,r)}`})]}),bh=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Qe(e.value||0).add(Qe(t)).toHexString();return Ds(Dl,{children:[Ds(Eh,{children:[io(Ph,{children:"Total (including fees)"}),io("div",{children:io(Ic,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&io(Th,{children:wr(n,o)})]})},Eh=Mc.div`
|
|
2041
2041
|
display: flex;
|
|
2042
2042
|
flex-direction: row;
|
|
2043
2043
|
justify-content: space-between;
|
|
2044
2044
|
align-items: center;
|
|
2045
2045
|
padding-top: 4px;
|
|
2046
|
-
`,
|
|
2046
|
+
`,Th=Mc.div`
|
|
2047
2047
|
display: flex;
|
|
2048
2048
|
flex-direction: row;
|
|
2049
2049
|
height: 12px;
|
|
@@ -2052,23 +2052,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2052
2052
|
line-height: 12px;
|
|
2053
2053
|
color: var(--privy-color-foreground-3);
|
|
2054
2054
|
font-weight: 400;
|
|
2055
|
-
`,
|
|
2055
|
+
`,Ph=Mc.div`
|
|
2056
2056
|
font-size: 14px;
|
|
2057
2057
|
line-height: 22.4px;
|
|
2058
2058
|
font-weight: 400;
|
|
2059
|
-
`;import
|
|
2059
|
+
`;import R3 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Mo,useState as I3}from"react";import ao from"styled-components";import{createContext as xh,useContext as fD}from"react";var kn=xh(void 0);var Ai=xh(void 0);import{Fragment as U3,jsx as er,jsxs as Sh}from"react/jsx-runtime";var _h=({defaultValue:e,children:t})=>{let[r,o]=I3(e||null),n=a=>{o(r===a?null:a)};return er(kn.Provider,{value:{activePanel:r,togglePanel:n},children:er(M3,{children:t})})},Ah=({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(N3,{isActive:n,"data-open":n,children:t})})},kh=({children:e})=>{let{activePanel:t}=Mo(kn),{onToggle:r,value:o}=Mo(Ai),n=t===o;return Sh(U3,{children:[Sh(W3,{onClick:r,"data-open":n,children:[er(O3,{children:e}),er(F3,{isactive:n,children:er(R3,{height:"16px",width:"16px",strokeWidth:"2"})})]}),er(L3,{})]})},Rh=({children:e})=>{let{activePanel:t}=Mo(kn),{value:r}=Mo(Ai);return er(D3,{"data-open":t===r,children:er(Mh,{children:e})})},Ih=({children:e})=>{let{activePanel:t}=Mo(kn),{value:r}=Mo(Ai);return er(Mh,{children:typeof e=="function"?e({isActive:t===r}):e})},M3=ao.div`
|
|
2060
2060
|
display: flex;
|
|
2061
2061
|
flex-direction: column;
|
|
2062
2062
|
width: 100%;
|
|
2063
2063
|
gap: 8px;
|
|
2064
|
-
`,
|
|
2064
|
+
`,W3=ao.div`
|
|
2065
2065
|
display: flex;
|
|
2066
2066
|
justify-content: space-between;
|
|
2067
2067
|
align-items: center;
|
|
2068
2068
|
width: 100%;
|
|
2069
2069
|
cursor: pointer;
|
|
2070
2070
|
padding-bottom: 8px;
|
|
2071
|
-
`,
|
|
2071
|
+
`,L3=ao.div`
|
|
2072
2072
|
width: 100%;
|
|
2073
2073
|
|
|
2074
2074
|
&& {
|
|
@@ -2076,13 +2076,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2076
2076
|
border-color: var(--privy-color-foreground-4);
|
|
2077
2077
|
}
|
|
2078
2078
|
padding-bottom: 12px;
|
|
2079
|
-
`,
|
|
2079
|
+
`,O3=ao.div`
|
|
2080
2080
|
font-size: 14px;
|
|
2081
2081
|
font-weight: 500;
|
|
2082
2082
|
line-height: 19.6px;
|
|
2083
2083
|
width: 100%;
|
|
2084
2084
|
padding-right: 8px;
|
|
2085
|
-
`,
|
|
2085
|
+
`,N3=ao.div`
|
|
2086
2086
|
display: flex;
|
|
2087
2087
|
flex-direction: column;
|
|
2088
2088
|
width: 100%;
|
|
@@ -2094,7 +2094,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2094
2094
|
border-color: var(--privy-color-foreground-4);
|
|
2095
2095
|
border-radius: var(--privy-border-radius-md);
|
|
2096
2096
|
}
|
|
2097
|
-
`,
|
|
2097
|
+
`,D3=ao.div`
|
|
2098
2098
|
position: relative;
|
|
2099
2099
|
overflow: hidden;
|
|
2100
2100
|
transition: max-height 25ms ease-out;
|
|
@@ -2106,38 +2106,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2106
2106
|
&[data-open='false'] {
|
|
2107
2107
|
max-height: 0;
|
|
2108
2108
|
}
|
|
2109
|
-
`,
|
|
2109
|
+
`,Mh=ao.div`
|
|
2110
2110
|
display: flex;
|
|
2111
2111
|
flex-direction: column;
|
|
2112
2112
|
gap: 12px;
|
|
2113
2113
|
flex: 1 1 auto;
|
|
2114
2114
|
min-height: 1px;
|
|
2115
|
-
`,
|
|
2115
|
+
`,F3=ao.div`
|
|
2116
2116
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2117
|
-
`;import
|
|
2117
|
+
`;import B3 from"styled-components";import{jsx as G3}from"react/jsx-runtime";var Wc=({walletAddress:e,chainId:t=xr})=>G3(H3,{href:yh(t,e),target:"_blank",children:Br(e)}),H3=B3.a`
|
|
2118
2118
|
&:hover {
|
|
2119
2119
|
text-decoration: underline;
|
|
2120
2120
|
}
|
|
2121
|
-
`;import{jsx as
|
|
2121
|
+
`;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(_h,{children:Lc(Ah,{value:"details",children:[St(kh,{children:Lc(V3,{children:[St("div",{children:o?.title||o?.actionDescription||"Details"}),St(z3,{children:St(vh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Lc(Rh,{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(Ch,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),St(Ih,{children:({isActive:s})=>St(bh,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},V3=Wh.div`
|
|
2122
2122
|
display: flex;
|
|
2123
2123
|
flex-direction: row;
|
|
2124
2124
|
justify-content: space-between;
|
|
2125
|
-
`,
|
|
2125
|
+
`,z3=Wh.div`
|
|
2126
2126
|
flex-shrink: 0;
|
|
2127
2127
|
padding-left: 8px;
|
|
2128
|
-
`;import
|
|
2128
|
+
`;import Ri from"styled-components";import{jsx as ki,jsxs as J3}from"react/jsx-runtime";var Oc=({description:e,contractInfo:t})=>J3(q3,{children:[t.imgUrl&&ki($3,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&ki(j3,{children:ki("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&ki(K3,{children:t.name}),ki(Y3,{children:e||t.actionText})]}),q3=Ri.div`
|
|
2129
2129
|
display: flex;
|
|
2130
2130
|
flex-direction: column;
|
|
2131
2131
|
align-items: center;
|
|
2132
2132
|
margin-bottom: 8px;
|
|
2133
|
-
|
|
2133
|
+
`,$3=Ri.img`
|
|
2134
2134
|
&& {
|
|
2135
2135
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2136
2136
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2137
2137
|
border-radius: 16px;
|
|
2138
2138
|
margin-bottom: 12px;
|
|
2139
2139
|
}
|
|
2140
|
-
`,
|
|
2140
|
+
`,j3=Ri.div`
|
|
2141
2141
|
font-size: 12px;
|
|
2142
2142
|
line-height: 12px;
|
|
2143
2143
|
padding: 7px;
|
|
@@ -2150,7 +2150,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2150
2150
|
text-decoration: underline;
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
|
-
`,
|
|
2153
|
+
`,K3=Ri.div`
|
|
2154
2154
|
font-size: 18px;
|
|
2155
2155
|
line-height: 18px;
|
|
2156
2156
|
font-weight: 500;
|
|
@@ -2158,7 +2158,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2158
2158
|
white-space: nowrap;
|
|
2159
2159
|
max-width: 275px;
|
|
2160
2160
|
text-overflow: ellipsis;
|
|
2161
|
-
`,
|
|
2161
|
+
`,Y3=Ri.div`
|
|
2162
2162
|
font-size: 16px;
|
|
2163
2163
|
line-height: 140%;
|
|
2164
2164
|
font-weight: 400;
|
|
@@ -2166,7 +2166,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2166
2166
|
overflow: hidden;
|
|
2167
2167
|
max-width: 275px;
|
|
2168
2168
|
text-overflow: ellipsis;
|
|
2169
|
-
`;import
|
|
2169
|
+
`;import Z3 from"@heroicons/react/24/outline/WalletIcon";import Dc from"styled-components";import{jsx as Lh,jsxs as Nc}from"react/jsx-runtime";var Oh=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=W(),i=a(t.chainId)||"ETH";return Nc(Q3,{children:[Nc(X3,{children:[Lh(Z3,{strokeWidth:"2",width:"16px",height:"16px"}),Lh("div",{children:Br(e)})]}),Nc(eb,{displayBalanceColor:n,hasFunds:o,children:[r?wr(r,i,6,!0):0," available"]})]})},Q3=Dc.div`
|
|
2170
2170
|
display: flex;
|
|
2171
2171
|
flex-direction: row;
|
|
2172
2172
|
justify-content: space-between;
|
|
@@ -2179,12 +2179,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2179
2179
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2180
2180
|
border-radius: var(--privy-border-radius-md);
|
|
2181
2181
|
}
|
|
2182
|
-
`,
|
|
2182
|
+
`,X3=Dc.div`
|
|
2183
2183
|
display: flex;
|
|
2184
2184
|
flex-direction: row;
|
|
2185
2185
|
align-items: center;
|
|
2186
2186
|
gap: 8px;
|
|
2187
|
-
`,
|
|
2187
|
+
`,eb=Dc.div`
|
|
2188
2188
|
display: flex;
|
|
2189
2189
|
align-items: center;
|
|
2190
2190
|
justify-content: center;
|
|
@@ -2194,35 +2194,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2194
2194
|
background-color: var(--privy-color-background-2);
|
|
2195
2195
|
padding: 5px 8px;
|
|
2196
2196
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2197
|
-
`;import
|
|
2197
|
+
`;import Fs from"styled-components";import{Fragment as Dh,jsx as Ii,jsxs as Fh}from"react/jsx-runtime";var Uh=({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 Fh(tb,{children:[a?Fh(Dh,{children:[Ii(Nh,{children:a}),Ii(rb,{children:i})]}):Ii(Dh,{children:Ii(Nh,{children:i})}),Ii(ob,{children:e})]})},tb=Fs.div`
|
|
2198
2198
|
display: flex;
|
|
2199
2199
|
flex-direction: column;
|
|
2200
2200
|
align-items: center;
|
|
2201
2201
|
margin-bottom: 20px;
|
|
2202
|
-
`,
|
|
2202
|
+
`,Nh=Fs.h2`
|
|
2203
2203
|
&& {
|
|
2204
2204
|
font-size: 48px;
|
|
2205
2205
|
line-height: 48px;
|
|
2206
2206
|
margin: 8px auto;
|
|
2207
2207
|
}
|
|
2208
|
-
`,
|
|
2208
|
+
`,rb=Fs.p`
|
|
2209
2209
|
margin-bottom: 12px;
|
|
2210
2210
|
&& {
|
|
2211
2211
|
font-size: 17px;
|
|
2212
2212
|
line-height: 17px;
|
|
2213
2213
|
color: var(--privy-color-foreground-3);
|
|
2214
2214
|
}
|
|
2215
|
-
`,
|
|
2215
|
+
`,ob=Fs.div`
|
|
2216
2216
|
font-size: 16px;
|
|
2217
2217
|
line-height: 22.4px;
|
|
2218
2218
|
font-weight: 400;
|
|
2219
2219
|
overflow: hidden;
|
|
2220
2220
|
max-width: 275px;
|
|
2221
2221
|
text-overflow: ellipsis;
|
|
2222
|
-
`;import{VoidSigner as
|
|
2222
|
+
`;import{VoidSigner as cb}from"@ethersproject/abstract-signer";import{EtherscanProvider as LF}from"@ethersproject/providers";import{BigNumber as Vh}from"@ethersproject/bignumber";import{BigNumber as In}from"@ethersproject/bignumber";import{Contract as nb}from"@ethersproject/contracts";import{serialize as ib}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),Bh=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 Hh(e,t){if(!e.chainId||e.chainId&&!Mn(e.chainId))return In.from(0);let r=In.from(0);try{let o=new nb(qd,$d,t),n=Gh(e),a=ib(n);r=await o.getL1Fee(a)}catch{}return r}async function zh(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var qh=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=Vh.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=Vh.from(0);if(e.chainId&&Mn(e.chainId))try{a=await Hh(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),$h=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),jh=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 Kh}from"@ethersproject/units";import{ofetch as ab}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:Kh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Kh(e.maxFee.toFixed(9),"gwei").toHexString()}),sb=e=>({safeLow:Gc(e.safeLow),standard:Gc(e.standard),fast:Gc(e.fast)}),lb=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 sb(await ab(t))};async function Yh(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 lb(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 Gh(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),Jh(t),!t.nonce){let o=new cb(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await zh(t,r)),t.from||(t.from=e),Vc(t.chainId)?t=await Yh(t):Uc(t.chainId)?t=await $h(t,r):Mn(t.chainId)?t=await Bh(t,r):Bc(t.chainId)?t=await jh(t,r):t=await qh(t,r),t}async function Us(e,t,r,o,n){o=Object.assign({chainId:xr},o),Jh(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 Jh(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!db(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 db(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&pb(e);return t||r||o}function pb(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 ub}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 ub(()=>{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 mb,useContext as fb}from"react";var qc=mb(null);function Wi(){let e=fb(qc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as Qh}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]=Zh(null),[u,y]=Zh(e),{tokenPrice:f}=Gs(u),g=l(e.chainId)||"ETH",E=hb(()=>r.find(v=>v.walletClientType==="privy"),[r]);return yb(()=>{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?Qh(vb,{children:Qh(Rn,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},vb=gb.div`
|
|
2223
2223
|
width: 100%;
|
|
2224
2224
|
padding: 1rem 0;
|
|
2225
|
-
`;import{Fragment as
|
|
2225
|
+
`;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();Pb(()=>{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(xb,{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(Tb,{})})}),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(wb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Cr(Se,{onClick:()=>l("sms"),children:[ae(Cb,{}),"SMS"]},"sms")]}),ae(X,{})]})},xb=({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(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 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(bb,{})})}),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 Xh,useState as ey}from"react";import ry from"styled-components";import{Fragment as Ab,jsx as br,jsxs as Vs}from"react/jsx-runtime";var ty={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}},oy=()=>{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]=ey(!1),[C,P]=ey(void 0),R=s()?.provider||"google",M=ty[R].name,k=ty[R].component,B=n?.render.inDialog?Oe:0;Xh(()=>{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]),Xh(()=>{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(Ab,{children:[br(A,{}),br(K,{}),Vs(Sb,{children:[br(_b,{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,{})]})},Sb=ry.div`
|
|
2226
2226
|
display: flex;
|
|
2227
2227
|
flex-direction: column;
|
|
2228
2228
|
align-items: center;
|
|
@@ -2230,7 +2230,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2230
2230
|
margin-left: 27px;
|
|
2231
2231
|
margin-right: 27px;
|
|
2232
2232
|
gap: 24px;
|
|
2233
|
-
`,
|
|
2233
|
+
`,_b=ry.div`
|
|
2234
2234
|
display: flex;
|
|
2235
2235
|
flex-direction: column;
|
|
2236
2236
|
justify-content: center;
|
|
@@ -2253,55 +2253,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2253
2253
|
left: -19px;
|
|
2254
2254
|
top: -19px;
|
|
2255
2255
|
}
|
|
2256
|
-
`;import{useEffect as
|
|
2256
|
+
`;import{useEffect as Rb,useState as iy}from"react";import Ib from"styled-components";import{isMobile as kb}from"react-device-detect";var ny=(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()&&kb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Wb,jsx as Lr,jsxs as ay}from"react/jsx-runtime";var sy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=iy(""),[a,i]=iy(!1);Rb(()=>{t&&r&&e().then(n)},[t,r]);let l=ny(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."),ay(Wb,{children:[Lr(A,{},"header"),Lr(K,{}),Lr(mr,{title:s.title,description:s.description}),ay(Ot,{children:[Lr(Mb,{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})]})},Mb=Ib(at)`
|
|
2257
2257
|
margin: 16px auto;
|
|
2258
|
-
`;import{BigNumber as
|
|
2258
|
+
`;import{BigNumber as dy}from"@ethersproject/bignumber";import{useMemo as py,useEffect as uy,useState as Ft}from"react";import Nn from"styled-components";function ly(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as Jc}from"@ethersproject/bignumber";import Lb from"styled-components";import{Fragment as Db,jsx as Li,jsxs as Fb}from"react/jsx-runtime";var Ob=(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},cy=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>Fb(Db,{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:Ob(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Li(Nb,{loading:!1,onClick:o,children:"All Done"}),Li(X,{})]}),Nb=Lb(F)`
|
|
2259
2259
|
&& {
|
|
2260
2260
|
margin-top: 24px;
|
|
2261
2261
|
}
|
|
2262
2262
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2263
|
-
`;import{Fragment as
|
|
2263
|
+
`;import{Fragment as Zc,jsx as Xe,jsxs as On}from"react/jsx-runtime";var Ub=({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(Uh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},fy=()=>{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);uy(()=>{e||(y("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let pt=py(()=>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=py(()=>Sr(ge.chainId,l,i,{appId:d}),[ge.chainId,i]);uy(()=>{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=dy.from(0),Ni=dy.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=ly(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(my,{children:Xe(pn,{})})]}):M!==null?Xe(cy,{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(my,{children:[On(Vb,{children:[Xe(Ub,{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(zb,{children:[Xe(Bb,{children:H}),Xe(Oh,{txn:ge,address:pt?.address??"",hasFunds:we,balance:yt}),On(Hb,{children:[Y&&Xe(F,{onClick:co,children:"Add Funds"}),Xe(Gb,{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})]})]})]})]})},my=Nn.div`
|
|
2264
2264
|
display: flex;
|
|
2265
2265
|
flex-direction: column;
|
|
2266
2266
|
justify-content: space-between;
|
|
2267
2267
|
flex-grow: 1;
|
|
2268
2268
|
padding-bottom: 16px;
|
|
2269
|
-
`,
|
|
2269
|
+
`,Bb=Nn.div`
|
|
2270
2270
|
font-size: 13px;
|
|
2271
2271
|
color: var(--privy-color-error);
|
|
2272
2272
|
width: 100%;
|
|
2273
2273
|
margin-top: 16px;
|
|
2274
|
-
`,
|
|
2274
|
+
`,Hb=Nn.div`
|
|
2275
2275
|
display: flex;
|
|
2276
2276
|
direction: row;
|
|
2277
2277
|
justify-content: space-between;
|
|
2278
2278
|
align-items: center;
|
|
2279
2279
|
gap: 8px;
|
|
2280
|
-
`,
|
|
2280
|
+
`,Gb=Nn(F)`
|
|
2281
2281
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2282
|
-
|
|
2282
|
+
`,Vb=Nn.div`
|
|
2283
2283
|
height: 100%;
|
|
2284
2284
|
display: flex;
|
|
2285
2285
|
flex-direction: column;
|
|
2286
2286
|
justify-content: space-evenly;
|
|
2287
2287
|
flex-grow: 1;
|
|
2288
|
-
`,
|
|
2288
|
+
`,zb=Nn.div`
|
|
2289
2289
|
display: flex;
|
|
2290
2290
|
flex-direction: column;
|
|
2291
2291
|
gap: 8px;
|
|
2292
|
-
`;import{isHexString as
|
|
2292
|
+
`;import{isHexString as qb}from"@ethersproject/bytes";import{toUtf8String as $b}from"@ethersproject/strings";import{useEffect as hy,useState as zs}from"react";import so,{css as jb}from"styled-components";import{Fragment as vy,jsx as Re,jsxs as Dn}from"react/jsx-runtime";var Kb=e=>{if(!qb(e))return e;try{return $b(e)}catch{return e}},Yb=e=>JSON.stringify(e,null,2),Jb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Re(tE,{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)})},Zb=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Dn(vy,{children:[Re(gy,{children:Re(Jb,{data:o})}),Re(Xr,{text:Yb(e.typedData),itemName:"full payload to clipboard"})," "]})},yy=()=>{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;hy(()=>{e||o("LANDING")},[e]),hy(()=>{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(vy,{children:[Re(A,{onClose:()=>B(f)}),Re(K,{}),Dn(Qb,{children:[Re(Xb,{children:k.title}),Re(eE,{children:k.description}),v==="personal_sign"&&Re(gy,{children:Kb(x)}),v==="eth_signTypedData_v4"&&Re(Zb,{typedData:x}),Re(rE,{fail:!0,children:s}),Re(nE,{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(oE,{children:[Re(os,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Re("span",{children:"Success"})]}):k.buttonText})]}),Re(oe,{}),Re(V,{protectedByPrivy:!0})]})},Qb=so.div`
|
|
2293
2293
|
display: flex;
|
|
2294
2294
|
flex-direction: column;
|
|
2295
2295
|
align-items: center;
|
|
2296
2296
|
justify-content: center;
|
|
2297
|
-
`,
|
|
2297
|
+
`,Xb=so.span`
|
|
2298
2298
|
color: var(--privy-color-foreground);
|
|
2299
2299
|
text-align: center;
|
|
2300
2300
|
font-size: 1.125rem;
|
|
2301
2301
|
font-weight: 500;
|
|
2302
2302
|
line-height: 1.25rem; /* 111.111% */
|
|
2303
2303
|
text-align: center;
|
|
2304
|
-
`,
|
|
2304
|
+
`,eE=so.span`
|
|
2305
2305
|
margin-top: 4px;
|
|
2306
2306
|
color: var(--privy-color-foreground);
|
|
2307
2307
|
text-align: center;
|
|
@@ -2311,7 +2311,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2311
2311
|
font-weight: 400;
|
|
2312
2312
|
line-height: 20px; /* 142.857% */
|
|
2313
2313
|
letter-spacing: -0.008px;
|
|
2314
|
-
`,
|
|
2314
|
+
`,gy=so.div`
|
|
2315
2315
|
margin-top: 1.5rem;
|
|
2316
2316
|
background-color: var(--privy-color-background-2);
|
|
2317
2317
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2330,7 +2330,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2330
2330
|
display: none; /* Safari and Chrome */
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
`,
|
|
2333
|
+
`,tE=so.ul`
|
|
2334
2334
|
margin-left: 12px !important;
|
|
2335
2335
|
white-space: nowrap;
|
|
2336
2336
|
|
|
@@ -2342,7 +2342,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2342
2342
|
font-weight: 500 !important;
|
|
2343
2343
|
}
|
|
2344
2344
|
}
|
|
2345
|
-
`,
|
|
2345
|
+
`,rE=so.div`
|
|
2346
2346
|
line-height: 20px;
|
|
2347
2347
|
height: 20px;
|
|
2348
2348
|
font-size: 13px;
|
|
@@ -2352,22 +2352,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2352
2352
|
width: 100%;
|
|
2353
2353
|
margin-top: 16px;
|
|
2354
2354
|
margin-bottom: 4px;
|
|
2355
|
-
`,
|
|
2355
|
+
`,oE=so.span`
|
|
2356
2356
|
display: flex;
|
|
2357
2357
|
align-items: center;
|
|
2358
2358
|
gap: 8px;
|
|
2359
|
-
`,
|
|
2359
|
+
`,nE=so(F)`
|
|
2360
2360
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2361
2361
|
|
|
2362
|
-
${e=>e.success&&
|
|
2362
|
+
${e=>e.success&&jb`
|
|
2363
2363
|
&&&& {
|
|
2364
2364
|
background-color: var(--privy-color-success);
|
|
2365
2365
|
color: #ffffff;
|
|
2366
2366
|
}
|
|
2367
2367
|
`}
|
|
2368
|
-
`;import
|
|
2368
|
+
`;import dE from"@heroicons/react/24/outline/EnvelopeIcon";import iE from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as aE,useState as wy}from"react";import by from"styled-components";import{Fragment as cE,jsx as Oi,jsxs as Cy}from"react/jsx-runtime";var Ey=aE((e,t)=>{let[r,o]=wy(""),[n,a]=wy(!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 Cy(cE,{children:[Oi(sE,{children:Cy(lE,{children:[Oi(iE,{}),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]})}),sE=by.div`
|
|
2369
2369
|
width: 100%;
|
|
2370
|
-
`,
|
|
2370
|
+
`,lE=by.label`
|
|
2371
2371
|
display: block;
|
|
2372
2372
|
position: relative;
|
|
2373
2373
|
width: 100%;
|
|
@@ -2425,7 +2425,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2425
2425
|
&& > input::placeholder {
|
|
2426
2426
|
color: var(--privy-color-foreground-3);
|
|
2427
2427
|
}
|
|
2428
|
-
`;import{Fragment as
|
|
2428
|
+
`;import{Fragment as pE,jsx as lo,jsxs as uE}from"react/jsx-runtime";var Ty=()=>uE(pE,{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(dE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),lo(Ot,{children:lo(Ey,{stacked:!0})}),lo(oe,{}),lo(V,{protectedByPrivy:!0})]});import fE,{createGlobalStyle as hE}from"styled-components";var mE=`
|
|
2429
2429
|
*,
|
|
2430
2430
|
::before,
|
|
2431
2431
|
::after {
|
|
@@ -2655,7 +2655,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2655
2655
|
[hidden] {
|
|
2656
2656
|
display: none;
|
|
2657
2657
|
}
|
|
2658
|
-
`,
|
|
2658
|
+
`,Py=mE;var xy=hE`
|
|
2659
2659
|
:root {
|
|
2660
2660
|
// Borders
|
|
2661
2661
|
--privy-border-radius-sm: 6px;
|
|
@@ -2687,10 +2687,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2687
2687
|
--privy-height-modal-full: 620px;
|
|
2688
2688
|
--privy-height-modal-compact: 480px;
|
|
2689
2689
|
};
|
|
2690
|
-
`,
|
|
2690
|
+
`,Sy=fE.div`
|
|
2691
2691
|
// css normalize only the privy application to avoid conflicts
|
|
2692
2692
|
// with consuming application
|
|
2693
|
-
${
|
|
2693
|
+
${Py}
|
|
2694
2694
|
|
|
2695
2695
|
// Privy styles
|
|
2696
2696
|
color: var(--privy-color-foreground-2);
|
|
@@ -2749,4 +2749,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2749
2749
|
opacity: 1;
|
|
2750
2750
|
}
|
|
2751
2751
|
}
|
|
2752
|
-
`;import{jsx as Ge,jsxs as Ry}from"react/jsx-runtime";var TE={["LANDING"]:$f,["CONNECT_OR_CREATE"]:zf,["AWAITING_PASSWORDLESS_CODE"]:Au,["AWAITING_CONNECTION"]:ju,["AWAITING_CONNECT_ONLY_CONNECTION"]:Zu,["AWAITING_FARCASTER_CONNECTION"]:ef,["AWAITING_FARCASTER_SIGNER"]:sf,["PHANTOM_INTERSTITIAL_SCREEN"]:cy,["LOGIN_FAILED_SCREEN"]:Xf,["AWAITING_OAUTH_SCREEN"]:iy,["ALLOWLIST_REJECTION_SCREEN"]:vu,["INSTALL_PHANTOM_SCREEN"]:bf,["LINK_EMAIL_SCREEN"]:jf,["LINK_PHONE_SCREEN"]:Kf,["LINK_WALLET_SCREEN"]:Yf,["UPDATE_EMAIL_SCREEN"]:Sy,["CONNECT_ONLY_LANDING_SCREEN"]:zu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Hu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Nm,["EMBEDDED_WALLET_CREATED_SCREEN"]:nm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:rm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Um,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:lm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:vy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:mf,["FIAT_ON_RAMP_STATUS_SCREEN"]:hf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Fm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Dm,["MFA_ENROLLMENT_FLOW_SCREEN"]:mh,["CAPTCHA_SCREEN"]:Mu,["ERROR_SCREEN"]:Bm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:yf,["AFFIRMATIVE_CONSENT_SCREEN"]:yu},PE=["LANDING","AWAITING_CONNECTION"],SE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=CE(null),f=ou(y),g=o&&i&&PE.includes(i)&&!n&&l==="ready";if(ky(()=>{g&&s()},[g]),ky(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ry(xn,{children:[Ge(A,{}),Ge(j,{}),Ge(rh,{children:Ge(ht,{})}),Ge(re,{}),Ge(Q,{})]});if(!i&&e)return Ge(xn,{style:{height:f},children:Ge("div",{ref:y,children:Ge(Zc,{open:e,onClose:t})})});if(!i)return null;let E=TE[i];return Ge(xn,{style:{height:f},children:Ry("div",{ref:y,children:[Ge(kr,{if:!!e,children:Ge(E,{})}),Ge(kr,{if:!e,children:Ge(Zc,{open:e,onClose:t})})]})})},xE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:wE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Iy=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=xE(),[o,n]=bE(!1);Sl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Ay,{children:Ge(SE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(th,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return EE.createPortal(l,s)}return l};import{useState as _E}from"react";import{useEffect as My,useRef as Wy}from"react";var $s=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Wo(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as WE}from"react/jsx-runtime";var AE=function(e){return()=>`id-${e++}`}(0);function kE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new $s,ed=new Map,RE=(e,t)=>typeof t=="bigint"?t.toString():t,IE=(e,t)=>`${e}${JSON.stringify(t,RE)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=IE(e,t);if(e==="privy:wallet:create"){let l=ed.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=AE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{ed.delete(a)});return ed.set(a,i),i}function ME(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ly(e){let t=Wy(null),r=Wy(e.mfaMethods),o=au(),[n,a]=_E(!1);return My(()=>{r.current=e.mfaMethods},[e.mfaMethods]),My(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&kE(f.data)&&ME(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Qd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),WE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Qi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function js(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Ks=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set when initialzing authentication.");try{await this.api.post(Id,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Mfa flow has no API instance");if(!this.meta.smsCode)throw new x("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Md,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return bt(t)}catch(t){throw pe(t)}}};import{jsx as Tr,jsxs as Oy}from"react/jsx-runtime";var Un;function DE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=ue.get(fo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Ny,gp=(e,t)=>Ny(e,t),Dy,vp=(e,t)=>Dy(e,t),Fy,wp=(e,t)=>Fy(e,t),Uy,Cp=()=>Uy(),FE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ue.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},UE=({config:e,...t})=>{if(!DE(t.appId))throw new x("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Xn({appId:t.appId,apiUrl:t.apiUrl||ji}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Tr(jp,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Tr(BE,{...t,config:r,client:Un})})},BE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,S]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=_a(),K=Aa(),[ae,te]=Me(!0),[ee,z]=Me({}),[Pe,we]=Me(null),[Pr,gt]=Me(null),[Ae,ge]=Me(!1),[vt,Bt]=Me(!1),Dr=Fn(null),rr=Fn(null),L=Fn(nu);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let Y=Fn(null),Z=Fn(null),Bn=OE(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{S(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&te(!0),$(c)};Nr(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Nr(()=>{T&&Pr?.(T)},[T]),Nr(()=>{(async()=>{if(!O.customAuth?.enabled)return;te(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h){await Lo.logout();return}if(i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();I||await Lo.logout(),d(I||null),E(D||!1),l(!0),Bt(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Nr(()=>{vt&&T&&s&&kt(s,e.config?.embeddedWallets?.createOnLogin)&&(Bt(!1),nr(s,Fo).catch(console.error))},[vt&&T&&s]),Nr(()=>{async function c(){let p=ut();FE();let m=LE();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Js()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ne.setReadyToTrue(),p&&(h?Z.current="link":Z.current="login")}!n&&K&&c()},[t,Pe,n,K]);let ut=()=>{let c=$n();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ar(c)),We("AWAITING_OAUTH_SCREEN"),!0)},po=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Ht(I,p,m,h)};async function Ht(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof dr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ht(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Z.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Z.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Z.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let uo=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Js=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Br()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new x("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),po(p,m,void 0,uo)};Nr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new x("User must be authenticated before linking an account.")},mo=()=>{Le(),Y.current="siwe",Z.current="link",$("LINK_WALLET_SCREEN")},wt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new x("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>uo(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await uo(c),We("AWAITING_CONNECTION")},or=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new x("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await pf(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new x("Unsupported fund provider. Currently supported option is `moonpay`.")},Fr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:wt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new x("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await or(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new x("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Bn(p)),aa(c,p)?c:p})};Nr(()=>{Fr()},[s?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new x("Connector not initialized");Fr(),t.connectors.on("walletsUpdated",Fr)}},[n]);let Di=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let nr=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ne.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,se)=>{te(!0),z({createWallet:{onSuccess:mt=>{N(L,"createWallet","onSuccess",mt),D(mt)},onFailure:mt=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),se(mt)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ne.refreshUser(),se=Ce(D);if(!se)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",se),se}},Zs=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new J(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},rd=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=Ce(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}te(!0);let se=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,tt=c.chainId?Number(c.chainId):se.chainId;Zs(tt);let mt=Object.assign({},c,{chainId:tt}),Sr=async()=>{let rt=await ve();if(!rt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ne.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let zt=_r(mt.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Qs=await Ln(D.address,mt,zt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:zy}=await Wn(Qs,zt),{hasSufficientFunds:qy}=await Hs(D.address,Qs,zy,zt);if(!qy)throw new Se(new Rt("Wallet has insufficient funds for this transaction.",Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let id=await Bs(rt,D.address,T,Qs,zt);N(L,"sendTransaction","onSuccess",id),h(id)}catch(Vt){N(L,"sendTransaction","onError","transaction_failure"),I(Vt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Sr();else{let rt={transactionRequest:mt,onSuccess:zt=>{N(L,"sendTransaction","onSuccess",zt),h(zt)},onFailure:zt=>{N(L,"sendTransaction","onError","transaction_failure"),I(zt)},uiOptions:p||{},fundWalletConfig:m},Vt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:zt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(zt)}};z({connectWallet:Vt,sendTransaction:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function od(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Gt=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Di,linkWallet:mo,linkEmail:()=>{Le(),Gt("email"),Y.current="email",Z.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Gt("phone"),Y.current="sms",Z.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Gt("google"),Z.current="link",await ne.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Gt("twitter"),Z.current="link",await ne.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Gt("discord"),Z.current="link",await ne.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Gt("github"),Z.current="link",await ne.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Gt("spotify"),Z.current="link",await ne.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Gt("tiktok"),Z.current="link",await ne.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Gt("linkedin"),Z.current="link",await ne.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Gt("apple"),Z.current="link",await ne.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Gt("farcaster"),await ne.initLoginWithFarcaster(),Z.current="link",Y.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new x("User does not have an email linked to their account.");Z.current="link",Y.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Z.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}We("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),s&&T&&await T.clearMfa({userId:s.id}),d(null),l(!1),S(null),N(L,"logout","onSuccess"),Z.current=null,Y.current=null,o(!1),ue.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new td(new sr(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new td(new sr(new be)):new td(new sr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Vr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Vr(new be):new Vr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ys(h.address)===Ys(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ys(h.address)===Ys(c));if(!p||!await p.isConnected())H(c),mo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return nr(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await od()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{te(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}te(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let se=await ve();if(!T||!se)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:mt}=await T.rpc({accessToken:se,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Sr=mt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Sr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let se=await D();N(L,"signMessage","onSuccess",se),m(se)}catch(se){N(L,"signMessage","onError","unable_to_sign"),h(se??new Se("Unable to sign message"))}}else{let mt={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:rt=>{N(L,"signMessage","onSuccess",rt),m(rt)},onFailure:rt=>{N(L,"signMessage","onError","unable_to_sign"),h(rt)},uiOptions:p||{}},Sr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:rt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(rt)}};z({signMessage:mt,connectWallet:Sr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}te(!0);let D=ea(c),se=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let tt=await ve();if(!T||!tt)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Sr}=await T.rpc({accessToken:tt,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),rt=Sr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),rt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let tt=await se();N(L,"signTypedData","onSuccess",tt),m(tt)}catch(tt){N(L,"signTypedData","onError","unable_to_sign"),h(tt??new Se("Unable to sign message"))}}else{let Sr={method:"eth_signTypedData_v4",data:D,confirmAndSign:se,onSuccess:Vt=>{N(L,"signTypedData","onSuccess",Vt),m(Vt)},onFailure:Vt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Vt)},uiOptions:p||{}},rt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Vt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Vt)}};z({signMessage:Sr,connectWallet:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await rd(c,p,m)).wait();return Gs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}te(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(se){if(xo(se))await ne.recoverEmbeddedWallet();else throw se}}catch(se){p(se);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:od,async init(c){let p;switch(c){case"sms":p=new Ks("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Dr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{rr.current={resolve:m,reject:h}});break;default:throw Dr.current?.reject(new x("Unsupported MFA method")),new x(`Unsupported MFA method: ${c}`)}},cancel(){Dr.current?.reject(new x("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ne.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(se=>se.type==="wallet"&&se.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(se=>se.type==="wallet"&&se.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ne.loginWithCode(c)},initLoginWithEmail(c){return ne.initLoginWithEmail(c)},initLoginWithSms(c){return ne.initLoginWithSms(c)},fundWallet(c,p){return ne.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ne.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ne.loginWithHeadlessOAuth(c)},isModalOpen:r};Ny=Lo.signMessage,Dy=Lo.signTypedData,Fy=async(...c)=>{let p=await rd(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let nd=!!e.config?.headless,ne=(()=>({headless:nd,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{gt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return gt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Z.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,Y.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Z.current==="link"&&Y.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,Y.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Z.current=null,Y.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Ht,initLoginWithWallet:async(c,p)=>{Y.current="siwe",uo(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new x("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),Y.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new zn(c);t.startAuthFlow(p);try{Y.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Z.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof zn))throw new x("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),Y.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(Y.current=c,ol()){if(c==="google"&&js(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new ar({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ar))throw new x("Must initialize OAuth flow before calling loginWithOAuth");let p=je.get(ho),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new x("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Y.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Y.current=c}catch(D){throw Z.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(ol()){if(c==="google"&&js(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new ar({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ar(c));let p=je.get(ho),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new x("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Y.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Y.current=c.provider}catch(D){throw Z.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Ur(c,p);t.startAuthFlow(m);try{Y.current="email",await m.sendCodeEmail()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new zi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{Y.current="sms",await m.sendSmsCode()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Ur)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new x("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}te(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){xo(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):xo(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:or,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Fr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await or(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();Uy=ne.recoverEmbeddedWallet;let Vy=NE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Tr(le.Provider,{value:Lo,children:Tr(Pl.Provider,{value:L,children:Tr(jc.Provider,{value:Vy,children:Oy(tu,{...O,children:[e.children,Oy(Tl.Provider,{value:ne,children:[!nd&&O.captchaEnabled&&n&&!i&&Tr(El,{delayedExecution:!1}),Tr(_y,{theme:{...O.appearance.palette||{}}}),Tr(Yp,{data:ee,setModalData:z,setInitialScreen:S,initialScreen:v,authenticated:i,open:r,children:Tr(Iy,{open:r})}),ae&&K?Tr(Ly,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Dr,mfaSubmitPromise:rr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as HE}from"react";function GE(e){let{login:t}=HE(le);return Ee("login",e),{login:t}}import{useContext as VE}from"react";function zE(e){let{logout:t}=VE(le);return Ee("logout",e),{logout:t}}import{useCallback as By,useEffect as qE}from"react";function $E(){let e=fe(),t=Aa(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=By(async d=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=By(async()=>{let d=$n();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{jn()}},[o]);return qE(()=>{let d=$n();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Hy}from"react";var jE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Hy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Hy(async({code:a})=>{if(e.enabled&&e.status==="error")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Gy}from"react";var KE=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Gy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Gy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as YE}from"react";function JE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=YE(le);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as ZE}from"react";function QE(e){let{connectWallet:t}=ZE(le);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as XE}from"react";function e4(e){let{createWallet:t}=XE(le);return Ee("createWallet",e),{createWallet:t}}var t4=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as r4}from"react";function o4(e){let{sendTransaction:t}=r4(le);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as n4}from"react";function i4(e){let{setWalletPassword:t}=n4(le);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as a4}from"react";function s4(e){let{signMessage:t}=a4(le);return Ee("signMessage",e),{signMessage:t}}import{useContext as l4}from"react";function c4(e){let{signTypedData:t}=l4(le);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as d4}from"react";var p4=()=>{let{isModalOpen:e}=d4(le);return{isOpen:e}};import{useContext as u4}from"react";function m4(e){let{getAccessToken:t}=u4(le);return Ee("accessToken",e),{getAccessToken:t}}function f4(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function h4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{sr as AsExternalProvider,El as Captcha,Qn as ConnectorManager,Xn as PrivyClient,UE as PrivyProvider,be as PrivyProxyProvider,Jn as SUPPORTED_CHAINS,sl as VERSION,ft as WalletConnector,h4 as addRpcUrlOverrideToChain,Zl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,QE as useConnectWallet,e4 as useCreateWallet,f4 as useExperimentalFarcasterSigner,t4 as useFundWallet,JE as useLinkAccount,GE as useLogin,jE as useLoginWithEmail,$E as useLoginWithOAuth,KE as useLoginWithSms,zE as useLogout,An as useMfa,_i as useMfaEnrollment,p4 as useModalStatus,G as usePrivy,Sl as useRegisterMfaListener,o4 as useSendTransaction,i4 as useSetWalletPassword,s4 as useSignMessage,c4 as useSignTypedData,m4 as useToken,Li as useWallets};
|
|
2752
|
+
`;import{jsx as Ge,jsxs as Ay}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"]:sy,["LOGIN_FAILED_SCREEN"]:Zf,["AWAITING_OAUTH_SCREEN"]:oy,["ALLOWLIST_REJECTION_SCREEN"]:yu,["INSTALL_PHANTOM_SCREEN"]:wf,["LINK_EMAIL_SCREEN"]:qf,["LINK_PHONE_SCREEN"]:$f,["LINK_WALLET_SCREEN"]:jf,["UPDATE_EMAIL_SCREEN"]:Ty,["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"]:yy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:fy,["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(_y(()=>{g&&s()},[g]),_y(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ay(Sn,{children:[Ge(A,{}),Ge(K,{}),Ge(eh,{children:Ge(ft,{})}),Ge(oe,{}),Ge(X,{})]});if(!i&&e)return Ge(Sn,{style:{height:f},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},children:Ay("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])}},ky=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=TE(),[o,n]=vE(!1);Tl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Sy,{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 Ry,useRef as Iy}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 My(e){let t=Iy(null),r=Iy(e.mfaMethods),o=nu(),[n,a]=PE(!1);return Ry(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Ry(()=>{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 Wy}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 Ly,hp=(e,t)=>Ly(e,t),Oy,yp=(e,t)=>Oy(e,t),Ny,gp=(e,t)=>Ny(e,t),Dy,vp=()=>Dy(),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){await Lo.logout();return}if(i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();I||await Lo.logout(),d(I||null),E(D||!1),l(!0),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:Gy}=await Wn(Zs,Vt),{hasSufficientFunds:Vy}=await Bs(D.address,Zs,Gy,Vt);if(!Vy)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()=>{await t.logout(),s&&T&&await T.clearMfa({userId:s.id}),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};Ly=Lo.signMessage,Oy=Lo.signTypedData,Ny=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}}))();Dy=ie.recoverEmbeddedWallet;let Hy=WE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Er(ce.Provider,{value:Lo,children:Er(El.Provider,{value:L,children:Er(qc.Provider,{value:Hy,children:Wy(Xp,{...O,children:[e.children,Wy(bl.Provider,{value:ie,children:[!rd&&O.captchaEnabled&&n&&!i&&Er(Cl,{delayedExecution:!1}),Er(xy,{theme:{...O.appearance.palette||{}}}),Er(jp,{data:te,setModalData:z,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Er(ky,{open:r})}),se&&Y?Er(My,{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 Fy,useEffect as GE}from"react";function VE(){let e=fe(),t=_a(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=Fy(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=Fy(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 Uy}from"react";var zE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Uy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Uy(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 By}from"react";var qE=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=By(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=By(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};
|