@privy-io/react-auth 1.44.0-beta-20231020180147 → 1.44.0-beta-20231020181624

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 CHANGED
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${a}
10
10
  Issued At: ${i}
11
11
  Resources:
12
- - https://privy.io`;this.getNonceOnce=new qe(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new g("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(bs(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw Q(t)}}async link(){if(!this.api)throw new g("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Es(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw Q(t)}}async sign(){if(!this.api)throw new g("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new g("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 g("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Cs(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new g("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",c=new Date().toISOString();return this.createSiweMessage(t,o,n,i,c,r,a)}};var wo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new g("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new g("phone number and sms code must be set prior to calling authenticate.");try{let t=Ss(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw Q(t)}}async link(){if(!this.api)throw new g("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new g("phone number and sms code must be set prior to calling authenticate.");try{let t=As();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw Q(t)}}async sendSmsCode(t,o){if(!this.api)throw new g("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new g("phone nNumber must be set when initialzing authentication.");try{let r=_s();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw Q(r)}}};import{v4 as Cm}from"uuid";function De(e){return new Date(e*1e3)}function Mu(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:De(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let i={address:o.address,type:o.type,verifiedAt:De(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:De(o.verified_at)};t.push(a);break;case"google_oauth":let c={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:De(o.verified_at)};t.push(c);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:De(o.verified_at)};t.push(s);break;case"discord_oauth":let l={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(l);break;case"github_oauth":let f={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(f);break;case"tiktok_oauth":let m={subject:o.subject,username:o.username,type:o.type,verifiedAt:De(o.verified_at)};t.push(m);break;case"linkedin_oauth":let v={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(v);break;case"apple_oauth":let y={subject:o.subject,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(y);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:De(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function dt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var te=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Lu=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),$t=(e,t)=>t==="all-users"&&!te(e)||t==="users-without-wallets"&&!Lu(e)?.length;function rt(e){if(!e)return null;let t=Mu(e.linked_accounts),o=dt(t,"wallet"),r=dt(t,"email"),n=dt(t,"phone"),i=dt(t,"google_oauth"),a=dt(t,"twitter_oauth"),c=dt(t,"discord_oauth"),s=dt(t,"github_oauth"),l=dt(t,"tiktok_oauth"),f=dt(t,"linkedin_oauth"),m=dt(t,"apple_oauth"),v=e.mfa_methods.map(({type:w,verified_at:T})=>({type:w,verifiedAt:De(T)}));return{id:e.id,createdAt:De(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},discord:c&&{subject:c.subject,username:c.username,email:c.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},tiktok:l&&{subject:l.subject,username:l.username},linkedin:f&&{subject:f.subject,name:f.name},apple:m&&{subject:m.subject,email:m.email},mfaMethods:v.map(w=>w.type)}}import{getAddress as Tl}from"@ethersproject/address";import hm from"eventemitter3";var Hs="1.44.0-beta-20231020180147";var sn="4df5e2316331463a9130964bd6078dfa",Gs="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",zs="34357d3c125c2bcf2ce2bc3309d98715",$s="0x4AAAAAAAJFhr_rDU7HKpyw",ln="https://auth.privy.io",Vs=2e4,Ue=1400,qs=2500,Ii=Hs;var qo="privy:token",Wi="privy-token",cn="privy:refresh_token",Ni="privy-refresh-token",js="privy-session",Er="privy:session_transfer_token",Du="privy:wallet",xr="privy:caid",dn=e=>`${Du}:${e}`,Mi="privy:connectors",Li="privy:connections";var Pr=12e4,pt=1,Oi="0x1",pn=3e4,Ks="https://api.moonpay.com/v1",Ys="https://api.moonpay.com/v1",Js="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Qs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Di=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ui=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Uu(){return typeof window<"u"&&window.localStorage?new Ui:new Di}var $=Uu();import{isPossiblePhoneNumber as Fu}from"libphonenumber-js/min";var un=()=>{let e=window;if(!e.ethereum)return!1;if(Tr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Tr(t,!0))return!0}return!1},_r=()=>{let e=window;if(!e.ethereum)return!1;if(Tr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Tr(t,!1))return!0}return!!window.ethereum.isZerion},Tr=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion)return!1;if(e.providers){for(let o of e.providers)if(!Tr(o))return!1}return!0},je=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),mn=()=>{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.isCoinbaseWallet)return!0}return!1};var Zs=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,}))$/),Xs=e=>Fu(String(e),"US"),el=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Vt=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let i=e.slice(0,r+t),a=e.slice(e.length-o,e.length);return`${i}...${a}`},Fi=e=>new Promise(t=>setTimeout(t,e)),tl=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,c=0;for(;!a&&c<r;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),c+=1,await Fi(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},fn=(e,t,o={})=>{let r=new URL(t,e);for(let[n,i]of Object.entries(o))r.searchParams.set(n,i);return r.href};var Bi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Co=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ol(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];un()&&i.push("metamask"),je()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function jo(e){return`eip155:${String(Number(e))}`}var nt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new F(`Unsupported chainId ${e}`,4901);let i;if(o.rpcUrls&&o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+sn:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Gs:i=n.rpcUrls.default?.http[0],!i)throw new F(`No RPC url found for ${e}`);return i},rl=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new F(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import Yu from"@coinbase/wallet-sdk";import{jsx as nl,jsxs as Bu}from"react/jsx-runtime";var ut=({style:e,...t})=>Bu("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:[nl("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),nl("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 yt}from"@ethersproject/address";import{Web3Provider as dl}from"@ethersproject/providers";import{default as ju}from"eventemitter3";import{StaticJsonRpcProvider as al}from"@ethersproject/providers";import qu from"eventemitter3";var Hu=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],il=e=>Hu.includes(e);import{ErrorCode as Gu}from"@ethersproject/logger";var Ko=class extends F{constructor(){super("Wallet timeout");this.type="wallet_error"}},Yo=class extends F{constructor(){super("User rejected connection");this.type="wallet_error"}},ft=e=>{if(e instanceof F)return e;if(e?.code&&e?.reason){let t=new xe(e);return e.code===Gu.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new xe(e):new F("Unknown connector error",e)},mt=class extends ot{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},xe=class extends mt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(i=>i.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},zu={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}},$u={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Vu={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Vu,...$u},At={...zu,...Ae};var oe=class{constructor(t,o){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Ko,o=this.rpcTimeoutDuration)=>new Promise((r,n)=>setTimeout(()=>{n(t)},o));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=o||Pr,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new F(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw ft(o)})}},qt=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},hn=class extends qu{constructor(o,r,n,i,a=1){super();this.walletProxy=o,this.address=r,this.chainId=a,this.rpcConfig=n,this.chains=i,this.provider=new al(nt(a,this.chains,n)),this.rpcTimeoutDuration=Jo(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new qt(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await kt()||!this.address)throw new qt("Disconnected",4900);return(await ll(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new qt(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new qt(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new al(nt(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await sl(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:Co(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Co(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(il(o.method)){let r=await kt();if(await cl(),!r||!this.address)throw new qt("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new qt("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await kt();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},ht=class extends oe{constructor(o){super(o,o.rpcTimeoutDuration)}},jt=class extends oe{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ku=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Fe=class extends ju{constructor(o,r,n,i){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=jo(o),this.walletClientType==="privy"&&$.put(dn(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=Jo(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>yt(i.address)===yt(o));return{address:yt(o),chainId:r,switchChain:async i=>{if(!n)throw new F("Wallet is not currently connected.");let a=this.wallets.find(m=>yt(m.address)===yt(o))?.chainId;if(!a)throw new F("Unable to determine current chainId.");let c,s;if(typeof i=="number"?(c=`0x${i.toString(16)}`,s=i):(c=i,s=Number(i)),a===jo(c))return;let l=this.chains.find(m=>m.id===s);if(!l)throw new F(`Unsupported chainId: ${i}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await f()}catch(m){if(Ku(m,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:l.name,nativeCurrency:l.nativeCurrency,rpcUrls:[l.rpcUrls.public?.http[0]??""],blockExplorerUrls:[l.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&m.message?.includes("wallet_switchEthereumChain")?new F(`Rainbow does not support the chainId ${r}`):m}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new dl(new ht(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new jt(this.proxyProvider)},sign:async i=>{if(!await n())throw new F("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let l=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(l)&&(r=l)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=yt(n),a=[],c;if(this.walletClientType==="privy"){let l=$.get(dn(i));this.chains.find(f=>f.id===Number(l))||($.del(dn(i)),l=null),c=l||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${c} on initialization`)}}else try{let l=await this.proxyProvider.request({method:"eth_chainId"});if(typeof l=="string")c=l;else if(typeof l=="number")c=`0x${l.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(l){console.warn(`Failed to get chainId from provider, defaulting to ${Oi}`,l),c=Oi}let s=jo(c);a.find(l=>yt(l.address)===i)||a.push(this.buildConnectedWallet(yt(n),s)),yn(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>yt(n)===yt(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new dl(new ht(this.proxyProvider)).getSigner().signMessage(o)}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 Ju=e=>{let t=`https://mainnet.infura.io/v3/${sn}`,o=1;return e.makeWeb3Provider(t,o)},gn,vn=class extends Fe{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),gn||(gn=new Yu({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Ju(gn)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){gn.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ut}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{jsx as pl}from"react/jsx-runtime";var Qo=({...e})=>pl("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:pl("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 wn=class extends Fe{constructor(o,r,n,i){super("privy",r,n,i);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Co(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Qo}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as wC}from"@ethersproject/address";import{Web3Provider as bC}from"@ethersproject/providers";import{isMobile as Zu}from"react-device-detect";import{jsx as Be,jsxs as Qu}from"react/jsx-runtime";var we=({style:e,...t})=>Qu("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:[Be("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Be("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Cn=class extends Fe{constructor(o,r,n){super("metamask",o,r,n);this.connectorType="injected";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let i=window,a=i.ethereum,c=i.ethereum.providers||[];for(let s of c)if(s.isMetaMask){a=s;break}this.proxyProvider.setWalletProvider(a),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:we}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!Zu&&un()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{jsx as ul,jsxs as Xu}from"react/jsx-runtime";var Ke=({style:e,...t})=>Xu("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:[ul("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),ul("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 bn=class extends Fe{constructor(o,r,n){super("phantom",o,r,n);this.connectorType="injected";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:Ke}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{EthereumProvider as dm,OPTIONAL_EVENTS as pm,OPTIONAL_METHODS as um}from"@walletconnect/ethereum-provider";import zi from"@walletconnect/qrcode-modal";import{isAndroid as mm,isMobile as fm}from"react-device-detect";import{createContext as tm,useContext as om,useEffect as Hi,useRef as rm,useState as fl}from"react";import{jsx as em}from"react/jsx-runtime";function ml(e){return em("link",{rel:"prefetch",href:e.src})}var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as nm,jsxs as im}from"react/jsx-runtime";var it="LANDING",hl=tm({ready:!1,app:null,currentScreen:it,lastScreen:it,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,outerClickRef:null}),yl=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=fl(e.initialScreen||it),[a,c]=fl(e.initialScreen||it);Hi(()=>{o||i(it)},[o]),Hi(()=>{r||(c(it),i(it))},[r]),Hi(()=>{e.initialScreen&&n===it&&(i(e.initialScreen),c(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===it?e.initialScreen:n,l=rm(null),f={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:m=>{c(n),i(m)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),c(it),i(it)},outerClickRef:l};return im(hl.Provider,{value:f,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&nm(ml,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},b=()=>om(hl);import{jsx as Zo,jsxs as am}from"react/jsx-runtime";var Xo=({style:e,...t})=>{let{app:o}=b();return am("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:o?.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)"})})})]})};import{isAndroid as vl,isDesktop as sm,isMobileOnly as lm}from"react-device-detect";var En=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(wl))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var wl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"3913df81-63c2-4413-d60b-8ff83cbed500",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},Cl=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function Gi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function cm(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Gi(o))}function bl(){return cm(wl)}function El(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function xl(e,t){return vl?e:El(e,Gi(t))}var Pl="WALLETCONNECT_DEEPLINK_CHOICE";function gl(e){let t=e.href.split("?")[0];$.put(Pl,{...e,href:t})}var Sr=(e,t)=>{if(!e||sm){$.del(Pl);return}if(vl){gl({name:"Unknown",href:t||"wc:"});return}else if(lm){let o=El(t||"wc:",Gi(e));gl({name:e?.displayName||"",href:o})}};var Ar=class extends Fe{constructor(o,r,n,i,a){super(a||"unknown",n,i,r);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.createProvider().then(c=>{if(this.provider=c,this.proxyProvider.setWalletProvider(c),this.subscribeListeners(),c.session){if(this.walletProvider.session?.peer.metadata.url){let s=En(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",Sr(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?we:Cl(this.walletEntry.image_id)}:{name:Bi(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||Xo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,Sr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Yo)};this.onQrModalClosed=n,(async()=>{let a="",c=await Promise.race([this.walletProvider.enable(),this.proxyProvider.walletTimeout()]);if(c.length>0&&(a=c[0]),!a||a==="")throw new F("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=En(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Jo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(c),o()})().catch(a=>{if(a){r(ft(a));return}r(new F("Unknown error during connection"))}).finally(()=>zi.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let i=nt(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await dm.init({projectId:this.walletConnectCloudProjectId,chains:[this.defaultChain.id],optionalChains:this.chains.map(n=>n.id),optionalEvents:pm,optionalMethods:um,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(mm)window.open(n,"_self");else if(fm&&this.walletEntry){Sr(this.walletEntry,n);let a=xl(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else zi.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:bl().map(i=>i.name)})}),r.on("connect",()=>{if(zi.close(),r.session?.peer.metadata.url){let n=En(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",Sr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var $i=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Tl(t)).length:!1},Jo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Pr:Pr,kr=class extends hm{constructor(o,r,n,i){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new oe:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||($.get(Mi)&&($.getKeys().forEach(o=>{o.startsWith("walletconnect")&&$.del(o)}),$.del(Mi)),ol().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(mn()||$.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){if(!this.findWalletConnector("embedded","privy")){let a=new hn(o,r,this.rpcConfig,this.chains,n.id),c=new wn(a,this.chains,n,this.rpcConfig);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof Ar&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return je()?new bn(this.chains,this.defaultChain,this.rpcConfig):null;case"metamask":default:return _r()?new Cn(this.chains,this.defaultChain,this.rpcConfig):null}case"coinbase_wallet":return new vn(this.chains,this.defaultChain,this.rpcConfig);case"wallet_connect_v2":return new Ar(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=$.get(Li);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));$.put(Li,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=Tl(o),this.emit("walletsUpdated")}};function yn(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as ym}from"ofetch";var gm=[nn(),an()],vm=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},xn=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Ii,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=ym.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let c=!gm.includes(n.toString());if(!a.has("authorization")&&c){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=vm(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new on}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw Q(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw Q(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw Q(r)}}};import Rr from"js-cookie";function _l(e){return e instanceof go?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof $o?"custom_auth":e instanceof zt?e.meta.provider:null}import*as Sl from"jose";var gt=class{static parse(t){try{return new gt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Sl.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 o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var wm=30,Pn=class{constructor(){this.authenticateOnce=new qe(async t=>this._authenticate(t)),this.linkOnce=new qe(async t=>this._link(t)),this.refreshOnce=new qe(this._refresh.bind(this)),this.destroyOnce=new qe(this._destroy.bind(this)),this.forkSessionOnce=new qe(this._forkSession.bind(this))}get token(){try{let t=$.get(qo);return typeof t=="string"?new gt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=$.get(cn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=$.get(Er);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Rr.get(js);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=gt.parse(this.token);return t!==null&&!t.isExpired(wm)}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:o,refresh_token:r,user:n,is_new_user:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=_l(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:rt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Oe(o)}}async _link(t){try{let o=await t.link();return rt(o)}catch(o){throw console.warn("Error linking account"),Oe(o)}}async _refresh(){if(!this.api)throw new g("Session has no API instance");if(!this.client)throw new g("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(nn(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(an(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),rt(n.user)}catch(n){if(n instanceof zo&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Oe(n)}}async _destroy(){try{await this.api?.post(vs(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new g("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ws(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Oe(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if($.put(qo,t),!this.client?.useServerCookies){let o=gt.parse(t)?.expiration;Rr.set(Wi,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else $.del(qo),Rr.remove(Wi)}storeRefreshToken(t){typeof t=="string"?($.put(cn,t),this.client?.useServerCookies||Rr.set(Ni,t,{sameSite:"Strict",secure:!0,expires:30})):($.del(cn),Rr.remove(Ni))}clearForkedToken(){$.del(Er)}};var Vi,Tn,Al,Ir=class{constructor(t){ys(this,Tn);this.apiUrl=t.apiUrl||ln,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Vs,this.appId=t.appId,this.clientAnalyticsId=gs(this,Tn,Al).call(this),Vi||(Vi=new Pn),this.session=Vi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n){this.connectors||(this.connectors=new kr(t,o,r,n))}generateApi(){let t=new xn(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 g("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new g("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Ns(),{address:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkPhone(t){try{let o=await this.api.post(Ms(),{phoneNumber:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkWallet(t){try{let o=await this.api.post(Ws(),{address:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(Ls(),{provider:t,subject:o});return rt(r)}catch(r){throw Oe(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Os(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Ds(),t)}catch(o){throw Oe(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?gt.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,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,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,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw Oe(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async forkSession(){return await this.session.forkSession()}};Tn=new WeakSet,Al=function(){if(typeof window>"u")return null;try{let o=$.get(xr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Cm();try{return $.put(xr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as tv,clearAllBodyScrollLocks as ov}from"body-scroll-lock";import{useRef as rv,useCallback as nv}from"react";import{useEffect as qp}from"react";import iv from"react-dom";import as from"styled-components";import{createContext as bm,useContext as Em}from"react";var qi=bm({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],clientAnalyticsId:null,nativeTokenSymbolForChainId:E,captchaData:{enabled:!1,ready:!1,execute:E,remove:E,token:void 0,error:void 0},initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,resendEmailCode:E,resendSmsCode:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E}),A=()=>Em(qi);import{createContext as xm,useContext as Pm}from"react";var He=xm({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,linkEmail:E,linkPhone:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,initEnroll:E,init:E,submitEnroll:E,submit:E,sendTransaction:E,exportWallet:E,setWalletPassword:E}),V=()=>Pm(He);import ea from"styled-components";import Yt,{css as Ji}from"styled-components";import Ki from"styled-components";import{Fragment as _m,jsx as ji,jsxs as Sm}from"react/jsx-runtime";var _n=({success:e,fail:t})=>Sm(_m,{children:[ji(bo,{className:e?"success":t?"fail":""}),ji(Yi,{className:e?"success":t?"fail":""})]}),bo=Ki.span`
12
+ - https://privy.io`;this.getNonceOnce=new qe(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new g("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(bs(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw Q(t)}}async link(){if(!this.api)throw new g("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Es(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw Q(t)}}async sign(){if(!this.api)throw new g("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new g("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 g("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Cs(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new g("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",c=new Date().toISOString();return this.createSiweMessage(t,o,n,i,c,r,a)}};var wo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new g("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new g("phone number and sms code must be set prior to calling authenticate.");try{let t=Ss(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw Q(t)}}async link(){if(!this.api)throw new g("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new g("phone number and sms code must be set prior to calling authenticate.");try{let t=As();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw Q(t)}}async sendSmsCode(t,o){if(!this.api)throw new g("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new g("phone nNumber must be set when initialzing authentication.");try{let r=_s();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw Q(r)}}};import{v4 as Cm}from"uuid";function De(e){return new Date(e*1e3)}function Mu(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:De(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let i={address:o.address,type:o.type,verifiedAt:De(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:De(o.verified_at)};t.push(a);break;case"google_oauth":let c={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:De(o.verified_at)};t.push(c);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:De(o.verified_at)};t.push(s);break;case"discord_oauth":let l={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(l);break;case"github_oauth":let f={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(f);break;case"tiktok_oauth":let m={subject:o.subject,username:o.username,type:o.type,verifiedAt:De(o.verified_at)};t.push(m);break;case"linkedin_oauth":let v={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(v);break;case"apple_oauth":let y={subject:o.subject,email:o.email,type:o.type,verifiedAt:De(o.verified_at)};t.push(y);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:De(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function dt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var te=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Lu=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),$t=(e,t)=>t==="all-users"&&!te(e)||t==="users-without-wallets"&&!Lu(e)?.length;function rt(e){if(!e)return null;let t=Mu(e.linked_accounts),o=dt(t,"wallet"),r=dt(t,"email"),n=dt(t,"phone"),i=dt(t,"google_oauth"),a=dt(t,"twitter_oauth"),c=dt(t,"discord_oauth"),s=dt(t,"github_oauth"),l=dt(t,"tiktok_oauth"),f=dt(t,"linkedin_oauth"),m=dt(t,"apple_oauth"),v=e.mfa_methods.map(({type:C,verified_at:T})=>({type:C,verifiedAt:De(T)}));return{id:e.id,createdAt:De(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},discord:c&&{subject:c.subject,username:c.username,email:c.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},tiktok:l&&{subject:l.subject,username:l.username},linkedin:f&&{subject:f.subject,name:f.name},apple:m&&{subject:m.subject,email:m.email},mfaMethods:v.map(C=>C.type)}}import{getAddress as Tl}from"@ethersproject/address";import hm from"eventemitter3";var Hs="1.44.0-beta-20231020181624";var sn="4df5e2316331463a9130964bd6078dfa",Gs="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",zs="34357d3c125c2bcf2ce2bc3309d98715",$s="0x4AAAAAAAJFhr_rDU7HKpyw",ln="https://auth.privy.io",Vs=2e4,Ue=1400,qs=2500,Ii=Hs;var qo="privy:token",Wi="privy-token",cn="privy:refresh_token",Ni="privy-refresh-token",js="privy-session",Er="privy:session_transfer_token",Du="privy:wallet",xr="privy:caid",dn=e=>`${Du}:${e}`,Mi="privy:connectors",Li="privy:connections";var Pr=12e4,pt=1,Oi="0x1",pn=3e4,Ks="https://api.moonpay.com/v1",Ys="https://api.moonpay.com/v1",Js="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Qs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Di=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ui=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Uu(){return typeof window<"u"&&window.localStorage?new Ui:new Di}var $=Uu();import{isPossiblePhoneNumber as Fu}from"libphonenumber-js/min";var un=()=>{let e=window;if(!e.ethereum)return!1;if(Tr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Tr(t,!0))return!0}return!1},_r=()=>{let e=window;if(!e.ethereum)return!1;if(Tr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Tr(t,!1))return!0}return!!window.ethereum.isZerion},Tr=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion)return!1;if(e.providers){for(let o of e.providers)if(!Tr(o))return!1}return!0},je=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),mn=()=>{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.isCoinbaseWallet)return!0}return!1};var Zs=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,}))$/),Xs=e=>Fu(String(e),"US"),el=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Vt=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let i=e.slice(0,r+t),a=e.slice(e.length-o,e.length);return`${i}...${a}`},Fi=e=>new Promise(t=>setTimeout(t,e)),tl=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,c=0;for(;!a&&c<r;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),c+=1,await Fi(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},fn=(e,t,o={})=>{let r=new URL(t,e);for(let[n,i]of Object.entries(o))r.searchParams.set(n,i);return r.href};var Bi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Co=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ol(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];un()&&i.push("metamask"),je()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function jo(e){return`eip155:${String(Number(e))}`}var nt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new F(`Unsupported chainId ${e}`,4901);let i;if(o.rpcUrls&&o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+sn:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Gs:i=n.rpcUrls.default?.http[0],!i)throw new F(`No RPC url found for ${e}`);return i},rl=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new F(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import Yu from"@coinbase/wallet-sdk";import{jsx as nl,jsxs as Bu}from"react/jsx-runtime";var ut=({style:e,...t})=>Bu("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:[nl("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),nl("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 yt}from"@ethersproject/address";import{Web3Provider as dl}from"@ethersproject/providers";import{default as ju}from"eventemitter3";import{StaticJsonRpcProvider as al}from"@ethersproject/providers";import qu from"eventemitter3";var Hu=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],il=e=>Hu.includes(e);import{ErrorCode as Gu}from"@ethersproject/logger";var Ko=class extends F{constructor(){super("Wallet timeout");this.type="wallet_error"}},Yo=class extends F{constructor(){super("User rejected connection");this.type="wallet_error"}},ft=e=>{if(e instanceof F)return e;if(e?.code&&e?.reason){let t=new xe(e);return e.code===Gu.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new xe(e):new F("Unknown connector error",e)},mt=class extends ot{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},xe=class extends mt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(i=>i.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},zu={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}},$u={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Vu={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Vu,...$u},At={...zu,...Ae};var oe=class{constructor(t,o){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Ko,o=this.rpcTimeoutDuration)=>new Promise((r,n)=>setTimeout(()=>{n(t)},o));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=o||Pr,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new F(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw ft(o)})}},qt=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},hn=class extends qu{constructor(o,r,n,i,a=1){super();this.walletProxy=o,this.address=r,this.chainId=a,this.rpcConfig=n,this.chains=i,this.provider=new al(nt(a,this.chains,n)),this.rpcTimeoutDuration=Jo(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new qt(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await kt()||!this.address)throw new qt("Disconnected",4900);return(await ll(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new qt(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new qt(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new al(nt(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await sl(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:Co(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Co(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(il(o.method)){let r=await kt();if(await cl(),!r||!this.address)throw new qt("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new qt("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await kt();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},ht=class extends oe{constructor(o){super(o,o.rpcTimeoutDuration)}},jt=class extends oe{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ku=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Fe=class extends ju{constructor(o,r,n,i){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=jo(o),this.walletClientType==="privy"&&$.put(dn(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=Jo(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>yt(i.address)===yt(o));return{address:yt(o),chainId:r,switchChain:async i=>{if(!n)throw new F("Wallet is not currently connected.");let a=this.wallets.find(m=>yt(m.address)===yt(o))?.chainId;if(!a)throw new F("Unable to determine current chainId.");let c,s;if(typeof i=="number"?(c=`0x${i.toString(16)}`,s=i):(c=i,s=Number(i)),a===jo(c))return;let l=this.chains.find(m=>m.id===s);if(!l)throw new F(`Unsupported chainId: ${i}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await f()}catch(m){if(Ku(m,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:l.name,nativeCurrency:l.nativeCurrency,rpcUrls:[l.rpcUrls.public?.http[0]??""],blockExplorerUrls:[l.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&m.message?.includes("wallet_switchEthereumChain")?new F(`Rainbow does not support the chainId ${r}`):m}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new dl(new ht(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new jt(this.proxyProvider)},sign:async i=>{if(!await n())throw new F("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let l=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(l)&&(r=l)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=yt(n),a=[],c;if(this.walletClientType==="privy"){let l=$.get(dn(i));this.chains.find(f=>f.id===Number(l))||($.del(dn(i)),l=null),c=l||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${c} on initialization`)}}else try{let l=await this.proxyProvider.request({method:"eth_chainId"});if(typeof l=="string")c=l;else if(typeof l=="number")c=`0x${l.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(l){console.warn(`Failed to get chainId from provider, defaulting to ${Oi}`,l),c=Oi}let s=jo(c);a.find(l=>yt(l.address)===i)||a.push(this.buildConnectedWallet(yt(n),s)),yn(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>yt(n)===yt(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new dl(new ht(this.proxyProvider)).getSigner().signMessage(o)}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 Ju=e=>{let t=`https://mainnet.infura.io/v3/${sn}`,o=1;return e.makeWeb3Provider(t,o)},gn,vn=class extends Fe{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),gn||(gn=new Yu({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Ju(gn)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){gn.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ut}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{jsx as pl}from"react/jsx-runtime";var Qo=({...e})=>pl("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:pl("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 wn=class extends Fe{constructor(o,r,n,i){super("privy",r,n,i);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Co(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Qo}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as wC}from"@ethersproject/address";import{Web3Provider as bC}from"@ethersproject/providers";import{isMobile as Zu}from"react-device-detect";import{jsx as Be,jsxs as Qu}from"react/jsx-runtime";var we=({style:e,...t})=>Qu("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:[Be("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Be("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Cn=class extends Fe{constructor(o,r,n){super("metamask",o,r,n);this.connectorType="injected";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let i=window,a=i.ethereum,c=i.ethereum.providers||[];for(let s of c)if(s.isMetaMask){a=s;break}this.proxyProvider.setWalletProvider(a),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:we}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!Zu&&un()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{jsx as ul,jsxs as Xu}from"react/jsx-runtime";var Ke=({style:e,...t})=>Xu("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:[ul("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),ul("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 bn=class extends Fe{constructor(o,r,n){super("phantom",o,r,n);this.connectorType="injected";this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:Ke}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ft(o)}}};import{EthereumProvider as dm,OPTIONAL_EVENTS as pm,OPTIONAL_METHODS as um}from"@walletconnect/ethereum-provider";import zi from"@walletconnect/qrcode-modal";import{isAndroid as mm,isMobile as fm}from"react-device-detect";import{createContext as tm,useContext as om,useEffect as Hi,useRef as rm,useState as fl}from"react";import{jsx as em}from"react/jsx-runtime";function ml(e){return em("link",{rel:"prefetch",href:e.src})}var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as nm,jsxs as im}from"react/jsx-runtime";var it="LANDING",hl=tm({ready:!1,app:null,currentScreen:it,lastScreen:it,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,outerClickRef:null}),yl=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=fl(e.initialScreen||it),[a,c]=fl(e.initialScreen||it);Hi(()=>{o||i(it)},[o]),Hi(()=>{r||(c(it),i(it))},[r]),Hi(()=>{e.initialScreen&&n===it&&(i(e.initialScreen),c(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===it?e.initialScreen:n,l=rm(null),f={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:m=>{c(n),i(m)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),c(it),i(it)},outerClickRef:l};return im(hl.Provider,{value:f,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&nm(ml,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},b=()=>om(hl);import{jsx as Zo,jsxs as am}from"react/jsx-runtime";var Xo=({style:e,...t})=>{let{app:o}=b();return am("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:o?.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)"})})})]})};import{isAndroid as vl,isDesktop as sm,isMobileOnly as lm}from"react-device-detect";var En=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(wl))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var wl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"3913df81-63c2-4413-d60b-8ff83cbed500",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},Cl=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function Gi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function cm(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Gi(o))}function bl(){return cm(wl)}function El(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function xl(e,t){return vl?e:El(e,Gi(t))}var Pl="WALLETCONNECT_DEEPLINK_CHOICE";function gl(e){let t=e.href.split("?")[0];$.put(Pl,{...e,href:t})}var Sr=(e,t)=>{if(!e||sm){$.del(Pl);return}if(vl){gl({name:"Unknown",href:t||"wc:"});return}else if(lm){let o=El(t||"wc:",Gi(e));gl({name:e?.displayName||"",href:o})}};var Ar=class extends Fe{constructor(o,r,n,i,a){super(a||"unknown",n,i,r);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new oe(void 0,this.rpcTimeoutDuration),this.createProvider().then(c=>{if(this.provider=c,this.proxyProvider.setWalletProvider(c),this.subscribeListeners(),c.session){if(this.walletProvider.session?.peer.metadata.url){let s=En(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",Sr(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?we:Cl(this.walletEntry.image_id)}:{name:Bi(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||Xo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,Sr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Yo)};this.onQrModalClosed=n,(async()=>{let a="",c=await Promise.race([this.walletProvider.enable(),this.proxyProvider.walletTimeout()]);if(c.length>0&&(a=c[0]),!a||a==="")throw new F("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=En(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Jo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(c),o()})().catch(a=>{if(a){r(ft(a));return}r(new F("Unknown error during connection"))}).finally(()=>zi.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let i=nt(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await dm.init({projectId:this.walletConnectCloudProjectId,chains:[this.defaultChain.id],optionalChains:this.chains.map(n=>n.id),optionalEvents:pm,optionalMethods:um,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(mm)window.open(n,"_self");else if(fm&&this.walletEntry){Sr(this.walletEntry,n);let a=xl(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else zi.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:bl().map(i=>i.name)})}),r.on("connect",()=>{if(zi.close(),r.session?.peer.metadata.url){let n=En(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",Sr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var $i=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Tl(t)).length:!1},Jo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Pr:Pr,kr=class extends hm{constructor(o,r,n,i){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new oe:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||($.get(Mi)&&($.getKeys().forEach(o=>{o.startsWith("walletconnect")&&$.del(o)}),$.del(Mi)),ol().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(mn()||$.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){if(!this.findWalletConnector("embedded","privy")){let a=new hn(o,r,this.rpcConfig,this.chains,n.id),c=new wn(a,this.chains,n,this.rpcConfig);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof Ar&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return je()?new bn(this.chains,this.defaultChain,this.rpcConfig):null;case"metamask":default:return _r()?new Cn(this.chains,this.defaultChain,this.rpcConfig):null}case"coinbase_wallet":return new vn(this.chains,this.defaultChain,this.rpcConfig);case"wallet_connect_v2":return new Ar(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=$.get(Li);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));$.put(Li,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=Tl(o),this.emit("walletsUpdated")}};function yn(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as ym}from"ofetch";var gm=[nn(),an()],vm=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},xn=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Ii,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=ym.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let c=!gm.includes(n.toString());if(!a.has("authorization")&&c){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=vm(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new on}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw Q(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw Q(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw Q(r)}}};import Rr from"js-cookie";function _l(e){return e instanceof go?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof $o?"custom_auth":e instanceof zt?e.meta.provider:null}import*as Sl from"jose";var gt=class{static parse(t){try{return new gt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Sl.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 o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var wm=30,Pn=class{constructor(){this.authenticateOnce=new qe(async t=>this._authenticate(t)),this.linkOnce=new qe(async t=>this._link(t)),this.refreshOnce=new qe(this._refresh.bind(this)),this.destroyOnce=new qe(this._destroy.bind(this)),this.forkSessionOnce=new qe(this._forkSession.bind(this))}get token(){try{let t=$.get(qo);return typeof t=="string"?new gt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=$.get(cn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=$.get(Er);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Rr.get(js);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=gt.parse(this.token);return t!==null&&!t.isExpired(wm)}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:o,refresh_token:r,user:n,is_new_user:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=_l(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:rt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Oe(o)}}async _link(t){try{let o=await t.link();return rt(o)}catch(o){throw console.warn("Error linking account"),Oe(o)}}async _refresh(){if(!this.api)throw new g("Session has no API instance");if(!this.client)throw new g("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(nn(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(an(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),rt(n.user)}catch(n){if(n instanceof zo&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Oe(n)}}async _destroy(){try{await this.api?.post(vs(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new g("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ws(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Oe(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if($.put(qo,t),!this.client?.useServerCookies){let o=gt.parse(t)?.expiration;Rr.set(Wi,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else $.del(qo),Rr.remove(Wi)}storeRefreshToken(t){typeof t=="string"?($.put(cn,t),this.client?.useServerCookies||Rr.set(Ni,t,{sameSite:"Strict",secure:!0,expires:30})):($.del(cn),Rr.remove(Ni))}clearForkedToken(){$.del(Er)}};var Vi,Tn,Al,Ir=class{constructor(t){ys(this,Tn);this.apiUrl=t.apiUrl||ln,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Vs,this.appId=t.appId,this.clientAnalyticsId=gs(this,Tn,Al).call(this),Vi||(Vi=new Pn),this.session=Vi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n){this.connectors||(this.connectors=new kr(t,o,r,n))}generateApi(){let t=new xn(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 g("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new g("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Ns(),{address:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkPhone(t){try{let o=await this.api.post(Ms(),{phoneNumber:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkWallet(t){try{let o=await this.api.post(Ws(),{address:t});return rt(o)}catch(o){throw Oe(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(Ls(),{provider:t,subject:o});return rt(r)}catch(r){throw Oe(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Os(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Ds(),t)}catch(o){throw Oe(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?gt.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,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,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,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw Oe(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async forkSession(){return await this.session.forkSession()}};Tn=new WeakSet,Al=function(){if(typeof window>"u")return null;try{let o=$.get(xr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Cm();try{return $.put(xr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as tv,clearAllBodyScrollLocks as ov}from"body-scroll-lock";import{useRef as rv,useCallback as nv}from"react";import{useEffect as qp}from"react";import iv from"react-dom";import as from"styled-components";import{createContext as bm,useContext as Em}from"react";var qi=bm({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],clientAnalyticsId:null,nativeTokenSymbolForChainId:E,captchaData:{enabled:!1,ready:!1,execute:E,remove:E,token:void 0,error:void 0},initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,resendEmailCode:E,resendSmsCode:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E}),A=()=>Em(qi);import{createContext as xm,useContext as Pm}from"react";var He=xm({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,linkEmail:E,linkPhone:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,initEnroll:E,init:E,submitEnroll:E,submit:E,sendTransaction:E,exportWallet:E,setWalletPassword:E}),V=()=>Pm(He);import ea from"styled-components";import Yt,{css as Ji}from"styled-components";import Ki from"styled-components";import{Fragment as _m,jsx as ji,jsxs as Sm}from"react/jsx-runtime";var _n=({success:e,fail:t})=>Sm(_m,{children:[ji(bo,{className:e?"success":t?"fail":""}),ji(Yi,{className:e?"success":t?"fail":""})]}),bo=Ki.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -315,7 +315,7 @@ Resources:
315
315
  }
316
316
  `,S=Ye.div`
317
317
  height: 16px;
318
- `,I=Ye.div`
318
+ `,W=Ye.div`
319
319
  height: 12px;
320
320
  `,Nl=Ye.div`
321
321
  position: relative;
@@ -336,7 +336,7 @@ Resources:
336
336
  && > a {
337
337
  color: var(--privy-color-accent);
338
338
  }
339
- `;function Nn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o}}=e.app,r=!!t,n=!!o,i=r&&n;return!r&&!n?null:Ol(Im,{children:["By logging in I agree to the"," ",n&&er("a",{href:o,target:"_blank",children:i?"Terms":"Terms of Service"}),i&&" & ",r&&er("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var D=({protectedByPrivy:e})=>er(X,{children:e?Ol(Wm,{children:[er(Qo,{className:"hide-on-mobile"}),er("span",{className:"hide-on-mobile",children:er("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),X=Ll.div`
339
+ `;function Nn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o}}=e.app,r=!!t,n=!!o,i=r&&n;return!r&&!n?null:Ol(Im,{children:["By logging in I agree to the"," ",n&&er("a",{href:o,target:"_blank",children:i?"Terms":"Terms of Service"}),i&&" & ",r&&er("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var O=({protectedByPrivy:e})=>er(X,{children:e?Ol(Wm,{children:[er(Qo,{className:"hide-on-mobile"}),er("span",{className:"hide-on-mobile",children:er("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),X=Ll.div`
340
340
  display: flex;
341
341
  align-items: center;
342
342
  justify-content: center;
@@ -494,7 +494,7 @@ Resources:
494
494
  h3 {
495
495
  margin-bottom: 24px;
496
496
  }
497
- `;import{Fragment as oa,jsx as pe,jsxs as Zt}from"react/jsx-runtime";var ra=6,Vl=new Array(ra).fill(""),Km=1400;var jl=()=>{let{app:e,navigate:t,setModalData:o}=b(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:c,updateWallets:s}=A(),{authenticated:l,user:f}=V(),[m,v]=Ln(Vl),[y,w]=Ln(!1),[T,_]=Ln(null),[x,C]=Ln(null),W=a()?.email?0:1,M=e?.render.inDialog?Ue:0,k=e?.render.inDialog?M-500:0;$l(()=>{if(l&&y&&f)if($t(f,e?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Z=>console.error(Z),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(H)}else{s();let H=setTimeout(r,M);return()=>clearTimeout(H)}},[l,y,f]),$l(()=>{if(T&&x===0){let Y=setTimeout(()=>{v(Vl),_(null),document.querySelector("input[name=code-0]")?.focus()},Km);return()=>clearTimeout(Y)}},[T]);let L=Y=>{let H=Y.currentTarget.value.replace(" ","");if(H==="")return;if(isNaN(Number(H))){_("Code should be numeric"),C(1);return}_(null),C(null);let Z=Number(Y.currentTarget.name?.charAt(5)),N=[...H||[""]].slice(0,ra-Z),We=[...m.slice(0,Z),...N,...m.slice(Z+N.length)];v(We);let G=N.length,q=Math.min(Math.max(Z+G,0),ra-1);isNaN(Number(Y.currentTarget.value))||document.querySelector(`input[name=code-${q}]`)?.focus(),We.every(Ce=>Ce&&!isNaN(+Ce))&&(document.querySelector(`input[name=code-${q}]`)?.blur(),c(We.join("")).then(()=>w(!0)).catch(le=>{le?.status===422?_("Invalid or expired verification code"):_("Issue verifying code"),C(0)})),Y.preventDefault()},U=Y=>{x===1&&(_(null),C(null));let H=[...m.slice(0,Y),"",...m.slice(Y+1)];v(H),Y>0&&document.querySelector(`input[name=code-${Y-1}]`)?.focus()},se=W==0?pe(Vm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):pe(qm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),B=W==0?Zt("p",{children:["Please check ",pe(ql,{children:a()?.email})," for an email from privy.io and enter your code below."]}):Zt("p",{children:["Please check ",pe(ql,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Zt(oa,{children:[pe(P,{},"header"),pe(S,{}),Zt(Ym,{children:[pe(he,{title:"Enter confirmation code",description:B,icon:se}),Zt(Il,{children:[Zt(Jm,{children:[pe(Qm,{fail:!!T,success:y,children:pe("span",{children:T||(y?"Success!":"")})}),pe("div",{children:m.map((Y,H)=>pe("input",{name:`code-${H}`,type:"text",value:m[H],onChange:L,onKeyUp:Z=>{Z.key==="Backspace"&&U(H)},inputMode:"numeric",autoFocus:H===0,pattern:"[0-9]",className:`${y?"success":""} ${T?"fail":""}`,autoComplete:jm?"one-time-code":"off"},H))})]}),pe(Zm,{children:W==0?Zt(oa,{children:[pe("span",{children:"Didn't get an email?"}),pe("button",{onClick:n,children:"Resend Code"})]}):Zt(oa,{children:[pe("span",{children:"Didn't get a message?"}),pe("button",{onClick:i,children:"Resend Code"})]})})]})]}),pe(I,{}),pe(D,{protectedByPrivy:!0})]})},Ym=Nr.div`
497
+ `;import{Fragment as oa,jsx as pe,jsxs as Zt}from"react/jsx-runtime";var ra=6,Vl=new Array(ra).fill(""),Km=1400;var jl=()=>{let{app:e,navigate:t,setModalData:o}=b(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:c,updateWallets:s}=A(),{authenticated:l,user:f}=V(),[m,v]=Ln(Vl),[y,C]=Ln(!1),[T,_]=Ln(null),[x,w]=Ln(null),D=a()?.email?0:1,I=e?.render.inDialog?Ue:0,k=e?.render.inDialog?I-500:0;$l(()=>{if(l&&y&&f)if($t(f,e?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Z=>console.error(Z),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(H)}else{s();let H=setTimeout(r,I);return()=>clearTimeout(H)}},[l,y,f]),$l(()=>{if(T&&x===0){let Y=setTimeout(()=>{v(Vl),_(null),document.querySelector("input[name=code-0]")?.focus()},Km);return()=>clearTimeout(Y)}},[T]);let M=Y=>{let H=Y.currentTarget.value.replace(" ","");if(H==="")return;if(isNaN(Number(H))){_("Code should be numeric"),w(1);return}_(null),w(null);let Z=Number(Y.currentTarget.name?.charAt(5)),N=[...H||[""]].slice(0,ra-Z),We=[...m.slice(0,Z),...N,...m.slice(Z+N.length)];v(We);let G=N.length,q=Math.min(Math.max(Z+G,0),ra-1);isNaN(Number(Y.currentTarget.value))||document.querySelector(`input[name=code-${q}]`)?.focus(),We.every(Ce=>Ce&&!isNaN(+Ce))&&(document.querySelector(`input[name=code-${q}]`)?.blur(),c(We.join("")).then(()=>C(!0)).catch(le=>{le?.status===422?_("Invalid or expired verification code"):_("Issue verifying code"),w(0)})),Y.preventDefault()},U=Y=>{x===1&&(_(null),w(null));let H=[...m.slice(0,Y),"",...m.slice(Y+1)];v(H),Y>0&&document.querySelector(`input[name=code-${Y-1}]`)?.focus()},se=D==0?pe(Vm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):pe(qm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),B=D==0?Zt("p",{children:["Please check ",pe(ql,{children:a()?.email})," for an email from privy.io and enter your code below."]}):Zt("p",{children:["Please check ",pe(ql,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Zt(oa,{children:[pe(P,{},"header"),pe(S,{}),Zt(Ym,{children:[pe(he,{title:"Enter confirmation code",description:B,icon:se}),Zt(Il,{children:[Zt(Jm,{children:[pe(Qm,{fail:!!T,success:y,children:pe("span",{children:T||(y?"Success!":"")})}),pe("div",{children:m.map((Y,H)=>pe("input",{name:`code-${H}`,type:"text",value:m[H],onChange:M,onKeyUp:Z=>{Z.key==="Backspace"&&U(H)},inputMode:"numeric",autoFocus:H===0,pattern:"[0-9]",className:`${y?"success":""} ${T?"fail":""}`,autoComplete:jm?"one-time-code":"off"},H))})]}),pe(Zm,{children:D==0?Zt(oa,{children:[pe("span",{children:"Didn't get an email?"}),pe("button",{onClick:n,children:"Resend Code"})]}):Zt(oa,{children:[pe("span",{children:"Didn't get a message?"}),pe("button",{onClick:i,children:"Resend Code"})]})})]})]}),pe(W,{}),pe(O,{protectedByPrivy:!0})]})},Ym=Nr.div`
498
498
  display: flex;
499
499
  flex-direction: column;
500
500
  align-items: flex-start;
@@ -657,7 +657,7 @@ Resources:
657
657
  @media (max-width: 440px) {
658
658
  margin-top: 4px;
659
659
  }
660
- `;import{Fragment as nf,jsx as Eo,jsxs as Ql}from"react/jsx-runtime";var Zl=()=>{let{app:e}=b(),t=`Connect a wallet to ${e?.name}`;return Ql(nf,{children:[Eo(P,{},"header"),Eo(S,{}),Eo(Qt,{title:"Connect your wallet",description:t}),Ql(de,{children:[Eo(Xt,{connectOnly:!0}),Eo(eo,{})]}),Eo(I,{}),Eo(D,{protectedByPrivy:!0})]})};import ia from"styled-components";import af from"react";import{jsx as Xl}from"react/jsx-runtime";var Dn=()=>{let{app:e}=b(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?Xl("div",{children:Xl("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?af.cloneElement(t,{height:n,width:i,alt:o,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{Fragment as df,jsx as It,jsxs as ec}from"react/jsx-runtime";var tc=()=>{let{app:e}=b();return ec(df,{children:[It(P,{},"header"),e?.appearance.logo?It(cf,{children:It(Dn,{})}):null,ec(lf,{children:[It(sf,{children:It("h4",{children:"Connect Wallet"})}),It(Xt,{connectOnly:!0}),It(eo,{})]}),e&&It(Nn,{app:e}),It(D,{protectedByPrivy:!0})]})},sf=ia.div`
660
+ `;import{Fragment as nf,jsx as Eo,jsxs as Ql}from"react/jsx-runtime";var Zl=()=>{let{app:e}=b(),t=`Connect a wallet to ${e?.name}`;return Ql(nf,{children:[Eo(P,{},"header"),Eo(S,{}),Eo(Qt,{title:"Connect your wallet",description:t}),Ql(de,{children:[Eo(Xt,{connectOnly:!0}),Eo(eo,{})]}),Eo(W,{}),Eo(O,{protectedByPrivy:!0})]})};import ia from"styled-components";import af from"react";import{jsx as Xl}from"react/jsx-runtime";var Dn=()=>{let{app:e}=b(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?Xl("div",{children:Xl("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?af.cloneElement(t,{height:n,width:i,alt:o,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{Fragment as df,jsx as It,jsxs as ec}from"react/jsx-runtime";var tc=()=>{let{app:e}=b();return ec(df,{children:[It(P,{},"header"),e?.appearance.logo?It(cf,{children:It(Dn,{})}):null,ec(lf,{children:[It(sf,{children:It("h4",{children:"Connect Wallet"})}),It(Xt,{connectOnly:!0}),It(eo,{})]}),e&&It(Nn,{app:e}),It(O,{protectedByPrivy:!0})]})},sf=ia.div`
661
661
  font-weight: 600;
662
662
  color: 'var(--privy-color-foreground)';
663
663
  display: flex;
@@ -693,7 +693,7 @@ Resources:
693
693
  @media (max-width: 440px) {
694
694
  padding: 10px 10px 20px;
695
695
  }
696
- `;import{useEffect as ic,useState as ac}from"react";import mf from"styled-components";import{useEffect as aa,useState as Mr}from"react";import{isMobile as sa}from"react-device-detect";import oc from"styled-components";import{Fragment as nc,jsx as ye,jsxs as Fn}from"react/jsx-runtime";var Un=2,Lr={metamask:{name:"MetaMask",component:we},phantom:{name:"Phantom",component:Ke},coinbase_wallet:{name:"Coinbase Wallet",component:ut},wallet_connect:{name:"WalletConnect",component:Xo},embedded:{name:"Privy Wallet",component:Qo}},la=e=>e?.privyErrorCode==="linked_to_another_user"?At.ERROR_USER_EXISTS:e instanceof xe&&!e.details.default?e.details:e instanceof Ko?At.ERROR_TIMED_OUT:e instanceof Yo?At.ERROR_USER_REJECTED_CONNECTION:At.ERROR_WALLET_CONNECTION,rc=()=>{let[e,t]=Mr(!1),[o,r]=Mr(!1),[n,i]=Mr(void 0),{app:a,navigate:c,navigateBack:s,lastScreen:l,currentScreen:f,setModalData:m}=b(),{getAuthFlow:v,walletConnectionStatus:y,closePrivyModal:w,loginWithWallet:T,updateWallets:_}=A(),{walletConnectors:x}=V(),[C,W]=Mr(0),{user:M}=V(),[k]=Mr(M?.linkedAccounts.length||0),L=sa&&y?.connector?.connectorType==="wallet_connect_v2"||sa&&y?.connector?.connectorType==="coinbase_wallet"||sa&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",U=y?.status==="connected",se=y?.status==="switching_to_supported_chain";aa(()=>{let z=v();if(z&&L&&U&&!z.preparedMessage){z.buildSiweMessage();return}!z||L||!U||(async()=>{r(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Fi(2500),await Y()}catch(et){console.warn("Auto-prompted signature failed",et)}finally{r(!1)}})()},[C,U]),aa(()=>{if(M&&e){let z;if($t(M,a?.embeddedWallets?.createOnLogin)){let et=a?.render.inDialog?Ue:0,be=a?.render.inDialog?et-500:0;z=setTimeout(()=>{m({createWallet:{onSuccess:()=>{},onFailure:Uo=>console.error(Uo),callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},be)}else _(),z=setTimeout(w,Ue);return()=>clearTimeout(z)}},[M,e]);let B=z=>{if(z?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}i(la(z))};async function Y(){try{if(await T(),!a?.render.inDialog)return w();t(!0)}catch(z){B(z)}finally{r(!1)}}aa(()=>{y?.connectError&&B(y?.connectError)},[y]);let H=y?.connector?.connectorType||"metamask",Z=y?.connector?.walletClientType||"metamask",N=y?.connector?.walletBranding.name||Lr[Z]?.name||"MetaMask",We=y?.connector?.walletBranding.icon||Lr[Z]?.component||(z=>ye(we,{...z})),G;e?G=`Successfully connected with ${N}`:n?G=n.message:se?G="Switching networks":U?G=o&&L?"Signing":"Sign to verify":G=`Waiting for ${N}`;let q="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let z=M?.linkedAccounts.length||0;k===z?q="Wallet was already linked.":q="You\u2019re good to go!"}else C>=Un&&n?q="Unable to connect wallet":n?q=n.detail:se?q="Switch your wallet to the requested network.":U&&L?q="Sign the message in your wallet to verify it belongs to you.":Z==="metamask"?q="For the best experience, connect only one wallet at a time.":H==="wallet_connect"?q="Open your mobile wallet app to continue":H==="coinbase_wallet"&&(mn()||($i(M)?q="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":q="Open the Coinbase app on your phone to continue."));let Ce=x?.walletConnectors?.find(z=>z.walletClientType==="coinbase_wallet"),le=Z==="coinbase_wallet"&&($i(M)||n===At.ERROR_USER_EXISTS);return Fn(nc,{children:[ye(P,{backFn:f===l?void 0:s}),ye(S,{}),Fn(pf,{children:[ye(ca,{walletLogo:We,success:e,fail:!!n}),Fn(Jt,{children:[ye("h3",{children:G}),ye("p",{children:q})]}),ye(In,{children:le?ye(fe,{onClick:()=>Ce&&Ce?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==At.ERROR_USER_EXISTS&&f!==l?ye(fe,{onClick:s,children:"Use a different wallet"}):U&&!e&&L?ye(fe,{onClick:()=>{r(!0),Y()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&C<Un?ye(fe,{onClick:()=>{W(C+1),i(void 0),U?(r(!0),Y()):y?.connectRetry()},invisible:e||!n?.retryable||C>=Un,disabled:!e&&(!n?.retryable||C>=Un),children:"Retry"}):null})]}),ye(X,{})]})},pf=oc.div`
696
+ `;import{useEffect as ic,useState as ac}from"react";import mf from"styled-components";import{useEffect as aa,useState as Mr}from"react";import{isMobile as sa}from"react-device-detect";import oc from"styled-components";import{Fragment as nc,jsx as ye,jsxs as Fn}from"react/jsx-runtime";var Un=2,Lr={metamask:{name:"MetaMask",component:we},phantom:{name:"Phantom",component:Ke},coinbase_wallet:{name:"Coinbase Wallet",component:ut},wallet_connect:{name:"WalletConnect",component:Xo},embedded:{name:"Privy Wallet",component:Qo}},la=e=>e?.privyErrorCode==="linked_to_another_user"?At.ERROR_USER_EXISTS:e instanceof xe&&!e.details.default?e.details:e instanceof Ko?At.ERROR_TIMED_OUT:e instanceof Yo?At.ERROR_USER_REJECTED_CONNECTION:At.ERROR_WALLET_CONNECTION,rc=()=>{let[e,t]=Mr(!1),[o,r]=Mr(!1),[n,i]=Mr(void 0),{app:a,navigate:c,navigateBack:s,lastScreen:l,currentScreen:f,setModalData:m}=b(),{getAuthFlow:v,walletConnectionStatus:y,closePrivyModal:C,loginWithWallet:T,updateWallets:_}=A(),{walletConnectors:x}=V(),[w,D]=Mr(0),{user:I}=V(),[k]=Mr(I?.linkedAccounts.length||0),M=sa&&y?.connector?.connectorType==="wallet_connect_v2"||sa&&y?.connector?.connectorType==="coinbase_wallet"||sa&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",U=y?.status==="connected",se=y?.status==="switching_to_supported_chain";aa(()=>{let z=v();if(z&&M&&U&&!z.preparedMessage){z.buildSiweMessage();return}!z||M||!U||(async()=>{r(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Fi(2500),await Y()}catch(et){console.warn("Auto-prompted signature failed",et)}finally{r(!1)}})()},[w,U]),aa(()=>{if(I&&e){let z;if($t(I,a?.embeddedWallets?.createOnLogin)){let et=a?.render.inDialog?Ue:0,be=a?.render.inDialog?et-500:0;z=setTimeout(()=>{m({createWallet:{onSuccess:()=>{},onFailure:Uo=>console.error(Uo),callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},be)}else _(),z=setTimeout(C,Ue);return()=>clearTimeout(z)}},[I,e]);let B=z=>{if(z?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}i(la(z))};async function Y(){try{if(await T(),!a?.render.inDialog)return C();t(!0)}catch(z){B(z)}finally{r(!1)}}aa(()=>{y?.connectError&&B(y?.connectError)},[y]);let H=y?.connector?.connectorType||"metamask",Z=y?.connector?.walletClientType||"metamask",N=y?.connector?.walletBranding.name||Lr[Z]?.name||"MetaMask",We=y?.connector?.walletBranding.icon||Lr[Z]?.component||(z=>ye(we,{...z})),G;e?G=`Successfully connected with ${N}`:n?G=n.message:se?G="Switching networks":U?G=o&&M?"Signing":"Sign to verify":G=`Waiting for ${N}`;let q="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let z=I?.linkedAccounts.length||0;k===z?q="Wallet was already linked.":q="You\u2019re good to go!"}else w>=Un&&n?q="Unable to connect wallet":n?q=n.detail:se?q="Switch your wallet to the requested network.":U&&M?q="Sign the message in your wallet to verify it belongs to you.":Z==="metamask"?q="For the best experience, connect only one wallet at a time.":H==="wallet_connect"?q="Open your mobile wallet app to continue":H==="coinbase_wallet"&&(mn()||($i(I)?q="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":q="Open the Coinbase app on your phone to continue."));let Ce=x?.walletConnectors?.find(z=>z.walletClientType==="coinbase_wallet"),le=Z==="coinbase_wallet"&&($i(I)||n===At.ERROR_USER_EXISTS);return Fn(nc,{children:[ye(P,{backFn:f===l?void 0:s}),ye(S,{}),Fn(pf,{children:[ye(ca,{walletLogo:We,success:e,fail:!!n}),Fn(Jt,{children:[ye("h3",{children:G}),ye("p",{children:q})]}),ye(In,{children:le?ye(fe,{onClick:()=>Ce&&Ce?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==At.ERROR_USER_EXISTS&&f!==l?ye(fe,{onClick:s,children:"Use a different wallet"}):U&&!e&&M?ye(fe,{onClick:()=>{r(!0),Y()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&w<Un?ye(fe,{onClick:()=>{D(w+1),i(void 0),U?(r(!0),Y()):y?.connectRetry()},invisible:e||!n?.retryable||w>=Un,disabled:!e&&(!n?.retryable||w>=Un),children:"Retry"}):null})]}),ye(X,{})]})},pf=oc.div`
697
697
  display: flex;
698
698
  flex-direction: column;
699
699
  align-items: center;
@@ -724,7 +724,7 @@ Resources:
724
724
  left: -19px;
725
725
  top: -19px;
726
726
  }
727
- `,ca=e=>{let t=e.walletLogo;return ye(nc,{children:ye(uf,{children:Fn("div",{children:[ye(_n,{success:e.success,fail:e.fail}),typeof t=="string"?ye("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ye(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as hf,jsx as Ct,jsxs as da}from"react/jsx-runtime";var Bn=2,sc=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=b(),{walletConnectionStatus:r,closePrivyModal:n}=A(),[i,a]=ac(void 0),[c,s]=ac(0),l=r?.status==="connected",f=r?.status==="switching_to_supported_chain";ic(()=>{if(l){let C=setTimeout(n,Ue);return()=>clearTimeout(C)}},[l]);let m=C=>{a(la(C))};ic(()=>{r?.connectError&&m(r?.connectError)},[r]);let v=r?.connector?.connectorType||"metamask",y=r?.connector?.walletClientType||"metamask",w=r?.connector?.walletBranding.name||Lr[y]?.name||"MetaMask",T=r?.connector?.walletBranding.icon||Lr[y]?.component||(C=>Ct(we,{...C})),_;l?_=`Successfully connected with ${w}`:i?_=i.message:f?_="Switching networks":_=`Waiting for ${w}`;let x="Don\u2019t see your wallet modal? Check your other browser windows.";return l?x="You\u2019re good to go!":c>=Bn&&i?x="Unable to connect wallet":i?x=i.detail:f?x="Switch your wallet to the requested network.":y==="metamask"?x="For the best experience, connect only one wallet at a time.":v==="wallet_connect_v2"?x="Open your mobile wallet app to continue":v==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),da(hf,{children:[Ct(P,{backFn:o===t?void 0:e}),Ct(S,{}),da(ff,{children:[Ct(ca,{walletLogo:T,success:l,fail:!!i}),da(Jt,{children:[Ct("h3",{children:_}),Ct("p",{children:x})]}),Ct(In,{children:i==At.ERROR_USER_EXISTS?Ct(fe,{onClick:e,children:"Use a different wallet"}):!l&&i?.retryable&&c<Bn?Ct(fe,{onClick:()=>{s(c+1),a(void 0),r?.connectRetry()},invisible:l||!i?.retryable||c>=Bn,disabled:!l&&(!i?.retryable||c>=Bn),children:"Retry"}):null})]}),Ct(X,{})]})},ff=mf.div`
727
+ `,ca=e=>{let t=e.walletLogo;return ye(nc,{children:ye(uf,{children:Fn("div",{children:[ye(_n,{success:e.success,fail:e.fail}),typeof t=="string"?ye("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ye(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as hf,jsx as Ct,jsxs as da}from"react/jsx-runtime";var Bn=2,sc=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=b(),{walletConnectionStatus:r,closePrivyModal:n}=A(),[i,a]=ac(void 0),[c,s]=ac(0),l=r?.status==="connected",f=r?.status==="switching_to_supported_chain";ic(()=>{if(l){let w=setTimeout(n,Ue);return()=>clearTimeout(w)}},[l]);let m=w=>{a(la(w))};ic(()=>{r?.connectError&&m(r?.connectError)},[r]);let v=r?.connector?.connectorType||"metamask",y=r?.connector?.walletClientType||"metamask",C=r?.connector?.walletBranding.name||Lr[y]?.name||"MetaMask",T=r?.connector?.walletBranding.icon||Lr[y]?.component||(w=>Ct(we,{...w})),_;l?_=`Successfully connected with ${C}`:i?_=i.message:f?_="Switching networks":_=`Waiting for ${C}`;let x="Don\u2019t see your wallet modal? Check your other browser windows.";return l?x="You\u2019re good to go!":c>=Bn&&i?x="Unable to connect wallet":i?x=i.detail:f?x="Switch your wallet to the requested network.":y==="metamask"?x="For the best experience, connect only one wallet at a time.":v==="wallet_connect_v2"?x="Open your mobile wallet app to continue":v==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),da(hf,{children:[Ct(P,{backFn:o===t?void 0:e}),Ct(S,{}),da(ff,{children:[Ct(ca,{walletLogo:T,success:l,fail:!!i}),da(Jt,{children:[Ct("h3",{children:_}),Ct("p",{children:x})]}),Ct(In,{children:i==At.ERROR_USER_EXISTS?Ct(fe,{onClick:e,children:"Use a different wallet"}):!l&&i?.retryable&&c<Bn?Ct(fe,{onClick:()=>{s(c+1),a(void 0),r?.connectRetry()},invisible:l||!i?.retryable||c>=Bn,disabled:!l&&(!i?.retryable||c>=Bn),children:"Retry"}):null})]}),Ct(X,{})]})},ff=mf.div`
728
728
  display: flex;
729
729
  flex-direction: column;
730
730
  align-items: center;
@@ -788,12 +788,12 @@ Resources:
788
788
  transform: rotate(360deg);
789
789
  }
790
790
  }
791
- `;var lc=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var Wt=class extends Error{constructor(o,r){super(r);this.type=o}};function ua(e){let t=e.type;return typeof t=="string"&&lc.includes(t)}function rr(e){return ua(e)&&e.type==="wallet_not_on_device"}function cc(e){return ua(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function dc(e){return!!(ua(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function pc(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as mc,jsx as to,jsxs as ma}from"react/jsx-runtime";var uc=1,fc=()=>{let{authenticated:e,user:t,getAccessToken:o}=V(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=A(),{navigate:a,data:c,setModalData:s,outerClickRef:l}=b(),f=xf(()=>Date.now(),[]),[m,v]=Pf(!1),{onCompleteNavigateTo:y,onFailure:w}=c?.connectWallet,T=x=>{m||(v(!0),w(typeof x=="string"?new Error(x):x))};Ef(()=>{let x=te(t),C;return!e||!x?T("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let M=await o();if(!M)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:M,address:x.address});let k=(Date.now()-f)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<uc?C=setTimeout(()=>{a(y)},(uc-k)*1e3):a(y)}catch(k){if(rr(k)&&x.recoveryMethod==="privy"){let L=await o();if(!L)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:x.address}),(await i?.recover({address:x.address,accessToken:L}))?.address||T(new Error("Unable to recover wallet")),y?a(y):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:x.address}),a(y)}catch{T("An error has occurred, please try again.")}}else rr(k)?(s({...c,recoverWallet:{privyWallet:x,onCompleteNavigateTo:y,onFailure:w}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):T(k)}})(),()=>clearTimeout(C)):void 0},[e,t,i]);let _=()=>{r({shouldCallAuthOnSuccess:!1}),T("User exited before wallet could be connected")};return l&&(l.current=_),ma(mc,{children:[to(P,{onClose:_}),to(S,{}),to(_f,{children:m?ma(mc,{children:[ma(Rt,{children:[to(bf,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),to(he,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),to(j,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):to(or,{})}),to(I,{})]})},_f=Tf.div`
791
+ `;var lc=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var Wt=class extends Error{constructor(o,r){super(r);this.type=o}};function ua(e){let t=e.type;return typeof t=="string"&&lc.includes(t)}function rr(e){return ua(e)&&e.type==="wallet_not_on_device"}function cc(e){return ua(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function dc(e){return!!(ua(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function pc(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as mc,jsx as to,jsxs as ma}from"react/jsx-runtime";var uc=1,fc=()=>{let{authenticated:e,user:t,getAccessToken:o}=V(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=A(),{navigate:a,data:c,setModalData:s,outerClickRef:l}=b(),f=xf(()=>Date.now(),[]),[m,v]=Pf(!1),{onCompleteNavigateTo:y,onFailure:C}=c?.connectWallet,T=x=>{m||(v(!0),C(typeof x=="string"?new Error(x):x))};Ef(()=>{let x=te(t),w;return!e||!x?T("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await o();if(!I)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:x.address});let k=(Date.now()-f)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<uc?w=setTimeout(()=>{a(y)},(uc-k)*1e3):a(y)}catch(k){if(rr(k)&&x.recoveryMethod==="privy"){let M=await o();if(!M)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:x.address}),(await i?.recover({address:x.address,accessToken:M}))?.address||T(new Error("Unable to recover wallet")),y?a(y):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:x.address}),a(y)}catch{T("An error has occurred, please try again.")}}else rr(k)?(s({...c,recoverWallet:{privyWallet:x,onCompleteNavigateTo:y,onFailure:C}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):T(k)}})(),()=>clearTimeout(w)):void 0},[e,t,i]);let _=()=>{r({shouldCallAuthOnSuccess:!1}),T("User exited before wallet could be connected")};return l&&(l.current=_),ma(mc,{children:[to(P,{onClose:_}),to(S,{}),to(_f,{children:m?ma(mc,{children:[ma(Rt,{children:[to(bf,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),to(he,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),to(j,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):to(or,{})}),to(W,{})]})},_f=Tf.div`
792
792
  display: flex;
793
793
  height: 100%;
794
794
  flex-direction: column;
795
795
  flex-grow: 1;
796
- `;import{CheckCircleIcon as Sf}from"@heroicons/react/24/solid";import{useEffect as Af}from"react";import{Fragment as kf,jsx as nr,jsxs as hc}from"react/jsx-runtime";var yc=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=A(),{app:n,data:i,outerClickRef:a}=b(),{onSuccess:c,onFailure:s,callAuthOnSuccessOnClose:l}=i.createWallet,f=()=>{let m=te(e);m?(r(),c(m),t({shouldCallAuthOnSuccess:l})):s(new Error("Failed to create wallet"))};return Af(()=>{let m=setTimeout(f,qs);return()=>clearTimeout(m)},[]),a&&(a.current=f),hc(kf,{children:[nr(P,{onClose:f}),nr(S,{}),hc(Rt,{children:[nr(Sf,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),nr(he,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),nr(I,{}),nr(D,{protectedByPrivy:!0})]})};import{useEffect as Cc,useRef as If,useState as fa}from"react";import Nt from"styled-components";import{jsx as ke,jsxs as Rf}from"react/jsx-runtime";var gc=({style:e,...t})=>Rf("svg",{width:"320",height:"144",viewBox:"0 0 320 144",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:320,height:144,...e},...t,children:[ke("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),ke("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M229.848 64.9512C228.001 65.1452 226.643 66.726 226.643 68.5829V75.414C226.643 77.2883 228.026 78.8767 229.891 79.0615C231.417 79.2127 233.21 79.3518 234.643 79.3518C236.862 79.3518 239.95 79.0176 241.563 78.8225C242.183 78.7474 242.643 78.2196 242.643 77.5948V69.7756C242.643 69.1508 242.183 68.6229 241.563 68.5479C239.955 68.3534 236.883 68.0207 234.665 68.0185L234.643 68.0185L234.622 68.0185C233.219 68.0199 231.475 68.1534 229.975 68.3005C229.636 68.3007 229.346 68.0433 229.312 67.6989C229.277 67.3325 229.544 67.0063 229.911 66.9703C231.423 66.8219 233.203 66.6852 234.643 66.6852C236.246 66.6852 238.275 66.855 239.887 67.0221C240.412 67.0765 240.896 67.1309 241.309 67.1796V66.4289C241.309 65.8099 240.858 65.2851 240.244 65.2046C238.746 65.0083 235.977 64.6852 233.976 64.6852C232.734 64.6852 231.195 64.8098 229.848 64.9512ZM240.309 74.6852C240.862 74.6852 241.309 74.2375 241.309 73.6852C241.309 73.1329 240.862 72.6852 240.309 72.6852C239.757 72.6852 239.309 73.1329 239.309 73.6852C239.309 74.2375 239.757 74.6852 240.309 74.6852Z",fill:"var(--privy-color-accent)"}),ke("path",{d:"M92.6426 74.2969H89.5743M76.6426 74.2969H85.5085M77.5837 78.2687L87.1555 61.6852M84.7273 65.9017L82.2897 61.6852M91.8614 78.2687L86.6849 69.2993",stroke:"var(--privy-color-accent)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),ke("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),ke("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),ke("path",{d:"M270.544 116.469C272.146 116.469 273.445 115.175 273.445 113.577C273.445 111.98 272.146 110.685 270.544 110.685C268.942 110.685 267.643 111.98 267.643 113.577C267.643 115.175 268.942 116.469 270.544 116.469Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M157.878 48.3615C160.282 48.3615 162.231 46.4193 162.231 44.0234C162.231 41.6274 160.282 39.6852 157.878 39.6852C155.475 39.6852 153.526 41.6274 153.526 44.0234C153.526 46.4193 155.475 48.3615 157.878 48.3615Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M35.0825 96.1749C36.8852 96.1749 38.3466 94.7182 38.3466 92.9212C38.3466 91.1243 36.8852 89.6676 35.0825 89.6676C33.2797 89.6676 31.8184 91.1243 31.8184 92.9212C31.8184 94.7182 33.2797 96.1749 35.0825 96.1749Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M164.407 103.673C166.41 103.673 168.034 102.055 168.034 100.058C168.034 98.0616 166.41 96.443 164.407 96.443C162.404 96.443 160.78 98.0616 160.78 100.058C160.78 102.055 162.404 103.673 164.407 103.673Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M292.664 33.277C294.267 33.277 295.566 31.9822 295.566 30.3849C295.566 28.7876 294.267 27.4928 292.664 27.4928C291.062 27.4928 289.763 28.7876 289.763 30.3849C289.763 31.9822 291.062 33.277 292.664 33.277Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M104 12.6997C105.302 12.6997 106.357 11.6476 106.357 10.3498C106.357 9.05206 105.302 8 104 8C102.698 8 101.643 9.05206 101.643 10.3498C101.643 11.6476 102.698 12.6997 104 12.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M7.99998 68.6997C9.30194 68.6997 10.3574 67.6476 10.3574 66.3498C10.3574 65.0521 9.30194 64 7.99998 64C6.69802 64 5.64258 65.0521 5.64258 66.3498C5.64258 67.6476 6.69802 68.6997 7.99998 68.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M312 60.6997C313.302 60.6997 314.357 59.6476 314.357 58.3498C314.357 57.0521 313.302 56 312 56C310.698 56 309.643 57.0521 309.643 58.3498C309.643 59.6476 310.698 60.6997 312 60.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M35.544 42.4694C37.1464 42.4694 38.4454 41.1746 38.4454 39.5773C38.4454 37.98 37.1464 36.6852 35.544 36.6852C33.9416 36.6852 32.6426 37.98 32.6426 39.5773C32.6426 41.1746 33.9416 42.4694 35.544 42.4694Z",fill:"var(--privy-color-accent-light"})]});import{Fragment as Hf,jsx as re,jsxs as bt}from"react/jsx-runtime";var bc=()=>{let[e,t]=fa(null),{authenticated:o,user:r,getAccessToken:n}=V(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:c}=A(),{data:s,outerClickRef:l}=b(),f=te(r)?.address,{onFailure:m,onSuccess:v,origin:y,appId:w}=s.keyExport,T=x=>{i({shouldCallAuthOnSuccess:!1}),m(typeof x=="string"?new Error(x):x)},_=()=>{i({shouldCallAuthOnSuccess:!1}),v(),a("embedded_wallet_key_export_completed",{walletAddress:f})};return Cc(()=>{let x=te(r);if(!o||!x)return T("User must be authenticated before exporting their wallet");n().then(t,T)},[o,r]),l&&(l.current=_),bt(Hf,{children:[re(P,{onClose:_}),re(S,{}),bt(Mf,{children:[re(gc,{}),bt(Lf,{children:[re("h3",{children:"Transfer"}),bt(Ff,{children:[re(Nf,{style:{marginRight:6}}),Vt(f)]})]}),re("p",{children:"You can take your account with you to another site using an external wallet!"}),bt(Of,{children:[bt(vc,{children:[re(wc,{children:"1"}),bt("span",{children:[re("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."]})]}),bt(vc,{children:[re(wc,{children:"2"}),re("span",{children:"Copy this key into your other wallet"})]})]}),re("div",{style:{width:"100%"},children:e&&re(Wf,{origin:y,appId:w,accessToken:e,clientAnalyticsId:c,address:f,dimensions:{height:"44px"}})}),bt(Bf,{children:[re("h4",{children:"WARNING"}),re("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),re(I,{}),re(D,{protectedByPrivy:!0})]})};function Wf(e){let[t,o]=fa(e.dimensions.width),[r,n]=fa(void 0),i=If(null);return Cc(()=>{if(i.current&&t===void 0){let{width:c}=i.current.getBoundingClientRect();o(c)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),re("div",{ref:i,children:t&&bt(Df,{children:[re("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:fn(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...r})}),re(Uf,{children:"Loading..."})]})})}function Nf(e){return re("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:re("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 Mf=Nt.div`
796
+ `;import{CheckCircleIcon as Sf}from"@heroicons/react/24/solid";import{useEffect as Af}from"react";import{Fragment as kf,jsx as nr,jsxs as hc}from"react/jsx-runtime";var yc=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=A(),{app:n,data:i,outerClickRef:a}=b(),{onSuccess:c,onFailure:s,callAuthOnSuccessOnClose:l}=i.createWallet,f=()=>{let m=te(e);m?(r(),c(m),t({shouldCallAuthOnSuccess:l})):s(new Error("Failed to create wallet"))};return Af(()=>{let m=setTimeout(f,qs);return()=>clearTimeout(m)},[]),a&&(a.current=f),hc(kf,{children:[nr(P,{onClose:f}),nr(S,{}),hc(Rt,{children:[nr(Sf,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),nr(he,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),nr(W,{}),nr(O,{protectedByPrivy:!0})]})};import{useEffect as Cc,useRef as If,useState as fa}from"react";import Nt from"styled-components";import{jsx as ke,jsxs as Rf}from"react/jsx-runtime";var gc=({style:e,...t})=>Rf("svg",{width:"320",height:"144",viewBox:"0 0 320 144",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:320,height:144,...e},...t,children:[ke("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),ke("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M229.848 64.9512C228.001 65.1452 226.643 66.726 226.643 68.5829V75.414C226.643 77.2883 228.026 78.8767 229.891 79.0615C231.417 79.2127 233.21 79.3518 234.643 79.3518C236.862 79.3518 239.95 79.0176 241.563 78.8225C242.183 78.7474 242.643 78.2196 242.643 77.5948V69.7756C242.643 69.1508 242.183 68.6229 241.563 68.5479C239.955 68.3534 236.883 68.0207 234.665 68.0185L234.643 68.0185L234.622 68.0185C233.219 68.0199 231.475 68.1534 229.975 68.3005C229.636 68.3007 229.346 68.0433 229.312 67.6989C229.277 67.3325 229.544 67.0063 229.911 66.9703C231.423 66.8219 233.203 66.6852 234.643 66.6852C236.246 66.6852 238.275 66.855 239.887 67.0221C240.412 67.0765 240.896 67.1309 241.309 67.1796V66.4289C241.309 65.8099 240.858 65.2851 240.244 65.2046C238.746 65.0083 235.977 64.6852 233.976 64.6852C232.734 64.6852 231.195 64.8098 229.848 64.9512ZM240.309 74.6852C240.862 74.6852 241.309 74.2375 241.309 73.6852C241.309 73.1329 240.862 72.6852 240.309 72.6852C239.757 72.6852 239.309 73.1329 239.309 73.6852C239.309 74.2375 239.757 74.6852 240.309 74.6852Z",fill:"var(--privy-color-accent)"}),ke("path",{d:"M92.6426 74.2969H89.5743M76.6426 74.2969H85.5085M77.5837 78.2687L87.1555 61.6852M84.7273 65.9017L82.2897 61.6852M91.8614 78.2687L86.6849 69.2993",stroke:"var(--privy-color-accent)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),ke("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),ke("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),ke("path",{d:"M270.544 116.469C272.146 116.469 273.445 115.175 273.445 113.577C273.445 111.98 272.146 110.685 270.544 110.685C268.942 110.685 267.643 111.98 267.643 113.577C267.643 115.175 268.942 116.469 270.544 116.469Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M157.878 48.3615C160.282 48.3615 162.231 46.4193 162.231 44.0234C162.231 41.6274 160.282 39.6852 157.878 39.6852C155.475 39.6852 153.526 41.6274 153.526 44.0234C153.526 46.4193 155.475 48.3615 157.878 48.3615Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M35.0825 96.1749C36.8852 96.1749 38.3466 94.7182 38.3466 92.9212C38.3466 91.1243 36.8852 89.6676 35.0825 89.6676C33.2797 89.6676 31.8184 91.1243 31.8184 92.9212C31.8184 94.7182 33.2797 96.1749 35.0825 96.1749Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M164.407 103.673C166.41 103.673 168.034 102.055 168.034 100.058C168.034 98.0616 166.41 96.443 164.407 96.443C162.404 96.443 160.78 98.0616 160.78 100.058C160.78 102.055 162.404 103.673 164.407 103.673Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M292.664 33.277C294.267 33.277 295.566 31.9822 295.566 30.3849C295.566 28.7876 294.267 27.4928 292.664 27.4928C291.062 27.4928 289.763 28.7876 289.763 30.3849C289.763 31.9822 291.062 33.277 292.664 33.277Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M104 12.6997C105.302 12.6997 106.357 11.6476 106.357 10.3498C106.357 9.05206 105.302 8 104 8C102.698 8 101.643 9.05206 101.643 10.3498C101.643 11.6476 102.698 12.6997 104 12.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M7.99998 68.6997C9.30194 68.6997 10.3574 67.6476 10.3574 66.3498C10.3574 65.0521 9.30194 64 7.99998 64C6.69802 64 5.64258 65.0521 5.64258 66.3498C5.64258 67.6476 6.69802 68.6997 7.99998 68.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M312 60.6997C313.302 60.6997 314.357 59.6476 314.357 58.3498C314.357 57.0521 313.302 56 312 56C310.698 56 309.643 57.0521 309.643 58.3498C309.643 59.6476 310.698 60.6997 312 60.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M35.544 42.4694C37.1464 42.4694 38.4454 41.1746 38.4454 39.5773C38.4454 37.98 37.1464 36.6852 35.544 36.6852C33.9416 36.6852 32.6426 37.98 32.6426 39.5773C32.6426 41.1746 33.9416 42.4694 35.544 42.4694Z",fill:"var(--privy-color-accent-light"})]});import{Fragment as Hf,jsx as re,jsxs as bt}from"react/jsx-runtime";var bc=()=>{let[e,t]=fa(null),{authenticated:o,user:r,getAccessToken:n}=V(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:c}=A(),{data:s,outerClickRef:l}=b(),f=te(r)?.address,{onFailure:m,onSuccess:v,origin:y,appId:C}=s.keyExport,T=x=>{i({shouldCallAuthOnSuccess:!1}),m(typeof x=="string"?new Error(x):x)},_=()=>{i({shouldCallAuthOnSuccess:!1}),v(),a("embedded_wallet_key_export_completed",{walletAddress:f})};return Cc(()=>{let x=te(r);if(!o||!x)return T("User must be authenticated before exporting their wallet");n().then(t,T)},[o,r]),l&&(l.current=_),bt(Hf,{children:[re(P,{onClose:_}),re(S,{}),bt(Mf,{children:[re(gc,{}),bt(Lf,{children:[re("h3",{children:"Transfer"}),bt(Ff,{children:[re(Nf,{style:{marginRight:6}}),Vt(f)]})]}),re("p",{children:"You can take your account with you to another site using an external wallet!"}),bt(Of,{children:[bt(vc,{children:[re(wc,{children:"1"}),bt("span",{children:[re("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."]})]}),bt(vc,{children:[re(wc,{children:"2"}),re("span",{children:"Copy this key into your other wallet"})]})]}),re("div",{style:{width:"100%"},children:e&&re(Wf,{origin:y,appId:C,accessToken:e,clientAnalyticsId:c,address:f,dimensions:{height:"44px"}})}),bt(Bf,{children:[re("h4",{children:"WARNING"}),re("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),re(W,{}),re(O,{protectedByPrivy:!0})]})};function Wf(e){let[t,o]=fa(e.dimensions.width),[r,n]=fa(void 0),i=If(null);return Cc(()=>{if(i.current&&t===void 0){let{width:c}=i.current.getBoundingClientRect();o(c)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),re("div",{ref:i,children:t&&bt(Df,{children:[re("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:fn(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...r})}),re(Uf,{children:"Loading..."})]})})}function Nf(e){return re("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:re("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 Mf=Nt.div`
797
797
  display: flex;
798
798
  height: 100%;
799
799
  flex-direction: column;
@@ -1023,7 +1023,7 @@ Resources:
1023
1023
  transition: all 0.1s ease-out;
1024
1024
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1025
1025
  }
1026
- `;import{Fragment as qf,jsx as st,jsxs as ga}from"react/jsx-runtime";var Ac=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=Sc(!1),[c,s]=Sc(""),l=o===c;return Vf(()=>{c&&!i&&a(!0)},[c]),ga(qf,{children:[st(P,{title:"Confirm Password",closeable:!1,backFn:n}),st(S,{}),ga(oo,{children:[ga(no,{children:[st($f,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),st(ir,{children:st(xo,{value:c,onChange:f=>s(f.target.value),onBlur:()=>a(!0),placeholder:"confirm your password"})}),st(Gn,{"aria-hidden":!i||l,error:!0,children:"Passwords do not match"})]}),st(ro,{onClick:r,loading:t,disabled:!l,hideAnimations:e,children:"Continue"}),st(I,{}),st(D,{protectedByPrivy:!0})]})};import{ExclamationTriangleIcon as Jf}from"@heroicons/react/24/outline";import{useState as Qf}from"react";import Zf from"styled-components";import zn from"styled-components";import{jsx as Ur,jsxs as Yf}from"react/jsx-runtime";var kc=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>Ur("label",{children:Yf(jf,{className:e,children:[Ur(Ic,{checked:t,...r}),Ur(Kf,{color:o,checked:t,children:Ur(Rc,{viewBox:"0 0 24 24",children:Ur("polyline",{points:"20 6 9 17 4 12"})})})]})}),jf=zn.div`
1026
+ `;import{Fragment as qf,jsx as st,jsxs as ga}from"react/jsx-runtime";var Ac=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=Sc(!1),[c,s]=Sc(""),l=o===c;return Vf(()=>{c&&!i&&a(!0)},[c]),ga(qf,{children:[st(P,{title:"Confirm Password",closeable:!1,backFn:n}),st(S,{}),ga(oo,{children:[ga(no,{children:[st($f,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),st(ir,{children:st(xo,{value:c,onChange:f=>s(f.target.value),onBlur:()=>a(!0),placeholder:"confirm your password"})}),st(Gn,{"aria-hidden":!i||l,error:!0,children:"Passwords do not match"})]}),st(ro,{onClick:r,loading:t,disabled:!l,hideAnimations:e,children:"Continue"}),st(W,{}),st(O,{protectedByPrivy:!0})]})};import{ExclamationTriangleIcon as Jf}from"@heroicons/react/24/outline";import{useState as Qf}from"react";import Zf from"styled-components";import zn from"styled-components";import{jsx as Ur,jsxs as Yf}from"react/jsx-runtime";var kc=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>Ur("label",{children:Yf(jf,{className:e,children:[Ur(Ic,{checked:t,...r}),Ur(Kf,{color:o,checked:t,children:Ur(Rc,{viewBox:"0 0 24 24",children:Ur("polyline",{points:"20 6 9 17 4 12"})})})]})}),jf=zn.div`
1027
1027
  display: inline-block;
1028
1028
  vertical-align: middle;
1029
1029
  `,Rc=zn.svg`
@@ -1063,21 +1063,21 @@ Resources:
1063
1063
  ${Rc} {
1064
1064
  visibility: ${e=>e.checked?"visible":"hidden"};
1065
1065
  }
1066
- `;import{Fragment as eh,jsx as lt,jsxs as Fr}from"react/jsx-runtime";var Wc=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=Qf(!1);return Fr(eh,{children:[lt(P,{title:"Confirm Password",closeable:!1,backFn:r}),lt(S,{}),Fr(oo,{children:[Fr(no,{children:[lt(Jf,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),lt(Or,{children:Fr(Dr,{style:{color:"var(--privy-color-error)"},children:[lt(kc,{color:"var(--privy-color-error)",checked:i,onChange:()=>a(c=>!c)}),"I understand losing my password means losing my account."]})})]}),Fr(Xf,{children:[n.initiatedBy==="user"&&lt(Rn,{onClick:n.onCancel,disabled:t,children:"Cancel"}),lt(ro,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),lt(I,{}),lt(D,{protectedByPrivy:!0})]})},Xf=Zf.div`
1066
+ `;import{Fragment as eh,jsx as lt,jsxs as Fr}from"react/jsx-runtime";var Wc=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=Qf(!1);return Fr(eh,{children:[lt(P,{title:"Confirm Password",closeable:!1,backFn:r}),lt(S,{}),Fr(oo,{children:[Fr(no,{children:[lt(Jf,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),lt(Or,{children:Fr(Dr,{style:{color:"var(--privy-color-error)"},children:[lt(kc,{color:"var(--privy-color-error)",checked:i,onChange:()=>a(c=>!c)}),"I understand losing my password means losing my account."]})})]}),Fr(Xf,{children:[n.initiatedBy==="user"&&lt(Rn,{onClick:n.onCancel,disabled:t,children:"Cancel"}),lt(ro,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),lt(W,{}),lt(O,{protectedByPrivy:!0})]})},Xf=Zf.div`
1067
1067
  display: flex;
1068
1068
  gap: 10px;
1069
- `;import{KeyIcon as yh}from"@heroicons/react/24/outline";import{CheckCircleIcon as Fc}from"@heroicons/react/24/solid";import{useState as gh,useMemo as va,useEffect as vh}from"react";import Bc from"styled-components";import th from"fast-password-entropy";import*as Nc from"secure-password-utilities";import{DEFAULT_WORDLIST as oh}from"secure-password-utilities/wordlists";var rh=95,nh=8,ih=3,ah=.3,sh=/[a-z]/,lh=/[A-Z]/,ch=/[0-9]/,dh="a-zA-Z0-9",Mc="!@#$%^&*()\\-_+.",Lc=`${dh}${Mc}`,ph=new RegExp(`[${Mc}]`),uh=new RegExp(`[${Lc}]`),Oc=new RegExp(`^[${Lc}]{6,}$`),Dc=(e="")=>{let t=e.split("").filter(o=>!uh.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},$n=()=>Nc.generatePassphrase(4,oh);function mh(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function fh(e){if(e.length<nh)return 0;let t=0;sh.test(e)&&(t+=1),lh.test(e)&&(t+=1),ch.test(e)&&(t+=1),ph.test(e)&&(t+=1);let o=t/ih;return Math.max(0,Math.min(1,o))}function hh(e=""){let t=fh(e),o=th(e)/rh;return(t*ah+o)/2}function Uc(e=""){let t=hh(e);return{value:t,label:mh(t)}}import{Fragment as bh,jsx as Pe,jsxs as io}from"react/jsx-runtime";var Hc=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:c})=>{let[s,l]=gh(!1);vh(()=>{o&&!s&&l(!0)},[o]);let f=va(()=>s?(o?.length||0)<6?"Password must be at least 6 characters":Oc.test(o||"")?null:`Invalid characters used ( ${Dc(o).join(" ")} )`:null,[o,s]),m=va(()=>f?{value:0,label:"Weak"}:Uc(o),[o,f]),v=va(()=>!!(!o?.length||f),[f,o]);return io(bh,{children:[Pe(P,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),Pe(S,{}),io(oo,{children:[io(no,{children:[Pe(yh,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Pe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Pe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),io(ir,{children:[Pe(xo,{value:o,onChange:y=>a(y.target.value),placeholder:"enter or generate a strong password"}),Pe(Tc,{onClick:c})]}),Pe(_c,{value:m.value===0?.01:m.value,label:m.label}),Pe(Gn,{error:!!f,children:f||`Password Strength: ${s?m.label:"--"}`}),io(Ch,{children:[Pe(wh,{children:io(Or,{children:[io(Dr,{children:[Pe(Fc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),io(Dr,{children:[Pe(Fc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Pe(ro,{onClick:n,loading:t,disabled:v,hideAnimations:e,children:"Continue"})]})]}),Pe(I,{}),Pe(D,{protectedByPrivy:!0})]})},wh=Bc(Or)`
1069
+ `;import{KeyIcon as yh}from"@heroicons/react/24/outline";import{CheckCircleIcon as Fc}from"@heroicons/react/24/solid";import{useState as gh,useMemo as va,useEffect as vh}from"react";import Bc from"styled-components";import th from"fast-password-entropy";import*as Nc from"secure-password-utilities";import{DEFAULT_WORDLIST as oh}from"secure-password-utilities/wordlists";var rh=95,nh=8,ih=3,ah=.3,sh=/[a-z]/,lh=/[A-Z]/,ch=/[0-9]/,dh="a-zA-Z0-9",Mc="!@#$%^&*()\\-_+.",Lc=`${dh}${Mc}`,ph=new RegExp(`[${Mc}]`),uh=new RegExp(`[${Lc}]`),Oc=new RegExp(`^[${Lc}]{6,}$`),Dc=(e="")=>{let t=e.split("").filter(o=>!uh.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},$n=()=>Nc.generatePassphrase(4,oh);function mh(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function fh(e){if(e.length<nh)return 0;let t=0;sh.test(e)&&(t+=1),lh.test(e)&&(t+=1),ch.test(e)&&(t+=1),ph.test(e)&&(t+=1);let o=t/ih;return Math.max(0,Math.min(1,o))}function hh(e=""){let t=fh(e),o=th(e)/rh;return(t*ah+o)/2}function Uc(e=""){let t=hh(e);return{value:t,label:mh(t)}}import{Fragment as bh,jsx as Pe,jsxs as io}from"react/jsx-runtime";var Hc=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:c})=>{let[s,l]=gh(!1);vh(()=>{o&&!s&&l(!0)},[o]);let f=va(()=>s?(o?.length||0)<6?"Password must be at least 6 characters":Oc.test(o||"")?null:`Invalid characters used ( ${Dc(o).join(" ")} )`:null,[o,s]),m=va(()=>f?{value:0,label:"Weak"}:Uc(o),[o,f]),v=va(()=>!!(!o?.length||f),[f,o]);return io(bh,{children:[Pe(P,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),Pe(S,{}),io(oo,{children:[io(no,{children:[Pe(yh,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Pe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Pe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),io(ir,{children:[Pe(xo,{value:o,onChange:y=>a(y.target.value),placeholder:"enter or generate a strong password"}),Pe(Tc,{onClick:c})]}),Pe(_c,{value:m.value===0?.01:m.value,label:m.label}),Pe(Gn,{error:!!f,children:f||`Password Strength: ${s?m.label:"--"}`}),io(Ch,{children:[Pe(wh,{children:io(Or,{children:[io(Dr,{children:[Pe(Fc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),io(Dr,{children:[Pe(Fc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Pe(ro,{onClick:n,loading:t,disabled:v,hideAnimations:e,children:"Continue"})]})]}),Pe(W,{}),Pe(O,{protectedByPrivy:!0})]})},wh=Bc(Or)`
1070
1070
  flex: 1;
1071
1071
  padding-top: 1rem;
1072
1072
  `,Ch=Bc.div`
1073
1073
  display: flex;
1074
1074
  flex-direction: column;
1075
1075
  height: 100%;
1076
- `;import{ArrowDownTrayIcon as Eh,ClipboardDocumentCheckIcon as xh,DocumentDuplicateIcon as Ph,ExclamationTriangleIcon as Th}from"@heroicons/react/24/outline";import{useState as _h,useCallback as Gc}from"react";import{Fragment as wa,jsx as Re,jsxs as Po}from"react/jsx-runtime";var zc=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,c]=_h(!1),s=Gc(()=>{c(!0),r&&navigator.clipboard.writeText(r)},[r]),l=Gc(()=>{let f=document.createElement("a"),m=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),v=new Blob([Sh(o,r)],{type:"text/plain"}),y=URL.createObjectURL(v);f.href=y,f.target="_blank",f.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(f),f.click(),setTimeout(()=>{f.remove(),URL.revokeObjectURL(y)},5e3)},[r]);return Po(wa,{children:[Re(P,{backFn:i,title:"Save Password",closeable:!1}),Re(S,{}),Po(oo,{children:[Po(no,{children:[Re(Th,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Re("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Re("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."})]}),Re(ir,{centered:!0,children:Re(xc,{children:r})}),Po("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Re(ya,{onClick:s,children:a?Po(wa,{children:[Re(xh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Po(wa,{children:[Re(Ph,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Po(ya,{onClick:l,children:[Re(Eh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Re(ro,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Re(I,{}),Re(D,{protectedByPrivy:!0})]})},Sh=(e,t)=>`Your wallet recovery password for ${e} is
1076
+ `;import{ArrowDownTrayIcon as Eh,ClipboardDocumentCheckIcon as xh,DocumentDuplicateIcon as Ph,ExclamationTriangleIcon as Th}from"@heroicons/react/24/outline";import{useState as _h,useCallback as Gc}from"react";import{Fragment as wa,jsx as Re,jsxs as Po}from"react/jsx-runtime";var zc=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,c]=_h(!1),s=Gc(()=>{c(!0),r&&navigator.clipboard.writeText(r)},[r]),l=Gc(()=>{let f=document.createElement("a"),m=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),v=new Blob([Sh(o,r)],{type:"text/plain"}),y=URL.createObjectURL(v);f.href=y,f.target="_blank",f.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(f),f.click(),setTimeout(()=>{f.remove(),URL.revokeObjectURL(y)},5e3)},[r]);return Po(wa,{children:[Re(P,{backFn:i,title:"Save Password",closeable:!1}),Re(S,{}),Po(oo,{children:[Po(no,{children:[Re(Th,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Re("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Re("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."})]}),Re(ir,{centered:!0,children:Re(xc,{children:r})}),Po("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Re(ya,{onClick:s,children:a?Po(wa,{children:[Re(xh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Po(wa,{children:[Re(Ph,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Po(ya,{onClick:l,children:[Re(Eh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Re(ro,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Re(W,{}),Re(O,{protectedByPrivy:!0})]})},Sh=(e,t)=>`Your wallet recovery password for ${e} is
1077
1077
 
1078
1078
  ${t}
1079
1079
 
1080
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import{CheckCircleIcon as Ah,XCircleIcon as kh}from"@heroicons/react/24/outline";import{Fragment as Rh,jsx as Mt,jsxs as Ca}from"react/jsx-runtime";var $c=({error:e,onClose:t})=>Ca(Rh,{children:[Mt(P,{closeable:!1}),Mt(S,{}),e?Ca(Rt,{children:[Mt(kh,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Mt(he,{title:"Something went wrong",description:e})]}):Ca(Rt,{children:[Mt(Ah,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Mt(he,{title:"Success"})]}),Mt(j,{onClick:t,children:"Close"}),Mt(I,{}),Mt(D,{protectedByPrivy:!0})]});import{useReducer as Ih}from"react";var Wh=(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}},Vc=()=>{let[e,t]=Ih(Wh,"creating");return{send:t,state:e}};import{jsx as Br}from"react/jsx-runtime";var Vn=({onSubmit:e,...t})=>{let{send:o,state:r}=Vc(),n=qc(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Nh(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),Ue)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=qc(()=>{o("back")},[o]);return r==="creating"?Br(Hc,{...t,onSubmit:n}):r==="saving"?Br(zc,{...t,onSubmit:n,onBack:i}):r==="confirming"?Br(Ac,{...t,onSubmit:n,onBack:i}):r==="finalizing"?Br(Wc,{...t,onSubmit:n,onBack:i}):r==="done"?Br($c,{...t,onSubmit:n}):null};import{jsx as ba}from"react/jsx-runtime";var Lh=250,Kc=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=b(),[n,i]=Hr(""),[a,c]=Hr(!1),[s,l]=Hr(),[f,m]=Hr(null),[v,y]=Hr(null),w=Mh(!1),{authenticated:T,getAccessToken:_}=V(),{refreshUser:x,closePrivyModal:C,createAnalyticsEvent:W,isNewUserThisSession:M,initializeWalletProxy:k}=A(),{onSuccess:L,onFailure:U,callAuthOnSuccessOnClose:se}=o.createWallet,B=e?.embeddedWallets.requireUserPasswordOnCreate===!0,Y=!!(!n||w.current)&&!B,H=new qe(async()=>N());jc(()=>{f||k(3e4).then(G=>m(G))},[f]),jc(()=>{if(!T){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!B&&!a&&!w.current&&(c(!0),H.execute().finally(()=>c(!1)))},[B,T]);let Z=()=>{B&&v&&v?.recoveryMethod!=="user-passcode"?U(new Le("User created a wallet but failed to set a password for it")):v?L(v):U(new Le("User wallet creation failed")),C({shouldCallAuthOnSuccess:se})};r&&(r.current=()=>({closeModal:!1}));let N=async function(){let G=await _();if(G)try{if(W("embedded_wallet_creation_started"),!await(await k(pn))?.create({accessToken:G,recoveryPassword:s}))throw W("embedded_wallet_creation_failed",{error:"walletProxy did not send a response."}),new Error("Unable to create wallet");let le=await x(),z=te(le);if(!z)throw W("embedded_wallet_creation_failed",{error:"Updated user is missing embedded wallet."}),new Error("Unable to create wallet");y(z),W("embedded_wallet_creation_completed",{walletAddress:z.address}),i(""),w.current=!0,B?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):z&&(L(z),C({shouldCallAuthOnSuccess:se}))}catch(q){if(w.current)return;i("An error has occurred, please try again."),console.warn(q)}else i("An error has occured, please login again."),W("embedded_wallet_creation_failed",{error:"Missing access token for user."})},We=async()=>B?(c(!0),H.execute().then(()=>new Promise(G=>setTimeout(G,Lh))).finally(()=>c(!1))):C({shouldCallAuthOnSuccess:se});return Y?ba(Pc,{children:ba(or,{})}):ba(Vn,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:Y||!f,buttonLoading:a,buttonHideAnimations:!v&&a,error:n,password:s||"",onClose:Z,onPasswordChange:l,onPasswordGenerate:()=>l($n()),onSubmit:We})};import{useEffect as Oh,useState as qn}from"react";import{jsx as Dh}from"react/jsx-runtime";var Yc=()=>{let[e,t]=qn(null),[o,r]=qn(!1),[n,i]=qn(null),[a,c]=qn(""),{authenticated:s,getAccessToken:l,user:f}=V(),{walletProxy:m,refreshUser:v,closePrivyModal:y,createAnalyticsEvent:w}=A(),{app:T,navigate:_,data:x,outerClickRef:C}=b(),{onSuccess:W,onFailure:M}=x.createWallet,k=te(f),L=e?.recoveryMethod==="user-passcode";Oh(()=>{s||(_("LANDING"),M(new rn("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){M(n),y({shouldCallAuthOnSuccess:!1});return}if(!L){M(new Le("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}W(e),y({shouldCallAuthOnSuccess:!1})};C&&(C.current=()=>(U(),{closeModal:!L}));let se=async()=>{let Y=await l();if(Y&&k?.address&&a&&m)try{if(w("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await m.setRecoveryPassword({accessToken:Y,address:k.address,recoveryPassword:a})).address){i(new Le("Error setting password on privy wallet")),w("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Z=await v(),N=te(Z);if(!N){i(new Le("Error setting password on privy wallet")),w("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(N),w("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(H){console.warn(H),i(H instanceof Error?H:new Error("Error setting password on privy wallet")),w("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:H})}},B=async()=>{L?(W(e),y({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await se(),r(!1))};return Dh(Vn,{appName:T?.name||"privy",config:{initiatedBy:"user",onCancel:U},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>c($n()),onPasswordChange:c,onSubmit:B,onClose:U})};import{UserCircleIcon as Uh}from"@heroicons/react/24/outline";import{LockClosedIcon as Fh}from"@heroicons/react/24/solid";import{useEffect as Bh}from"react";import{Fragment as Hh,jsx as Lt,jsxs as jn}from"react/jsx-runtime";var Jc=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:o}=A(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=b(),{onSuccess:c,onFailure:s}=r.setWalletPassword,l=()=>{s(new Le("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return Bh(()=>{a&&(a.current=l)},[]),jn(Hh,{children:[Lt(P,{onClose:l}),Lt(S,{}),jn(Rt,{children:[jn(Nl,{children:[Lt(Uh,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Lt(Ml,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Lt(Fh,{width:"12px",height:"12px",fill:"white"})})]}),jn(he,{title:"Secure Your Account",children:["Please set a password to secure your account.",Lt("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."})]})]}),Lt(j,{onClick:()=>{let m=te(e);o("embedded_wallet_set_password_started",{walletAddress:m?.address}),n({createWallet:{onFailure:s,onSuccess:c,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Lt(I,{}),Lt(D,{protectedByPrivy:!0})]})};import{ShieldCheckIcon as Gh}from"@heroicons/react/24/outline";import{useEffect as zh,useState as Ea}from"react";import Kn,{css as $h}from"styled-components";import{Fragment as Yh,jsx as Ze,jsxs as ar}from"react/jsx-runtime";var Qc=()=>{let{authenticated:e,getAccessToken:t}=V(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=A(),{navigate:i,data:a,outerClickRef:c}=b(),[s,l]=Ea(void 0),[f,m]=Ea(""),[v,y]=Ea(!1),{privyWallet:w,onCompleteNavigateTo:T,onSuccess:_,onFailure:x}=a.recoverWallet,C=(k="User exited before their wallet could be recovered")=>{r({shouldCallAuthOnSuccess:!1}),x(typeof k=="string"?new Le(k):k)};c&&(c.current=()=>C()),zh(()=>{if(!e||!w)return C("User must be authenticated and have a Privy wallet before it can be recovered")},[e]);let W=k=>{k&&l(k)};return ar(Yh,{children:[Ze(P,{onClose:C}),Ze(S,{}),ar(qh,{children:[ar(Vh,{children:[Ze(Gh,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ze("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ze("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),ar("div",{children:[Ze(xo,{onChange:k=>W(k.target.value),disabled:v}),!!f&&Ze(jh,{children:f})]}),ar("div",{children:[ar(Wl,{children:[Ze("h4",{children:"Why is this necessary?"}),Ze("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ze(Kh,{loading:v||!o,disabled:!s,onClick:async()=>{y(!0);let k=await t();if(k&&w&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:w.address}),await o?.recover({address:w.address,accessToken:k,recoveryPin:s}),m(""),T?i(T):r({shouldCallAuthOnSuccess:!1}),_?.(w),n("embedded_wallet_recovery_completed",{walletAddress:w.address})}catch(L){cc(L)?m("Invalid recovery password, please try again."):m("An error has occurred, please try again.")}finally{y(!1)}else return C("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!w&&v,children:"Recover your account"})]})]}),Ze(I,{}),Ze(D,{protectedByPrivy:!0})]})},Vh=Kn.div`
1080
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import{CheckCircleIcon as Ah,XCircleIcon as kh}from"@heroicons/react/24/outline";import{Fragment as Rh,jsx as Mt,jsxs as Ca}from"react/jsx-runtime";var $c=({error:e,onClose:t})=>Ca(Rh,{children:[Mt(P,{closeable:!1}),Mt(S,{}),e?Ca(Rt,{children:[Mt(kh,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Mt(he,{title:"Something went wrong",description:e})]}):Ca(Rt,{children:[Mt(Ah,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Mt(he,{title:"Success"})]}),Mt(j,{onClick:t,children:"Close"}),Mt(W,{}),Mt(O,{protectedByPrivy:!0})]});import{useReducer as Ih}from"react";var Wh=(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}},Vc=()=>{let[e,t]=Ih(Wh,"creating");return{send:t,state:e}};import{jsx as Br}from"react/jsx-runtime";var Vn=({onSubmit:e,...t})=>{let{send:o,state:r}=Vc(),n=qc(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Nh(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),Ue)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=qc(()=>{o("back")},[o]);return r==="creating"?Br(Hc,{...t,onSubmit:n}):r==="saving"?Br(zc,{...t,onSubmit:n,onBack:i}):r==="confirming"?Br(Ac,{...t,onSubmit:n,onBack:i}):r==="finalizing"?Br(Wc,{...t,onSubmit:n,onBack:i}):r==="done"?Br($c,{...t,onSubmit:n}):null};import{jsx as ba}from"react/jsx-runtime";var Lh=250,Kc=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=b(),[n,i]=Hr(""),[a,c]=Hr(!1),[s,l]=Hr(),[f,m]=Hr(null),[v,y]=Hr(null),C=Mh(!1),{authenticated:T,getAccessToken:_}=V(),{refreshUser:x,closePrivyModal:w,createAnalyticsEvent:D,isNewUserThisSession:I,initializeWalletProxy:k}=A(),{onSuccess:M,onFailure:U,callAuthOnSuccessOnClose:se}=o.createWallet,B=e?.embeddedWallets.requireUserPasswordOnCreate===!0,Y=!!(!n||C.current)&&!B,H=new qe(async()=>N());jc(()=>{f||k(3e4).then(G=>m(G))},[f]),jc(()=>{if(!T){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!B&&!a&&!C.current&&(c(!0),H.execute().finally(()=>c(!1)))},[B,T]);let Z=()=>{B&&v&&v?.recoveryMethod!=="user-passcode"?U(new Le("User created a wallet but failed to set a password for it")):v?M(v):U(new Le("User wallet creation failed")),w({shouldCallAuthOnSuccess:se})};r&&(r.current=()=>({closeModal:!1}));let N=async function(){let G=await _();if(G)try{if(D("embedded_wallet_creation_started"),!await(await k(pn))?.create({accessToken:G,recoveryPassword:s}))throw D("embedded_wallet_creation_failed",{error:"walletProxy did not send a response."}),new Error("Unable to create wallet");let le=await x(),z=te(le);if(!z)throw D("embedded_wallet_creation_failed",{error:"Updated user is missing embedded wallet."}),new Error("Unable to create wallet");y(z),D("embedded_wallet_creation_completed",{walletAddress:z.address}),i(""),C.current=!0,B?t("EMBEDDED_WALLET_CREATED_SCREEN"):I?t("EMBEDDED_WALLET_CREATED_SCREEN"):z&&(M(z),w({shouldCallAuthOnSuccess:se}))}catch(q){if(C.current)return;i("An error has occurred, please try again."),console.warn(q)}else i("An error has occured, please login again."),D("embedded_wallet_creation_failed",{error:"Missing access token for user."})},We=async()=>B?(c(!0),H.execute().then(()=>new Promise(G=>setTimeout(G,Lh))).finally(()=>c(!1))):w({shouldCallAuthOnSuccess:se});return Y?ba(Pc,{children:ba(or,{})}):ba(Vn,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:Y||!f,buttonLoading:a,buttonHideAnimations:!v&&a,error:n,password:s||"",onClose:Z,onPasswordChange:l,onPasswordGenerate:()=>l($n()),onSubmit:We})};import{useEffect as Oh,useState as qn}from"react";import{jsx as Dh}from"react/jsx-runtime";var Yc=()=>{let[e,t]=qn(null),[o,r]=qn(!1),[n,i]=qn(null),[a,c]=qn(""),{authenticated:s,getAccessToken:l,user:f}=V(),{walletProxy:m,refreshUser:v,closePrivyModal:y,createAnalyticsEvent:C}=A(),{app:T,navigate:_,data:x,outerClickRef:w}=b(),{onSuccess:D,onFailure:I}=x.createWallet,k=te(f),M=e?.recoveryMethod==="user-passcode";Oh(()=>{s||(_("LANDING"),I(new rn("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){I(n),y({shouldCallAuthOnSuccess:!1});return}if(!M){I(new Le("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}D(e),y({shouldCallAuthOnSuccess:!1})};w&&(w.current=()=>(U(),{closeModal:!M}));let se=async()=>{let Y=await l();if(Y&&k?.address&&a&&m)try{if(C("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await m.setRecoveryPassword({accessToken:Y,address:k.address,recoveryPassword:a})).address){i(new Le("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Z=await v(),N=te(Z);if(!N){i(new Le("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(N),C("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(H){console.warn(H),i(H instanceof Error?H:new Error("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:H})}},B=async()=>{M?(D(e),y({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await se(),r(!1))};return Dh(Vn,{appName:T?.name||"privy",config:{initiatedBy:"user",onCancel:U},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>c($n()),onPasswordChange:c,onSubmit:B,onClose:U})};import{UserCircleIcon as Uh}from"@heroicons/react/24/outline";import{LockClosedIcon as Fh}from"@heroicons/react/24/solid";import{useEffect as Bh}from"react";import{Fragment as Hh,jsx as Lt,jsxs as jn}from"react/jsx-runtime";var Jc=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:o}=A(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=b(),{onSuccess:c,onFailure:s}=r.setWalletPassword,l=()=>{s(new Le("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return Bh(()=>{a&&(a.current=l)},[]),jn(Hh,{children:[Lt(P,{onClose:l}),Lt(S,{}),jn(Rt,{children:[jn(Nl,{children:[Lt(Uh,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Lt(Ml,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Lt(Fh,{width:"12px",height:"12px",fill:"white"})})]}),jn(he,{title:"Secure Your Account",children:["Please set a password to secure your account.",Lt("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."})]})]}),Lt(j,{onClick:()=>{let m=te(e);o("embedded_wallet_set_password_started",{walletAddress:m?.address}),n({createWallet:{onFailure:s,onSuccess:c,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Lt(W,{}),Lt(O,{protectedByPrivy:!0})]})};import{ShieldCheckIcon as Gh}from"@heroicons/react/24/outline";import{useEffect as zh,useState as Ea}from"react";import Kn,{css as $h}from"styled-components";import{Fragment as Yh,jsx as Ze,jsxs as ar}from"react/jsx-runtime";var Qc=()=>{let{authenticated:e,getAccessToken:t}=V(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=A(),{navigate:i,data:a,outerClickRef:c}=b(),[s,l]=Ea(void 0),[f,m]=Ea(""),[v,y]=Ea(!1),{privyWallet:C,onCompleteNavigateTo:T,onSuccess:_,onFailure:x}=a.recoverWallet,w=(k="User exited before their wallet could be recovered")=>{r({shouldCallAuthOnSuccess:!1}),x(typeof k=="string"?new Le(k):k)};c&&(c.current=()=>w()),zh(()=>{if(!e||!C)return w("User must be authenticated and have a Privy wallet before it can be recovered")},[e]);let D=k=>{k&&l(k)};return ar(Yh,{children:[Ze(P,{onClose:w}),Ze(S,{}),ar(qh,{children:[ar(Vh,{children:[Ze(Gh,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ze("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ze("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),ar("div",{children:[Ze(xo,{onChange:k=>D(k.target.value),disabled:v}),!!f&&Ze(jh,{children:f})]}),ar("div",{children:[ar(Wl,{children:[Ze("h4",{children:"Why is this necessary?"}),Ze("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ze(Kh,{loading:v||!o,disabled:!s,onClick:async()=>{y(!0);let k=await t();if(k&&C&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:C.address}),await o?.recover({address:C.address,accessToken:k,recoveryPin:s}),m(""),T?i(T):r({shouldCallAuthOnSuccess:!1}),_?.(C),n("embedded_wallet_recovery_completed",{walletAddress:C.address})}catch(M){cc(M)?m("Invalid recovery password, please try again."):m("An error has occurred, please try again.")}finally{y(!1)}else return w("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!C&&v,children:"Recover your account"})]})]}),Ze(W,{}),Ze(O,{protectedByPrivy:!0})]})},Vh=Kn.div`
1081
1081
  display: flex;
1082
1082
  flex-direction: column;
1083
1083
  align-items: center;
@@ -1166,7 +1166,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1166
1166
  margin: 0 0.5rem;
1167
1167
  `,ly=Ot.div`
1168
1168
  margin: 30px 0;
1169
- `;import{ofetch as cy}from"ofetch";import{useEffect as dy,useRef as py,useState as uy}from"react";var Jn="moonpay",ed="sdk_fiat_on_ramp_completed_with_status";async function td(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function my(e,t){let o=t?Ys:Ks,r=t?Qs:Js;return cy(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function od(e,t=!1){let[o,r]=uy(null),{createAnalyticsEvent:n}=A(),i=py(0);return dy(()=>{let a=setInterval(async()=>{if(e)try{let[c]=await my(e,t),s=c.status==="waitingAuthorization"&&c.paymentMethod==="credit_debit_card"?"pending":c.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(ed,{status:s,provider:Jn,paymentMethod:c.paymentMethod,cardPaymentType:c.cardPaymentType,currency:c.currency?.code,baseCurrencyAmount:c.baseCurrencyAmount,quoteCurrencyAmount:c.quoteCurrencyAmount,feeAmount:c.feeAmount,extraFeeAmount:c.extraFeeAmount,networkFeeAmount:c.networkFeeAmount}),clearInterval(a))}catch(c){c.response?.status!==404&&(i.current+=1),i.current>=3&&(r("serviceFailure"),n(ed,{status:"serviceFailure",provider:Jn}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as fy,jsx as Qn,jsxs as hy}from"react/jsx-runtime";var rd=()=>{let{app:e,data:t,navigate:o}=b(),{createAnalyticsEvent:r}=A(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:hy(fy,{children:[Qn(P,{title:"Fund account"},"header"),Qn(S,{}),Qn(Xc,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:Jn}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Qn(D,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as yy,CheckCircleIcon as gy,XCircleIcon as vy}from"@heroicons/react/24/solid";import{useMemo as wy}from"react";import nd from"styled-components";import{Fragment as Ta,jsx as ge,jsxs as _o}from"react/jsx-runtime";var id=()=>{let{app:e,data:t}=b(),{closePrivyModal:o}=A(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=od(r||null,e.fiatOnRamp.useSandbox);return _o(Ta,{children:[ge(P,{title:"Fund account"},"header"),ge(S,{}),ge(by,{status:n,onClickCta:o}),ge(D,{protectedByPrivy:!0})]})},Cy=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:_o(Ta,{children:[_o("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ge("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ge("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:""}}},by=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=wy(()=>Cy(e),[e]);return _o(Ta,{children:[_o(_y,{style:{height:"100%",gap:0},children:[ge(Py,{status:e}),_o(Jt,{children:[ge("h3",{children:o}),ge(Ty,{children:r})]})]}),n&&ge(de,{children:ge(j,{onClick:t,children:n})})]})},Ey=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)",xy=e=>{switch(e){case"serviceFailure":case"failed":return vy;case"completed":return gy;case"waitingAuthorization":return()=>ge(yy,{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}},Py=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return _o("div",{style:{position:"relative"},children:[ge(bo,{color:r,style:{position:"absolute"}}),ge(Yi,{color:r}),ge(Yn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=xy(e),o=Ey(e);return ge("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ge(t,{width:"4rem",height:"4rem",color:o})})},Ty=nd.p`
1169
+ `;import{ofetch as cy}from"ofetch";import{useEffect as dy,useRef as py,useState as uy}from"react";var Jn="moonpay",ed="sdk_fiat_on_ramp_completed_with_status";async function td(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function my(e,t){let o=t?Ys:Ks,r=t?Qs:Js;return cy(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function od(e,t=!1){let[o,r]=uy(null),{createAnalyticsEvent:n}=A(),i=py(0);return dy(()=>{let a=setInterval(async()=>{if(e)try{let[c]=await my(e,t),s=c.status==="waitingAuthorization"&&c.paymentMethod==="credit_debit_card"?"pending":c.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(ed,{status:s,provider:Jn,paymentMethod:c.paymentMethod,cardPaymentType:c.cardPaymentType,currency:c.currency?.code,baseCurrencyAmount:c.baseCurrencyAmount,quoteCurrencyAmount:c.quoteCurrencyAmount,feeAmount:c.feeAmount,extraFeeAmount:c.extraFeeAmount,networkFeeAmount:c.networkFeeAmount}),clearInterval(a))}catch(c){c.response?.status!==404&&(i.current+=1),i.current>=3&&(r("serviceFailure"),n(ed,{status:"serviceFailure",provider:Jn}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as fy,jsx as Qn,jsxs as hy}from"react/jsx-runtime";var rd=()=>{let{app:e,data:t,navigate:o}=b(),{createAnalyticsEvent:r}=A(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:hy(fy,{children:[Qn(P,{title:"Fund account"},"header"),Qn(S,{}),Qn(Xc,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:Jn}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Qn(O,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as yy,CheckCircleIcon as gy,XCircleIcon as vy}from"@heroicons/react/24/solid";import{useMemo as wy}from"react";import nd from"styled-components";import{Fragment as Ta,jsx as ge,jsxs as _o}from"react/jsx-runtime";var id=()=>{let{app:e,data:t}=b(),{closePrivyModal:o}=A(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=od(r||null,e.fiatOnRamp.useSandbox);return _o(Ta,{children:[ge(P,{title:"Fund account"},"header"),ge(S,{}),ge(by,{status:n,onClickCta:o}),ge(O,{protectedByPrivy:!0})]})},Cy=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:_o(Ta,{children:[_o("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ge("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ge("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:""}}},by=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=wy(()=>Cy(e),[e]);return _o(Ta,{children:[_o(_y,{style:{height:"100%",gap:0},children:[ge(Py,{status:e}),_o(Jt,{children:[ge("h3",{children:o}),ge(Ty,{children:r})]})]}),n&&ge(de,{children:ge(j,{onClick:t,children:n})})]})},Ey=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)",xy=e=>{switch(e){case"serviceFailure":case"failed":return vy;case"completed":return gy;case"waitingAuthorization":return()=>ge(yy,{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}},Py=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return _o("div",{style:{position:"relative"},children:[ge(bo,{color:r,style:{position:"absolute"}}),ge(Yi,{color:r}),ge(Yn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=xy(e),o=Ey(e);return ge("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ge(t,{width:"4rem",height:"4rem",color:o})})},Ty=nd.p`
1170
1170
  font-size: 1rem;
1171
1171
  color: var(--privy-color-foreground-3);
1172
1172
  margin-bottom: 1rem;
@@ -1224,7 +1224,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1224
1224
  border-color: ${e=>e.fgColor};
1225
1225
  border-radius: var(--privy-border-radius-md);
1226
1226
  }
1227
- `,cd=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return _e(Uy,{size:r,bgColor:t,fgColor:o,children:_e(Dy,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as Fy}from"react/jsx-runtime";var pd=({size:e})=>Fy(cd,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:ut,size:e,fgColor:"#1F1F1F"});import{jsx as ud}from"react/jsx-runtime";var md=e=>ud("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:ud("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M68.853 62.127c-5.174.517-8.978 4.95-8.978 10.149v15.336c0 5.248 3.873 9.7 9.098 10.196 3.623.344 7.71.64 11.027.64 5.445 0 12.964-.799 17.098-1.294a3.445 3.445 0 0 0 3.027-3.436v-19.05c0-1.75-1.29-3.228-3.027-3.436-3.657-.438-9.961-1.113-15.136-1.264a66.647 66.647 0 0 0-1.965-.03c-.72 0-1.478.013-2.262.04-3.046.1-6.453.373-9.467.669a1.677 1.677 0 0 1-.174-3.347c3.804-.373 8.282-.717 11.903-.717 4.034 0 9.137.427 13.193.847 1.322.137 2.54.274 3.58.397v-1.582c0-1.734-1.264-3.203-2.983-3.426-3.83-.497-10.563-1.267-15.464-1.267-2.848 0-6.314.26-9.47.575Zm25.399 24.581a2.516 2.516 0 1 0 0-5.031 2.516 2.516 0 0 0 0 5.031Z",fill:"var(--privy-color-accent)"})});import{jsx as ve,jsxs as By}from"react/jsx-runtime";var fd=({style:e,...t})=>By("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:[ve("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),ve(we,{x:"206",y:"140",width:"36",height:"36"}),ve("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),ve("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),ve("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),ve(Ke,{x:"44.5",y:"23",width:"40",height:"40"}),ve("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),ve("g",{clipPath:"url(#clip0_428_81)",children:ve("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),ve(md,{x:"63",y:"17"}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),ve("path",{fill:"var(--privy-color-accent)",d:"M269.405 111c8.865 0 16.052-7.163 16.052-16s-7.187-16-16.052-16c-8.865 0-16.051 7.163-16.051 16s7.186 16 16.051 16ZM133.971 24c6.649 0 12.039-5.373 12.039-12s-5.39-12-12.039-12-12.039 5.373-12.039 12 5.39 12 12.039 12ZM15.592 112c4.986 0 9.029-4.029 9.029-9 0-4.97-4.043-9-9.03-9-4.986 0-9.028 4.03-9.028 9 0 4.971 4.042 9 9.029 9Z"}),ve("path",{fill:"var(--privy-color-accent-light)",d:"M152.029 177c5.541 0 10.032-4.477 10.032-10s-4.491-10-10.032-10-10.032 4.477-10.032 10 4.491 10 10.032 10ZM263.386 21c4.432 0 8.026-3.582 8.026-8s-3.594-8-8.026-8c-4.433 0-8.026 3.582-8.026 8s3.593 8 8.026 8ZM7.064 36c3.602 0 6.521-2.91 6.521-6.5s-2.92-6.5-6.52-6.5C3.462 23 .542 25.91.542 29.5S3.463 36 7.064 36Z"}),ve("defs",{children:ve("clipPath",{id:"clip0_428_81",children:ve("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as Aa,jsx as R,jsxs as ae}from"react/jsx-runtime";var ka=()=>{let{navigate:e}=b(),t="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Dt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),ae(Wa,{children:[R(wt,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),R(Na,{children:R(we,{style:{width:"152px",height:"152px"}})}),ae(Zn,{children:[R(Et,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your recovery phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ra=()=>{let{navigate:e}=b(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Dt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),ae(Wa,{children:[R(wt,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),R(Na,{children:R(Ke,{style:{width:"152px",height:"152px"}})}),ae(Zn,{children:[R(Et,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your recovery phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ia=()=>{let{navigate:e}=b();return ae(Wa,{children:[R(wt,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),R(Na,{style:{marginTop:"-24px"},children:R(pd,{size:200})}),ae(Zn,{children:[R(Et,{children:"Scan the QR code with your camera"}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your seed phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},gd=()=>{let[e,t]=Hy("WHAT_IS_A_WALLET"),{navigateBack:o}=b();return ae(Aa,{children:[R(P,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),R(S,{}),ae(Gy,{children:[e==="WHAT_IS_A_WALLET"&&ae(Aa,{children:[R(jy,{children:R(fd,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),ae(he,{title:"Get started with a new wallet",children:[R("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),R("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),R(Vy,{children:R(qy,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&R(Aa,{children:ae(zy,{children:[R(wt,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),ae($y,{children:[ae(hd,{onClick:()=>{Dt.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Dt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":t("CREATE_METAMASK_WALLET")},children:[R(we,{}),ae(yd,{children:[R("h4",{children:"MetaMask"}),R("p",{children:"Get a browser-based wallet"})]})]}),ae(hd,{onClick:()=>{Dt.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Dt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":t("CREATE_COINBASE_WALLET")},children:[R(ut,{}),ae(yd,{children:[R("h4",{children:"Coinbase Wallet"}),R("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&R(Ia,{}),e==="CREATE_METAMASK_WALLET"&&R(ka,{}),e==="CREATE_PHANTOM_WALLET"&&R(Ra,{})]}),R(I,{}),ae(X,{children:[R("span",{children:"Still not sure? "}),R("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},Gy=xt.div`
1227
+ `,cd=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return _e(Uy,{size:r,bgColor:t,fgColor:o,children:_e(Dy,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as Fy}from"react/jsx-runtime";var pd=({size:e})=>Fy(cd,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:ut,size:e,fgColor:"#1F1F1F"});import{jsx as ud}from"react/jsx-runtime";var md=e=>ud("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:ud("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M68.853 62.127c-5.174.517-8.978 4.95-8.978 10.149v15.336c0 5.248 3.873 9.7 9.098 10.196 3.623.344 7.71.64 11.027.64 5.445 0 12.964-.799 17.098-1.294a3.445 3.445 0 0 0 3.027-3.436v-19.05c0-1.75-1.29-3.228-3.027-3.436-3.657-.438-9.961-1.113-15.136-1.264a66.647 66.647 0 0 0-1.965-.03c-.72 0-1.478.013-2.262.04-3.046.1-6.453.373-9.467.669a1.677 1.677 0 0 1-.174-3.347c3.804-.373 8.282-.717 11.903-.717 4.034 0 9.137.427 13.193.847 1.322.137 2.54.274 3.58.397v-1.582c0-1.734-1.264-3.203-2.983-3.426-3.83-.497-10.563-1.267-15.464-1.267-2.848 0-6.314.26-9.47.575Zm25.399 24.581a2.516 2.516 0 1 0 0-5.031 2.516 2.516 0 0 0 0 5.031Z",fill:"var(--privy-color-accent)"})});import{jsx as ve,jsxs as By}from"react/jsx-runtime";var fd=({style:e,...t})=>By("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:[ve("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),ve(we,{x:"206",y:"140",width:"36",height:"36"}),ve("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),ve("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),ve("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),ve(Ke,{x:"44.5",y:"23",width:"40",height:"40"}),ve("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),ve("g",{clipPath:"url(#clip0_428_81)",children:ve("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),ve(md,{x:"63",y:"17"}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),ve("path",{fill:"var(--privy-color-accent)",d:"M269.405 111c8.865 0 16.052-7.163 16.052-16s-7.187-16-16.052-16c-8.865 0-16.051 7.163-16.051 16s7.186 16 16.051 16ZM133.971 24c6.649 0 12.039-5.373 12.039-12s-5.39-12-12.039-12-12.039 5.373-12.039 12 5.39 12 12.039 12ZM15.592 112c4.986 0 9.029-4.029 9.029-9 0-4.97-4.043-9-9.03-9-4.986 0-9.028 4.03-9.028 9 0 4.971 4.042 9 9.029 9Z"}),ve("path",{fill:"var(--privy-color-accent-light)",d:"M152.029 177c5.541 0 10.032-4.477 10.032-10s-4.491-10-10.032-10-10.032 4.477-10.032 10 4.491 10 10.032 10ZM263.386 21c4.432 0 8.026-3.582 8.026-8s-3.594-8-8.026-8c-4.433 0-8.026 3.582-8.026 8s3.593 8 8.026 8ZM7.064 36c3.602 0 6.521-2.91 6.521-6.5s-2.92-6.5-6.52-6.5C3.462 23 .542 25.91.542 29.5S3.463 36 7.064 36Z"}),ve("defs",{children:ve("clipPath",{id:"clip0_428_81",children:ve("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as Aa,jsx as R,jsxs as ae}from"react/jsx-runtime";var ka=()=>{let{navigate:e}=b(),t="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Dt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),ae(Wa,{children:[R(wt,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),R(Na,{children:R(we,{style:{width:"152px",height:"152px"}})}),ae(Zn,{children:[R(Et,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your recovery phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ra=()=>{let{navigate:e}=b(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Dt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),ae(Wa,{children:[R(wt,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),R(Na,{children:R(Ke,{style:{width:"152px",height:"152px"}})}),ae(Zn,{children:[R(Et,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your recovery phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ia=()=>{let{navigate:e}=b();return ae(Wa,{children:[R(wt,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),R(Na,{style:{marginTop:"-24px"},children:R(pd,{size:200})}),ae(Zn,{children:[R(Et,{children:"Scan the QR code with your camera"}),R(So,{}),R(Et,{children:"Set up your first wallet"}),R(So,{}),R(Et,{children:"Store your seed phrase in a safe place!"})]}),R(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},gd=()=>{let[e,t]=Hy("WHAT_IS_A_WALLET"),{navigateBack:o}=b();return ae(Aa,{children:[R(P,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),R(S,{}),ae(Gy,{children:[e==="WHAT_IS_A_WALLET"&&ae(Aa,{children:[R(jy,{children:R(fd,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),ae(he,{title:"Get started with a new wallet",children:[R("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),R("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),R(Vy,{children:R(qy,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&R(Aa,{children:ae(zy,{children:[R(wt,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),ae($y,{children:[ae(hd,{onClick:()=>{Dt.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Dt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":t("CREATE_METAMASK_WALLET")},children:[R(we,{}),ae(yd,{children:[R("h4",{children:"MetaMask"}),R("p",{children:"Get a browser-based wallet"})]})]}),ae(hd,{onClick:()=>{Dt.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Dt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":t("CREATE_COINBASE_WALLET")},children:[R(ut,{}),ae(yd,{children:[R("h4",{children:"Coinbase Wallet"}),R("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&R(Ia,{}),e==="CREATE_METAMASK_WALLET"&&R(ka,{}),e==="CREATE_PHANTOM_WALLET"&&R(Ra,{})]}),R(W,{}),ae(X,{children:[R("span",{children:"Still not sure? "}),R("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},Gy=xt.div`
1228
1228
  display: flex;
1229
1229
  flex-direction: column;
1230
1230
  height: 100%;
@@ -1319,7 +1319,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1319
1319
  display: flex;
1320
1320
  justify-content: center;
1321
1321
  flex-grow: 1;
1322
- `;import{Fragment as Ky,jsx as lr,jsxs as vd}from"react/jsx-runtime";var wd=()=>{let{navigateBack:e}=b();return vd(Ky,{children:[lr(P,{backFn:e},"header"),lr(S,{}),lr(Ia,{}),lr(I,{}),vd(X,{children:[lr("span",{children:"Still not sure? "}),lr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Yy,jsx as cr,jsxs as Cd}from"react/jsx-runtime";var bd=()=>{let{navigateBack:e}=b();return Cd(Yy,{children:[cr(P,{backFn:e},"header"),cr(S,{}),cr(ka,{}),cr(I,{}),Cd(X,{children:[cr("span",{children:"Still not sure? "}),cr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Jy,jsx as dr,jsxs as Ed}from"react/jsx-runtime";var xd=()=>{let{navigateBack:e}=b();return Ed(Jy,{children:[dr(P,{backFn:e},"header"),dr(S,{}),dr(Ra,{}),dr(I,{}),Ed(X,{children:[dr("span",{children:"Still not sure? "}),dr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as fg}from"react";import{isMobile as kd}from"react-device-detect";import pr from"styled-components";import{EnvelopeIcon as Qy}from"@heroicons/react/24/outline";import{useEffect as Ma,useState as La}from"react";import Da from"styled-components";import{Fragment as tg,jsx as Ao,jsxs as Oa}from"react/jsx-runtime";var Xn=e=>{let[t,o]=La(""),[r,n]=La(!1),[i,a]=La(null),{isLinking:c,initLoginWithEmail:s,captchaData:l}=A(),{app:f,navigate:m}=b(),v=f?.loginMethods.wallet??!1;Ma(()=>{document.querySelector("#email-input")?.focus()},[]);let y=Zs(t),w=()=>{n(!0),s(t,l.token).then(()=>{l.enabled&&l.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{C?.status===422?a(C.message):C?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(C),a("Issue submitting email")),n(!1)})},T="Get started without a wallet.";i?T=i:c?T="\u200B":v||(T="Get started quickly with email");let _=l.enabled&&!l.token&&!l.error,x=l.error!==void 0;return Ma(()=>{l.error&&a("Issue verifying you are a human")},[l.error]),Ma(()=>{l.ready&&l.execute()},[l.ready]),Oa(tg,{children:[Oa(Zy,{stacked:e.stacked,children:[Oa(Xy,{standalone:e.stacked,children:[Ao(Qy,{}),Ao("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:C=>o(C.target.value),onKeyUp:C=>{C.key==="Enter"&&w()},value:t,autoComplete:"email"})]}),e.stacked?null:Ao(Wn,{disabled:r||!y||_||x,onClick:w,children:r||_?Ao(Kt,{}):"Submit"})]}),l.enabled&&Ao("div",{id:"cf-turnstile"}),Ao(eg,{fail:!!i,children:T}),e.stacked?Ao(j,{loading:r||_,loadingText:null,disabled:r||!y||_||x,onClick:w,children:"Submit"}):null]})},Zy=Da.div`
1322
+ `;import{Fragment as Ky,jsx as lr,jsxs as vd}from"react/jsx-runtime";var wd=()=>{let{navigateBack:e}=b();return vd(Ky,{children:[lr(P,{backFn:e},"header"),lr(S,{}),lr(Ia,{}),lr(W,{}),vd(X,{children:[lr("span",{children:"Still not sure? "}),lr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Yy,jsx as cr,jsxs as Cd}from"react/jsx-runtime";var bd=()=>{let{navigateBack:e}=b();return Cd(Yy,{children:[cr(P,{backFn:e},"header"),cr(S,{}),cr(ka,{}),cr(W,{}),Cd(X,{children:[cr("span",{children:"Still not sure? "}),cr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Jy,jsx as dr,jsxs as Ed}from"react/jsx-runtime";var xd=()=>{let{navigateBack:e}=b();return Ed(Jy,{children:[dr(P,{backFn:e},"header"),dr(S,{}),dr(Ra,{}),dr(W,{}),Ed(X,{children:[dr("span",{children:"Still not sure? "}),dr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as fg}from"react";import{isMobile as kd}from"react-device-detect";import pr from"styled-components";import{EnvelopeIcon as Qy}from"@heroicons/react/24/outline";import{useEffect as Ma,useState as La}from"react";import Da from"styled-components";import{Fragment as tg,jsx as Ao,jsxs as Oa}from"react/jsx-runtime";var Xn=e=>{let[t,o]=La(""),[r,n]=La(!1),[i,a]=La(null),{isLinking:c,initLoginWithEmail:s,captchaData:l}=A(),{app:f,navigate:m}=b(),v=f?.loginMethods.wallet??!1;Ma(()=>{document.querySelector("#email-input")?.focus()},[]);let y=Zs(t),C=()=>{n(!0),s(t,l.token).then(()=>{l.enabled&&l.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{w?.status===422?a(w.message):w?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(w),a("Issue submitting email")),n(!1)})},T="Get started without a wallet.";i?T=i:c?T="\u200B":v||(T="Get started quickly with email");let _=l.enabled&&!l.token&&!l.error,x=l.error!==void 0;return Ma(()=>{l.error&&a("Issue verifying you are a human")},[l.error]),Ma(()=>{l.ready&&l.execute()},[l.ready]),Oa(tg,{children:[Oa(Zy,{stacked:e.stacked,children:[Oa(Xy,{standalone:e.stacked,children:[Ao(Qy,{}),Ao("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:w=>o(w.target.value),onKeyUp:w=>{w.key==="Enter"&&C()},value:t,autoComplete:"email"})]}),e.stacked?null:Ao(Wn,{disabled:r||!y||_||x,onClick:C,children:r||_?Ao(Kt,{}):"Submit"})]}),l.enabled&&Ao("div",{id:"cf-turnstile"}),Ao(eg,{fail:!!i,children:T}),e.stacked?Ao(j,{loading:r||_,loadingText:null,disabled:r||!y||_||x,onClick:C,children:"Submit"}):null]})},Zy=Da.div`
1323
1323
  width: 100%;
1324
1324
  height: ${e=>e.stacked?"100%":"auto"};
1325
1325
 
@@ -1381,7 +1381,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1381
1381
  > a {
1382
1382
  text-decoration: underline;
1383
1383
  }
1384
- `;import{PhoneIcon as og}from"@heroicons/react/24/outline";import{useEffect as Ua,useState as Fa}from"react";import Ha from"styled-components";import{Fragment as ag,jsx as ko,jsxs as Ba}from"react/jsx-runtime";var ei=e=>{let[t,o]=Fa(""),[r,n]=Fa(!1),[i,a]=Fa(null),{isLinking:c,initLoginWithSms:s,captchaData:l}=A(),{app:f,navigate:m}=b(),v=f?.loginMethods.wallet??!1;Ua(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let y=Xs(t),w=()=>{n(!0),s(t,l.token).then(()=>{l.enabled&&l.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{C?.status===422?a(C.message):C?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(C),a("Issue submitting phone number")),n(!1)})},T="Get started without a wallet.";i?T=i:c?T="\u200B":v||(T="Get started quickly with your phone");let _=l.enabled&&!l.token&&!l.error,x=l.error!==void 0;return Ua(()=>{l.error&&a("Issue verifying you are a human")},[l.error]),Ua(()=>{l.ready&&l.execute()},[l.ready]),Ba(ag,{children:[Ba(rg,{stacked:e.stacked,children:[Ba(ng,{standalone:e.stacked,children:[ko(og,{}),ko("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:C=>{o(C.target.value)},onKeyUp:C=>{C.key==="Enter"&&w()},value:t,autoComplete:"tel"})]}),e.stacked?null:ko(Wn,{disabled:r||!y||_||x,onClick:w,children:r||_?ko(Kt,{}):"Submit"})]}),l.enabled&&ko("div",{id:"cf-turnstile"}),ko(ig,{fail:!!i,children:T}),e.stacked?ko(j,{loading:r||_,loadingText:null,disabled:r||!y||_||x,onClick:w,children:"Submit"}):null]})},rg=Ha.div`
1384
+ `;import{PhoneIcon as og}from"@heroicons/react/24/outline";import{useEffect as Ua,useState as Fa}from"react";import Ha from"styled-components";import{Fragment as ag,jsx as ko,jsxs as Ba}from"react/jsx-runtime";var ei=e=>{let[t,o]=Fa(""),[r,n]=Fa(!1),[i,a]=Fa(null),{isLinking:c,initLoginWithSms:s,captchaData:l}=A(),{app:f,navigate:m}=b(),v=f?.loginMethods.wallet??!1;Ua(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let y=Xs(t),C=()=>{n(!0),s(t,l.token).then(()=>{l.enabled&&l.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{w?.status===422?a(w.message):w?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(w),a("Issue submitting phone number")),n(!1)})},T="Get started without a wallet.";i?T=i:c?T="\u200B":v||(T="Get started quickly with your phone");let _=l.enabled&&!l.token&&!l.error,x=l.error!==void 0;return Ua(()=>{l.error&&a("Issue verifying you are a human")},[l.error]),Ua(()=>{l.ready&&l.execute()},[l.ready]),Ba(ag,{children:[Ba(rg,{stacked:e.stacked,children:[Ba(ng,{standalone:e.stacked,children:[ko(og,{}),ko("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:w=>{o(w.target.value)},onKeyUp:w=>{w.key==="Enter"&&C()},value:t,autoComplete:"tel"})]}),e.stacked?null:ko(Wn,{disabled:r||!y||_||x,onClick:C,children:r||_?ko(Kt,{}):"Submit"})]}),l.enabled&&ko("div",{id:"cf-turnstile"}),ko(ig,{fail:!!i,children:T}),e.stacked?ko(j,{loading:r||_,loadingText:null,disabled:r||!y||_||x,onClick:C,children:"Submit"}):null]})},rg=Ha.div`
1385
1385
  display: flex;
1386
1386
  border: 1px solid var(--privy-color-foreground-4);
1387
1387
  width: 100%;
@@ -1472,7 +1472,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1472
1472
  background-color: var(--privy-color-background-2);
1473
1473
  }
1474
1474
  }
1475
- `;import{Fragment as za,jsx as ne,jsxs as Io}from"react/jsx-runtime";var Id=()=>{let{app:e,outerClickRef:t}=b(),{captchaData:o,closePrivyModal:r}=A(),n=e?.loginMethods.email??!1,i=e?.loginMethods.sms??!1,a=e?.loginMethods.wallet??!1,c=e?.loginMethods.google??!1,s=e?.loginMethods.twitter??!1,l=e?.loginMethods.discord??!1,f=e?.loginMethods.github??!1,m=e?.loginMethods.tiktok??!1,v=e?.loginMethods.linkedin??!1,y=e?.loginMethods.apple??!1,w=!e?.appearance.showWalletLoginFirst,T=a&&e?.appearance.showWalletLoginFirst?0:1,[_,x]=fg(T),C=_==0,W=_==1,M=a,k=n||i,L=M!==k,U=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=U),Io(za,{children:[ne(P,{onClose:U},"header"),e?.appearance.logo?ne(wg,{hasOnlyOneSection:L,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:ne(Dn,{})}):null,Io(Cg,{reverse:w,children:[M&&ne(hg,{active:C||L,connectOnly:!1,tabIndex:w?1:0,onClick:()=>{o.enabled&&o.remove(),x(0)},isOnlySection:!k}),k&&ne(yg,{active:W||L,onClick:()=>x(1),email:n,sms:i,google:c,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:l,github:f,tiktok:m,linkedin:v,apple:y,tabIndex:w?0:1,isOnlySection:!M})]}),e&&ne(Nn,{app:e}),ne(D,{protectedByPrivy:!0})]})};function hg(e){return Io(Nd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[ne(Wd,{active:e.active,children:ne("h4",{children:"Connect Wallet"})}),e.active&&Io(za,{children:[ne(Xt,{connectOnly:e.connectOnly}),ne(eo,{})]})]})}function yg(e){let t=!kd||e.twitterOAuthOnMobileEnabled&&kd,o=e.google||e.discord||e.github||e.tiktok||e.linkedin||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return Io(Nd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[e.isOnlySection?null:ne(Wd,{active:e.active,children:ne("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&ne(Xn,{}),e.active&&e.sms&&!e.email&&ne(ei,{}),e.active&&o&&ne(gg,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,tiktok:e.tiktok,linkedin:e.linkedin,apple:e.apple})]})}function gg(e){return Io(za,{children:[Io(vg,{children:[ne(Rd,{}),ne("p",{children:" Or "}),ne(Rd,{})]}),ne(Ad,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showLinkedIn:e.linkedin,showTwitter:e.twitter,showTiktok:e.tiktok,showApple:e.apple})]})}var Wd=pr.div`
1475
+ `;import{Fragment as za,jsx as ne,jsxs as Io}from"react/jsx-runtime";var Id=()=>{let{app:e,outerClickRef:t}=b(),{captchaData:o,closePrivyModal:r}=A(),n=e?.loginMethods.email??!1,i=e?.loginMethods.sms??!1,a=e?.loginMethods.wallet??!1,c=e?.loginMethods.google??!1,s=e?.loginMethods.twitter??!1,l=e?.loginMethods.discord??!1,f=e?.loginMethods.github??!1,m=e?.loginMethods.tiktok??!1,v=e?.loginMethods.linkedin??!1,y=e?.loginMethods.apple??!1,C=!e?.appearance.showWalletLoginFirst,T=a&&e?.appearance.showWalletLoginFirst?0:1,[_,x]=fg(T),w=_==0,D=_==1,I=a,k=n||i,M=I!==k,U=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=U),Io(za,{children:[ne(P,{onClose:U},"header"),e?.appearance.logo?ne(wg,{hasOnlyOneSection:M,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:ne(Dn,{})}):null,Io(Cg,{reverse:C,children:[I&&ne(hg,{active:w||M,connectOnly:!1,tabIndex:C?1:0,onClick:()=>{o.enabled&&o.remove(),x(0)},isOnlySection:!k}),k&&ne(yg,{active:D||M,onClick:()=>x(1),email:n,sms:i,google:c,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:l,github:f,tiktok:m,linkedin:v,apple:y,tabIndex:C?0:1,isOnlySection:!I})]}),e&&ne(Nn,{app:e}),ne(O,{protectedByPrivy:!0})]})};function hg(e){return Io(Nd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[ne(Wd,{active:e.active,children:ne("h4",{children:"Connect Wallet"})}),e.active&&Io(za,{children:[ne(Xt,{connectOnly:e.connectOnly}),ne(eo,{})]})]})}function yg(e){let t=!kd||e.twitterOAuthOnMobileEnabled&&kd,o=e.google||e.discord||e.github||e.tiktok||e.linkedin||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return Io(Nd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[e.isOnlySection?null:ne(Wd,{active:e.active,children:ne("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&ne(Xn,{}),e.active&&e.sms&&!e.email&&ne(ei,{}),e.active&&o&&ne(gg,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,tiktok:e.tiktok,linkedin:e.linkedin,apple:e.apple})]})}function gg(e){return Io(za,{children:[Io(vg,{children:[ne(Rd,{}),ne("p",{children:" Or "}),ne(Rd,{})]}),ne(Ad,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showLinkedIn:e.linkedin,showTwitter:e.twitter,showTiktok:e.tiktok,showApple:e.apple})]})}var Wd=pr.div`
1476
1476
  font-weight: ${e=>e.active?600:500};
1477
1477
  color: ${e=>e.active?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
1478
1478
  display: flex;
@@ -1532,7 +1532,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1532
1532
  }
1533
1533
  `,Cg=pr(de)`
1534
1534
  flex-direction: ${e=>e.reverse?"column-reverse":"column"};
1535
- `;import{EnvelopeIcon as bg}from"@heroicons/react/24/outline";import{Fragment as Eg,jsx as ao,jsxs as xg}from"react/jsx-runtime";var Md=()=>{let{app:e}=b();return xg(Eg,{children:[ao(P,{},"header"),ao(S,{}),ao(he,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ao(bg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ao(de,{children:ao(Xn,{stacked:!0})}),ao(I,{}),ao(D,{protectedByPrivy:!0})]})};import{PhoneIcon as Pg}from"@heroicons/react/24/outline";import{Fragment as Tg,jsx as so,jsxs as _g}from"react/jsx-runtime";var Ld=()=>{let{app:e}=b();return _g(Tg,{children:[so(P,{},"header"),so(S,{}),so(he,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:so(Pg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),so(de,{children:so(ei,{stacked:!0})}),so(I,{}),so(D,{protectedByPrivy:!0})]})};import{Fragment as Sg,jsx as Wo,jsxs as Od}from"react/jsx-runtime";var Dd=()=>{let{linkingHint:e}=A(),{app:t}=b(),o=e?`Select the wallet with ${Vt(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Od(Sg,{children:[Wo(P,{},"header"),Wo(S,{}),Wo(Qt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Od(de,{children:[Wo(Xt,{connectOnly:!1}),Wo(eo,{})]}),Wo(I,{}),Wo(D,{protectedByPrivy:!0})]})};import{jsx as Ud,jsxs as Ag}from"react/jsx-runtime";var Fd=({style:e,...t})=>Ag("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:[Ud("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Ud("path",{"fill-rule":"evenodd","clip-rule":"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 kg,jsx as lo,jsxs as Bd}from"react/jsx-runtime";var Hd=()=>{let{closePrivyModal:e}=A(),{navigate:t}=b();return Bd(kg,{children:[lo(P,{},"header"),lo(S,{}),lo(Fd,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),lo(Qt,{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"}}),Bd(de,{children:[lo(j,{onClick:()=>t("LANDING"),children:"Try again"}),lo(Rn,{onClick:()=>e(),children:"Cancel"})]}),lo(I,{}),lo(D,{protectedByPrivy:!0})]})};import{useEffect as Gd,useState as zd}from"react";import Vd from"styled-components";function $a(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as Wg,jsx as Ut,jsxs as pi}from"react/jsx-runtime";var $d={google:{name:"Google",component:ii},discord:{name:"Discord",component:oi},github:{name:"Github",component:ri},linkedin:{name:"LinkedIn",component:si},twitter:{name:"Twitter",component:ci},tiktok:{name:"Tiktok",component:li},apple:{name:"Apple",component:ti}},di=()=>{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"),window.history.pushState({},"",e)},qd=()=>{let{user:e,authenticated:t}=V(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=b(),{getAuthMeta:c,initLoginWithOAuth:s,loginWithOAuth:l,updateWallets:f,closePrivyModal:m}=A(),[v,y]=zd(!1),[w,T]=zd(void 0),_=c()?.provider||"google",x=$d[_].name,C=$d[_].component,W=o?.render.inDialog?Ue:0;Gd(()=>{l().then(()=>{di(),y(!0)}).catch(L=>{let U={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){T(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),di();return}else L?.privyErrorCode==="linked_to_another_user"?U.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(U.retryable=!0,U.detail="Something went wrong. Try again."):L.privyErrorCode==="oauth_user_denied"&&(U.detail=`Retry and check ${$a(_)} to finish connecting your account.`,U.retryable=!0);di(),T(U)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),Gd(()=>{if(t&&v&&e)if($t(e,o?.embeddedWallets?.createOnLogin)){let U=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:se=>console.error(se),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},W);return()=>clearTimeout(U)}else{let U=setTimeout(m,W);return f(),()=>clearTimeout(U)}},[t,v,e]);let M=v?`Successfully connected with ${x}`:w?w.message:`Verifying connection to ${x}`,k="";return v?k="You\u2019re good to go!":w?k=w.detail:k="Just a few moments more",pi(Wg,{children:[Ut(P,{}),Ut(S,{}),pi(Rg,{children:[Ut(Ig,{children:pi("div",{children:[Ut(_n,{success:v,fail:!!w}),Ut(C,{style:{width:"38px",height:"38px"}})]})}),pi(Jt,{children:[Ut("h3",{children:M}),Ut("p",{children:k})]}),w&&w?.retryable?Ut(fe,{onClick:()=>{di(),s(_),T(void 0)},disabled:!v&&!w?.retryable,children:"Retry"}):null]}),Ut(X,{})]})},Rg=Vd.div`
1535
+ `;import{EnvelopeIcon as bg}from"@heroicons/react/24/outline";import{Fragment as Eg,jsx as ao,jsxs as xg}from"react/jsx-runtime";var Md=()=>{let{app:e}=b();return xg(Eg,{children:[ao(P,{},"header"),ao(S,{}),ao(he,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ao(bg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ao(de,{children:ao(Xn,{stacked:!0})}),ao(W,{}),ao(O,{protectedByPrivy:!0})]})};import{PhoneIcon as Pg}from"@heroicons/react/24/outline";import{Fragment as Tg,jsx as so,jsxs as _g}from"react/jsx-runtime";var Ld=()=>{let{app:e}=b();return _g(Tg,{children:[so(P,{},"header"),so(S,{}),so(he,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:so(Pg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),so(de,{children:so(ei,{stacked:!0})}),so(W,{}),so(O,{protectedByPrivy:!0})]})};import{Fragment as Sg,jsx as Wo,jsxs as Od}from"react/jsx-runtime";var Dd=()=>{let{linkingHint:e}=A(),{app:t}=b(),o=e?`Select the wallet with ${Vt(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Od(Sg,{children:[Wo(P,{},"header"),Wo(S,{}),Wo(Qt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Od(de,{children:[Wo(Xt,{connectOnly:!1}),Wo(eo,{})]}),Wo(W,{}),Wo(O,{protectedByPrivy:!0})]})};import{jsx as Ud,jsxs as Ag}from"react/jsx-runtime";var Fd=({style:e,...t})=>Ag("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:[Ud("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Ud("path",{"fill-rule":"evenodd","clip-rule":"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 kg,jsx as lo,jsxs as Bd}from"react/jsx-runtime";var Hd=()=>{let{closePrivyModal:e}=A(),{navigate:t}=b();return Bd(kg,{children:[lo(P,{},"header"),lo(S,{}),lo(Fd,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),lo(Qt,{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"}}),Bd(de,{children:[lo(j,{onClick:()=>t("LANDING"),children:"Try again"}),lo(Rn,{onClick:()=>e(),children:"Cancel"})]}),lo(W,{}),lo(O,{protectedByPrivy:!0})]})};import{useEffect as Gd,useState as zd}from"react";import Vd from"styled-components";function $a(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as Wg,jsx as Ut,jsxs as pi}from"react/jsx-runtime";var $d={google:{name:"Google",component:ii},discord:{name:"Discord",component:oi},github:{name:"Github",component:ri},linkedin:{name:"LinkedIn",component:si},twitter:{name:"Twitter",component:ci},tiktok:{name:"Tiktok",component:li},apple:{name:"Apple",component:ti}},di=()=>{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"),window.history.pushState({},"",e)},qd=()=>{let{user:e,authenticated:t}=V(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=b(),{getAuthMeta:c,initLoginWithOAuth:s,loginWithOAuth:l,updateWallets:f,closePrivyModal:m}=A(),[v,y]=zd(!1),[C,T]=zd(void 0),_=c()?.provider||"google",x=$d[_].name,w=$d[_].component,D=o?.render.inDialog?Ue:0;Gd(()=>{l().then(()=>{di(),y(!0)}).catch(M=>{let U={retryable:!1,message:"Authentication failed"};if(M?.privyErrorCode==="allowlist_rejected"){T(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),di();return}else M?.privyErrorCode==="linked_to_another_user"?U.detail="This account has already been linked to another user.":M?.privyErrorCode==="invalid_credentials"?(U.retryable=!0,U.detail="Something went wrong. Try again."):M.privyErrorCode==="oauth_user_denied"&&(U.detail=`Retry and check ${$a(_)} to finish connecting your account.`,U.retryable=!0);di(),T(U)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),Gd(()=>{if(t&&v&&e)if($t(e,o?.embeddedWallets?.createOnLogin)){let U=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:se=>console.error(se),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(U)}else{let U=setTimeout(m,D);return f(),()=>clearTimeout(U)}},[t,v,e]);let I=v?`Successfully connected with ${x}`:C?C.message:`Verifying connection to ${x}`,k="";return v?k="You\u2019re good to go!":C?k=C.detail:k="Just a few moments more",pi(Wg,{children:[Ut(P,{}),Ut(S,{}),pi(Rg,{children:[Ut(Ig,{children:pi("div",{children:[Ut(_n,{success:v,fail:!!C}),Ut(w,{style:{width:"38px",height:"38px"}})]})}),pi(Jt,{children:[Ut("h3",{children:I}),Ut("p",{children:k})]}),C&&C?.retryable?Ut(fe,{onClick:()=>{di(),s(_),T(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),Ut(X,{})]})},Rg=Vd.div`
1536
1536
  display: flex;
1537
1537
  flex-direction: column;
1538
1538
  align-items: center;
@@ -1563,7 +1563,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1563
1563
  left: -19px;
1564
1564
  top: -19px;
1565
1565
  }
1566
- `;import{useEffect as Mg,useState as Kd}from"react";import Lg from"styled-components";import{isMobile as Ng}from"react-device-detect";var jd=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!je()&&Ng)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Dg,jsx as Ft,jsxs as Yd}from"react/jsx-runtime";var Jd=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=Kd(""),[i,a]=Kd(!1);Mg(()=>{t&&o&&e().then(n)},[t,o]);let c=jd(r,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),Yd(Dg,{children:[Ft(P,{},"header"),Ft(S,{}),Ft(Qt,{title:s.title,description:s.description}),Yd(de,{children:[Ft(Og,{children:Ft(Ke,{style:{width:"72px",height:"72px"}})}),Ft(kn,{href:c,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!c,children:i?"Go to App Store":"Continue"}),s.footnote?Ft("p",{children:s.footnote}):null]}),Ft(I,{}),Ft(D,{protectedByPrivy:!0})]})},Og=Lg(Qi)`
1566
+ `;import{useEffect as Mg,useState as Kd}from"react";import Lg from"styled-components";import{isMobile as Ng}from"react-device-detect";var jd=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!je()&&Ng)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Dg,jsx as Ft,jsxs as Yd}from"react/jsx-runtime";var Jd=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=Kd(""),[i,a]=Kd(!1);Mg(()=>{t&&o&&e().then(n)},[t,o]);let c=jd(r,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),Yd(Dg,{children:[Ft(P,{},"header"),Ft(S,{}),Ft(Qt,{title:s.title,description:s.description}),Yd(de,{children:[Ft(Og,{children:Ft(Ke,{style:{width:"72px",height:"72px"}})}),Ft(kn,{href:c,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!c,children:i?"Go to App Store":"Continue"}),s.footnote?Ft("p",{children:s.footnote}):null]}),Ft(W,{}),Ft(O,{protectedByPrivy:!0})]})},Og=Lg(Qi)`
1567
1567
  margin: 16px auto;
1568
1568
  `;import{StaticJsonRpcProvider as M1}from"@ethersproject/providers";import{useMemo as Lp,useEffect as Op,useState as Mo}from"react";import gr from"styled-components";import vp from"styled-components";import Zd from"styled-components";import{jsx as Qd,jsxs as Bg}from"react/jsx-runtime";var ui=({label:e,children:t,valueStyles:o})=>Bg(Ug,{children:[Qd("div",{children:e}),Qd(Fg,{style:{...o},children:t})]}),Ug=Zd.div`
1569
1569
  display: flex;
@@ -1731,7 +1731,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1731
1731
  overflow: hidden;
1732
1732
  max-width: 275px;
1733
1733
  text-overflow: ellipsis;
1734
- `;import{WalletIcon as w1}from"@heroicons/react/24/outline";import{useState as Za,useEffect as C1}from"react";import es from"styled-components";import{VoidSigner as f1}from"@ethersproject/abstract-signer";import{EtherscanProvider as BT}from"@ethersproject/providers";import{parseUnits as wp}from"@ethersproject/units";import{ofetch as u1}from"ofetch";var jr={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 Kr={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 Cp=[jr.id,Kr.id],Qa=e=>({maxPriorityFee:wp(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:wp(e.maxFee.toFixed(9),"gwei").toHexString()}),m1=e=>({safeLow:Qa(e.safeLow),standard:Qa(e.standard),fast:Qa(e.fast)}),bp=async e=>{let t="";switch(e){case jr.id:t="https://gasstation.polygon.technology/v2";break;case Kr.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return m1(await u1(t))};function mr(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 h1(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=mr(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=mr(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=mr(e.gasPrice)),e.value!==void 0&&(t.value=mr(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=mr(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=mr(e.maxPriorityFeePerGas)),t}async function gi(e,t,o){t.chainId=Number(t.chainId),xp(t);let r=new f1(e,o);if(delete t.gas,Cp.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await bp(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}let n=await r.populateTransaction(t);return h1(n)}async function vi(e,t,o,r,n){r=Object.assign({chainId:pt},r),xp(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,s=await(await n.sendTransaction(a)).wait();return v1(s)}async function wi(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(co(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function Ep(e,t){return delete e.from,await t.estimateGas(e)}function xp(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!y1(r))throw new Error(`Transaction request property '${o}' 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 y1(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&g1(e);return t||o||r}function g1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function v1(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{jsx as Pp,jsxs as Xa}from"react/jsx-runtime";var Tp=({wallet:e,txn:t,provider:o})=>{let[r,n]=Za(),[i,a]=Za(!1),[c,s]=Za(!1),{nativeTokenSymbolForChainId:l}=A(),f=l(t.chainId)||"ETH";return C1(()=>{(async v=>{try{let{balance:y,hasSufficientFunds:w}=await wi(v,t,o);s(!0),a(w===!1),n(y.toHexString())}catch(y){console.warn(`Failed to fetch wallet balance with error: ${y}`)}})(e.address)},[e,t]),Xa(b1,{children:[Xa(E1,{children:[Pp(w1,{strokeWidth:"2",width:"16px",height:"16px"}),Pp("div",{children:Vt(e?.address)})]}),Xa(x1,{displayBalanceColor:c,hasFunds:!i,children:[r?Pt(r,f,6,!0):0," available"]})]})},b1=es.div`
1734
+ `;import{WalletIcon as w1}from"@heroicons/react/24/outline";import{useState as Za,useEffect as C1}from"react";import es from"styled-components";import{VoidSigner as f1}from"@ethersproject/abstract-signer";import{EtherscanProvider as BT}from"@ethersproject/providers";import{parseUnits as wp}from"@ethersproject/units";import{ofetch as u1}from"ofetch";var jr={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 Kr={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 Cp=[jr.id,Kr.id],Qa=e=>({maxPriorityFee:wp(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:wp(e.maxFee.toFixed(9),"gwei").toHexString()}),m1=e=>({safeLow:Qa(e.safeLow),standard:Qa(e.standard),fast:Qa(e.fast)}),bp=async e=>{let t="";switch(e){case jr.id:t="https://gasstation.polygon.technology/v2";break;case Kr.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return m1(await u1(t))};function mr(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 h1(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=mr(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=mr(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=mr(e.gasPrice)),e.value!==void 0&&(t.value=mr(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=mr(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=mr(e.maxPriorityFeePerGas)),t}async function gi(e,t,o){t.chainId=Number(t.chainId),xp(t);let r=new f1(e,o);if(delete t.gas,Cp.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await bp(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}let n=await r.populateTransaction(t);return h1(n)}async function vi(e,t,o,r,n){r=Object.assign({chainId:pt},r),xp(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,s=await(await n.sendTransaction(a)).wait();return v1(s)}async function wi(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(co(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function Ep(e,t){return delete e.from,await t.estimateGas(e)}function xp(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!y1(r))throw new Error(`Transaction request property '${o}' 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 y1(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&g1(e);return t||o||r}function g1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function v1(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{jsx as Pp,jsxs as Xa}from"react/jsx-runtime";var Tp=({wallet:e,txn:t,provider:o})=>{let[r,n]=Za(),[i,a]=Za(!1),[c,s]=Za(!1),{nativeTokenSymbolForChainId:l}=A(),f=l(t.chainId)||"ETH";return C1(()=>{(async v=>{try{let{balance:y,hasSufficientFunds:C}=await wi(v,t,o);s(!0),a(C===!1),n(y.toHexString())}catch(y){console.warn(`Failed to fetch wallet balance with error: ${y}`)}})(e.address)},[e,t]),Xa(b1,{children:[Xa(E1,{children:[Pp(w1,{strokeWidth:"2",width:"16px",height:"16px"}),Pp("div",{children:Vt(e?.address)})]}),Xa(x1,{displayBalanceColor:c,hasFunds:!i,children:[r?Pt(r,f,6,!0):0," available"]})]})},b1=es.div`
1735
1735
  display: flex;
1736
1736
  flex-direction: row;
1737
1737
  justify-content: space-between;
@@ -1784,7 +1784,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1784
1784
  overflow: hidden;
1785
1785
  max-width: 275px;
1786
1786
  text-overflow: ellipsis;
1787
- `;function Rp(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{StaticJsonRpcProvider as S1}from"@ethersproject/providers";import{useState as fr,useEffect as Ip,useMemo as A1}from"react";var Wp=e=>{let{getUsdTokenPrice:t,chains:o,rpcConfig:r}=A(),[n,i]=fr(!0),[a,c]=fr(!0),[s,l]=fr(void 0),[f,m]=fr(void 0),[v,y]=fr(void 0),[w,T]=fr(null),_=A1(()=>new S1(nt(e.chainId||pt,o,r)),[e.chainId,o,r]);return Ip(()=>{let x=e.chainId||pt,C=o.find(M=>M.id===Number(x));if(!C)throw new F(`Unsupported chain: ${x}`);(async()=>{try{i(!0);let M=await t(C);M?y(M):m(new Error(`Unable to fetch token price on chain id ${C.id}`))}catch(M){m(M)}finally{i(!1)}})()},[e.chainId]),Ip(()=>{(async()=>{try{c(!0);let C=await Ep(e,_);T(C.toBigInt())}catch(C){l(C)}finally{c(!1)}})()},[e]),{tokenPrice:v,estimatedGas:w,isTokenPriceLoading:n,isGasPriceLoading:a,tokenPriceError:f,gasError:s}};import{createContext as k1,useContext as R1}from"react";var ts=k1({wallets:[]});function os(){return R1(ts)}import Np from"styled-components";import{Fragment as N1,jsx as hr,jsxs as rs}from"react/jsx-runtime";var Mp=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i})=>rs(N1,{children:[hr(P,{onClose:r}),rs(I1,{children:[rs("div",{children:[hr(wt,{title:"Transaction complete!",description:"You're all set."}),hr(yi,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o,tokenSymbol:i})]}),hr("div",{children:hr(W1,{loading:!1,onClick:r,children:"All Done"})})]}),hr(X,{})]}),I1=Np.div`
1787
+ `;function Rp(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{StaticJsonRpcProvider as S1}from"@ethersproject/providers";import{useState as fr,useEffect as Ip,useMemo as A1}from"react";var Wp=e=>{let{getUsdTokenPrice:t,chains:o,rpcConfig:r}=A(),[n,i]=fr(!0),[a,c]=fr(!0),[s,l]=fr(void 0),[f,m]=fr(void 0),[v,y]=fr(void 0),[C,T]=fr(null),_=A1(()=>new S1(nt(e.chainId||pt,o,r)),[e.chainId,o,r]);return Ip(()=>{let x=e.chainId||pt,w=o.find(I=>I.id===Number(x));if(!w)throw new F(`Unsupported chain: ${x}`);(async()=>{try{i(!0);let I=await t(w);I?y(I):m(new Error(`Unable to fetch token price on chain id ${w.id}`))}catch(I){m(I)}finally{i(!1)}})()},[e.chainId]),Ip(()=>{(async()=>{try{c(!0);let w=await Ep(e,_);T(w.toBigInt())}catch(w){l(w)}finally{c(!1)}})()},[e]),{tokenPrice:v,estimatedGas:C,isTokenPriceLoading:n,isGasPriceLoading:a,tokenPriceError:f,gasError:s}};import{createContext as k1,useContext as R1}from"react";var ts=k1({wallets:[]});function os(){return R1(ts)}import Np from"styled-components";import{Fragment as N1,jsx as hr,jsxs as rs}from"react/jsx-runtime";var Mp=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i})=>rs(N1,{children:[hr(P,{onClose:r}),rs(I1,{children:[rs("div",{children:[hr(wt,{title:"Transaction complete!",description:"You're all set."}),hr(yi,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o,tokenSymbol:i})]}),hr("div",{children:hr(W1,{loading:!1,onClick:r,children:"All Done"})})]}),hr(X,{})]}),I1=Np.div`
1788
1788
  display: flex;
1789
1789
  height: 100%;
1790
1790
  flex-direction: column;
@@ -1793,7 +1793,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1793
1793
  `,W1=Np(j)`
1794
1794
  margin-top: 24px;
1795
1795
  transition: color 350ms ease, background-color 350ms ease;
1796
- `;import{Fragment as ns,jsx as ue,jsxs as yr}from"react/jsx-runtime";var L1=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return ue(Ja,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return ue(Ja,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return ue(ns,{children:ue(kp,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},Up=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:o}=os(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:c,nativeTokenSymbolForChainId:s}=A(),{app:l,navigate:f,data:m,outerClickRef:v,setModalData:y}=b(),{transactionRequest:w,onSuccess:T,onFailure:_,uiOptions:x,fundWalletConfig:C}=m.sendTransaction,[W,M]=Mo(null),[k,L]=Mo(""),[U,se]=Mo(),[B,Y]=Mo(!1),[H,Z]=Mo(!0),[N,We]=Mo(!1),[G,q]=Mo(w),{tokenPrice:Ce,estimatedGas:le,isTokenPriceLoading:z}=Wp(G),et=s(w.chainId)||"ETH";Op(()=>{e||(f("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let be=Lp(()=>o.find(Ne=>Ne.walletClientType==="privy"),[o]),Uo=async()=>{if(!be)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ne,externalTransactionId:ce}=await i(be.address,{config:C?.config||{}});y({fiatOnRampPrompt:{signedUrl:Ne},fiatOnRampStatus:{externalTransactionId:ce}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},Fo=Lp(()=>new M1(nt(G.chainId,c,a)),[G.chainId,a]);Op(()=>{async function Ne(){return!await t()||!r||!be?G:gi(be.address,G,Fo)}Ne().then(ce=>{Z(!1),q(ce)},async ce=>{Z(!0);let tt=!1;if(dc(ce))tt=!0;else if(pc(ce))try{let{hasSufficientFunds:Ho}=await wi(be.address,G,Fo);tt=Ho===!1}catch(Ho){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${Ho}`)}let yo="";tt?(yo="Wallet has insufficient funds for this transaction",l?.fiatOnRamp.enabled&&Y(!0)):(yo="There was an error preparing your transaction",console.error(ce)),L(yo),se(new xe(new mt(yo,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let Zr=Rp(G),Si=Zr==="SEND"?`Send ${et}`:"Review transaction",ho={modalTitle:x.header||x.modalTitle||Si,buttonText:x.buttonText||"Submit"},Bo=()=>{N||(W?T(W):_(U||new xe(new mt("The user rejected the request",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return v&&(v.current=Bo),Ce===void 0&&z?yr(ns,{children:[ue(P,{title:ho.modalTitle,onClose:Bo}),ue(S,{}),ue(Dp,{children:ue(or,{})}),ue(I,{})]}):W!==null?ue(Mp,{txn:G,onClose:Bo,receipt:W,transactionInfo:x.transactionInfo,tokenPrice:Ce,tokenSymbol:et}):yr(ns,{children:[ue(P,{title:ho.modalTitle,onClose:Bo}),yr(Dp,{children:[yr(F1,{children:[ue(L1,{txn:G,txnFamily:Zr,uiOptions:x,tokenSymbol:et,tokenPrice:Ce}),be?ue(yi,{from:be.address,to:G.to,txn:G,transactionInfo:x.transactionInfo,gas:le?co(le).toHexString():void 0,tokenPrice:Ce,tokenSymbol:et}):null]}),yr(B1,{children:[ue(O1,{children:k}),be?ue(Tp,{txn:G,wallet:be,provider:Fo}):null,yr(D1,{children:[B&&ue(j,{onClick:Uo,children:"Add Funds"}),ue(U1,{disabled:H||N,loading:!r||N,loadingText:N?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{We(!0);let Ne=await t();if(Ne&&!N&&be)try{let ce=await vi(Ne,be.address,r,G,Fo);M(ce),L("")}catch(ce){let tt="";ce.reason==="processing response error"?(console.warn({transaction:G,error:ce}),tt="An error has occurred, please contact support."):tt=ce.reason||"An error has occurred, please try again.",L(tt),se(new xe(new mt(tt,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{We(!1)}},children:ho.buttonText})]})]})]}),ue(X,{})]})},Dp=gr.div`
1796
+ `;import{Fragment as ns,jsx as ue,jsxs as yr}from"react/jsx-runtime";var L1=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return ue(Ja,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return ue(Ja,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return ue(ns,{children:ue(kp,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},Up=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:o}=os(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:c,nativeTokenSymbolForChainId:s}=A(),{app:l,navigate:f,data:m,outerClickRef:v,setModalData:y}=b(),{transactionRequest:C,onSuccess:T,onFailure:_,uiOptions:x,fundWalletConfig:w}=m.sendTransaction,[D,I]=Mo(null),[k,M]=Mo(""),[U,se]=Mo(),[B,Y]=Mo(!1),[H,Z]=Mo(!0),[N,We]=Mo(!1),[G,q]=Mo(C),{tokenPrice:Ce,estimatedGas:le,isTokenPriceLoading:z}=Wp(G),et=s(C.chainId)||"ETH";Op(()=>{e||(f("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let be=Lp(()=>o.find(Ne=>Ne.walletClientType==="privy"),[o]),Uo=async()=>{if(!be)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ne,externalTransactionId:ce}=await i(be.address,{config:w?.config||{}});y({fiatOnRampPrompt:{signedUrl:Ne},fiatOnRampStatus:{externalTransactionId:ce}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},Fo=Lp(()=>new M1(nt(G.chainId,c,a)),[G.chainId,a]);Op(()=>{async function Ne(){return!await t()||!r||!be?G:gi(be.address,G,Fo)}Ne().then(ce=>{Z(!1),q(ce)},async ce=>{Z(!0);let tt=!1;if(dc(ce))tt=!0;else if(pc(ce))try{let{hasSufficientFunds:Ho}=await wi(be.address,G,Fo);tt=Ho===!1}catch(Ho){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${Ho}`)}let yo="";tt?(yo="Wallet has insufficient funds for this transaction",l?.fiatOnRamp.enabled&&Y(!0)):(yo="There was an error preparing your transaction",console.error(ce)),M(yo),se(new xe(new mt(yo,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let Zr=Rp(G),Si=Zr==="SEND"?`Send ${et}`:"Review transaction",ho={modalTitle:x.header||x.modalTitle||Si,buttonText:x.buttonText||"Submit"},Bo=()=>{N||(D?T(D):_(U||new xe(new mt("The user rejected the request",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return v&&(v.current=Bo),Ce===void 0&&z?yr(ns,{children:[ue(P,{title:ho.modalTitle,onClose:Bo}),ue(S,{}),ue(Dp,{children:ue(or,{})}),ue(W,{})]}):D!==null?ue(Mp,{txn:G,onClose:Bo,receipt:D,transactionInfo:x.transactionInfo,tokenPrice:Ce,tokenSymbol:et}):yr(ns,{children:[ue(P,{title:ho.modalTitle,onClose:Bo}),yr(Dp,{children:[yr(F1,{children:[ue(L1,{txn:G,txnFamily:Zr,uiOptions:x,tokenSymbol:et,tokenPrice:Ce}),be?ue(yi,{from:be.address,to:G.to,txn:G,transactionInfo:x.transactionInfo,gas:le?co(le).toHexString():void 0,tokenPrice:Ce,tokenSymbol:et}):null]}),yr(B1,{children:[ue(O1,{children:k}),be?ue(Tp,{txn:G,wallet:be,provider:Fo}):null,yr(D1,{children:[B&&ue(j,{onClick:Uo,children:"Add Funds"}),ue(U1,{disabled:H||N,loading:!r||N,loadingText:N?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{We(!0);let Ne=await t();if(Ne&&!N&&be)try{let ce=await vi(Ne,be.address,r,G,Fo);I(ce),M("")}catch(ce){let tt="";ce.reason==="processing response error"?(console.warn({transaction:G,error:ce}),tt="An error has occurred, please contact support."):tt=ce.reason||"An error has occurred, please try again.",M(tt),se(new xe(new mt(tt,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{We(!1)}},children:ho.buttonText})]})]})]}),ue(X,{})]})},Dp=gr.div`
1797
1797
  display: flex;
1798
1798
  height: 100%;
1799
1799
  flex-direction: column;
@@ -1823,7 +1823,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1823
1823
  display: flex;
1824
1824
  flex-direction: column;
1825
1825
  gap: 8px;
1826
- `;import{isHexString as H1}from"@ethersproject/bytes";import{toUtf8String as G1}from"@ethersproject/strings";import{useEffect as z1,useState as is}from"react";import Jr,{css as $1}from"styled-components";import{jsx as Fp}from"react/jsx-runtime";var Bp=({style:e,color:t,...o})=>Fp("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},...o,children:Fp("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as Q1,jsx as Tt,jsxs as bi}from"react/jsx-runtime";var V1=e=>{if(!H1(e))return e;try{return G1(e)}catch{return e}},Hp=()=>{let{authenticated:e}=V(),{walletProxy:t,closePrivyModal:o}=A(),{navigate:r,data:n,outerClickRef:i}=b(),[a,c]=is(""),[s,l]=is(),[f,m]=is(null),v=f!==null;z1(()=>{e||r("LANDING")},[e]);let{message:y,confirmAndSignMessage:w,onSuccess:T,onFailure:_,uiOptions:x}=n.signMessage,C=!t,W={title:x.title||"Sign message",description:x.description||"Signing this message will not cost you any fees.",buttonText:x.buttonText||"Sign and continue"},M=k=>{k?T(k):_(s||new xe(new mt("The user rejected the request.",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),m(null),c(""),l(void 0)};return i&&(i.current=()=>M(f)),bi(Q1,{children:[Tt(P,{onClose:()=>M(f)}),Tt(S,{}),bi(q1,{children:[bi("div",{children:[Tt(wt,{title:W.title,description:W.description}),Tt(j1,{children:V1(y)}),Tt(K1,{fail:!0,children:a})]}),Tt(J1,{success:v,loading:C,disabled:v,onClick:async()=>{try{let k=await w();m(k),c(""),setTimeout(()=>{M(k)},Ue)}catch{c("An error has occurred, please try again."),l(new xe(new mt(a,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:v?bi(Y1,{children:[Tt(Bp,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Tt("span",{children:"Success"})]}):W.buttonText})]}),Tt(I,{}),Tt(D,{protectedByPrivy:!0})]})},q1=Jr.div`
1826
+ `;import{isHexString as H1}from"@ethersproject/bytes";import{toUtf8String as G1}from"@ethersproject/strings";import{useEffect as z1,useState as is}from"react";import Jr,{css as $1}from"styled-components";import{jsx as Fp}from"react/jsx-runtime";var Bp=({style:e,color:t,...o})=>Fp("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},...o,children:Fp("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as Q1,jsx as Tt,jsxs as bi}from"react/jsx-runtime";var V1=e=>{if(!H1(e))return e;try{return G1(e)}catch{return e}},Hp=()=>{let{authenticated:e}=V(),{walletProxy:t,closePrivyModal:o}=A(),{navigate:r,data:n,outerClickRef:i}=b(),[a,c]=is(""),[s,l]=is(),[f,m]=is(null),v=f!==null;z1(()=>{e||r("LANDING")},[e]);let{message:y,confirmAndSignMessage:C,onSuccess:T,onFailure:_,uiOptions:x}=n.signMessage,w=!t,D={title:x.title||"Sign message",description:x.description||"Signing this message will not cost you any fees.",buttonText:x.buttonText||"Sign and continue"},I=k=>{k?T(k):_(s||new xe(new mt("The user rejected the request.",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),m(null),c(""),l(void 0)};return i&&(i.current=()=>I(f)),bi(Q1,{children:[Tt(P,{onClose:()=>I(f)}),Tt(S,{}),bi(q1,{children:[bi("div",{children:[Tt(wt,{title:D.title,description:D.description}),Tt(j1,{children:V1(y)}),Tt(K1,{fail:!0,children:a})]}),Tt(J1,{success:v,loading:w,disabled:v,onClick:async()=>{try{let k=await C();m(k),c(""),setTimeout(()=>{I(k)},Ue)}catch{c("An error has occurred, please try again."),l(new xe(new mt(a,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:v?bi(Y1,{children:[Tt(Bp,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Tt("span",{children:"Success"})]}):D.buttonText})]}),Tt(W,{}),Tt(O,{protectedByPrivy:!0})]})},q1=Jr.div`
1827
1827
  display: flex;
1828
1828
  height: 100%;
1829
1829
  flex-direction: column;
@@ -2190,7 +2190,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2190
2190
  opacity: 1;
2191
2191
  }
2192
2192
  }
2193
- `;import{jsx as Xe,jsxs as mv}from"react/jsx-runtime";var av={["LANDING"]:Id,["AWAITING_PASSWORDLESS_CODE"]:jl,["WALLET_EDUCATION"]:gd,["AWAITING_CONNECTION"]:rc,["AWAITING_CONNECT_ONLY_CONNECTION"]:sc,["PHANTOM_INTERSTITIAL_SCREEN"]:Jd,["LOGIN_FAILED_SCREEN"]:Hd,["AWAITING_OAUTH_SCREEN"]:qd,["ALLOWLIST_REJECTION_SCREEN"]:Hl,["INSTALL_METAMASK_SCREEN"]:bd,["INSTALL_PHANTOM_SCREEN"]:xd,["INSTALL_COINBASE_WALLET_SCREEN"]:wd,["LINK_EMAIL_SCREEN"]:Md,["LINK_PHONE_SCREEN"]:Ld,["LINK_WALLET_SCREEN"]:Dd,["CONNECT_ONLY_LANDING_SCREEN"]:tc,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Zl,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Kc,["EMBEDDED_WALLET_CREATED_SCREEN"]:yc,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:fc,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Qc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:bc,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Hp,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Up,["FIAT_ON_RAMP_PROMPT_SCREEN"]:rd,["FIAT_ON_RAMP_STATUS_SCREEN"]:id,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Jc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Yc},sv={["AWAITING_CONNECTION"]:"compact",["AWAITING_CONNECT_ONLY_CONNECTION"]:"compact",["CONNECT_ONLY_LANDING_SCREEN"]:"compact",["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:"compact",["AWAITING_OAUTH_SCREEN"]:"compact",["ALLOWLIST_REJECTION_SCREEN"]:"compact",["WALLET_EDUCATION"]:"full",["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:"full",["EMBEDDED_WALLET_RECOVERY_SCREEN"]:"compact"},lv=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=sv[e];return r||(o?"medium":"full")},cv=()=>{let{ready:e}=V(),{isLinking:t}=A(),{ready:o,currentScreen:r,app:n}=b(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=lv(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return mv(Vp,{"data-height":s,children:[Xe(P,{}),Xe(S,{}),Xe(uv,{children:Xe(bo,{})}),Xe(I,{}),Xe(X,{})]});let l=av[r];return l?Xe(Vp,{"data-height":s,children:Xe(l,{})}):null},jp=()=>{let{closePrivyModal:e}=A(),{app:t,outerClickRef:o}=b(),r=()=>{if(o?.current){let{closeModal:c}=o.current()||{closeModal:!0};c&&(e(),o.current=null)}else return e()},n=nv(c=>{c.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);qp(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=Xe($p,{onClick:c=>c.stopPropagation(),children:Xe(cv,{})}),a=t?.render.inDialog?Xe(pv,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return iv.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},dv=({children:e,...t})=>{let o=rv(null);return qp(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),tv(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),ov())}},[t.open,t.onClose]),Xe("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},pv=as(dv)`
2193
+ `;import{jsx as Xe,jsxs as mv}from"react/jsx-runtime";var av={["LANDING"]:Id,["AWAITING_PASSWORDLESS_CODE"]:jl,["WALLET_EDUCATION"]:gd,["AWAITING_CONNECTION"]:rc,["AWAITING_CONNECT_ONLY_CONNECTION"]:sc,["PHANTOM_INTERSTITIAL_SCREEN"]:Jd,["LOGIN_FAILED_SCREEN"]:Hd,["AWAITING_OAUTH_SCREEN"]:qd,["ALLOWLIST_REJECTION_SCREEN"]:Hl,["INSTALL_METAMASK_SCREEN"]:bd,["INSTALL_PHANTOM_SCREEN"]:xd,["INSTALL_COINBASE_WALLET_SCREEN"]:wd,["LINK_EMAIL_SCREEN"]:Md,["LINK_PHONE_SCREEN"]:Ld,["LINK_WALLET_SCREEN"]:Dd,["CONNECT_ONLY_LANDING_SCREEN"]:tc,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Zl,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Kc,["EMBEDDED_WALLET_CREATED_SCREEN"]:yc,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:fc,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Qc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:bc,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Hp,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Up,["FIAT_ON_RAMP_PROMPT_SCREEN"]:rd,["FIAT_ON_RAMP_STATUS_SCREEN"]:id,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Jc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Yc},sv={["AWAITING_CONNECTION"]:"compact",["AWAITING_CONNECT_ONLY_CONNECTION"]:"compact",["CONNECT_ONLY_LANDING_SCREEN"]:"compact",["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:"compact",["AWAITING_OAUTH_SCREEN"]:"compact",["ALLOWLIST_REJECTION_SCREEN"]:"compact",["WALLET_EDUCATION"]:"full",["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:"full",["EMBEDDED_WALLET_RECOVERY_SCREEN"]:"compact"},lv=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=sv[e];return r||(o?"medium":"full")},cv=()=>{let{ready:e}=V(),{isLinking:t}=A(),{ready:o,currentScreen:r,app:n}=b(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=lv(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return mv(Vp,{"data-height":s,children:[Xe(P,{}),Xe(S,{}),Xe(uv,{children:Xe(bo,{})}),Xe(W,{}),Xe(X,{})]});let l=av[r];return l?Xe(Vp,{"data-height":s,children:Xe(l,{})}):null},jp=()=>{let{closePrivyModal:e}=A(),{app:t,outerClickRef:o}=b(),r=()=>{if(o?.current){let{closeModal:c}=o.current()||{closeModal:!0};c&&(e(),o.current=null)}else return e()},n=nv(c=>{c.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);qp(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=Xe($p,{onClick:c=>c.stopPropagation(),children:Xe(cv,{})}),a=t?.render.inDialog?Xe(pv,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return iv.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},dv=({children:e,...t})=>{let o=rv(null);return qp(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),tv(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),ov())}},[t.open,t.onClose]),Xe("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},pv=as(dv)`
2194
2194
  position: fixed;
2195
2195
  top: 0;
2196
2196
  left: 0;
@@ -2248,4 +2248,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
2248
2248
  align-items: center;
2249
2249
  justify-content: center;
2250
2250
  height: 100%;
2251
- `;import{useEffect as fv}from"react";import{Fragment as yv,jsx as gv}from"react/jsx-runtime";var hv=({onLoad:e})=>{let t=window;return fv(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),gv(yv,{})},Kp=hv;var Yp={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 Jp={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 Qp={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 Zp={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 Xp={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 eu={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 tu={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 ou={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 ru={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 nu={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 iu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{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 au={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 su={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 Ei={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 lu={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 cu={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 du={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{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 xi=[Yp,Jp,iu,du,Ei,lu,cu,jr,Kr,tu,ou,ru,nu,Xp,eu,au,su,Qp,Zp],rA=new Set(xi.map(e=>e.id));import Lo from"tinycolor2";var pu="#FFFFFF",vv="#000000",wv=pu,Cv="#1E1E1D";function bv(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 mo(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return Lo({...e.toHsl(),l:o})}function uu({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=pu,blackHex:a=vv}){let c;switch(e){case"light":c=wv;break;case"dark":c=Cv;break;default:c=e;break}let s=Lo(c),l=Lo(t),f=Lo(o),m=Lo(r),v=Lo(n),y=bv(s.getLuminance()),w=mo(s,y==="light"?-.04:.11),T=mo(s,y==="light"?-.88:.87),_=mo(s,y==="light"?-.77:.75),x=mo(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),C=mo(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),W=mo(l,.15),M=mo(l,-.06),k=Lo(l.getLuminance()>.5?a:i),L=mo(f,-.16);return{colorScheme:y,background:s.toHslString(),background2:w.toHslString(),foreground:T.toHslString(),foreground2:_.toHslString(),foreground3:x.toHslString(),foreground4:C.toHslString(),accent:l.toHslString(),accentLight:W.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:f.toHslString(),successDark:L.toHslString(),error:v.toHslString(),warn:m.toHslString()}}var Bt={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:zs,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function Pi(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(W=>o.includes(W)),n=r?.slice(0,5),i,a,c,s,l,f,m,v,y,w;if(t?.loginMethods?(i=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),s=n?.includes("google"),l=n?.includes("twitter"),f=n?.includes("discord"),m=n?.includes("tiktok"),y=n?.includes("github"),v=n?.includes("linkedin"),w=n?.includes("apple")):(i=e.emailAuth,a=e.smsAuth,c=e.walletAuth,s=e.googleOAuth,l=e.twitterOAuth,f=e.discordOAuth,y=e.githubOAuth,m=e.tiktokOAuth,v=e.linkedinOAuth,w=e.appleOAuth),i&&a&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),a=!1),!i&&!a&&[s,l,f,y,m,v,w].some(W=>W))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![i,a,c,s,l,f,y,m,v,w].some(W=>W))throw new Error("You must enable at least one login method");let{chains:T,defaultChain:_}=Ev(t?.additionalChains,t?.supportedChains,t?.defaultChain);r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let x=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:uu({backgroundTheme:t?.appearance?.theme??Bt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Bt.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:c,email:i,sms:a,google:s,twitter:l,discord:f,github:y,tiktok:m,linkedin:v,apple:w},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Bt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Bt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Bt.rpcConfig.rpcTimeouts},chains:T,defaultChain:_,captchaEnabled:e.captchaEnabled??Bt.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...x?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:x?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Bt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Bt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Bt._render.inParentNodeId}}}function mu(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function Ev(e,t,o){let r;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");r=t}else r=xi.concat(e??[]);let n=t?r[0]:Ei,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}import{useRef as _v,useEffect as Sv}from"react";import{createContext as xv,useContext as Pv,useEffect as Tv}from"react";var fu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onPromptMfa:[],onError:[]}},ss=xv(void 0),hu=()=>Pv(ss);function _t(e,t){if(!t)return;let r=hu().current[e];return Tv(()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(a=>a!==i)}},[t])}function K(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function yu(){let e=hu();return(t,o,...r)=>K(e,t,o,...r)}var Ti=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as Nv}from"react/jsx-runtime";var Av=function(e){return()=>`id-${e++}`}(0);function kv(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function vr(e){return e.error!==void 0}var Do=new Ti,ls=new Map,Rv=(e,t)=>typeof t=="bigint"?t.toString():t,Iv=(e,t)=>`${e}${JSON.stringify(t,Rv)}`;function Oo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=Iv(e,t);if(e==="privy:wallet:create"){let a=ls.get(n);if(a)return a}let i=new Promise((a,c)=>{let s=Av();Do.enqueue(s,{resolve:a,reject:c}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ls.delete(n)});return ls.set(n,i),i}function Wv(e){switch(e.event){case"privy:iframe:ready":let t=Do.dequeue(e.event,e.id);return vr(e)?t.reject(new Wt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Do.dequeue(e.event,e.id);return vr(e)?o.reject(new Wt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Do.dequeue(e.event,e.id);return vr(e)?r.reject(new Wt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Do.dequeue(e.event,e.id);return vr(e)?n.reject(new Wt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Do.dequeue(e.event,e.id);return vr(e)?i.reject(new Wt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Do.dequeue(e.event,e.id);return vr(e)?a.reject(new Wt(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function gu(e){let t=_v(null),o=yu();return Sv(()=>{let r=t.current;if(!r)return;function n(l){l&&l.origin===e.origin&&kv(l.data)&&Wv(l.data)}let i={create(l){return Oo("privy:wallet:create",l,r)},connect(l){return Oo("privy:wallet:connect",l,r)},recover(l){return Oo("privy:wallet:recover",l,r)},async rpc(l){if(e.mfaMethods.length>0){o("configureMfa","onPromptMfa",e.mfaMethods);let f=await new Promise((m,v)=>{e.mfaPromise.current={resolve:m,reject:v}});return Oo("privy:wallet:rpc",{...l,...f},r)}return Oo("privy:wallet:rpc",l,r)},setRecoveryPassword(l){return Oo("privy:wallet:set-recovery-password",l,r)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),c=(...l)=>{console.warn("Privy iframe failed to load: ",...l),e.onLoadFailed()},s=new AbortController;return tl(()=>Oo("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,c),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),Nv("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:fn(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}var wr=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new g("action required");if(!this.api)throw new g("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new g("phone number must be set when initialzing authentication.");try{let t=Fs();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw Q(t)}}async authenticate(){if(!this.meta.action)throw new g("action required");if(!this.api)throw new g("Mfa flow has no API instance");if(!this.meta.smsCode)throw new g("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new g("phone number must be set prior to calling authenticate.");try{let t=Bs(),o=await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return rt(o)}catch(t){throw Q(t)}}};import{jsx as fo,jsxs as vu}from"react/jsx-runtime";function Ov(e){return typeof e=="string"&&e.length===25}var Qr;function kt(){if(!Qr){let e=$.get(qo);return Promise.resolve(e||null)}return Qr.getAccessToken()}var wu,sl=(e,t)=>wu(e,t),Cu,ll=(e,t)=>Cu(e,t),bu,cl=()=>bu(),Dv=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;$.put(Er,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Uv=({config:e,...t})=>{if(!Ov(t.appId))throw new g("Cannot initialize the Privy provider with an invalid Privy app ID");Qr||(Qr=new Ir({appId:t.appId,apiUrl:t.apiUrl||ln}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.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."),fo(Fv,{...t,config:o,client:Qr})},Fv=e=>{let t=e.client,[o,r]=ee(!1),[n,i]=ee(!1),[a,c]=ee(!1),[s,l]=ee(null),[f,m]=ee(!1),[v,y]=ee([]),w=ds(v),[T,_]=ee(!1),[x,C]=ee(null),[W,M]=ee(!1),[k,L]=ee({status:"disconnected",connectError:null,connector:null,connectRetry:E}),[U,se]=ee(null),[B,Y]=ee(null),[H,Z]=ee({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}),[N,We]=ee(()=>{let d=mu(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),Pi(H,e.config)}),[G,q]=ee(!0),[Ce,le]=ee({}),[z,et]=ee(null),[be,Uo]=ee(null),[Fo,Zr]=ee(!1),[Si,ho]=ee(),[Bo,Ne]=ee(),[ce,tt]=ee(),[yo,Ho]=ee(!1),Ai=ds(null),J=ds(fu),Se=d=>{d&&C(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Xr=d=>{N.embeddedWallets.createOnLogin!=="off"&&q(!0),Se(d)};St(()=>{if(!B||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(B,p,N.defaultChain)}},[B,s]),St(()=>{B&&be?.(B)},[B]),St(()=>{(async()=>{if(!N.customAuth?.enabled)return;q(!0);let{getCustomAccessToken:p,isLoading:u}=N.customAuth;if(!(!n||u))try{let h=await p();if(!h){await Go.logout();return}if(a)return;t.startAuthFlow(new $o(h));let{user:O,isNewUser:me}=await t.authenticate();O||await Go.logout(),l(O||null),_(me||!1),c(!0),Ho(!0)}catch(h){console.warn(h),a&&await Go.logout()}})()},[N.customAuth?.enabled,N.customAuth?.getCustomAccessToken,N.customAuth?.isLoading,n,a]),St(()=>{yo&&B&&s&&$t(s,e.config?.embeddedWallets?.createOnLogin)&&(Ho(!1),fs(s,pn).catch(console.error))},[yo&&B&&s]),St(()=>{async function d(){let p=await t.getServerConfig();Z(p);let u=Pi(p,e.config);We(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains,u.defaultChain),t.connectors?.initialize();let h=Eu();Dv();let O=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(c(!!O),O&&K(J,"login","onComplete",O,!1,!0),l(O)),h||(i(!0),z?.()),h&&O&&m(!0),xu()}n||d()},[t,z,n]),St(()=>{let d=Pi(H,e.config);We(d)},[e.config]);let Eu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),h=d.get("privy_oauth_provider");return p&&u&&h?(t.startAuthFlow(new zt(h,p,u)),Xr("AWAITING_OAUTH_SCREEN"),le({finishOauthFlow:{onComplete:()=>{i(!0),z?.()}}}),!0):!1},ki=async(d,p,u)=>{let h=await t.connectors?.createWalletConnector(d,p)||null;ps(h,u)};async function ps(d,p){if(!d)return L({status:"disconnected",connectError:new F("Unable to connect to wallet."),connector:null,connectRetry:E}),p?.(null);L({connector:d,status:"connecting",connectError:null,connectRetry:()=>ps(d,p)});try{let u=await d.connect({showPrompt:!0});if(!N.chains.find(h=>h.id===Number(u?.chainId))){L(h=>({...h,connector:d,status:"switching_to_supported_chain",connectError:null,connectRetry:E}));try{await u?.switchChain(N.defaultChain.id),u&&(u.chainId=jo(Co(N.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${N.defaultChain.id}`)}}return L(h=>({...h,status:"connected",connectError:null,connectRetry:E})),u&&!W&&K(J,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof ot?(console.warn(u.cause?u.cause:u.message),W||K(J,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),W||K(J,"connectWallet","onError","unknown_connect_wallet_error")),L(h=>({...h,status:"disconnected",connectError:u})),p?.(null)}}let Ri=d=>{d!==null&&t.startAuthFlow(new vo(d))},xu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!je()&&Xr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new g("Connector not initialized");Se("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),ki(p,u,Ri)};St(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(l)},[n,a,s,t]);let us=()=>{m(!0),Se("LINK_WALLET_SCREEN")},Pu=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},Tu=async d=>{if(!t.connectors)throw new g("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;L(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:E})),Ri(d),Xr("AWAITING_CONNECTION")},_u=async(d,p)=>{if(!t.connectors)throw new g("Connector not initialized");await ki(d,p,Ri)},ms=async(d,p)=>{if(!N.fiatOnRamp.enabled)throw new g("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:h}=await td(t,d,p?.config??{},N.appearance.palette,N.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:h}}else throw new g("Unsupported fund provider. Currently supported option is `moonpay`.")},en=()=>{y(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:Pu(u),loginOrLink:async()=>{if(!await u.isConnected())throw new g("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new g("Cannot link or login with embedded wallet");Tu(u)},fund:async h=>{let{signedUrl:O,externalTransactionId:me}=await ms(u.address,h);le({fiatOnRampPrompt:{signedUrl:O},fiatOnRampStatus:{externalTransactionId:me}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new g("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new g("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(u.address);l(h)}}))||[];return yn(d,p)?d:p})};St(()=>{en()},[s?.linkedAccounts,a,n]),St(()=>{if(n){if(!t.connectors)throw new g("Connector not initialized");en(),t.connectors.on("walletsUpdated",en)}},[n]);let Su=()=>{Se(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};St(()=>{if(!v[0])return;let d=v[0],p=w.current.find(h=>h.address===d.address),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===d.address);if(!p&&u){let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},l(h)}w.current=v},[v]);let fs=async(d,p)=>{if(te(d))throw K(J,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,O]=await Promise.all([Me.initializeWalletProxy(p),kt()]);if(!h&&e.config?.customAuth?.enabled)throw K(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!O||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((me,Ee)=>{q(!0),le({createWallet:{onSuccess:Ve=>{K(J,"createWallet","onSuccess",Ve),me(Ve)},onFailure:Ve=>{K(J,"createWallet","onError","unknown_embedded_wallet_error"),Ee(Ve)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:O});let me=await Me.refreshUser(),Ee=te(me);if(!Ee)throw K(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return K(J,"createWallet","onSuccess",Ee),Ee}},Au=d=>{if(!N.chains.map(p=>p.id).includes(d))throw new F(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Go={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Su,linkWallet:us,linkEmail:()=>{if(s?.email)throw new g("User already has an email linked to their account.");m(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new g("User already has a phone number linked to their account.");m(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new g("User already has a Google account linked to their account.");await Me.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new g("User already has a Twitter account linked to their account.");await Me.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new g("User already has a Discord account linked to their account.");await Me.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new g("User already has a Github account linked to their account.");await Me.initLoginWithOAuth("github")},linkTiktok:async()=>{if(s?.tiktok)throw new g("User already has a Tiktok account linked to their account.");await Me.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(s?.linkedin)throw new g("User already has a LinkedIn account linked to their account.");await Me.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Me.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{et(()=>d)}),et(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}M(!0),Xr()},logout:async()=>{await t.logout(),l(null),c(!1),C(null),K(J,"logout","onSuccess"),m(!1),r(!1),$.del(xr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new oe;let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new oe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new cs(new ht(new oe));let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new cs(new ht(new oe)):new cs(new ht(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new jt(new oe);let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new jt(new oe):new jt(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return l(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return l(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return l(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return l(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return l(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return l(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return l(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return l(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return l(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return l(p),p},setActiveWallet:async d=>{let p=v.find(h=>_i(h.address)===_i(d)),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&_i(h.address)===_i(d));if(!p||!await p.isConnected())se(d),us();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},l(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw K(J,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return fs(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=te(s);if(!u||!B){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}q(!0);let h={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},O={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};le({setWalletPassword:h,connectWallet:O}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,h)=>{if(!a||!s){h(new Error("User must be authenticated before signing with a Privy wallet"));return}let O=te(s);if(!O){h(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){h(new Error("Message must be a non-empty string"));return}q(!0);let me=async()=>{if(!a)return h(new Error("User must be authenticated before signing with a Privy wallet")),null;let Ee=await kt();if(B&&Ee)try{if(!await Me.recoverEmbeddedWallet())return h(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:O.address});let{response:Ve}=await B.rpc({accessToken:Ee,address:O.address,request:{method:"personal_sign",params:[d,O.address]}}),Cr=Ve.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:O.address}),Cr}catch(Ht){return h(Ht),null}else return null};if(N.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let Ee=await me();Ee?u(Ee):h(new xe("Unable to sign message"))}else{let Ve={message:d,confirmAndSignMessage:me,onSuccess:Gt=>{u(Gt)},onFailure:Gt=>{h(Gt)},uiOptions:p||{}},Cr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:h};le({signMessage:Ve,connectWallet:Cr}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(h,O)=>{if(!a||!s){O(new Error("User must be authenticated before signing with a Privy wallet"));return}let me=te(s);if(!me){O(new Error("Must have a Privy wallet before signing"));return}q(!0);let Ee=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ht=d.chainId?Number(d.chainId):Ee.chainId;Au(Ht);let Ve=Object.assign({},d,{chainId:Ht}),Cr=async()=>{let Gt=await kt();if(!Gt||!B){O(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Me.recoverEmbeddedWallet()){O(new Error("Unable to connect to wallet"));return}let hs=new Mv(nt(Ve.chainId,N.chains,N.rpcConfig)),Ru=await gi(me.address,Ve,hs),Iu=await vi(Gt,me.address,B,Ru,hs);h(Iu)}catch(tn){O(tn)}};if(N.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Cr();else{let Gt={transactionRequest:Ve,onSuccess:h,onFailure:O,uiOptions:p||{},fundWalletConfig:u},tn={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:O};le({connectWallet:tn,sendTransaction:Gt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!te(s)){p(new Error("Must have a Privy wallet before exporting"));return}q(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},O={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};le({keyExport:O,connectWallet:h}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),async init(d){let p;switch(d){case"sms":p=new wr("verify");break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p);try{await p.init()}catch(u){throw K(J,"configureMfa","onError",u.privyErrorCode||"unknown_mfa_error"),u}},async submit(d,p){switch(d){case"sms":Ai.current?.resolve({mfaMethod:d,mfaCode:p});break;default:throw Ai.current?.reject(new g("Unsupported MFA method")),K(J,"configureMfa","onError","unknown_mfa_error"),new g(`Unsupported MFA method: ${d}`)}},async initEnroll(d,p){let u;switch(d){case"sms":if(!p?.phoneNumber)throw K(J,"configureMfa","onError","missing_mfa_credentials"),new Error("Missing MFA credentials");u=new wr("enroll",p.phoneNumber);break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(u);try{await u.init()}catch(h){throw K(J,"configureMfa","onError",h.privyErrorCode||"unknown_mfa_error"),h}},async submitEnroll(d,p){let u;switch(d){case"sms":u=new wr("enroll"),u.meta={action:"enroll",smsCode:p.mfaCode,phoneNumber:p.phoneNumber};break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(u);try{await u.authenticate();let h=await t.getAuthenticatedUser();l(h)}catch(h){throw K(J,"configureMfa","onError",h.privyErrorCode||"unknown_mfa_error"),h}}};wu=Go.signMessage,Cu=Go.sendTransaction;let Me=(()=>({isNewUserThisSession:T,isLinking:f,linkingHint:U,walletConnectionStatus:k,rpcConfig:N.rpcConfig,chains:N.chains,clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>N.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Fo,enabled:N.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:$s,action:N.id,callback:ho,"error-callback":Ne,"expired-callback":()=>{try{d.reset(ce),Ne(void 0),ho(void 0)}catch{Ne("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),tt(p)},remove:()=>{let d=window.turnstile;!d?.remove||!ce||(d.remove(ce),tt(void 0),Ne(void 0),ho(void 0))},token:Si,error:Bo},initializeWalletProxy:async d=>{if(B)return B;let p=new Promise(O=>{Uo(()=>me=>O(me))}),u=new Promise(O=>setTimeout(()=>O(null),d)),h=await Promise.race([p,u]);return Uo(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(K(J,"login","onComplete",s,T,!1),e.onSuccess?.(s,T)):W&&K(J,"login","onError","exited_auth_flow"),t.authFlow=void 0,se(null),C(null),M(!1),m(!1),_(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:ki,initLoginWithWallet:_u,loginWithWallet:async()=>{if(!n)throw new br;if(!(t.authFlow instanceof vo))throw new g("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw K(J,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}l(d||s||null),_(p||!1),c(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new zt(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof zt))throw new g("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw K(J,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}l(d),_(p||!1),c(!0)},initLoginWithEmail:async(d,p)=>{let u=new go(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(h){throw K(J,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},initLoginWithSms:async(d,p)=>{let u=new wo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(h){throw K(J,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new br;if(t.authFlow instanceof go)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=d.trim();else throw new g("Must initialize a passwordless code flow first");let p,u;a?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),l(p||s||null),_(u||!1),c(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return l(d),d},walletProxy:B,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(O=>O.type==="wallet"&&O.walletClientType==="privy"),h=await kt();if(!h||!B||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}q(!0);try{await B.connect({accessToken:h,address:u.address}),d(!0)}catch(O){rr(O)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await B.recover({address:u.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):rr(O)?(le({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(O)}}),getFiatOnRampConfig:ms,updateWallets:()=>en()}))();bu=Me.recoverEmbeddedWallet;let ku=Lv(()=>({wallets:v}),[v]);return fo(He.Provider,{value:Go,children:fo(ss.Provider,{value:J,children:vu(ts.Provider,{value:ku,children:[e.children,vu(qi.Provider,{value:Me,children:[fo(zp,{theme:{...N.appearance.palette||{}}}),fo(yl,{appConfig:N,data:Ce,setModalData:le,setInitialScreen:C,initialScreen:x,visible:o,authenticated:a,children:o?fo(jp,{}):null}),G&&H.id?fo(gu,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods??[],mfaPromise:Ai,onLoad:Y,onLoadFailed:()=>null}):null]}),N.captchaEnabled&&fo(Kp,{onLoad:()=>Zr(!0)})]})})})};import{useContext as Bv}from"react";function Hv(e){let{init:t,submit:o,submitEnroll:r,initEnroll:n}=Bv(He);return _t("configureMfa",e),{init:t,submit:o,submitEnroll:r,initEnroll:n}}import{useContext as Gv}from"react";function zv(e){let{login:t}=Gv(He);return _t("login",e),{login:t}}import{useContext as $v}from"react";function Vv(e){let{logout:t}=$v(He);return _t("logout",e),{logout:t}}import{useContext as qv}from"react";function jv(e){let{connectWallet:t}=qv(He);return _t("connectWallet",e),{connectWallet:t}}import{useContext as Kv}from"react";function Yv(e){let{createWallet:t}=Kv(He);return _t("createWallet",e),{createWallet:t}}export{ht as AsExternalProvider,kr as ConnectorManager,Ir as PrivyClient,Uv as PrivyProvider,oe as PrivyProxyProvider,xi as SUPPORTED_CHAINS,Ii as VERSION,Fe as WalletConnector,kt as getAccessToken,Hv as useConfigureMfa,jv as useConnectWallet,Yv as useCreateWallet,zv as useLogin,Vv as useLogout,V as usePrivy,os as useWallets};
2251
+ `;import{useEffect as fv}from"react";import{Fragment as yv,jsx as gv}from"react/jsx-runtime";var hv=({onLoad:e})=>{let t=window;return fv(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),gv(yv,{})},Kp=hv;var Yp={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 Jp={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 Qp={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 Zp={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 Xp={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 eu={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 tu={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 ou={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 ru={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 nu={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 iu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{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 au={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 su={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 Ei={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 lu={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 cu={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 du={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{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 xi=[Yp,Jp,iu,du,Ei,lu,cu,jr,Kr,tu,ou,ru,nu,Xp,eu,au,su,Qp,Zp],rA=new Set(xi.map(e=>e.id));import Lo from"tinycolor2";var pu="#FFFFFF",vv="#000000",wv=pu,Cv="#1E1E1D";function bv(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 mo(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return Lo({...e.toHsl(),l:o})}function uu({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=pu,blackHex:a=vv}){let c;switch(e){case"light":c=wv;break;case"dark":c=Cv;break;default:c=e;break}let s=Lo(c),l=Lo(t),f=Lo(o),m=Lo(r),v=Lo(n),y=bv(s.getLuminance()),C=mo(s,y==="light"?-.04:.11),T=mo(s,y==="light"?-.88:.87),_=mo(s,y==="light"?-.77:.75),x=mo(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),w=mo(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),D=mo(l,.15),I=mo(l,-.06),k=Lo(l.getLuminance()>.5?a:i),M=mo(f,-.16);return{colorScheme:y,background:s.toHslString(),background2:C.toHslString(),foreground:T.toHslString(),foreground2:_.toHslString(),foreground3:x.toHslString(),foreground4:w.toHslString(),accent:l.toHslString(),accentLight:D.toHslString(),accentDark:I.toHslString(),foregroundAccent:k.toHslString(),success:f.toHslString(),successDark:M.toHslString(),error:v.toHslString(),warn:m.toHslString()}}var Bt={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:zs,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function Pi(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(I=>o.includes(I)),n=r?.slice(0,5),i,a,c,s,l,f,m,v,y,C;if(t?.loginMethods?(i=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),s=n?.includes("google"),l=n?.includes("twitter"),f=n?.includes("discord"),m=n?.includes("tiktok"),y=n?.includes("github"),v=n?.includes("linkedin"),C=n?.includes("apple")):(i=e.emailAuth,a=e.smsAuth,c=e.walletAuth,s=e.googleOAuth,l=e.twitterOAuth,f=e.discordOAuth,y=e.githubOAuth,m=e.tiktokOAuth,v=e.linkedinOAuth,C=e.appleOAuth),i&&a&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),a=!1),!i&&!a&&[s,l,f,y,m,v,C].some(I=>I))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![i,a,c,s,l,f,y,m,v,C].some(I=>I))throw new Error("You must enable at least one login method");let{chains:T,defaultChain:_}=Ev(t?.additionalChains,t?.supportedChains,t?.defaultChain),x=!!t?.defaultChain||!!t?.supportedChains;r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let w=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:uu({backgroundTheme:t?.appearance?.theme??Bt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Bt.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:c,email:i,sms:a,google:s,twitter:l,discord:f,github:y,tiktok:m,linkedin:v,apple:C},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Bt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Bt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Bt.rpcConfig.rpcTimeouts},chains:T,defaultChain:_,shouldSwitchChainOnConnect:x,captchaEnabled:e.captchaEnabled??Bt.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...w?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:w?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Bt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Bt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Bt._render.inParentNodeId}}}function mu(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function Ev(e,t,o){let r;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");r=t}else r=xi.concat(e??[]);let n=t?r[0]:Ei,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}import{useRef as _v,useEffect as Sv}from"react";import{createContext as xv,useContext as Pv,useEffect as Tv}from"react";var fu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onPromptMfa:[],onError:[]}},ss=xv(void 0),hu=()=>Pv(ss);function _t(e,t){if(!t)return;let r=hu().current[e];return Tv(()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(a=>a!==i)}},[t])}function K(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function yu(){let e=hu();return(t,o,...r)=>K(e,t,o,...r)}var Ti=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as Nv}from"react/jsx-runtime";var Av=function(e){return()=>`id-${e++}`}(0);function kv(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function vr(e){return e.error!==void 0}var Do=new Ti,ls=new Map,Rv=(e,t)=>typeof t=="bigint"?t.toString():t,Iv=(e,t)=>`${e}${JSON.stringify(t,Rv)}`;function Oo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=Iv(e,t);if(e==="privy:wallet:create"){let a=ls.get(n);if(a)return a}let i=new Promise((a,c)=>{let s=Av();Do.enqueue(s,{resolve:a,reject:c}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ls.delete(n)});return ls.set(n,i),i}function Wv(e){switch(e.event){case"privy:iframe:ready":let t=Do.dequeue(e.event,e.id);return vr(e)?t.reject(new Wt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Do.dequeue(e.event,e.id);return vr(e)?o.reject(new Wt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Do.dequeue(e.event,e.id);return vr(e)?r.reject(new Wt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Do.dequeue(e.event,e.id);return vr(e)?n.reject(new Wt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Do.dequeue(e.event,e.id);return vr(e)?i.reject(new Wt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Do.dequeue(e.event,e.id);return vr(e)?a.reject(new Wt(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function gu(e){let t=_v(null),o=yu();return Sv(()=>{let r=t.current;if(!r)return;function n(l){l&&l.origin===e.origin&&kv(l.data)&&Wv(l.data)}let i={create(l){return Oo("privy:wallet:create",l,r)},connect(l){return Oo("privy:wallet:connect",l,r)},recover(l){return Oo("privy:wallet:recover",l,r)},async rpc(l){if(e.mfaMethods.length>0){o("configureMfa","onPromptMfa",e.mfaMethods);let f=await new Promise((m,v)=>{e.mfaPromise.current={resolve:m,reject:v}});return Oo("privy:wallet:rpc",{...l,...f},r)}return Oo("privy:wallet:rpc",l,r)},setRecoveryPassword(l){return Oo("privy:wallet:set-recovery-password",l,r)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),c=(...l)=>{console.warn("Privy iframe failed to load: ",...l),e.onLoadFailed()},s=new AbortController;return tl(()=>Oo("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,c),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),Nv("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:fn(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}var wr=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new g("action required");if(!this.api)throw new g("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new g("phone number must be set when initialzing authentication.");try{let t=Fs();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw Q(t)}}async authenticate(){if(!this.meta.action)throw new g("action required");if(!this.api)throw new g("Mfa flow has no API instance");if(!this.meta.smsCode)throw new g("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new g("phone number must be set prior to calling authenticate.");try{let t=Bs(),o=await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return rt(o)}catch(t){throw Q(t)}}};import{jsx as fo,jsxs as vu}from"react/jsx-runtime";function Ov(e){return typeof e=="string"&&e.length===25}var Qr;function kt(){if(!Qr){let e=$.get(qo);return Promise.resolve(e||null)}return Qr.getAccessToken()}var wu,sl=(e,t)=>wu(e,t),Cu,ll=(e,t)=>Cu(e,t),bu,cl=()=>bu(),Dv=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;$.put(Er,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Uv=({config:e,...t})=>{if(!Ov(t.appId))throw new g("Cannot initialize the Privy provider with an invalid Privy app ID");Qr||(Qr=new Ir({appId:t.appId,apiUrl:t.apiUrl||ln}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.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."),fo(Fv,{...t,config:o,client:Qr})},Fv=e=>{let t=e.client,[o,r]=ee(!1),[n,i]=ee(!1),[a,c]=ee(!1),[s,l]=ee(null),[f,m]=ee(!1),[v,y]=ee([]),C=ds(v),[T,_]=ee(!1),[x,w]=ee(null),[D,I]=ee(!1),[k,M]=ee({status:"disconnected",connectError:null,connector:null,connectRetry:E}),[U,se]=ee(null),[B,Y]=ee(null),[H,Z]=ee({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}),[N,We]=ee(()=>{let d=mu(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),Pi(H,e.config)}),[G,q]=ee(!0),[Ce,le]=ee({}),[z,et]=ee(null),[be,Uo]=ee(null),[Fo,Zr]=ee(!1),[Si,ho]=ee(),[Bo,Ne]=ee(),[ce,tt]=ee(),[yo,Ho]=ee(!1),Ai=ds(null),J=ds(fu),Se=d=>{d&&w(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Xr=d=>{N.embeddedWallets.createOnLogin!=="off"&&q(!0),Se(d)};St(()=>{if(!B||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(B,p,N.defaultChain)}},[B,s]),St(()=>{B&&be?.(B)},[B]),St(()=>{(async()=>{if(!N.customAuth?.enabled)return;q(!0);let{getCustomAccessToken:p,isLoading:u}=N.customAuth;if(!(!n||u))try{let h=await p();if(!h){await Go.logout();return}if(a)return;t.startAuthFlow(new $o(h));let{user:L,isNewUser:me}=await t.authenticate();L||await Go.logout(),l(L||null),_(me||!1),c(!0),Ho(!0)}catch(h){console.warn(h),a&&await Go.logout()}})()},[N.customAuth?.enabled,N.customAuth?.getCustomAccessToken,N.customAuth?.isLoading,n,a]),St(()=>{yo&&B&&s&&$t(s,e.config?.embeddedWallets?.createOnLogin)&&(Ho(!1),fs(s,pn).catch(console.error))},[yo&&B&&s]),St(()=>{async function d(){let p=await t.getServerConfig();Z(p);let u=Pi(p,e.config);We(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains,u.defaultChain),t.connectors?.initialize();let h=Eu();Dv();let L=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(c(!!L),L&&K(J,"login","onComplete",L,!1,!0),l(L)),h||(i(!0),z?.()),h&&L&&m(!0),xu()}n||d()},[t,z,n]),St(()=>{let d=Pi(H,e.config);We(d)},[e.config]);let Eu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),h=d.get("privy_oauth_provider");return p&&u&&h?(t.startAuthFlow(new zt(h,p,u)),Xr("AWAITING_OAUTH_SCREEN"),le({finishOauthFlow:{onComplete:()=>{i(!0),z?.()}}}),!0):!1},ki=async(d,p,u)=>{let h=await t.connectors?.createWalletConnector(d,p)||null;ps(h,u)};async function ps(d,p){if(!d)return M({status:"disconnected",connectError:new F("Unable to connect to wallet."),connector:null,connectRetry:E}),p?.(null);M({connector:d,status:"connecting",connectError:null,connectRetry:()=>ps(d,p)});try{let u=await d.connect({showPrompt:!0});if(N.shouldSwitchChainOnConnect&&!N.chains.find(h=>h.id===Number(u?.chainId))){M(h=>({...h,connector:d,status:"switching_to_supported_chain",connectError:null,connectRetry:E}));try{await u?.switchChain(N.defaultChain.id),u&&(u.chainId=jo(Co(N.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${N.defaultChain.id}`)}}return M(h=>({...h,status:"connected",connectError:null,connectRetry:E})),u&&!D&&K(J,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof ot?(console.warn(u.cause?u.cause:u.message),D||K(J,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),D||K(J,"connectWallet","onError","unknown_connect_wallet_error")),M(h=>({...h,status:"disconnected",connectError:u})),p?.(null)}}let Ri=d=>{d!==null&&t.startAuthFlow(new vo(d))},xu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!je()&&Xr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new g("Connector not initialized");Se("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),ki(p,u,Ri)};St(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(l)},[n,a,s,t]);let us=()=>{m(!0),Se("LINK_WALLET_SCREEN")},Pu=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},Tu=async d=>{if(!t.connectors)throw new g("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;M(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:E})),Ri(d),Xr("AWAITING_CONNECTION")},_u=async(d,p)=>{if(!t.connectors)throw new g("Connector not initialized");await ki(d,p,Ri)},ms=async(d,p)=>{if(!N.fiatOnRamp.enabled)throw new g("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:h}=await td(t,d,p?.config??{},N.appearance.palette,N.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:h}}else throw new g("Unsupported fund provider. Currently supported option is `moonpay`.")},en=()=>{y(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:Pu(u),loginOrLink:async()=>{if(!await u.isConnected())throw new g("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new g("Cannot link or login with embedded wallet");Tu(u)},fund:async h=>{let{signedUrl:L,externalTransactionId:me}=await ms(u.address,h);le({fiatOnRampPrompt:{signedUrl:L},fiatOnRampStatus:{externalTransactionId:me}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new g("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new g("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(u.address);l(h)}}))||[];return yn(d,p)?d:p})};St(()=>{en()},[s?.linkedAccounts,a,n]),St(()=>{if(n){if(!t.connectors)throw new g("Connector not initialized");en(),t.connectors.on("walletsUpdated",en)}},[n]);let Su=()=>{Se(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};St(()=>{if(!v[0])return;let d=v[0],p=C.current.find(h=>h.address===d.address),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===d.address);if(!p&&u){let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},l(h)}C.current=v},[v]);let fs=async(d,p)=>{if(te(d))throw K(J,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,L]=await Promise.all([Me.initializeWalletProxy(p),kt()]);if(!h&&e.config?.customAuth?.enabled)throw K(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!L||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((me,Ee)=>{q(!0),le({createWallet:{onSuccess:Ve=>{K(J,"createWallet","onSuccess",Ve),me(Ve)},onFailure:Ve=>{K(J,"createWallet","onError","unknown_embedded_wallet_error"),Ee(Ve)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:L});let me=await Me.refreshUser(),Ee=te(me);if(!Ee)throw K(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return K(J,"createWallet","onSuccess",Ee),Ee}},Au=d=>{if(!N.chains.map(p=>p.id).includes(d))throw new F(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Go={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Su,linkWallet:us,linkEmail:()=>{if(s?.email)throw new g("User already has an email linked to their account.");m(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new g("User already has a phone number linked to their account.");m(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new g("User already has a Google account linked to their account.");await Me.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new g("User already has a Twitter account linked to their account.");await Me.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new g("User already has a Discord account linked to their account.");await Me.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new g("User already has a Github account linked to their account.");await Me.initLoginWithOAuth("github")},linkTiktok:async()=>{if(s?.tiktok)throw new g("User already has a Tiktok account linked to their account.");await Me.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(s?.linkedin)throw new g("User already has a LinkedIn account linked to their account.");await Me.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Me.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{et(()=>d)}),et(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}I(!0),Xr()},logout:async()=>{await t.logout(),l(null),c(!1),w(null),K(J,"logout","onSuccess"),m(!1),r(!1),$.del(xr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new oe;let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new oe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new cs(new ht(new oe));let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new cs(new ht(new oe)):new cs(new ht(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new jt(new oe);let d=v.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new jt(new oe):new jt(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return l(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return l(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return l(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return l(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return l(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return l(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return l(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return l(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return l(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return l(p),p},setActiveWallet:async d=>{let p=v.find(h=>_i(h.address)===_i(d)),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&_i(h.address)===_i(d));if(!p||!await p.isConnected())se(d),us();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},l(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw K(J,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return fs(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=te(s);if(!u||!B){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}q(!0);let h={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},L={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};le({setWalletPassword:h,connectWallet:L}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,h)=>{if(!a||!s){h(new Error("User must be authenticated before signing with a Privy wallet"));return}let L=te(s);if(!L){h(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){h(new Error("Message must be a non-empty string"));return}q(!0);let me=async()=>{if(!a)return h(new Error("User must be authenticated before signing with a Privy wallet")),null;let Ee=await kt();if(B&&Ee)try{if(!await Me.recoverEmbeddedWallet())return h(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:L.address});let{response:Ve}=await B.rpc({accessToken:Ee,address:L.address,request:{method:"personal_sign",params:[d,L.address]}}),Cr=Ve.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:L.address}),Cr}catch(Ht){return h(Ht),null}else return null};if(N.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let Ee=await me();Ee?u(Ee):h(new xe("Unable to sign message"))}else{let Ve={message:d,confirmAndSignMessage:me,onSuccess:Gt=>{u(Gt)},onFailure:Gt=>{h(Gt)},uiOptions:p||{}},Cr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:h};le({signMessage:Ve,connectWallet:Cr}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(h,L)=>{if(!a||!s){L(new Error("User must be authenticated before signing with a Privy wallet"));return}let me=te(s);if(!me){L(new Error("Must have a Privy wallet before signing"));return}q(!0);let Ee=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ht=d.chainId?Number(d.chainId):Ee.chainId;Au(Ht);let Ve=Object.assign({},d,{chainId:Ht}),Cr=async()=>{let Gt=await kt();if(!Gt||!B){L(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Me.recoverEmbeddedWallet()){L(new Error("Unable to connect to wallet"));return}let hs=new Mv(nt(Ve.chainId,N.chains,N.rpcConfig)),Ru=await gi(me.address,Ve,hs),Iu=await vi(Gt,me.address,B,Ru,hs);h(Iu)}catch(tn){L(tn)}};if(N.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Cr();else{let Gt={transactionRequest:Ve,onSuccess:h,onFailure:L,uiOptions:p||{},fundWalletConfig:u},tn={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:L};le({connectWallet:tn,sendTransaction:Gt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!te(s)){p(new Error("Must have a Privy wallet before exporting"));return}q(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},L={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};le({keyExport:L,connectWallet:h}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),async init(d){let p;switch(d){case"sms":p=new wr("verify");break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p);try{await p.init()}catch(u){throw K(J,"configureMfa","onError",u.privyErrorCode||"unknown_mfa_error"),u}},async submit(d,p){switch(d){case"sms":Ai.current?.resolve({mfaMethod:d,mfaCode:p});break;default:throw Ai.current?.reject(new g("Unsupported MFA method")),K(J,"configureMfa","onError","unknown_mfa_error"),new g(`Unsupported MFA method: ${d}`)}},async initEnroll(d,p){let u;switch(d){case"sms":if(!p?.phoneNumber)throw K(J,"configureMfa","onError","missing_mfa_credentials"),new Error("Missing MFA credentials");u=new wr("enroll",p.phoneNumber);break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(u);try{await u.init()}catch(h){throw K(J,"configureMfa","onError",h.privyErrorCode||"unknown_mfa_error"),h}},async submitEnroll(d,p){let u;switch(d){case"sms":u=new wr("enroll"),u.meta={action:"enroll",smsCode:p.mfaCode,phoneNumber:p.phoneNumber};break;default:throw K(J,"configureMfa","onError","unknown_mfa_error"),new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(u);try{await u.authenticate();let h=await t.getAuthenticatedUser();l(h)}catch(h){throw K(J,"configureMfa","onError",h.privyErrorCode||"unknown_mfa_error"),h}}};wu=Go.signMessage,Cu=Go.sendTransaction;let Me=(()=>({isNewUserThisSession:T,isLinking:f,linkingHint:U,walletConnectionStatus:k,rpcConfig:N.rpcConfig,chains:N.chains,clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>N.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Fo,enabled:N.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:$s,action:N.id,callback:ho,"error-callback":Ne,"expired-callback":()=>{try{d.reset(ce),Ne(void 0),ho(void 0)}catch{Ne("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),tt(p)},remove:()=>{let d=window.turnstile;!d?.remove||!ce||(d.remove(ce),tt(void 0),Ne(void 0),ho(void 0))},token:Si,error:Bo},initializeWalletProxy:async d=>{if(B)return B;let p=new Promise(L=>{Uo(()=>me=>L(me))}),u=new Promise(L=>setTimeout(()=>L(null),d)),h=await Promise.race([p,u]);return Uo(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(K(J,"login","onComplete",s,T,!1),e.onSuccess?.(s,T)):D&&K(J,"login","onError","exited_auth_flow"),t.authFlow=void 0,se(null),w(null),I(!1),m(!1),_(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:ki,initLoginWithWallet:_u,loginWithWallet:async()=>{if(!n)throw new br;if(!(t.authFlow instanceof vo))throw new g("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw K(J,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}l(d||s||null),_(p||!1),c(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new zt(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof zt))throw new g("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw K(J,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}l(d),_(p||!1),c(!0)},initLoginWithEmail:async(d,p)=>{let u=new go(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(h){throw K(J,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},initLoginWithSms:async(d,p)=>{let u=new wo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(h){throw K(J,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new br;if(t.authFlow instanceof go)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=d.trim();else throw new g("Must initialize a passwordless code flow first");let p,u;a?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),l(p||s||null),_(u||!1),c(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return l(d),d},walletProxy:B,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(L=>L.type==="wallet"&&L.walletClientType==="privy"),h=await kt();if(!h||!B||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}q(!0);try{await B.connect({accessToken:h,address:u.address}),d(!0)}catch(L){rr(L)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await B.recover({address:u.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):rr(L)?(le({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(L)}}),getFiatOnRampConfig:ms,updateWallets:()=>en()}))();bu=Me.recoverEmbeddedWallet;let ku=Lv(()=>({wallets:v}),[v]);return fo(He.Provider,{value:Go,children:fo(ss.Provider,{value:J,children:vu(ts.Provider,{value:ku,children:[e.children,vu(qi.Provider,{value:Me,children:[fo(zp,{theme:{...N.appearance.palette||{}}}),fo(yl,{appConfig:N,data:Ce,setModalData:le,setInitialScreen:w,initialScreen:x,visible:o,authenticated:a,children:o?fo(jp,{}):null}),G&&H.id?fo(gu,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods??[],mfaPromise:Ai,onLoad:Y,onLoadFailed:()=>null}):null]}),N.captchaEnabled&&fo(Kp,{onLoad:()=>Zr(!0)})]})})})};import{useContext as Bv}from"react";function Hv(e){let{init:t,submit:o,submitEnroll:r,initEnroll:n}=Bv(He);return _t("configureMfa",e),{init:t,submit:o,submitEnroll:r,initEnroll:n}}import{useContext as Gv}from"react";function zv(e){let{login:t}=Gv(He);return _t("login",e),{login:t}}import{useContext as $v}from"react";function Vv(e){let{logout:t}=$v(He);return _t("logout",e),{logout:t}}import{useContext as qv}from"react";function jv(e){let{connectWallet:t}=qv(He);return _t("connectWallet",e),{connectWallet:t}}import{useContext as Kv}from"react";function Yv(e){let{createWallet:t}=Kv(He);return _t("createWallet",e),{createWallet:t}}export{ht as AsExternalProvider,kr as ConnectorManager,Ir as PrivyClient,Uv as PrivyProvider,oe as PrivyProxyProvider,xi as SUPPORTED_CHAINS,Ii as VERSION,Fe as WalletConnector,kt as getAccessToken,Hv as useConfigureMfa,jv as useConnectWallet,Yv as useCreateWallet,zv as useLogin,Vv as useLogout,V as usePrivy,os as useWallets};