@privy-io/react-auth 1.14.1-beta.2 → 1.14.1-beta.3

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ni=Object.create;var wt=Object.defineProperty;var Oi=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var Gi=(t,e)=>{for(var o in e)wt(t,o,{get:e[o],enumerable:!0})},Uo=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ui(e))!Di.call(t,i)&&i!==o&&wt(t,i,{get:()=>e[i],enumerable:!(r=Oi(e,i))||r.enumerable});return t};var v=(t,e,o)=>(o=t!=null?Ni(Fi(t)):{},Uo(e||!t||!t.__esModule?wt(o,"default",{value:t,enumerable:!0}):o,t)),Vi=t=>Uo(wt({},"__esModule",{value:!0}),t);var ms={};Gi(ms,{AsExternalProvider:()=>xe,ConnectorManager:()=>$e,PrivyClient:()=>Ze,PrivyProvider:()=>Mi,PrivyProxyProvider:()=>oe,VERSION:()=>yt,WalletConnector:()=>le,getAccessToken:()=>Ri,usePrivy:()=>U});module.exports=Vi(ms);var K=require("react");var bt=v(require("axios"));var Fo=v(require("axios")),te=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Ve=class extends te{constructor(o,r,i,n){super(i,n);this.type=o;this.status=r}},p=class extends te{constructor(o,r){super(o,r);this.type="client_error"}};var N=class extends te{constructor(o,r){super(o,r);this.type="connector_error"}},M=t=>{if(t instanceof te)return t;if(!Fo.default.isAxiosError(t))return J(t);if(!t.response)return new Ve("api_error",null,t.message,t);let{type:e,message:o,error:r}=t.response.data;return new Ve(e||"ApiError",t.response.status,o||r,t)},J=t=>t instanceof te?t:t instanceof Error?new p(t.message,t):new p(`Internal error: ${t}`);var Do="1.14.1-beta.2";var Go="https://api.privy.io/v0",Vo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",ot="4df5e2316331463a9130964bd6078dfa",Ho=1e4,He=1400,yt=Do;var Be="privy:token",Ct="privy:refresh_token",vt="privy:connectors",Bo="walletconnect";var xt=class{constructor(e,o,r){this.appId=e,this.sdkVersion=yt,this.client=o,this.defaults=r}async get(e,o){try{return await bt.default.get(e,await this.buildConfig({headers:{"Cache-Control":"no-cache"},...o}))}catch(r){throw M(r)}}async post(e,o,r){try{return await bt.default.post(e,o,await this.buildConfig(r))}catch(i){throw M(i)}}async delete(e,o){try{return await bt.default.delete(e,await this.buildConfig(o))}catch(r){throw M(r)}}async buildConfig(e){if(e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,!e.headers.authorization){let o=await this.client.getAccessToken();o!==null&&(e.headers.authorization=`Bearer ${o}`)}return{...this.defaults,...e}}};var zo=v(require("jose")),he=class{static parse(e){try{return new he(e)}catch{return null}}constructor(e){this.value=e,this._decoded=zo.decodeJwt(e)}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(e=0){let o=Date.now(),r=(this.expiration-e)*1e3;return o>=r}};var ve=class{constructor(e){this.promise=null;this.fn=e}execute(e){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}};var eo=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,o){o!==void 0?this._cache[e]=o:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}},to=class{get(e){let o=localStorage.getItem(e);return o===null?void 0:JSON.parse(o)}put(e,o){o!==void 0?localStorage.setItem(e,JSON.stringify(o)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map(([e])=>e)}};function Bi(){return typeof window<"u"&&window.localStorage?new to:new eo}var B=Bi();var jo=require("@ethersproject/logger");var ze=class extends N{constructor(){super("Wallet timeout");this.type="wallet_error"}},be=t=>{if(t instanceof N)return t;if((t==null?void 0:t.code)&&(t==null?void 0:t.reason)){let e=new je(t);return t.code===jo.ErrorCode.ACTION_REJECTED&&(e.details=Re.E4001_USER_REJECTED_REQUEST),e}return t!=null&&t.code?new je(t):new N("Unknown connector error",t)},oo=class extends te{constructor(o,r,i){super(o);this.type="provider_error";this.code=r,this.data=i}},je=class extends oo{constructor(o){var n,l,u;let r=o;super(r.message,r.code,r.data);let i=Object.values(Re).find(f=>f.eipCode===r.code);this.details=i||Re.UNKNOWN_ERROR,r.code===-32002&&((n=r.message)!=null&&n.includes("already pending for origin")?(l=r.message)!=null&&l.includes("wallet_requestPermissions")?this.details=Re.E32002_CONNECTION_ALREADY_PENDING:this.details=Re.E32002_REQUEST_ALREADY_PENDING:(u=r.message)!=null&&u.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Re.E32002_WALLET_LOCKED))}},zi={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}},ji={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}},$i={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}},Re={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...$i,...ji},Lt={...zi,...Re};var Zi=12e4,ro=(t=new ze,e=Zi)=>new Promise((o,r)=>setTimeout(()=>{r(t)},e)),oe=class{constructor(e){this.removeListener=(e,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(e,o)};this.setProvider=e=>{this.walletProvider=e,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=e,this._subscriptions=[]}on(e,o){if(this.walletProvider)return this.walletProvider.on(e,o);this._subscriptions.push({eventName:e,listener:o})}request(e){if(!this.walletProvider)throw new N(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),ro()]).catch(o=>{throw be(o)})}},xe=class extends oe{constructor(o){super(o)}},At=class extends oe{constructor(e){super(e)}sendAsync(e,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ko=require("@ethersproject/address");var $o=require("@ethersproject/address");var Zo=require("@ethersproject/providers"),le=class{constructor(e,o,r){this.createSiweMessage=(e,o,r,i,n,l,u)=>`${r} wants you to sign in with your Ethereum account:
1
+ "use strict";var Ni=Object.create;var wt=Object.defineProperty;var Oi=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var Gi=(t,e)=>{for(var o in e)wt(t,o,{get:e[o],enumerable:!0})},Uo=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ui(e))!Di.call(t,i)&&i!==o&&wt(t,i,{get:()=>e[i],enumerable:!(r=Oi(e,i))||r.enumerable});return t};var v=(t,e,o)=>(o=t!=null?Ni(Fi(t)):{},Uo(e||!t||!t.__esModule?wt(o,"default",{value:t,enumerable:!0}):o,t)),Vi=t=>Uo(wt({},"__esModule",{value:!0}),t);var ms={};Gi(ms,{AsExternalProvider:()=>xe,ConnectorManager:()=>$e,PrivyClient:()=>Ze,PrivyProvider:()=>Mi,PrivyProxyProvider:()=>oe,VERSION:()=>yt,WalletConnector:()=>le,getAccessToken:()=>Ri,usePrivy:()=>U});module.exports=Vi(ms);var K=require("react");var bt=v(require("axios"));var Fo=v(require("axios")),te=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Ve=class extends te{constructor(o,r,i,n){super(i,n);this.type=o;this.status=r}},p=class extends te{constructor(o,r){super(o,r);this.type="client_error"}};var N=class extends te{constructor(o,r){super(o,r);this.type="connector_error"}},M=t=>{if(t instanceof te)return t;if(!Fo.default.isAxiosError(t))return J(t);if(!t.response)return new Ve("api_error",null,t.message,t);let{type:e,message:o,error:r}=t.response.data;return new Ve(e||"ApiError",t.response.status,o||r,t)},J=t=>t instanceof te?t:t instanceof Error?new p(t.message,t):new p(`Internal error: ${t}`);var Do="1.14.1-beta.3";var Go="https://api.privy.io/v0",Vo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",ot="4df5e2316331463a9130964bd6078dfa",Ho=1e4,He=1400,yt=Do;var Be="privy:token",Ct="privy:refresh_token",vt="privy:connectors",Bo="walletconnect";var xt=class{constructor(e,o,r){this.appId=e,this.sdkVersion=yt,this.client=o,this.defaults=r}async get(e,o){try{return await bt.default.get(e,await this.buildConfig({headers:{"Cache-Control":"no-cache"},...o}))}catch(r){throw M(r)}}async post(e,o,r){try{return await bt.default.post(e,o,await this.buildConfig(r))}catch(i){throw M(i)}}async delete(e,o){try{return await bt.default.delete(e,await this.buildConfig(o))}catch(r){throw M(r)}}async buildConfig(e){if(e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,!e.headers.authorization){let o=await this.client.getAccessToken();o!==null&&(e.headers.authorization=`Bearer ${o}`)}return{...this.defaults,...e}}};var zo=v(require("jose")),he=class{static parse(e){try{return new he(e)}catch{return null}}constructor(e){this.value=e,this._decoded=zo.decodeJwt(e)}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(e=0){let o=Date.now(),r=(this.expiration-e)*1e3;return o>=r}};var ve=class{constructor(e){this.promise=null;this.fn=e}execute(e){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}};var eo=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,o){o!==void 0?this._cache[e]=o:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}},to=class{get(e){let o=localStorage.getItem(e);return o===null?void 0:JSON.parse(o)}put(e,o){o!==void 0?localStorage.setItem(e,JSON.stringify(o)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map(([e])=>e)}};function Bi(){return typeof window<"u"&&window.localStorage?new to:new eo}var B=Bi();var jo=require("@ethersproject/logger");var ze=class extends N{constructor(){super("Wallet timeout");this.type="wallet_error"}},be=t=>{if(t instanceof N)return t;if((t==null?void 0:t.code)&&(t==null?void 0:t.reason)){let e=new je(t);return t.code===jo.ErrorCode.ACTION_REJECTED&&(e.details=Re.E4001_USER_REJECTED_REQUEST),e}return t!=null&&t.code?new je(t):new N("Unknown connector error",t)},oo=class extends te{constructor(o,r,i){super(o);this.type="provider_error";this.code=r,this.data=i}},je=class extends oo{constructor(o){var n,l,u;let r=o;super(r.message,r.code,r.data);let i=Object.values(Re).find(f=>f.eipCode===r.code);this.details=i||Re.UNKNOWN_ERROR,r.code===-32002&&((n=r.message)!=null&&n.includes("already pending for origin")?(l=r.message)!=null&&l.includes("wallet_requestPermissions")?this.details=Re.E32002_CONNECTION_ALREADY_PENDING:this.details=Re.E32002_REQUEST_ALREADY_PENDING:(u=r.message)!=null&&u.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Re.E32002_WALLET_LOCKED))}},zi={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}},ji={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}},$i={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}},Re={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...$i,...ji},Lt={...zi,...Re};var Zi=12e4,ro=(t=new ze,e=Zi)=>new Promise((o,r)=>setTimeout(()=>{r(t)},e)),oe=class{constructor(e){this.removeListener=(e,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(e,o)};this.setProvider=e=>{this.walletProvider=e,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=e,this._subscriptions=[]}on(e,o){if(this.walletProvider)return this.walletProvider.on(e,o);this._subscriptions.push({eventName:e,listener:o})}request(e){if(!this.walletProvider)throw new N(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),ro()]).catch(o=>{throw be(o)})}},xe=class extends oe{constructor(o){super(o)}},At=class extends oe{constructor(e){super(e)}sendAsync(e,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ko=require("@ethersproject/address");var $o=require("@ethersproject/address");var Zo=require("@ethersproject/providers"),le=class{constructor(e,o,r){this.createSiweMessage=(e,o,r,i,n,l,u)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
3
3
 
4
4
  ${u}
@@ -9,7 +9,7 @@ Chain ID: ${e}
9
9
  Nonce: ${l}
10
10
  Issued At: ${n}
11
11
  Resources:
12
- - https://privy.io`;this.provider=o,this.walletType=e,this.address=r,this.chain=null,this.connected=!1}async fetchAddress(){if(!this.address){let e=await this.provider.request({method:"eth_accounts"});Array.isArray(e)&&e.length>0&&(this.address=(0,$o.getAddress)(e[0]))}return this.address}async fetchChainId(){if(!this.chain){let e=await this.provider.request({method:"eth_chainId"}),o=Number(e);this.chain=String(o)}return this.chain}async getConnectedWallet(){let e=this.walletType;if(!e||!await this.isConnected())return null;let o=await this.fetchAddress(),r=await this.fetchChainId();return{address:o,chainId:r,chainType:"ethereum",walletType:e}}async sign(e){return new Zo.Web3Provider(new xe(this.provider)).getSigner().signMessage(e)}prepareMessage(e,o,r){let i=window.location.host,n=window.location.origin,l="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",u=new Date().toISOString();return this.createSiweMessage(e,o,i,n,u,r,l)}};var qo=require("react-device-detect"),Et=class extends le{constructor(e,o){super("metamask",e,o)}async connect(e){var o;return this.provider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async r=>{r.isMetaMask&&this.provider.setProvider(r)}),(!await this.isConnected()||e.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return await this.fetchAddress()!==null}async promptConnection(){try{let e="";qo.isMobile||await this.provider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.provider.request({method:"eth_requestAccounts"});if(o.length>0&&(e=(0,Ko.getAddress)(o[0])),!e||e==="")throw new N("Unable to retrieve address");this.connected=!0,this.address=e}catch(e){throw be(e)}}};var Jo=require("@ethersproject/address");var Yo=v(require("@coinbase/wallet-sdk"));var Ki=()=>{let t=`https://mainnet.infura.io/v3/${ot}`,e=1;return new Yo.default({appName:"Privy",darkMode:!1,headlessMode:!1}).makeWeb3Provider(t,e)},kt=class extends le{constructor(e,o){super("coinbase_wallet",e,o)}async connect(e){return this.provider.setProvider(Ki()),(!await this.isConnected()||e.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return await this.fetchAddress()!==null}async promptConnection(){try{let e="",o=await this.provider.request({method:"eth_requestAccounts"});if(o.length>0&&(e=(0,Jo.getAddress)(o[0])),!e||e==="")throw new N("Unable to retrieve address");this.connected=!0}catch(e){throw be(e)}}};var io=v(require("@walletconnect/web3-provider"));var no=class extends le{constructor(o,r,i){super("wallet_connect",r,i);this._globalConnector=o,this._provider=this._globalConnector.getProviderForAddress(i)}async connect(o){return this.provider.setProvider(this._provider),(!await this.isConnected()||o.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.provider.walletProvider.connected}async promptConnection(){try{let o="";this.provider.setProvider(this._provider);let r=await Promise.race([this._provider.enable(),ro()]);if(r.length>0&&(o=r[0]),this._globalConnector.indexProvider(this._provider),!o||o==="")throw new N("Unable to retrieve address");this.connected=!0}catch(o){throw be(o)}}},_t=class{constructor(){this._storageIdToProvider={},this._addressToStorageId={},B.getKeys().forEach(e=>{if(e.startsWith("walletconnect")){let o=new io.default({infuraId:ot,storageId:e});o.enable(),this._storageIdToProvider[e]=o;for(let r of o.accounts)this._addressToStorageId[r]=e}})}build(e,o){return new no(this,e,o)}async destroy(){Object.values(this._storageIdToProvider).forEach(async e=>{await e.disconnect()})}getProviderForAddress(e){let o=Bo,r=()=>`walletconnect:${Math.random().toString(36).slice(2)}`;e===null?o=r():o=this._addressToStorageId[e]||r();let i=new io.default({infuraId:ot,storageId:o});return this._storageIdToProvider[o]=i,i}indexProvider(e){this._storageIdToProvider[e.storageId]=e;for(let o of e.accounts)this._addressToStorageId[o]=e.storageId}};var so=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let t of window.ethereum.providers)if(t.isMetaMask)return!0}return!1},Pt=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let t of window.ethereum.providers)if(t.isCoinbaseWallet)return!0}return!1},Qo=()=>{var e;let t=B.get(vt);return t?(e=t.find(o=>o.active))==null?void 0:e.address:null},$e=class{constructor(){this.getEthereumProvider=()=>{var e;return((e=this.activeWalletConnector)==null?void 0:e.provider)||new oe};this.walletConnectors=[],this.walletConnectGlobalWalletConnector=new _t}initialize(){this.load(),this.activeWalletConnector&&this.activeWalletConnector.connect({showPrompt:!1})}initializeLinkedWallets(e){e.linkedAccounts.forEach(()=>{})}load(){(B.get(vt)||[]).forEach(o=>{let r=this.createWalletConnector(o.walletType,o.address);this.addWalletConnector(r),o.active&&(this.activeWalletConnector=r)})}save(){let e=this.walletConnectors.map(o=>{var r;return{address:o.address,walletType:o.walletType,active:o.address===((r=this.activeWalletConnector)==null?void 0:r.address)}});B.put(vt,e)}addWalletConnector(e){this.walletConnectors.find(r=>r.address===e.address&&r.walletType===e.walletType)||this.walletConnectors.push(e)}removeWallet(e){var r;if(this.walletConnectors=this.walletConnectors.filter(i=>i.address!==e),e===((r=this.activeWalletConnector)==null?void 0:r.address))if(this.walletConnectors.length>0){let i=this.walletConnectors[this.walletConnectors.length-1];this.setActiveWallet(i.address)}else this.activeWalletConnector=void 0;this.save()}async activeWalletSign(e){if(!this.activeWalletConnector)throw new N("Cannot sign, no wallet is active. Is a wallet connected?");if(!await this.activeWalletConnector.connect({showPrompt:!1}))throw new N("Cannot sign - unable to connect to wallet.");return this.activeWalletConnector.sign(e)}setActiveWallet(e){let o=this.walletConnectors.find(r=>r.address===e);return o?(this.activeWalletConnector=o,this.save(),!0):!1}createWalletConnector(e,o){switch(e){case"metamask":return new Et(new oe,o);case"coinbase_wallet":return new kt(new oe,o);case"wallet_connect":return this.walletConnectGlobalWalletConnector.build(new oe,o)}}};function Le(t){return new Date(t*1e3)}function qi(t){return t.map(e=>{switch(e.type){case"wallet":return{address:e.address,type:e.type,verifiedAt:Le(e.verified_at),chainType:e.chain_type};case"email":return{address:e.address,type:e.type,verifiedAt:Le(e.verified_at)};case"phone":return{number:e.phoneNumber,type:e.type,verifiedAt:Le(e.verified_at)};case"google_oauth":return{subject:e.subject,email:e.email,name:e.name,type:e.type,verifiedAt:Le(e.verified_at)};case"twitter_oauth":return{subject:e.subject,username:e.username,name:e.name,type:e.type,verifiedAt:Le(e.verified_at)};case"discord_oauth":return{subject:e.subject,username:e.username,email:e.email,type:e.type,verifiedAt:Le(e.verified_at)};case"github_oauth":return{subject:e.subject,username:e.username,name:e.name,email:e.email,type:e.type,verifiedAt:Le(e.verified_at)};default:throw new p("Unrecognized account type")}})}function Me(t,e){return t.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),t.find(o=>o.type===e)}function rt(t){let e=Qo();if(!e)return t.wallet&&console.warn("[Privy] User has linked wallets but no active wallet"),t;let o=t.linkedAccounts.find(i=>i.type==="wallet"&&i.address===e),r=Object.assign({},t);return r.wallet=o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},r}function me(t){if(!t)return null;let e=qi(t.linked_accounts),o=Me(e,"wallet"),r=Me(e,"email"),i=Me(e,"phone"),n=Me(e,"google_oauth"),l=Me(e,"twitter_oauth"),u=Me(e,"discord_oauth"),f=Me(e,"github_oauth"),m={id:t.id,createdAt:Le(t.created_at),linkedAccounts:e,email:r&&{address:r==null?void 0:r.address},phone:i&&{number:i==null?void 0:i.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:n&&{subject:n.subject,email:n.email,name:n.name},twitter:l&&{subject:l.subject,username:l.username,name:l.name},discord:u&&{subject:u.subject,username:u.username,email:u.email},github:f&&{subject:f.subject,username:f.username,name:f.name,email:f.email}};return rt(m)}var Xo=()=>"/api/v1/sessions",er=()=>"/api/v1/sessions/logout",tr=()=>"/api/v1/sessions/fork",or=()=>"/api/v1/siwe/init",rr=()=>"/api/v1/siwe/authenticate",ir=()=>"/api/v1/siwe/link",nr=()=>"/api/v1/passwordless/init",sr=()=>"/api/v1/passwordless/authenticate",ar=()=>"/api/v1/passwordless/link",lr=()=>"/api/v1/passwordless_sms/init",dr=()=>"/api/v1/passwordless_sms/authenticate",cr=()=>"/api/v1/passwordless_sms/link",pr=()=>"/api/v1/oauth/init",ur=()=>"/api/v1/oauth/authenticate",hr=()=>"/api/v1/oauth/link",mr=()=>"/api/v1/siwe/unlink",fr=()=>"/api/v1/passwordless/unlink",gr=()=>"/api/v1/passwordless_sms/unlink",wr=()=>"/api/v1/oauth/unlink";var Ji=30,St=class{constructor(){this.authenticateOnce=new ve(async e=>this._authenticate(e)),this.linkOnce=new ve(async e=>this._link(e)),this.refreshOnce=new ve(this._refresh.bind(this)),this.destroyOnce=new ve(this._destroy.bind(this)),this.forkSessionOnce=new ve(this._forkSession.bind(this))}get token(){try{let e=B.get(Be);return typeof e=="string"?new he(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=B.get(Ct);return typeof e=="string"?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=he.parse(this.token);return e!==null&&!e.isExpired(Ji)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:o,refresh_token:r,user:i,is_new_user:n}=await e.authenticate();return this.storeToken(o),this.storeRefreshToken(r),{user:me(i),isNewUser:n}}catch(o){throw console.warn("Error authenticating session"),J(o)}}async _link(e){try{let o=await e.link();return me(o)}catch(o){throw console.warn("Error linking account"),J(o)}}async _refresh(){if(!this.api)throw new p("Session has no API instance");if(!this.client)throw new p("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,o=this.refreshToken;if(!e||!o)return null;try{let r=await this.api.post(Xo(),{refresh_token:o},{headers:{authorization:`Bearer ${e}`}});return this.storeToken(r.data.token),this.storeRefreshToken(r.data.refresh_token),me(r.data.user)}catch(r){if(r instanceof Ve&&r.status===400&&r.message==="Invalid auth token")return this.destroyLocalState(),null;throw J(r)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(er(),{refresh_token:this.refreshToken}))}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new p("Session has no API instance");let e=this.refreshToken;try{let o=await this.api.post(tr(),{refresh_token:e});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),o.data.new_session_refresh_token}catch(o){throw J(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?B.put(Be,e):B.del(Be)}storeRefreshToken(e){typeof e=="string"?B.put(Ct,e):B.del(Ct)}};var ao,Ze=class{constructor(e){let o=e.apiURL||Go,r=e.timeout||Ho;this.appId=e.appId,this.connectors=new $e,ao||(ao=new St),this.session=ao,this.api=new xt(e.appId,this,{baseURL:o,timeout:r}),this.session.api=this.api,this.session.client=this}authenticate(){if(!this.authFlow)throw new p("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new p("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let o=await this.api.post(fr(),{address:e});return me(o.data)}catch(o){throw J(o)}}async unlinkPhone(e){try{let o=await this.api.post(gr(),{phoneNumber:e});return me(o.data)}catch(o){throw J(o)}}async unlinkWallet(e){try{let o=await this.api.post(mr(),{address:e});return me(o.data)}catch(o){throw J(o)}}async unlinkOAuth(e,o){try{let r=await this.api.post(wr(),{provider:e,subject:o});return me(r.data)}catch(r){throw J(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(e){var o;return this.session.hasActiveToken()?((o=he.parse(this.session.token))==null?void 0:o.audience)!==this.appId?(await this.logout(),null):this.session.token:!(e!=null&&e.disableAutoRefresh)&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getAppSettings(){try{let e=await this.api.get(`/api/v1/apps/${this.appId}`);return{id:e.data.id,name:e.data.name,verificationKey:e.data.verification_key,logoUrl:e.data.logo_url||void 0,theme:e.data.theme,accentColor:e.data.accent_color||void 0,showWalletLoginFirst:e.data.show_wallet_login_first,allowlistConfig:{errorTitle:e.data.allowlist_config.error_title,errorDetail:e.data.allowlist_config.error_detail,errorCtaText:e.data.allowlist_config.cta_text,errorCtaLink:e.data.allowlist_config.cta_link},walletAuth:e.data.wallet_auth,emailAuth:e.data.email_auth,smsAuth:e.data.sms_auth,googleOAuth:e.data.google_oauth,twitterOAuth:e.data.twitter_oauth,discordOAuth:e.data.discord_oauth,githubOAuth:e.data.github_oauth,termsAndConditionsUrl:e.data.terms_and_conditions_url,privacyPolicyUrl:e.data.privacy_policy_url,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw J(e)}}setActiveWallet(e,o){if(!o.linkedAccounts.map(n=>n.type==="wallet"?n.address:null).includes(e))throw new p("Cannot set an unlinked address as active.");if(!this.connectors.setActiveWallet(e))throw new p("Error setting the active wallet.");return rt(o)}async forkSession(){return await this.session.forkSession()}};var Ii=require("@ethersproject/providers");var Tt=require("react");var w=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var lo=(0,Tt.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,login:w,linkEmail:w,linkPhone:w,linkWallet:w,linkGoogle:w,linkTwitter:w,linkDiscord:w,linkGithub:w,logout:w,getAccessToken:w,getEthereumProvider:w,getEthersProvider:w,getWeb3jsProvider:w,unlinkEmail:w,unlinkPhone:w,unlinkWallet:w,unlinkGoogle:w,unlinkTwitter:w,unlinkDiscord:w,unlinkGithub:w,setActiveWallet:w,forkSession:w}),U=()=>(0,Tt.useContext)(lo);var it=class{constructor(e,o){this.meta={walletType:o},this.connectors=e,this.walletConnector=this.connectors.createWalletConnector(o,null)}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");try{let{message:e,signature:o}=await this.promptConnectAndSign(this.api),r=await this.api.post(rr(),{message:e,signature:o});return this.connectors.addWalletConnector(this.walletConnector),this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");try{let{message:e,signature:o}=await this.promptConnectAndSign(this.api),r=await this.api.post(ir(),{message:e,signature:o});return this.connectors.addWalletConnector(this.walletConnector),this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(e){throw M(e)}}async promptConnectAndSign(e){let o=await this.walletConnector.connect({showPrompt:!0}),r=o.address,i=o.chainId,n=await e.post(or(),{address:r}),l=this.walletConnector.prepareMessage(i,r,n.data.nonce),u=await this.walletConnector.sign(l);return{message:l,signature:u}}};var nt=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new p("Email and email code must be set prior to calling authenticate.");try{let e=sr(),o=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new p("Email and email code must be set prior to calling authenticate.");try{let e=ar();return(await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode})).data}catch(e){throw M(e)}}async sendCodeEmail(e){if(!this.api)throw new p("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new p("Email must be set when initialzing authentication.");try{let o=nr();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw M(o)}}};var st=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new p("phone number and sms code must be set prior to calling authenticate.");try{let e=dr(),o=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new p("phone number and sms code must be set prior to calling authenticate.");try{let e=cr();return(await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(e){throw M(e)}}async sendSmsCode(e){if(!this.api)throw new p("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new p("phone nNumber must be set when initialzing authentication.");try{let o=lr();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw M(o)}}};var Ke=class{constructor(e,o,r){this.meta={provider:e},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new p("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new p("User denied confirmation during OAuth flow");try{let e=ur(),o=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new p("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new p("User denied confirmation during OAuth flow");try{let e=hr();return(await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(e){throw M(e)}}async getAuthorizationUrl(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.provider)throw new p("Provider must be set when initialzing OAuth authentication.");try{let e=pr();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw M(e)}}};var gc=require("wicg-inert"),Si=v(require("react-dom")),Qt=v(require("styled-components"));var de=require("react");var Cr=require("react/jsx-runtime");function yr(t){return(0,Cr.jsx)("link",{rel:"prefetch",href:t.src})}var Wt=require("react/jsx-runtime"),vr=(0,de.createContext)({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1,github:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:w,navigateBack:w}),br=t=>{let e=t.appSettings,o=t.authenticated,r=t.visible,[i,n]=(0,de.useState)("LANDING"),[l,u]=(0,de.useState)("LANDING");(0,de.useEffect)(()=>{o||n("LANDING")},[o]),(0,de.useEffect)(()=>{r||(u("LANDING"),n("LANDING"))},[r]);let f={ready:!!(e!=null&&e.id),app:e,options:t.options,currentScreen:i,lastScreen:l,navigate:m=>{u(i),n(m)},navigateBack:()=>{n(l)}};return(0,Wt.jsxs)(vr.Provider,{value:f,children:[e&&e.logoUrl&&(0,Wt.jsx)(yr,{src:e.logoUrl}),t.children]})},y=()=>(0,de.useContext)(vr);var Zt=require("react"),Qe=v(require("styled-components"));var Ar=v(require("styled-components"));var co=require("react/jsx-runtime"),xr=({style:t,...e})=>(0,co.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,co.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});var po=require("react/jsx-runtime"),Lr=({style:t,...e})=>(0,po.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,po.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});var It=require("react");var uo=(0,It.createContext)({isLinking:!1,linkingHint:null,getAuthMeta:w,getAuthFlow:w,closePrivyModal:w,initLoginWithWallet:w,loginWithWallet:w,loginWithCode:w,initLoginWithEmail:w,initLoginWithSms:w,resendEmailCode:w,resendSmsCode:w,initLoginWithOAuth:w,loginWithOAuth:w}),T=()=>(0,It.useContext)(uo);var Y=require("react/jsx-runtime"),Yi=()=>(0,Y.jsx)("div",{}),Qi=({backFn:t})=>(0,Y.jsx)("div",{children:(0,Y.jsx)(Lr,{onClick:t})}),Xi=t=>(0,Y.jsx)("div",{children:(0,Y.jsx)("div",{children:(0,Y.jsx)(xr,{onClick:t.onClose})})});var E=({backFn:t,onClose:e})=>{let{closePrivyModal:o}=T();return(0,Y.jsxs)(en,{children:[t?(0,Y.jsx)(Qi,{backFn:t}):(0,Y.jsx)(Yi,{}),(0,Y.jsx)(Xi,{onClose:e||o})]})},en=Ar.default.div`
12
+ - https://privy.io`;this.provider=o,this.walletType=e,this.address=r,this.chain=null,this.connected=!1}async fetchAddress(){if(!this.address){let e=await this.provider.request({method:"eth_accounts"});Array.isArray(e)&&e.length>0&&(this.address=(0,$o.getAddress)(e[0]))}return this.address}async fetchChainId(){if(!this.chain){let e=await this.provider.request({method:"eth_chainId"}),o=Number(e);this.chain=String(o)}return this.chain}async getConnectedWallet(){let e=this.walletType;if(!e||!await this.isConnected())return null;let o=await this.fetchAddress(),r=await this.fetchChainId();return{address:o,chainId:r,chainType:"ethereum",walletType:e}}async sign(e){return new Zo.Web3Provider(new xe(this.provider)).getSigner().signMessage(e)}prepareMessage(e,o,r){let i=window.location.host,n=window.location.origin,l="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",u=new Date().toISOString();return this.createSiweMessage(e,o,i,n,u,r,l)}};var qo=require("react-device-detect"),Et=class extends le{constructor(e,o){super("metamask",e,o)}async connect(e){var o;return this.provider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async r=>{r.isMetaMask&&this.provider.setProvider(r)}),(!await this.isConnected()||e.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return await this.fetchAddress()!==null}async promptConnection(){try{let e="";qo.isMobile||await this.provider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.provider.request({method:"eth_requestAccounts"});if(o.length>0&&(e=(0,Ko.getAddress)(o[0])),!e||e==="")throw new N("Unable to retrieve address");this.connected=!0,this.address=e}catch(e){throw be(e)}}};var Jo=require("@ethersproject/address");var Yo=v(require("@coinbase/wallet-sdk"));var Ki=()=>{let t=`https://mainnet.infura.io/v3/${ot}`,e=1;return new Yo.default({appName:"Privy",darkMode:!1,headlessMode:!1}).makeWeb3Provider(t,e)},kt=class extends le{constructor(e,o){super("coinbase_wallet",e,o)}async connect(e){return this.provider.setProvider(Ki()),(!await this.isConnected()||e.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return await this.fetchAddress()!==null}async promptConnection(){try{let e="",o=await this.provider.request({method:"eth_requestAccounts"});if(o.length>0&&(e=(0,Jo.getAddress)(o[0])),!e||e==="")throw new N("Unable to retrieve address");this.connected=!0}catch(e){throw be(e)}}};var io=v(require("@walletconnect/web3-provider"));var no=class extends le{constructor(o,r,i){super("wallet_connect",r,i);this._globalConnector=o,this._provider=this._globalConnector.getProviderForAddress(i)}async connect(o){return this.provider.setProvider(this._provider),(!await this.isConnected()||o.showPrompt)&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.provider.walletProvider.connected}async promptConnection(){try{let o="";this.provider.setProvider(this._provider);let r=await Promise.race([this._provider.enable(),ro()]);if(r.length>0&&(o=r[0]),this._globalConnector.indexProvider(this._provider),!o||o==="")throw new N("Unable to retrieve address");this.connected=!0}catch(o){throw be(o)}}},_t=class{constructor(){this._storageIdToProvider={},this._addressToStorageId={},B.getKeys().forEach(e=>{if(e.startsWith("walletconnect")){let o=new io.default({infuraId:ot,storageId:e});o.enable(),this._storageIdToProvider[e]=o;for(let r of o.accounts)this._addressToStorageId[r]=e}})}build(e,o){return new no(this,e,o)}async destroy(){Object.values(this._storageIdToProvider).forEach(async e=>{await e.disconnect()})}getProviderForAddress(e){let o=Bo,r=()=>`walletconnect:${Math.random().toString(36).slice(2)}`;e===null?o=r():o=this._addressToStorageId[e]||r();let i=new io.default({infuraId:ot,storageId:o});return this._storageIdToProvider[o]=i,i}indexProvider(e){this._storageIdToProvider[e.storageId]=e;for(let o of e.accounts)this._addressToStorageId[o]=e.storageId}};var so=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let t of window.ethereum.providers)if(t.isMetaMask)return!0}return!1},Pt=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let t of window.ethereum.providers)if(t.isCoinbaseWallet)return!0}return!1},Qo=()=>{var e;let t=B.get(vt);return t?(e=t.find(o=>o.active))==null?void 0:e.address:null},$e=class{constructor(){this.getEthereumProvider=()=>{var e;return((e=this.activeWalletConnector)==null?void 0:e.provider)||new oe};this.walletConnectors=[],this.walletConnectGlobalWalletConnector=new _t}initialize(){this.load(),this.activeWalletConnector&&this.activeWalletConnector.connect({showPrompt:!1})}initializeLinkedWallets(e){e.linkedAccounts.forEach(()=>{})}load(){(B.get(vt)||[]).forEach(o=>{let r=this.createWalletConnector(o.walletType,o.address);this.addWalletConnector(r),o.active&&(this.activeWalletConnector=r)})}save(){let e=this.walletConnectors.map(o=>{var r;return{address:o.address,walletType:o.walletType,active:o.address===((r=this.activeWalletConnector)==null?void 0:r.address)}});B.put(vt,e)}addWalletConnector(e){this.walletConnectors.find(r=>r.address===e.address&&r.walletType===e.walletType)||this.walletConnectors.push(e)}removeWallet(e){var r;if(this.walletConnectors=this.walletConnectors.filter(i=>i.address!==e),e===((r=this.activeWalletConnector)==null?void 0:r.address))if(this.walletConnectors.length>0){let i=this.walletConnectors[this.walletConnectors.length-1];this.setActiveWallet(i.address)}else this.activeWalletConnector=void 0;this.save()}async activeWalletSign(e){if(!this.activeWalletConnector)throw new N("Cannot sign, no wallet is active. Is a wallet connected?");if(!await this.activeWalletConnector.connect({showPrompt:!1}))throw new N("Cannot sign - unable to connect to wallet.");return this.activeWalletConnector.sign(e)}setActiveWallet(e){let o=this.walletConnectors.find(r=>r.address===e);return o?(this.activeWalletConnector=o,this.save(),!0):!1}createWalletConnector(e,o){switch(e){case"metamask":return new Et(new oe,o);case"coinbase_wallet":return new kt(new oe,o);case"wallet_connect":return this.walletConnectGlobalWalletConnector.build(new oe,o)}}};function Le(t){return new Date(t*1e3)}function qi(t){let e=[];for(let o of t){let r=o.type;switch(o.type){case"wallet":e.push({address:o.address,type:o.type,verifiedAt:Le(o.verified_at),chainType:o.chain_type});break;case"email":e.push({address:o.address,type:o.type,verifiedAt:Le(o.verified_at)});break;case"phone":e.push({number:o.phoneNumber,type:o.type,verifiedAt:Le(o.verified_at)});break;case"google_oauth":e.push({subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:Le(o.verified_at)});break;case"twitter_oauth":e.push({subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:Le(o.verified_at)});break;case"discord_oauth":e.push({subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:Le(o.verified_at)});break;case"github_oauth":e.push({subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Le(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return e}function Me(t,e){return t.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),t.find(o=>o.type===e)}function rt(t){let e=Qo();if(!e)return t.wallet&&console.warn("[Privy] User has linked wallets but no active wallet"),t;let o=t.linkedAccounts.find(i=>i.type==="wallet"&&i.address===e),r=Object.assign({},t);return r.wallet=o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},r}function me(t){if(!t)return null;let e=qi(t.linked_accounts),o=Me(e,"wallet"),r=Me(e,"email"),i=Me(e,"phone"),n=Me(e,"google_oauth"),l=Me(e,"twitter_oauth"),u=Me(e,"discord_oauth"),f=Me(e,"github_oauth"),m={id:t.id,createdAt:Le(t.created_at),linkedAccounts:e,email:r&&{address:r==null?void 0:r.address},phone:i&&{number:i==null?void 0:i.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:n&&{subject:n.subject,email:n.email,name:n.name},twitter:l&&{subject:l.subject,username:l.username,name:l.name},discord:u&&{subject:u.subject,username:u.username,email:u.email},github:f&&{subject:f.subject,username:f.username,name:f.name,email:f.email}};return rt(m)}var Xo=()=>"/api/v1/sessions",er=()=>"/api/v1/sessions/logout",tr=()=>"/api/v1/sessions/fork",or=()=>"/api/v1/siwe/init",rr=()=>"/api/v1/siwe/authenticate",ir=()=>"/api/v1/siwe/link",nr=()=>"/api/v1/passwordless/init",sr=()=>"/api/v1/passwordless/authenticate",ar=()=>"/api/v1/passwordless/link",lr=()=>"/api/v1/passwordless_sms/init",cr=()=>"/api/v1/passwordless_sms/authenticate",dr=()=>"/api/v1/passwordless_sms/link",ur=()=>"/api/v1/oauth/init",pr=()=>"/api/v1/oauth/authenticate",hr=()=>"/api/v1/oauth/link",mr=()=>"/api/v1/siwe/unlink",fr=()=>"/api/v1/passwordless/unlink",gr=()=>"/api/v1/passwordless_sms/unlink",wr=()=>"/api/v1/oauth/unlink";var Ji=30,St=class{constructor(){this.authenticateOnce=new ve(async e=>this._authenticate(e)),this.linkOnce=new ve(async e=>this._link(e)),this.refreshOnce=new ve(this._refresh.bind(this)),this.destroyOnce=new ve(this._destroy.bind(this)),this.forkSessionOnce=new ve(this._forkSession.bind(this))}get token(){try{let e=B.get(Be);return typeof e=="string"?new he(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=B.get(Ct);return typeof e=="string"?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=he.parse(this.token);return e!==null&&!e.isExpired(Ji)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:o,refresh_token:r,user:i,is_new_user:n}=await e.authenticate();return this.storeToken(o),this.storeRefreshToken(r),{user:me(i),isNewUser:n}}catch(o){throw console.warn("Error authenticating session"),J(o)}}async _link(e){try{let o=await e.link();return me(o)}catch(o){throw console.warn("Error linking account"),J(o)}}async _refresh(){if(!this.api)throw new p("Session has no API instance");if(!this.client)throw new p("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,o=this.refreshToken;if(!e||!o)return null;try{let r=await this.api.post(Xo(),{refresh_token:o},{headers:{authorization:`Bearer ${e}`}});return this.storeToken(r.data.token),this.storeRefreshToken(r.data.refresh_token),me(r.data.user)}catch(r){if(r instanceof Ve&&r.status===400&&r.message==="Invalid auth token")return this.destroyLocalState(),null;throw J(r)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(er(),{refresh_token:this.refreshToken}))}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new p("Session has no API instance");let e=this.refreshToken;try{let o=await this.api.post(tr(),{refresh_token:e});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),o.data.new_session_refresh_token}catch(o){throw J(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?B.put(Be,e):B.del(Be)}storeRefreshToken(e){typeof e=="string"?B.put(Ct,e):B.del(Ct)}};var ao,Ze=class{constructor(e){let o=e.apiURL||Go,r=e.timeout||Ho;this.appId=e.appId,this.connectors=new $e,ao||(ao=new St),this.session=ao,this.api=new xt(e.appId,this,{baseURL:o,timeout:r}),this.session.api=this.api,this.session.client=this}authenticate(){if(!this.authFlow)throw new p("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new p("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let o=await this.api.post(fr(),{address:e});return me(o.data)}catch(o){throw J(o)}}async unlinkPhone(e){try{let o=await this.api.post(gr(),{phoneNumber:e});return me(o.data)}catch(o){throw J(o)}}async unlinkWallet(e){try{let o=await this.api.post(mr(),{address:e});return me(o.data)}catch(o){throw J(o)}}async unlinkOAuth(e,o){try{let r=await this.api.post(wr(),{provider:e,subject:o});return me(r.data)}catch(r){throw J(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(e){var o;return this.session.hasActiveToken()?((o=he.parse(this.session.token))==null?void 0:o.audience)!==this.appId?(await this.logout(),null):this.session.token:!(e!=null&&e.disableAutoRefresh)&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getAppSettings(){try{let e=await this.api.get(`/api/v1/apps/${this.appId}`);return{id:e.data.id,name:e.data.name,verificationKey:e.data.verification_key,logoUrl:e.data.logo_url||void 0,theme:e.data.theme,accentColor:e.data.accent_color||void 0,showWalletLoginFirst:e.data.show_wallet_login_first,allowlistConfig:{errorTitle:e.data.allowlist_config.error_title,errorDetail:e.data.allowlist_config.error_detail,errorCtaText:e.data.allowlist_config.cta_text,errorCtaLink:e.data.allowlist_config.cta_link},walletAuth:e.data.wallet_auth,emailAuth:e.data.email_auth,smsAuth:e.data.sms_auth,googleOAuth:e.data.google_oauth,twitterOAuth:e.data.twitter_oauth,discordOAuth:e.data.discord_oauth,githubOAuth:e.data.github_oauth,termsAndConditionsUrl:e.data.terms_and_conditions_url,privacyPolicyUrl:e.data.privacy_policy_url,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw J(e)}}setActiveWallet(e,o){if(!o.linkedAccounts.map(n=>n.type==="wallet"?n.address:null).includes(e))throw new p("Cannot set an unlinked address as active.");if(!this.connectors.setActiveWallet(e))throw new p("Error setting the active wallet.");return rt(o)}async forkSession(){return await this.session.forkSession()}};var Ii=require("@ethersproject/providers");var Tt=require("react");var w=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var lo=(0,Tt.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,login:w,linkEmail:w,linkPhone:w,linkWallet:w,linkGoogle:w,linkTwitter:w,linkDiscord:w,linkGithub:w,logout:w,getAccessToken:w,getEthereumProvider:w,getEthersProvider:w,getWeb3jsProvider:w,unlinkEmail:w,unlinkPhone:w,unlinkWallet:w,unlinkGoogle:w,unlinkTwitter:w,unlinkDiscord:w,unlinkGithub:w,setActiveWallet:w,forkSession:w}),U=()=>(0,Tt.useContext)(lo);var it=class{constructor(e,o){this.meta={walletType:o},this.connectors=e,this.walletConnector=this.connectors.createWalletConnector(o,null)}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");try{let{message:e,signature:o}=await this.promptConnectAndSign(this.api),r=await this.api.post(rr(),{message:e,signature:o});return this.connectors.addWalletConnector(this.walletConnector),this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");try{let{message:e,signature:o}=await this.promptConnectAndSign(this.api),r=await this.api.post(ir(),{message:e,signature:o});return this.connectors.addWalletConnector(this.walletConnector),this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(e){throw M(e)}}async promptConnectAndSign(e){let o=await this.walletConnector.connect({showPrompt:!0}),r=o.address,i=o.chainId,n=await e.post(or(),{address:r}),l=this.walletConnector.prepareMessage(i,r,n.data.nonce),u=await this.walletConnector.sign(l);return{message:l,signature:u}}};var nt=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new p("Email and email code must be set prior to calling authenticate.");try{let e=sr(),o=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new p("Email and email code must be set prior to calling authenticate.");try{let e=ar();return(await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode})).data}catch(e){throw M(e)}}async sendCodeEmail(e){if(!this.api)throw new p("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new p("Email must be set when initialzing authentication.");try{let o=nr();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw M(o)}}};var st=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new p("phone number and sms code must be set prior to calling authenticate.");try{let e=cr(),o=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new p("phone number and sms code must be set prior to calling authenticate.");try{let e=dr();return(await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(e){throw M(e)}}async sendSmsCode(e){if(!this.api)throw new p("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new p("phone nNumber must be set when initialzing authentication.");try{let o=lr();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw M(o)}}};var Ke=class{constructor(e,o,r){this.meta={provider:e},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new p("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new p("User denied confirmation during OAuth flow");try{let e=pr(),o=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(e){throw M(e)}}async link(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new p("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new p("User denied confirmation during OAuth flow");try{let e=hr();return(await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(e){throw M(e)}}async getAuthorizationUrl(){if(!this.api)throw new p("Auth flow has no API instance");if(!this.meta.provider)throw new p("Provider must be set when initialzing OAuth authentication.");try{let e=ur();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw M(e)}}};var fd=require("wicg-inert"),Si=v(require("react-dom")),Qt=v(require("styled-components"));var ce=require("react");var Cr=require("react/jsx-runtime");function yr(t){return(0,Cr.jsx)("link",{rel:"prefetch",href:t.src})}var Wt=require("react/jsx-runtime"),vr=(0,ce.createContext)({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1,github:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:w,navigateBack:w}),br=t=>{let e=t.appSettings,o=t.authenticated,r=t.visible,[i,n]=(0,ce.useState)("LANDING"),[l,u]=(0,ce.useState)("LANDING");(0,ce.useEffect)(()=>{o||n("LANDING")},[o]),(0,ce.useEffect)(()=>{r||(u("LANDING"),n("LANDING"))},[r]);let f={ready:!!(e!=null&&e.id),app:e,options:t.options,currentScreen:i,lastScreen:l,navigate:m=>{u(i),n(m)},navigateBack:()=>{n(l)}};return(0,Wt.jsxs)(vr.Provider,{value:f,children:[e&&e.logoUrl&&(0,Wt.jsx)(yr,{src:e.logoUrl}),t.children]})},y=()=>(0,ce.useContext)(vr);var Zt=require("react"),Qe=v(require("styled-components"));var Ar=v(require("styled-components"));var co=require("react/jsx-runtime"),xr=({style:t,...e})=>(0,co.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,co.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});var uo=require("react/jsx-runtime"),Lr=({style:t,...e})=>(0,uo.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,uo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});var It=require("react");var po=(0,It.createContext)({isLinking:!1,linkingHint:null,getAuthMeta:w,getAuthFlow:w,closePrivyModal:w,initLoginWithWallet:w,loginWithWallet:w,loginWithCode:w,initLoginWithEmail:w,initLoginWithSms:w,resendEmailCode:w,resendSmsCode:w,initLoginWithOAuth:w,loginWithOAuth:w}),T=()=>(0,It.useContext)(po);var Y=require("react/jsx-runtime"),Yi=()=>(0,Y.jsx)("div",{}),Qi=({backFn:t})=>(0,Y.jsx)("div",{children:(0,Y.jsx)(Lr,{onClick:t})}),Xi=t=>(0,Y.jsx)("div",{children:(0,Y.jsx)("div",{children:(0,Y.jsx)(xr,{onClick:t.onClose})})});var E=({backFn:t,onClose:e})=>{let{closePrivyModal:o}=T();return(0,Y.jsxs)(en,{children:[t?(0,Y.jsx)(Qi,{backFn:t}):(0,Y.jsx)(Yi,{}),(0,Y.jsx)(Xi,{onClose:e||o})]})},en=Ar.default.div`
13
13
  height: 30px;
14
14
  display: flex;
15
15
  align-items: center;
@@ -167,7 +167,7 @@ Resources:
167
167
  && > a {
168
168
  color: var(--primary-color);
169
169
  }
170
- `;function Sr(t){let{privacyPolicyUrl:e,termsAndConditionsUrl:o}=t.app,r=!!e,i=!!o,n=r&&i;return!r&&!i?null:(0,Q.jsxs)(rn,{children:["By logging in I agree to the"," ",i&&(0,Q.jsx)("a",{href:o,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",r&&(0,Q.jsx)("a",{href:e,target:"_blank",children:"Privacy Policy"})]})}var ce=({protectedByPrivy:t})=>(0,Q.jsx)(we,{hideOnMobile:t,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pr,{}),(0,Q.jsx)("span",{children:(0,Q.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),we=yo.default.div`
170
+ `;function Sr(t){let{privacyPolicyUrl:e,termsAndConditionsUrl:o}=t.app,r=!!e,i=!!o,n=r&&i;return!r&&!i?null:(0,Q.jsxs)(rn,{children:["By logging in I agree to the"," ",i&&(0,Q.jsx)("a",{href:o,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",r&&(0,Q.jsx)("a",{href:e,target:"_blank",children:"Privacy Policy"})]})}var de=({protectedByPrivy:t})=>(0,Q.jsx)(we,{hideOnMobile:t,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pr,{}),(0,Q.jsx)("span",{children:(0,Q.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),we=yo.default.div`
171
171
  height: 20px;
172
172
  font-size: 12px;
173
173
  display: flex;
@@ -204,7 +204,7 @@ Resources:
204
204
  justify-content: center;
205
205
  height: 100%;
206
206
  width: 100%;
207
- `;var qe=v(require("styled-components"));var vo=require("react/jsx-runtime"),Ut=({style:t,logoFill:e,...o})=>(0,vo.jsx)("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...o,children:(0,vo.jsx)("path",{d:"M7.54311 19.7551C16.5973 19.7551 21.5516 12.2467 21.5516 5.74656C21.5516 5.53533 21.5516 5.32409 21.542 5.11286C22.5021 4.42156 23.3375 3.54783 24 2.55888C23.1166 2.95254 22.1661 3.21178 21.1675 3.3366C22.1853 2.73171 22.963 1.76196 23.3375 0.609788C22.3869 1.17627 21.3308 1.57953 20.2074 1.80037C19.3049 0.840223 18.0279 0.244934 16.6165 0.244934C13.8993 0.244934 11.6909 2.45326 11.6909 5.17047C11.6909 5.55453 11.7389 5.92898 11.8157 6.29384C7.72554 6.09221 4.09619 4.12391 1.66703 1.14747C1.24457 1.87718 1.00453 2.72211 1.00453 3.62464C1.00453 5.3337 1.87826 6.84112 3.19366 7.72445C2.38714 7.69565 1.62862 7.47481 0.966125 7.10996C0.966125 7.12916 0.966125 7.14837 0.966125 7.17717C0.966125 9.55833 2.66558 11.5554 4.91232 12.0067C4.49945 12.1219 4.06739 12.1795 3.61612 12.1795C3.29927 12.1795 2.99203 12.1507 2.69438 12.0931C3.31848 14.0518 5.14275 15.4728 7.29347 15.5112C5.60362 16.8362 3.4817 17.6235 1.17736 17.6235C0.783698 17.6235 0.390039 17.6043 0.00598145 17.5563C2.17591 18.9389 4.76829 19.7551 7.54311 19.7551Z",fill:e==="primary"?"#1da1f2":"white"})});var ke=require("react/jsx-runtime"),Ft=({logoFill:t,style:e,...o})=>(0,ke.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...o,children:[(0,ke.jsx)("g",{clipPath:"url(#clip0)",children:(0,ke.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:t==="primary"?"#5865f2":"white"})}),(0,ke.jsx)("defs",{children:(0,ke.jsx)("clipPath",{id:"clip0",children:(0,ke.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var bo=require("react/jsx-runtime"),Dt=({logoFill:t,style:e,...o})=>(0,bo.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...o,children:(0,bo.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:t==="primary"?"#2D333B":"white"})});var Oe=require("react/jsx-runtime"),Gt=({style:t,...e})=>(0,Oe.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...e,children:[(0,Oe.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,Oe.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,Oe.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,Oe.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var re=require("react/jsx-runtime"),Wr=({showGoogle:t,showTwitter:e,showDiscord:o,showGithub:r,stacked:i})=>{let{initLoginWithOAuth:n}=T();return(0,re.jsxs)(nn,{stacked:i,children:[t&&(0,re.jsx)(dn,{onClick:()=>{n("google")},children:(0,re.jsx)(Gt,{})}),e&&(0,re.jsx)(sn,{onClick:()=>{n("twitter")},children:(0,re.jsx)(Ut,{})}),o&&(0,re.jsx)(an,{onClick:()=>{n("discord")},children:(0,re.jsx)(Ft,{})}),r&&(0,re.jsx)(ln,{onClick:()=>{n("github")},children:(0,re.jsx)(Dt,{})})]})},nn=qe.default.div`
207
+ `;var qe=v(require("styled-components"));var vo=require("react/jsx-runtime"),Ut=({style:t,logoFill:e,...o})=>(0,vo.jsx)("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...o,children:(0,vo.jsx)("path",{d:"M7.54311 19.7551C16.5973 19.7551 21.5516 12.2467 21.5516 5.74656C21.5516 5.53533 21.5516 5.32409 21.542 5.11286C22.5021 4.42156 23.3375 3.54783 24 2.55888C23.1166 2.95254 22.1661 3.21178 21.1675 3.3366C22.1853 2.73171 22.963 1.76196 23.3375 0.609788C22.3869 1.17627 21.3308 1.57953 20.2074 1.80037C19.3049 0.840223 18.0279 0.244934 16.6165 0.244934C13.8993 0.244934 11.6909 2.45326 11.6909 5.17047C11.6909 5.55453 11.7389 5.92898 11.8157 6.29384C7.72554 6.09221 4.09619 4.12391 1.66703 1.14747C1.24457 1.87718 1.00453 2.72211 1.00453 3.62464C1.00453 5.3337 1.87826 6.84112 3.19366 7.72445C2.38714 7.69565 1.62862 7.47481 0.966125 7.10996C0.966125 7.12916 0.966125 7.14837 0.966125 7.17717C0.966125 9.55833 2.66558 11.5554 4.91232 12.0067C4.49945 12.1219 4.06739 12.1795 3.61612 12.1795C3.29927 12.1795 2.99203 12.1507 2.69438 12.0931C3.31848 14.0518 5.14275 15.4728 7.29347 15.5112C5.60362 16.8362 3.4817 17.6235 1.17736 17.6235C0.783698 17.6235 0.390039 17.6043 0.00598145 17.5563C2.17591 18.9389 4.76829 19.7551 7.54311 19.7551Z",fill:e==="primary"?"#1da1f2":"white"})});var ke=require("react/jsx-runtime"),Ft=({logoFill:t,style:e,...o})=>(0,ke.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...o,children:[(0,ke.jsx)("g",{clipPath:"url(#clip0)",children:(0,ke.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:t==="primary"?"#5865f2":"white"})}),(0,ke.jsx)("defs",{children:(0,ke.jsx)("clipPath",{id:"clip0",children:(0,ke.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var bo=require("react/jsx-runtime"),Dt=({logoFill:t,style:e,...o})=>(0,bo.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...o,children:(0,bo.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:t==="primary"?"#2D333B":"white"})});var Oe=require("react/jsx-runtime"),Gt=({style:t,...e})=>(0,Oe.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...e,children:[(0,Oe.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,Oe.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,Oe.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,Oe.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var re=require("react/jsx-runtime"),Wr=({showGoogle:t,showTwitter:e,showDiscord:o,showGithub:r,stacked:i})=>{let{initLoginWithOAuth:n}=T();return(0,re.jsxs)(nn,{stacked:i,children:[t&&(0,re.jsx)(cn,{onClick:()=>{n("google")},children:(0,re.jsx)(Gt,{})}),e&&(0,re.jsx)(sn,{onClick:()=>{n("twitter")},children:(0,re.jsx)(Ut,{})}),o&&(0,re.jsx)(an,{onClick:()=>{n("discord")},children:(0,re.jsx)(Ft,{})}),r&&(0,re.jsx)(ln,{onClick:()=>{n("github")},children:(0,re.jsx)(Dt,{})})]})},nn=qe.default.div`
208
208
  display: flex;
209
209
  flex-direction: ${t=>t.stacked?"column":"row"};
210
210
  justify-content: space-between;
@@ -246,7 +246,7 @@ Resources:
246
246
  justify-content: center;
247
247
  align-items: center;
248
248
  }
249
- `,dn=qe.default.button`
249
+ `,cn=qe.default.button`
250
250
  && {
251
251
  border-radius: var(--border-radius-sm);
252
252
  cursor: pointer;
@@ -292,7 +292,7 @@ Resources:
292
292
  border-color: var(--fail-light);
293
293
  border-bottom-color: var(--fail-light);
294
294
  }
295
- `;var Mr=require("libphonenumber-js/min");var Nr=t=>!!String(t).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,}))$/),Or=t=>(0,Mr.isPossiblePhoneNumber)(String(t),"US"),Bt=t=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(r,i,n,l){return i+i+n+n+l+l});var o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return{r:parseInt((o==null?void 0:o[1])||"00",16),g:parseInt((o==null?void 0:o[2])||"00",16),b:parseInt((o==null?void 0:o[3])||"00",16)}},Ur=(t,e)=>{var o=t.slice(0);let r=[];for(;o.length;)r.push(o.splice(0,e));return r},Fr=t=>{if(!t)return"";let e=t.slice(0,8),o=t.slice(t.length-4,t.length);return`${e}...${o}`};var G=require("react/jsx-runtime"),zt=t=>{let[e,o]=(0,Je.useState)(""),[r,i]=(0,Je.useState)(!1),[n,l]=(0,Je.useState)(null),{authenticated:u}=U(),{initLoginWithEmail:f}=T(),{navigate:m,options:R}=y(),_=R.wallet;(0,Je.useEffect)(()=>{let c=document.querySelector("#email-input");c==null||c.focus()},[]);let S=Nr(e),C=()=>{i(!0),f(e).then(()=>{m("AWAITING_PASSWORDLESS_CODE")}).catch(c=>{let L=(c==null?void 0:c.status)===401&&(c==null?void 0:c.message)==="User is not allowed to login to this app.";(c==null?void 0:c.status)===422?l(c.message):L?m("ALLOWLIST_REJECTION_SCREEN"):l("Issue submitting email"),i(!1)})};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(cn,{stacked:t.stacked,children:[(0,G.jsxs)(hn,{standalone:t.stacked,children:[(0,G.jsx)(Vt,{}),(0,G.jsx)("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:c=>o(c.target.value),onKeyUp:c=>{c.key==="Enter"&&C()},value:e,autoComplete:"email"})]}),t.stacked?null:(0,G.jsx)(pn,{disabled:r||!S,onClick:C,children:r?(0,G.jsx)(_e,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),n||u||!_?(0,G.jsx)(fn,{fail:!!n,children:n||""}):null,!n&&!u&&_?(0,G.jsx)(mn,{children:(0,G.jsx)("span",{children:"Get started without a wallet."})}):null,t.stacked?(0,G.jsx)(un,{disabled:r||!S,onClick:C,children:r?(0,G.jsx)(_e,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"}):null]})},cn=Ue.default.div`
295
+ `;var Mr=require("libphonenumber-js/min");var Nr=t=>!!String(t).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,}))$/),Or=t=>(0,Mr.isPossiblePhoneNumber)(String(t),"US"),Bt=t=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(r,i,n,l){return i+i+n+n+l+l});var o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return{r:parseInt((o==null?void 0:o[1])||"00",16),g:parseInt((o==null?void 0:o[2])||"00",16),b:parseInt((o==null?void 0:o[3])||"00",16)}},Ur=(t,e)=>{var o=t.slice(0);let r=[];for(;o.length;)r.push(o.splice(0,e));return r},Fr=t=>{if(!t)return"";let e=t.slice(0,8),o=t.slice(t.length-4,t.length);return`${e}...${o}`};var G=require("react/jsx-runtime"),zt=t=>{let[e,o]=(0,Je.useState)(""),[r,i]=(0,Je.useState)(!1),[n,l]=(0,Je.useState)(null),{authenticated:u}=U(),{initLoginWithEmail:f}=T(),{navigate:m,options:R}=y(),_=R.wallet;(0,Je.useEffect)(()=>{let d=document.querySelector("#email-input");d==null||d.focus()},[]);let S=Nr(e),C=()=>{i(!0),f(e).then(()=>{m("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{let L=(d==null?void 0:d.status)===401&&(d==null?void 0:d.message)==="User is not allowed to login to this app.";(d==null?void 0:d.status)===422?l(d.message):L?m("ALLOWLIST_REJECTION_SCREEN"):l("Issue submitting email"),i(!1)})};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(dn,{stacked:t.stacked,children:[(0,G.jsxs)(hn,{standalone:t.stacked,children:[(0,G.jsx)(Vt,{}),(0,G.jsx)("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:d=>o(d.target.value),onKeyUp:d=>{d.key==="Enter"&&C()},value:e,autoComplete:"email"})]}),t.stacked?null:(0,G.jsx)(un,{disabled:r||!S,onClick:C,children:r?(0,G.jsx)(_e,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),n||u||!_?(0,G.jsx)(fn,{fail:!!n,children:n||""}):null,!n&&!u&&_?(0,G.jsx)(mn,{children:(0,G.jsx)("span",{children:"Get started without a wallet."})}):null,t.stacked?(0,G.jsx)(pn,{disabled:r||!S,onClick:C,children:r?(0,G.jsx)(_e,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"}):null]})},dn=Ue.default.div`
296
296
  display: flex;
297
297
  border: 1px solid var(--border-color-1);
298
298
  width: 100%;
@@ -306,7 +306,7 @@ Resources:
306
306
  @media (max-width: 440px) {
307
307
  margin-top: 20px;
308
308
  }
309
- `,pn=Ue.default.button`
309
+ `,un=Ue.default.button`
310
310
  display: flex;
311
311
  flex-direction: row;
312
312
  align-items: center;
@@ -331,7 +331,7 @@ Resources:
331
331
  color: var(--disabled-fg);
332
332
  cursor: not-allowed;
333
333
  }
334
- `,un=Ue.default.button`
334
+ `,pn=Ue.default.button`
335
335
  display: flex;
336
336
  flex-direction: column;
337
337
  align-items: center;
@@ -412,7 +412,7 @@ Resources:
412
412
  opacity: ${t=>t.success||t.fail?"1":"0"};
413
413
 
414
414
  transition: ${t=>t.fail?"":"all 150ms ease-in-out"};
415
- `;var Ye=require("react"),Pe=v(require("styled-components"));var Lo=require("react/jsx-runtime"),jt=({style:t,...e})=>(0,Lo.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:1.5,stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,Lo.jsx)("path",{d:"M2.5 4.16667C2.5 3.72464 2.67559 3.30072 2.98816 2.98816C3.30072 2.67559 3.72464 2.5 4.16667 2.5H6.9C7.07483 2.50013 7.24519 2.55525 7.38696 2.65754C7.52874 2.75984 7.63475 2.90413 7.69 3.07L8.93833 6.81417C9.00158 7.00445 8.9941 7.21116 8.91726 7.39637C8.84042 7.58158 8.69938 7.73288 8.52 7.8225L6.63917 8.76417C7.5611 10.8046 9.19538 12.4389 11.2358 13.3608L12.1775 11.48C12.2671 11.3006 12.4184 11.1596 12.6036 11.0827C12.7888 11.0059 12.9956 10.9984 13.1858 11.0617L16.93 12.31C17.096 12.3653 17.2404 12.4714 17.3427 12.6134C17.445 12.7553 17.5 12.9259 17.5 13.1008V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H15C8.09667 17.5 2.5 11.9033 2.5 5V4.16667Z",strokeLinecap:"round",strokeLinejoin:"round"})});var V=require("react/jsx-runtime"),$t=t=>{let[e,o]=(0,Ye.useState)(""),[r,i]=(0,Ye.useState)(!1),[n,l]=(0,Ye.useState)(null),{authenticated:u}=U(),{initLoginWithSms:f}=T(),{navigate:m,options:R}=y(),_=R.wallet;(0,Ye.useEffect)(()=>{let c=document.querySelector("#phone-number-input");c==null||c.focus()},[]);let S=Or(e),C=()=>{i(!0),f(e).then(()=>{m("AWAITING_PASSWORDLESS_CODE")}).catch(c=>{let L=(c==null?void 0:c.status)===401&&(c==null?void 0:c.message)==="User is not allowed to login to this app.";(c==null?void 0:c.status)===422?l(c.message):L?m("ALLOWLIST_REJECTION_SCREEN"):l("Issue submitting phone number"),i(!1)})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(gn,{stacked:t.stacked,children:[(0,V.jsxs)(Cn,{standalone:t.stacked,children:[(0,V.jsx)(jt,{}),(0,V.jsx)("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:c=>{o(c.target.value)},onKeyUp:c=>{c.key==="Enter"&&C()},value:e,autoComplete:"tel"})]}),t.stacked?null:(0,V.jsx)(wn,{disabled:r||!S,onClick:C,children:r?(0,V.jsx)(Dr,{color:"var(--disabled-fg)"}):"Submit"})]}),n||u||!_?(0,V.jsx)(bn,{fail:!!n,children:n||""}):null,!n&&!u&&_?(0,V.jsx)(vn,{children:(0,V.jsx)("span",{children:"Don\u2019t have a wallet? Start exploring with your phone or socials."})}):null,t.stacked?(0,V.jsx)(yn,{disabled:r||!S,onClick:C,children:r?(0,V.jsx)(Dr,{color:"var(--disabled-fg)"}):"Submit"}):null]})},gn=Pe.default.div`
415
+ `;var Ye=require("react"),Pe=v(require("styled-components"));var Lo=require("react/jsx-runtime"),jt=({style:t,...e})=>(0,Lo.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:1.5,stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,Lo.jsx)("path",{d:"M2.5 4.16667C2.5 3.72464 2.67559 3.30072 2.98816 2.98816C3.30072 2.67559 3.72464 2.5 4.16667 2.5H6.9C7.07483 2.50013 7.24519 2.55525 7.38696 2.65754C7.52874 2.75984 7.63475 2.90413 7.69 3.07L8.93833 6.81417C9.00158 7.00445 8.9941 7.21116 8.91726 7.39637C8.84042 7.58158 8.69938 7.73288 8.52 7.8225L6.63917 8.76417C7.5611 10.8046 9.19538 12.4389 11.2358 13.3608L12.1775 11.48C12.2671 11.3006 12.4184 11.1596 12.6036 11.0827C12.7888 11.0059 12.9956 10.9984 13.1858 11.0617L16.93 12.31C17.096 12.3653 17.2404 12.4714 17.3427 12.6134C17.445 12.7553 17.5 12.9259 17.5 13.1008V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H15C8.09667 17.5 2.5 11.9033 2.5 5V4.16667Z",strokeLinecap:"round",strokeLinejoin:"round"})});var V=require("react/jsx-runtime"),$t=t=>{let[e,o]=(0,Ye.useState)(""),[r,i]=(0,Ye.useState)(!1),[n,l]=(0,Ye.useState)(null),{authenticated:u}=U(),{initLoginWithSms:f}=T(),{navigate:m,options:R}=y(),_=R.wallet;(0,Ye.useEffect)(()=>{let d=document.querySelector("#phone-number-input");d==null||d.focus()},[]);let S=Or(e),C=()=>{i(!0),f(e).then(()=>{m("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{let L=(d==null?void 0:d.status)===401&&(d==null?void 0:d.message)==="User is not allowed to login to this app.";(d==null?void 0:d.status)===422?l(d.message):L?m("ALLOWLIST_REJECTION_SCREEN"):l("Issue submitting phone number"),i(!1)})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(gn,{stacked:t.stacked,children:[(0,V.jsxs)(Cn,{standalone:t.stacked,children:[(0,V.jsx)(jt,{}),(0,V.jsx)("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:d=>{o(d.target.value)},onKeyUp:d=>{d.key==="Enter"&&C()},value:e,autoComplete:"tel"})]}),t.stacked?null:(0,V.jsx)(wn,{disabled:r||!S,onClick:C,children:r?(0,V.jsx)(Dr,{color:"var(--disabled-fg)"}):"Submit"})]}),n||u||!_?(0,V.jsx)(bn,{fail:!!n,children:n||""}):null,!n&&!u&&_?(0,V.jsx)(vn,{children:(0,V.jsx)("span",{children:"Don\u2019t have a wallet? Start exploring with your phone or socials."})}):null,t.stacked?(0,V.jsx)(yn,{disabled:r||!S,onClick:C,children:r?(0,V.jsx)(Dr,{color:"var(--disabled-fg)"}):"Submit"}):null]})},gn=Pe.default.div`
416
416
  display: flex;
417
417
  border: 1px solid var(--border-color-1);
418
418
  width: 100%;
@@ -537,7 +537,7 @@ Resources:
537
537
  width: 1rem;
538
538
  border-width: 2px;
539
539
  }
540
- `;var Ao=require("react/jsx-runtime"),Gr=()=>{let{app:t}=y();return t!=null&&t.logoUrl?(0,Ao.jsx)("div",{children:(0,Ao.jsx)("img",{src:t.logoUrl,alt:`${t==null?void 0:t.name} logo`,style:{objectFit:"contain",width:"200px",height:"80px"}})}):null};var Eo=require("react-device-detect"),h=require("react/jsx-runtime");var Hr=()=>{let{ready:t}=U(),{getAuthMeta:e,isLinking:o}=T(),{app:r,navigate:i,options:n}=y(),l=n.email,u=n.sms,f=n.wallet,m=n.google,R=n.twitter,_=n.discord,S=n.github,C=f&&(r==null?void 0:r.showWalletLoginFirst)?0:1,[c,L]=(0,Zt.useState)(C),b=e(),ee=(b==null?void 0:b.authorizationCode)&&(b==null?void 0:b.stateCode)&&(b==null?void 0:b.provider);(0,Zt.useEffect)(()=>{ee?i("AWAITING_OAUTH_SCREEN"):o&&l?i("LINK_EMAIL_SCREEN"):o&&u?i("LINK_PHONE_SCREEN"):o&&f&&i("LINK_WALLET_SCREEN")},[t]);let We=c==0,O=c==1,$=()=>(0,h.jsx)(h.Fragment,{children:f&&(0,h.jsx)(xn,{active:We,onClick:()=>L(0)})}),A=()=>(0,h.jsx)(h.Fragment,{children:(l||u)&&(0,h.jsx)(Ln,{active:O,onClick:()=>L(1),email:l,sms:u,google:m,twitter:R,discord:_,github:S})});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(E,{},"header"),(0,h.jsx)(kn,{walletOnly:!l&&!u&&!m&&!R&&!_&&!S,hasTerms:!!((r==null?void 0:r.privacyPolicyUrl)||(r==null?void 0:r.termsAndConditionsUrl)),children:(0,h.jsx)(Gr,{})}),(0,h.jsx)(Ee,{children:r!=null&&r.showWalletLoginFirst?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)($,{}),(0,h.jsx)(A,{})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(A,{}),(0,h.jsx)($,{})]})}),r&&(0,h.jsx)(Sr,{app:r}),(0,h.jsx)(ce,{protectedByPrivy:!0})]})};function xn(t){return(0,h.jsxs)(zr,{active:t.active,onClick:t.onClick,children:[(0,h.jsx)(Br,{active:t.active,children:(0,h.jsx)("h4",{children:"Connect Wallet"})}),t.active&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nt,{}),(0,h.jsx)(Ot,{})]})]})}function Ln(t){let e=t.google||t.discord||t.github||t.twitter&&!Eo.isMobile,o=t.email?"Email":"Phone";return(0,h.jsxs)(zr,{active:t.active,onClick:t.onClick,children:[(0,h.jsx)(Br,{active:t.active,children:(0,h.jsx)("h4",{children:e?`${o} & Social`:o})}),t.active&&t.email&&(0,h.jsx)(zt,{}),t.active&&t.sms&&!t.email&&(0,h.jsx)($t,{}),t.active&&e&&(0,h.jsx)(An,{google:t.google,twitter:t.twitter&&!Eo.isMobile,discord:t.discord,github:t.github})]})}function An(t){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(En,{children:[(0,h.jsx)(Vr,{}),(0,h.jsx)("p",{children:" Or "}),(0,h.jsx)(Vr,{})]}),(0,h.jsx)(Wr,{showGoogle:t.google,showDiscord:t.discord,showGithub:t.github,showTwitter:t.twitter})]})}var Br=Qe.default.div`
540
+ `;var Ao=require("react/jsx-runtime"),Gr=()=>{let{app:t}=y();return t!=null&&t.logoUrl?(0,Ao.jsx)("div",{children:(0,Ao.jsx)("img",{src:t.logoUrl,alt:`${t==null?void 0:t.name} logo`,style:{objectFit:"contain",width:"200px",height:"80px"}})}):null};var Eo=require("react-device-detect"),h=require("react/jsx-runtime");var Hr=()=>{let{ready:t}=U(),{getAuthMeta:e,isLinking:o}=T(),{app:r,navigate:i,options:n}=y(),l=n.email,u=n.sms,f=n.wallet,m=n.google,R=n.twitter,_=n.discord,S=n.github,C=f&&(r==null?void 0:r.showWalletLoginFirst)?0:1,[d,L]=(0,Zt.useState)(C),b=e(),ee=(b==null?void 0:b.authorizationCode)&&(b==null?void 0:b.stateCode)&&(b==null?void 0:b.provider);(0,Zt.useEffect)(()=>{ee?i("AWAITING_OAUTH_SCREEN"):o&&l?i("LINK_EMAIL_SCREEN"):o&&u?i("LINK_PHONE_SCREEN"):o&&f&&i("LINK_WALLET_SCREEN")},[t]);let We=d==0,O=d==1,$=()=>(0,h.jsx)(h.Fragment,{children:f&&(0,h.jsx)(xn,{active:We,onClick:()=>L(0)})}),A=()=>(0,h.jsx)(h.Fragment,{children:(l||u)&&(0,h.jsx)(Ln,{active:O,onClick:()=>L(1),email:l,sms:u,google:m,twitter:R,discord:_,github:S})});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(E,{},"header"),(0,h.jsx)(kn,{walletOnly:!l&&!u&&!m&&!R&&!_&&!S,hasTerms:!!((r==null?void 0:r.privacyPolicyUrl)||(r==null?void 0:r.termsAndConditionsUrl)),children:(0,h.jsx)(Gr,{})}),(0,h.jsx)(Ee,{children:r!=null&&r.showWalletLoginFirst?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)($,{}),(0,h.jsx)(A,{})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(A,{}),(0,h.jsx)($,{})]})}),r&&(0,h.jsx)(Sr,{app:r}),(0,h.jsx)(de,{protectedByPrivy:!0})]})};function xn(t){return(0,h.jsxs)(zr,{active:t.active,onClick:t.onClick,children:[(0,h.jsx)(Br,{active:t.active,children:(0,h.jsx)("h4",{children:"Connect Wallet"})}),t.active&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nt,{}),(0,h.jsx)(Ot,{})]})]})}function Ln(t){let e=t.google||t.discord||t.github||t.twitter&&!Eo.isMobile,o=t.email?"Email":"Phone";return(0,h.jsxs)(zr,{active:t.active,onClick:t.onClick,children:[(0,h.jsx)(Br,{active:t.active,children:(0,h.jsx)("h4",{children:e?`${o} & Social`:o})}),t.active&&t.email&&(0,h.jsx)(zt,{}),t.active&&t.sms&&!t.email&&(0,h.jsx)($t,{}),t.active&&e&&(0,h.jsx)(An,{google:t.google,twitter:t.twitter&&!Eo.isMobile,discord:t.discord,github:t.github})]})}function An(t){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(En,{children:[(0,h.jsx)(Vr,{}),(0,h.jsx)("p",{children:" Or "}),(0,h.jsx)(Vr,{})]}),(0,h.jsx)(Wr,{showGoogle:t.google,showDiscord:t.discord,showGithub:t.github,showTwitter:t.twitter})]})}var Br=Qe.default.div`
541
541
  font-weight: ${t=>t.active?600:500};
542
542
  color: ${t=>t.active?"inherit":"var(--light-theme-fg-3)"};
543
543
  display: flex;
@@ -595,9 +595,9 @@ Resources:
595
595
  // the logo is close to the top (mobile or full wallet-open design)
596
596
  margin-top: ${t=>`${28+(t.walletOnly?31:0)-(t.hasTerms?18:0)}px`};
597
597
  margin-bottom: ${t=>`${60+(t.walletOnly?31:0)-(t.hasTerms?18:0)}px`};
598
- `;var Se=require("react");var ct=v(require("styled-components"));var dt=v(require("styled-components")),ye=require("react/jsx-runtime"),Fe=({title:t,description:e,children:o,...r})=>(0,ye.jsxs)($r,{...r,children:[(0,ye.jsx)("h3",{children:t}),typeof e=="string"?(0,ye.jsx)("p",{children:e}):null,o]}),jr=(0,dt.default)(Fe)`
598
+ `;var Se=require("react");var dt=v(require("styled-components"));var ct=v(require("styled-components")),ye=require("react/jsx-runtime"),Fe=({title:t,description:e,children:o,...r})=>(0,ye.jsxs)($r,{...r,children:[(0,ye.jsx)("h3",{children:t}),typeof e=="string"?(0,ye.jsx)("p",{children:e}):null,o]}),jr=(0,ct.default)(Fe)`
599
599
  margin-bottom: 24px;
600
- `,Xe=({title:t,description:e,icon:o,children:r,...i})=>(0,ye.jsxs)(_n,{...i,children:[o?(0,ye.jsx)(Pn,{children:o}):null,(0,ye.jsx)("h3",{children:t}),typeof e=="string"?(0,ye.jsx)("p",{children:e}):null,r]}),$r=dt.default.div`
600
+ `,Xe=({title:t,description:e,icon:o,children:r,...i})=>(0,ye.jsxs)(_n,{...i,children:[o?(0,ye.jsx)(Pn,{children:o}):null,(0,ye.jsx)("h3",{children:t}),typeof e=="string"?(0,ye.jsx)("p",{children:e}):null,r]}),$r=ct.default.div`
601
601
  display: flex;
602
602
  flex-direction: column;
603
603
  justify-content: flex-start;
@@ -616,7 +616,7 @@ Resources:
616
616
  color: var(--light-theme-fg-2);
617
617
  font-size: 14px;
618
618
  }
619
- `,_n=(0,dt.default)($r)`
619
+ `,_n=(0,ct.default)($r)`
620
620
  align-items: center;
621
621
  text-align: center;
622
622
  gap: 16px;
@@ -624,21 +624,21 @@ Resources:
624
624
  h3 {
625
625
  margin-bottom: 24px;
626
626
  }
627
- `,Pn=dt.default.div`
627
+ `,Pn=ct.default.div`
628
628
  padding: 14px;
629
629
  border-radius: 50%;
630
630
  && {
631
631
  border-color: var(--light-theme-bg-3);
632
632
  border-width: 1px;
633
633
  }
634
- `;var k=require("react/jsx-runtime"),ko=6,Zr=new Array(ko).fill(""),Sn=1400;var Kr=()=>{var A,Ie,gt;let{app:t}=y(),{closePrivyModal:e,resendEmailCode:o,resendSmsCode:r,getAuthMeta:i,loginWithCode:n}=T(),{authenticated:l,user:u}=U(),[f,m]=(0,Se.useState)(Zr),[R,_]=(0,Se.useState)(!1),[S,C]=(0,Se.useState)(null),[c,L]=(0,Se.useState)(null),b=(A=i())!=null&&A.email?0:1;(0,Se.useEffect)(()=>{if(l&&R){let H=setTimeout(e,He);return()=>clearTimeout(H)}},[l,R,u]),(0,Se.useEffect)(()=>{if(S&&c===0){let H=setTimeout(()=>{m(Zr),C(null);let W=document.querySelector("input[name=code-0]");W==null||W.focus()},Sn);return()=>clearTimeout(H)}},[S]);let ee=H=>{var Oo;let W=H.currentTarget.value.replace(" ","");if(W==="")return;if(isNaN(Number(W))){C("Code should be numeric"),L(1);return}C(null),L(null);let s=Number((Oo=H.currentTarget.name)==null?void 0:Oo.charAt(5)),d=[...W||[""]].slice(0,ko-s),q=[...f.slice(0,s),...d,...f.slice(s+d.length)];m(q);let tt=d.length,No=Math.min(Math.max(s+tt,0),ko-1);if(!isNaN(Number(H.currentTarget.value))){let ae=document.querySelector(`input[name=code-${No}]`);ae==null||ae.focus()}if(q.every(ae=>ae&&!isNaN(+ae))){let ae=document.querySelector(`input[name=code-${No}]`);ae==null||ae.blur(),n(q.join("")).then(()=>_(!0)).catch(Xt=>{(Xt==null?void 0:Xt.status)===422?C("Invalid or expired verification code"):C("Issue verifying code"),L(0)})}H.preventDefault()},We=H=>{c===1&&(C(null),L(null));let W=[...f.slice(0,H),"",...f.slice(H+1)];if(m(W),H>0){let s=document.querySelector(`input[name=code-${H-1}]`);s==null||s.focus()}},O=`Verify your ${b==0?"email":"phone"}`,$=b==0?`Please check ${(Ie=i())==null?void 0:Ie.email} for an email from privy.io and enter your code below.`:`Please check ${(gt=i())==null?void 0:gt.phoneNumber} for a message from ${(t==null?void 0:t.name)||"privy.io"} and enter your code below.`;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(E,{},"header"),(0,k.jsxs)(Tn,{children:[(0,k.jsx)(Fe,{title:O,description:$}),(0,k.jsxs)(Tr,{children:[(0,k.jsxs)(Wn,{children:[(0,k.jsx)(In,{fail:!!S,success:R,children:(0,k.jsx)("span",{children:S||(R?"Success!":"")})}),(0,k.jsx)("div",{children:f.map((H,W)=>(0,k.jsx)("input",{name:`code-${W}`,type:"text",value:f[W],onChange:ee,onKeyUp:s=>{s.key==="Backspace"&&We(W)},inputMode:"numeric",autoFocus:W===0,pattern:"[0-9]",className:`${R?"success":""} ${S?"fail":""}`,autoComplete:"one-time-code"},W))})]}),(0,k.jsx)(Rn,{children:b==0?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:"Didn't get an email?"}),(0,k.jsx)("button",{onClick:o,children:"Resend Code"})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:"Didn't get a message?"}),(0,k.jsx)("button",{onClick:r,children:"Resend Code"})]})})]})]}),(0,k.jsx)(ce,{protectedByPrivy:!0})]})},Tn=ct.default.div`
634
+ `;var k=require("react/jsx-runtime"),ko=6,Zr=new Array(ko).fill(""),Sn=1400;var Kr=()=>{var A,Ie,gt;let{app:t}=y(),{closePrivyModal:e,resendEmailCode:o,resendSmsCode:r,getAuthMeta:i,loginWithCode:n}=T(),{authenticated:l,user:u}=U(),[f,m]=(0,Se.useState)(Zr),[R,_]=(0,Se.useState)(!1),[S,C]=(0,Se.useState)(null),[d,L]=(0,Se.useState)(null),b=(A=i())!=null&&A.email?0:1;(0,Se.useEffect)(()=>{if(l&&R){let H=setTimeout(e,He);return()=>clearTimeout(H)}},[l,R,u]),(0,Se.useEffect)(()=>{if(S&&d===0){let H=setTimeout(()=>{m(Zr),C(null);let W=document.querySelector("input[name=code-0]");W==null||W.focus()},Sn);return()=>clearTimeout(H)}},[S]);let ee=H=>{var Oo;let W=H.currentTarget.value.replace(" ","");if(W==="")return;if(isNaN(Number(W))){C("Code should be numeric"),L(1);return}C(null),L(null);let s=Number((Oo=H.currentTarget.name)==null?void 0:Oo.charAt(5)),c=[...W||[""]].slice(0,ko-s),q=[...f.slice(0,s),...c,...f.slice(s+c.length)];m(q);let tt=c.length,No=Math.min(Math.max(s+tt,0),ko-1);if(!isNaN(Number(H.currentTarget.value))){let ae=document.querySelector(`input[name=code-${No}]`);ae==null||ae.focus()}if(q.every(ae=>ae&&!isNaN(+ae))){let ae=document.querySelector(`input[name=code-${No}]`);ae==null||ae.blur(),n(q.join("")).then(()=>_(!0)).catch(Xt=>{(Xt==null?void 0:Xt.status)===422?C("Invalid or expired verification code"):C("Issue verifying code"),L(0)})}H.preventDefault()},We=H=>{d===1&&(C(null),L(null));let W=[...f.slice(0,H),"",...f.slice(H+1)];if(m(W),H>0){let s=document.querySelector(`input[name=code-${H-1}]`);s==null||s.focus()}},O=`Verify your ${b==0?"email":"phone"}`,$=b==0?`Please check ${(Ie=i())==null?void 0:Ie.email} for an email from privy.io and enter your code below.`:`Please check ${(gt=i())==null?void 0:gt.phoneNumber} for a message from ${(t==null?void 0:t.name)||"privy.io"} and enter your code below.`;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(E,{},"header"),(0,k.jsxs)(Tn,{children:[(0,k.jsx)(Fe,{title:O,description:$}),(0,k.jsxs)(Tr,{children:[(0,k.jsxs)(Wn,{children:[(0,k.jsx)(In,{fail:!!S,success:R,children:(0,k.jsx)("span",{children:S||(R?"Success!":"")})}),(0,k.jsx)("div",{children:f.map((H,W)=>(0,k.jsx)("input",{name:`code-${W}`,type:"text",value:f[W],onChange:ee,onKeyUp:s=>{s.key==="Backspace"&&We(W)},inputMode:"numeric",autoFocus:W===0,pattern:"[0-9]",className:`${R?"success":""} ${S?"fail":""}`,autoComplete:"one-time-code"},W))})]}),(0,k.jsx)(Rn,{children:b==0?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:"Didn't get an email?"}),(0,k.jsx)("button",{onClick:o,children:"Resend Code"})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("span",{children:"Didn't get a message?"}),(0,k.jsx)("button",{onClick:r,children:"Resend Code"})]})})]})]}),(0,k.jsx)(de,{protectedByPrivy:!0})]})},Tn=dt.default.div`
635
635
  display: flex;
636
636
  flex-direction: column;
637
637
  align-items: flex-start;
638
638
  justify-content: flex-end;
639
639
  margin: auto;
640
640
  gap: 16px;
641
- `,Wn=ct.default.div`
641
+ `,Wn=dt.default.div`
642
642
  display: flex;
643
643
  flex-direction: column;
644
644
  width: 100%;
@@ -706,7 +706,7 @@ Resources:
706
706
  transform: translate(1px, 0px);
707
707
  }
708
708
  }
709
- `,In=ct.default.div`
709
+ `,In=dt.default.div`
710
710
  line-height: 20px;
711
711
  height: 20px;
712
712
  font-size: 13px;
@@ -714,7 +714,7 @@ Resources:
714
714
  display: flex;
715
715
  justify-content: flex-end;
716
716
  width: 100%;
717
- `,Rn=ct.default.div`
717
+ `,Rn=dt.default.div`
718
718
  font-size: 13px;
719
719
  color: var(--light-theme-fg-3);
720
720
  display: flex;
@@ -728,7 +728,7 @@ Resources:
728
728
  > button {
729
729
  text-decoration: underline;
730
730
  }
731
- `;var pt=v(require("styled-components"));var qr=v(require("styled-components")),Jr=qr.default.span`
731
+ `;var ut=v(require("styled-components"));var qr=v(require("styled-components")),Jr=qr.default.span`
732
732
  && {
733
733
  width: 82px;
734
734
  height: 82px;
@@ -744,7 +744,7 @@ Resources:
744
744
  border-color: var(--primary-color);
745
745
  border-bottom-color: var(--primary-color);
746
746
  }
747
- `;var _o=require("react/jsx-runtime"),Yr=({style:t,...e})=>(0,_o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,_o.jsx)("path",{"fill-rule":"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z","clip-rule":"evenodd"})});var I=require("react/jsx-runtime"),Xr=()=>{let{navigate:t,app:e}=y(),o=(e==null?void 0:e.allowlistConfig.errorTitle)||"You don't have access to this app",r=(e==null?void 0:e.allowlistConfig.errorDetail)||"Have you been invited?",i=(e==null?void 0:e.allowlistConfig.errorCtaText)||"Try another account";return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{}),(0,I.jsxs)(Mn,{children:[(0,I.jsx)(On,{children:(0,I.jsxs)("div",{children:[(0,I.jsx)(Jr,{}),(0,I.jsx)(Yr,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--primary-color)",fill:"var(--primary-color)"}})]})}),(0,I.jsxs)(Nn,{children:[typeof o=="string"?(0,I.jsx)("h3",{children:o}):(0,I.jsx)(I.Fragment,{children:o}),typeof r=="string"?(0,I.jsx)("p",{children:r}):(0,I.jsx)(I.Fragment,{children:r})]}),e!=null&&e.allowlistConfig.errorCtaLink?(0,I.jsx)(Qr,{as:"a",href:e.allowlistConfig.errorCtaLink,visible:!0,children:i}):(0,I.jsx)(Qr,{onClick:()=>{t("LANDING")},visible:!0,children:i})]})]})},Mn=pt.default.div`
747
+ `;var _o=require("react/jsx-runtime"),Yr=({style:t,...e})=>(0,_o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...e,children:(0,_o.jsx)("path",{"fill-rule":"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z","clip-rule":"evenodd"})});var I=require("react/jsx-runtime"),Xr=()=>{let{navigate:t,app:e}=y(),o=(e==null?void 0:e.allowlistConfig.errorTitle)||"You don't have access to this app",r=(e==null?void 0:e.allowlistConfig.errorDetail)||"Have you been invited?",i=(e==null?void 0:e.allowlistConfig.errorCtaText)||"Try another account";return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{}),(0,I.jsxs)(Mn,{children:[(0,I.jsx)(On,{children:(0,I.jsxs)("div",{children:[(0,I.jsx)(Jr,{}),(0,I.jsx)(Yr,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--primary-color)",fill:"var(--primary-color)"}})]})}),(0,I.jsxs)(Nn,{children:[typeof o=="string"?(0,I.jsx)("h3",{children:o}):(0,I.jsx)(I.Fragment,{children:o}),typeof r=="string"?(0,I.jsx)("p",{children:r}):(0,I.jsx)(I.Fragment,{children:r})]}),e!=null&&e.allowlistConfig.errorCtaLink?(0,I.jsx)(Qr,{as:"a",href:e.allowlistConfig.errorCtaLink,visible:!0,children:i}):(0,I.jsx)(Qr,{onClick:()=>{t("LANDING")},visible:!0,children:i})]})]})},Mn=ut.default.div`
748
748
  display: flex;
749
749
  flex-direction: column;
750
750
  align-items: center;
@@ -752,11 +752,11 @@ Resources:
752
752
  margin-left: 27px;
753
753
  margin-right: 27px;
754
754
  gap: 24px;
755
- `,Nn=pt.default.div`
755
+ `,Nn=ut.default.div`
756
756
  display: flex;
757
757
  flex-direction: column;
758
758
  gap: 8px;
759
- `,On=pt.default.div`
759
+ `,On=ut.default.div`
760
760
  display: flex;
761
761
  flex-direction: column;
762
762
  justify-content: center;
@@ -779,7 +779,7 @@ Resources:
779
779
  left: -19px;
780
780
  top: -19px;
781
781
  }
782
- `,Qr=pt.default.button`
782
+ `,Qr=ut.default.button`
783
783
  && {
784
784
  padding: 12px 16px;
785
785
  font-weight: 500;
@@ -795,7 +795,7 @@ Resources:
795
795
  background-color: var(--primary-color-bg-2);
796
796
  }
797
797
  }
798
- `;var ui=require("react"),X=v(require("styled-components"));var ti=v(require("qrcode")),oi=v(require("styled-components"));var x=require("react/jsx-runtime"),Z=7,Po=(t,e,o,r,i)=>{for(let n=e;n<e+r;n++)for(let l=o;l<o+i;l++){let u=t==null?void 0:t[l];u&&u[n]&&(u[n]=0)}return t},Un=t=>{let e=ti.default.create(t,{errorCorrectionLevel:"high"}).modules,o=Ur(Array.from(e.data),e.size);return o=Po(o,0,0,Z,Z),o=Po(o,o.length-Z,0,Z,Z),o=Po(o,0,o.length-Z,Z,Z),o},Fn=({x:t,y:e,cellSize:o,bgColor:r,fgColor:i})=>(0,x.jsx)(x.Fragment,{children:[0,1,2].map(n=>(0,x.jsx)("circle",{r:o*(Z-n*2)/2,cx:t+o*Z/2,cy:e+o*Z/2,fill:n%2!==0?r:i},`finder-${t}-${e}-${n}`))}),Dn=({cellSize:t,matrixSize:e,bgColor:o,fgColor:r})=>{let i=[[0,0],[(e-Z)*t,0],[0,(e-Z)*t]];return(0,x.jsx)(x.Fragment,{children:i.map(([n,l])=>(0,x.jsx)(Fn,{x:n,y:l,cellSize:t,bgColor:o,fgColor:r}))})},Gn=({matrix:t,cellSize:e,color:o})=>(0,x.jsx)(x.Fragment,{children:t.map((r,i)=>r.map((n,l)=>n?(0,x.jsx)("circle",{r:e/2.5,cx:i*e+e/2,cy:l*e+e/2,fill:o},`circle-${i}-${l}`):(0,x.jsx)(x.Fragment,{})))}),ei=(t,e)=>t-t%e,Vn=({outputSize:t,cellSize:e,element:o,size:r,padding:i,bgColor:n})=>{if(!o)return(0,x.jsx)(x.Fragment,{});let l=r||40,u=i||4,f=o,m=t/2-l/2-u;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("rect",{x:ei(m,e),y:ei(m,e),width:l+u*2+(m%e?e+.5:.5),height:l+u*2+(m%e?e+.5:.5),fill:n}),(0,x.jsx)(f,{x:t/2-l/2,y:t/2-l/2,height:l,width:l})]})},Hn=t=>{var i;let e=t.outputSize,o=Un(t.url),r=e/o.length;return(0,x.jsxs)("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,x.jsx)(Gn,{matrix:o,cellSize:r,color:t.fgColor}),(0,x.jsx)(Dn,{cellSize:r,matrixSize:o.length,fgColor:t.fgColor,bgColor:t.bgColor}),(0,x.jsx)(Vn,{outputSize:t.outputSize,cellSize:r,element:(i=t.logo)==null?void 0:i.element,bgColor:t.bgColor})]})},Bn=oi.default.div`
798
+ `;var pi=require("react"),X=v(require("styled-components"));var ti=v(require("qrcode")),oi=v(require("styled-components"));var x=require("react/jsx-runtime"),Z=7,Po=(t,e,o,r,i)=>{for(let n=e;n<e+r;n++)for(let l=o;l<o+i;l++){let u=t==null?void 0:t[l];u&&u[n]&&(u[n]=0)}return t},Un=t=>{let e=ti.default.create(t,{errorCorrectionLevel:"high"}).modules,o=Ur(Array.from(e.data),e.size);return o=Po(o,0,0,Z,Z),o=Po(o,o.length-Z,0,Z,Z),o=Po(o,0,o.length-Z,Z,Z),o},Fn=({x:t,y:e,cellSize:o,bgColor:r,fgColor:i})=>(0,x.jsx)(x.Fragment,{children:[0,1,2].map(n=>(0,x.jsx)("circle",{r:o*(Z-n*2)/2,cx:t+o*Z/2,cy:e+o*Z/2,fill:n%2!==0?r:i},`finder-${t}-${e}-${n}`))}),Dn=({cellSize:t,matrixSize:e,bgColor:o,fgColor:r})=>{let i=[[0,0],[(e-Z)*t,0],[0,(e-Z)*t]];return(0,x.jsx)(x.Fragment,{children:i.map(([n,l])=>(0,x.jsx)(Fn,{x:n,y:l,cellSize:t,bgColor:o,fgColor:r}))})},Gn=({matrix:t,cellSize:e,color:o})=>(0,x.jsx)(x.Fragment,{children:t.map((r,i)=>r.map((n,l)=>n?(0,x.jsx)("circle",{r:e/2.5,cx:i*e+e/2,cy:l*e+e/2,fill:o},`circle-${i}-${l}`):(0,x.jsx)(x.Fragment,{})))}),ei=(t,e)=>t-t%e,Vn=({outputSize:t,cellSize:e,element:o,size:r,padding:i,bgColor:n})=>{if(!o)return(0,x.jsx)(x.Fragment,{});let l=r||40,u=i||4,f=o,m=t/2-l/2-u;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("rect",{x:ei(m,e),y:ei(m,e),width:l+u*2+(m%e?e+.5:.5),height:l+u*2+(m%e?e+.5:.5),fill:n}),(0,x.jsx)(f,{x:t/2-l/2,y:t/2-l/2,height:l,width:l})]})},Hn=t=>{var i;let e=t.outputSize,o=Un(t.url),r=e/o.length;return(0,x.jsxs)("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,x.jsx)(Gn,{matrix:o,cellSize:r,color:t.fgColor}),(0,x.jsx)(Dn,{cellSize:r,matrixSize:o.length,fgColor:t.fgColor,bgColor:t.bgColor}),(0,x.jsx)(Vn,{outputSize:t.outputSize,cellSize:r,element:(i=t.logo)==null?void 0:i.element,bgColor:t.bgColor})]})},Bn=oi.default.div`
799
799
  display: flex;
800
800
  justify-content: center;
801
801
  align-items: center;
@@ -815,7 +815,7 @@ Resources:
815
815
  flex-direction: column;
816
816
  justify-content: flex-start;
817
817
  gap: 4px;
818
- `,ut=qt.default.div`
818
+ `,pt=qt.default.div`
819
819
  &&& {
820
820
  margin-left: 7px; /* TODO: This is a total hack */
821
821
  border-left: 2px solid var(--border-color-2);
@@ -860,17 +860,17 @@ Resources:
860
860
  color: var(--disabled-fg);
861
861
  cursor: not-allowed;
862
862
  }
863
- `,di=(0,Yt.default)(li)`
863
+ `,ci=(0,Yt.default)(li)`
864
864
  && {
865
865
  background-color: var(--primary-color);
866
866
  color: var(--light-theme-bg-1);
867
867
  }
868
- `,Z1=(0,Yt.default)(li)`
868
+ `,$1=(0,Yt.default)(li)`
869
869
  && {
870
870
  border: 1px solid var(--light-theme-bg-3);
871
871
  color: var(--light-theme-fg-1);
872
872
  }
873
- `;var a=require("react/jsx-runtime");var Wo=()=>{let{navigate:t}=y(),e="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Te.isFirefox&&(e="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),(0,a.jsxs)(mi,{children:[(0,a.jsx)(Fe,{title:"Create a Metamask wallet",description:"Follow the instructions below to get started."}),(0,a.jsx)(fi,{children:(0,a.jsx)(Ne,{style:{width:"152px",height:"152px"}})}),(0,a.jsxs)(To,{children:[(0,a.jsx)(De,{children:(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:"Install the "}),(0,a.jsx)("a",{href:e,target:"_blank",children:"MetaMask browser extension"})]})}),(0,a.jsx)(ut,{}),(0,a.jsx)(De,{children:"Set up your first wallet"}),(0,a.jsx)(ut,{}),(0,a.jsx)(De,{children:"Store your recovery phrase in a safe place!"})]}),(0,a.jsx)(gi,{onClick:()=>t("LANDING"),children:"Done! I have my wallet"})]})},Io=()=>{let{navigate:t}=y();return(0,a.jsxs)(mi,{children:[(0,a.jsx)(Fe,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),(0,a.jsx)(fi,{style:{marginTop:"-24px"},children:(0,a.jsx)(ii,{size:200})}),(0,a.jsxs)(To,{children:[(0,a.jsx)(De,{children:"Scan the QR code with your camera"}),(0,a.jsx)(ut,{}),(0,a.jsx)(De,{children:"Set up your first wallet"}),(0,a.jsx)(ut,{}),(0,a.jsx)(De,{children:"Store your seed phrase in a safe place!"})]}),(0,a.jsx)(gi,{onClick:()=>t("LANDING"),children:"Done! I have my wallet"})]})},hi=()=>{let[t,e]=(0,ui.useState)("WHAT_IS_A_WALLET"),{navigateBack:o}=y();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E,{backFn:t==="WHAT_IS_A_WALLET"?o:t==="PICK_A_NEW_WALLET"?()=>e("WHAT_IS_A_WALLET"):()=>e("PICK_A_NEW_WALLET")},"header"),(0,a.jsxs)(jn,{children:[t==="WHAT_IS_A_WALLET"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Jn,{children:(0,a.jsx)(ai,{style:{width:"240px",height:"auto",borderRadius:"var(--border-radius-sm)",marginBottom:"32px"}})}),(0,a.jsxs)(Xe,{title:"Get started with a new wallet",children:[(0,a.jsx)("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),(0,a.jsx)("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),(0,a.jsx)(Kn,{children:(0,a.jsx)(qn,{onClick:()=>{e("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),t==="PICK_A_NEW_WALLET"&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)($n,{children:[(0,a.jsx)(Fe,{title:"Create a new wallet",description:"Select one the wallet providers below to get started on your web3 adventure."}),(0,a.jsxs)(Zn,{children:[(0,a.jsxs)(ci,{onClick:()=>{Te.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Te.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":e("CREATE_METAMASK_WALLET")},children:[(0,a.jsx)(Ne,{}),(0,a.jsxs)(pi,{children:[(0,a.jsx)("h4",{children:"MetaMask"}),(0,a.jsx)("p",{children:"Get a browser-based wallet"})]}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:"Set up"})})]}),(0,a.jsxs)(ci,{onClick:()=>{Te.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Te.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":e("CREATE_COINBASE_WALLET")},children:[(0,a.jsx)(Ae,{}),(0,a.jsxs)(pi,{children:[(0,a.jsx)("h4",{children:"Coinbase Wallet"}),(0,a.jsx)("p",{children:"Get a mobile app wallet"})]}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:"Set up"})})]})]})]})}),t==="CREATE_COINBASE_WALLET"&&(0,a.jsx)(Io,{}),t==="CREATE_METAMASK_WALLET"&&(0,a.jsx)(Wo,{})]}),(0,a.jsxs)(we,{children:[(0,a.jsx)("span",{children:"Still not sure? "}),(0,a.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"}),"."]})]})},jn=X.default.div`
873
+ `;var a=require("react/jsx-runtime");var Wo=()=>{let{navigate:t}=y(),e="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Te.isFirefox&&(e="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),(0,a.jsxs)(mi,{children:[(0,a.jsx)(Fe,{title:"Create a Metamask wallet",description:"Follow the instructions below to get started."}),(0,a.jsx)(fi,{children:(0,a.jsx)(Ne,{style:{width:"152px",height:"152px"}})}),(0,a.jsxs)(To,{children:[(0,a.jsx)(De,{children:(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:"Install the "}),(0,a.jsx)("a",{href:e,target:"_blank",children:"MetaMask browser extension"})]})}),(0,a.jsx)(pt,{}),(0,a.jsx)(De,{children:"Set up your first wallet"}),(0,a.jsx)(pt,{}),(0,a.jsx)(De,{children:"Store your recovery phrase in a safe place!"})]}),(0,a.jsx)(gi,{onClick:()=>t("LANDING"),children:"Done! I have my wallet"})]})},Io=()=>{let{navigate:t}=y();return(0,a.jsxs)(mi,{children:[(0,a.jsx)(Fe,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),(0,a.jsx)(fi,{style:{marginTop:"-24px"},children:(0,a.jsx)(ii,{size:200})}),(0,a.jsxs)(To,{children:[(0,a.jsx)(De,{children:"Scan the QR code with your camera"}),(0,a.jsx)(pt,{}),(0,a.jsx)(De,{children:"Set up your first wallet"}),(0,a.jsx)(pt,{}),(0,a.jsx)(De,{children:"Store your seed phrase in a safe place!"})]}),(0,a.jsx)(gi,{onClick:()=>t("LANDING"),children:"Done! I have my wallet"})]})},hi=()=>{let[t,e]=(0,pi.useState)("WHAT_IS_A_WALLET"),{navigateBack:o}=y();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E,{backFn:t==="WHAT_IS_A_WALLET"?o:t==="PICK_A_NEW_WALLET"?()=>e("WHAT_IS_A_WALLET"):()=>e("PICK_A_NEW_WALLET")},"header"),(0,a.jsxs)(jn,{children:[t==="WHAT_IS_A_WALLET"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Jn,{children:(0,a.jsx)(ai,{style:{width:"240px",height:"auto",borderRadius:"var(--border-radius-sm)",marginBottom:"32px"}})}),(0,a.jsxs)(Xe,{title:"Get started with a new wallet",children:[(0,a.jsx)("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),(0,a.jsx)("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),(0,a.jsx)(Kn,{children:(0,a.jsx)(qn,{onClick:()=>{e("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),t==="PICK_A_NEW_WALLET"&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)($n,{children:[(0,a.jsx)(Fe,{title:"Create a new wallet",description:"Select one the wallet providers below to get started on your web3 adventure."}),(0,a.jsxs)(Zn,{children:[(0,a.jsxs)(di,{onClick:()=>{Te.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Te.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":e("CREATE_METAMASK_WALLET")},children:[(0,a.jsx)(Ne,{}),(0,a.jsxs)(ui,{children:[(0,a.jsx)("h4",{children:"MetaMask"}),(0,a.jsx)("p",{children:"Get a browser-based wallet"})]}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:"Set up"})})]}),(0,a.jsxs)(di,{onClick:()=>{Te.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Te.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":e("CREATE_COINBASE_WALLET")},children:[(0,a.jsx)(Ae,{}),(0,a.jsxs)(ui,{children:[(0,a.jsx)("h4",{children:"Coinbase Wallet"}),(0,a.jsx)("p",{children:"Get a mobile app wallet"})]}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:"Set up"})})]})]})]})}),t==="CREATE_COINBASE_WALLET"&&(0,a.jsx)(Io,{}),t==="CREATE_METAMASK_WALLET"&&(0,a.jsx)(Wo,{})]}),(0,a.jsxs)(we,{children:[(0,a.jsx)("span",{children:"Still not sure? "}),(0,a.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"}),"."]})]})},jn=X.default.div`
874
874
  display: flex;
875
875
  flex-direction: column;
876
876
  height: 100%;
@@ -892,7 +892,7 @@ Resources:
892
892
  flex-direction: column;
893
893
  width: 100%;
894
894
  gap: 8px;
895
- `,ci=X.default.button`
895
+ `,di=X.default.button`
896
896
  display: flex;
897
897
  flex-direction: row;
898
898
  align-items: center;
@@ -949,7 +949,7 @@ Resources:
949
949
  border: 1px solid var(--border-color-2);
950
950
  }
951
951
  }
952
- `,pi=X.default.div`
952
+ `,ui=X.default.div`
953
953
  text-align: left;
954
954
 
955
955
  p {
@@ -962,7 +962,7 @@ Resources:
962
962
  align-items: flex-end;
963
963
  flex-grow: 1;
964
964
  width: 100%;
965
- `,qn=(0,X.default)(di)`
965
+ `,qn=(0,X.default)(ci)`
966
966
  && {
967
967
  margin-top: 14px;
968
968
  }
@@ -995,7 +995,7 @@ Resources:
995
995
  `,Jn=X.default.div`
996
996
  display: flex;
997
997
  justify-content: center;
998
- `;var Ce=require("react");var ht=v(require("styled-components"));var z=require("react/jsx-runtime"),Ro=2,wi={metamask:{name:"MetaMask",component:Ne},coinbase_wallet:{name:"Coinbase Wallet",component:Ae},wallet_connect:{name:"WalletConnect",component:Rt}},yi=()=>{let[t,e]=(0,Ce.useState)(!1),[o,r]=(0,Ce.useState)("metamask"),[i,n]=(0,Ce.useState)(void 0),{navigate:l,navigateBack:u}=y(),{getAuthMeta:f,closePrivyModal:m,loginWithWallet:R}=T(),[_,S]=(0,Ce.useState)(0),{user:C}=U(),[c,L]=(0,Ce.useState)((C==null?void 0:C.linkedAccounts.length)||0);(0,Ce.useEffect)(()=>{var $;r((($=f())==null?void 0:$.walletType)||"metamask"),n(void 0),R().then(()=>e(!0)).catch(A=>{A instanceof te?console.error(A.cause):console.error(A);let Ie=(A==null?void 0:A.status)===401&&(A==null?void 0:A.message)==="User is not allowed to login to this app.";(A==null?void 0:A.status)===422?n(Lt.ERROR_USER_EXISTS):Ie?l("ALLOWLIST_REJECTION_SCREEN"):A instanceof je&&!A.details.default?n(A.details):A instanceof ze?n(Lt.ERROR_TIMED_OUT):n(Lt.ERROR_WALLET_CONNECTION)})},[_]),(0,Ce.useEffect)(()=>{if(t){let $=setTimeout(m,He);return()=>clearTimeout($)}},[C]);let b=wi[o].name,ee=wi[o].component,We=t?`Successfully connected with ${b}`:i?i.message:`Waiting for ${b}`,O="";if(t){let $=(C==null?void 0:C.linkedAccounts.length)||0;c===$?O="Wallet was already linked.":O="You\u2019re good to go!"}else if(_>=Ro&&i)O="Unable to connect wallet";else if(i)O=i.detail;else switch(O="Don\u2019t see your wallet modal? Check your other browser windows.",o){case"wallet_connect":O="Open your mobile wallet app to continue";break;case"coinbase_wallet":Pt()||(O="Open the Coinbase app on your phone to continue.");break;default:O="Don\u2019t see your wallet modal? Check your other browser windows."}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(E,{backFn:u}),(0,z.jsxs)(Yn,{children:[(0,z.jsx)(Xn,{children:(0,z.jsxs)("div",{children:[(0,z.jsx)(Ht,{success:t,fail:!!i}),(0,z.jsx)(ee,{style:{width:"38px",height:"38px"}})]})}),(0,z.jsxs)(Qn,{children:[(0,z.jsx)("h3",{children:We}),(0,z.jsx)("p",{children:O})]}),(0,z.jsx)(es,{onClick:()=>{S(_+1),n(void 0)},visible:!t&&(i==null?void 0:i.retryable)&&_<Ro,disabled:!t&&(!(i!=null&&i.retryable)||_>=Ro),children:"Retry"})]})]})},Yn=ht.default.div`
998
+ `;var Ce=require("react");var ht=v(require("styled-components"));var z=require("react/jsx-runtime"),Ro=2,wi={metamask:{name:"MetaMask",component:Ne},coinbase_wallet:{name:"Coinbase Wallet",component:Ae},wallet_connect:{name:"WalletConnect",component:Rt}},yi=()=>{let[t,e]=(0,Ce.useState)(!1),[o,r]=(0,Ce.useState)("metamask"),[i,n]=(0,Ce.useState)(void 0),{navigate:l,navigateBack:u}=y(),{getAuthMeta:f,closePrivyModal:m,loginWithWallet:R}=T(),[_,S]=(0,Ce.useState)(0),{user:C}=U(),[d,L]=(0,Ce.useState)((C==null?void 0:C.linkedAccounts.length)||0);(0,Ce.useEffect)(()=>{var $;r((($=f())==null?void 0:$.walletType)||"metamask"),n(void 0),R().then(()=>e(!0)).catch(A=>{A instanceof te?console.error(A.cause):console.error(A);let Ie=(A==null?void 0:A.status)===401&&(A==null?void 0:A.message)==="User is not allowed to login to this app.";(A==null?void 0:A.status)===422?n(Lt.ERROR_USER_EXISTS):Ie?l("ALLOWLIST_REJECTION_SCREEN"):A instanceof je&&!A.details.default?n(A.details):A instanceof ze?n(Lt.ERROR_TIMED_OUT):n(Lt.ERROR_WALLET_CONNECTION)})},[_]),(0,Ce.useEffect)(()=>{if(t){let $=setTimeout(m,He);return()=>clearTimeout($)}},[C]);let b=wi[o].name,ee=wi[o].component,We=t?`Successfully connected with ${b}`:i?i.message:`Waiting for ${b}`,O="";if(t){let $=(C==null?void 0:C.linkedAccounts.length)||0;d===$?O="Wallet was already linked.":O="You\u2019re good to go!"}else if(_>=Ro&&i)O="Unable to connect wallet";else if(i)O=i.detail;else switch(O="Don\u2019t see your wallet modal? Check your other browser windows.",o){case"wallet_connect":O="Open your mobile wallet app to continue";break;case"coinbase_wallet":Pt()||(O="Open the Coinbase app on your phone to continue.");break;default:O="Don\u2019t see your wallet modal? Check your other browser windows."}return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(E,{backFn:u}),(0,z.jsxs)(Yn,{children:[(0,z.jsx)(Xn,{children:(0,z.jsxs)("div",{children:[(0,z.jsx)(Ht,{success:t,fail:!!i}),(0,z.jsx)(ee,{style:{width:"38px",height:"38px"}})]})}),(0,z.jsxs)(Qn,{children:[(0,z.jsx)("h3",{children:We}),(0,z.jsx)("p",{children:O})]}),(0,z.jsx)(es,{onClick:()=>{S(_+1),n(void 0)},visible:!t&&(i==null?void 0:i.retryable)&&_<Ro,disabled:!t&&(!(i!=null&&i.retryable)||_>=Ro),children:"Retry"})]})]})},Yn=ht.default.div`
999
999
  display: flex;
1000
1000
  flex-direction: column;
1001
1001
  align-items: center;
@@ -1042,7 +1042,7 @@ Resources:
1042
1042
  opacity: ${t=>t.visible?"1":"0"};
1043
1043
  transition: opacity 200ms;
1044
1044
  }
1045
- `;var pe=require("react/jsx-runtime"),Ci=()=>{let{navigateBack:t}=y();return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(E,{backFn:t},"header"),(0,pe.jsx)(Wo,{}),(0,pe.jsxs)(we,{children:[(0,pe.jsx)("span",{children:"Still not sure? "}),(0,pe.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var ue=require("react/jsx-runtime"),vi=()=>{let{navigateBack:t}=y();return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(E,{backFn:t},"header"),(0,ue.jsx)(Io,{}),(0,ue.jsxs)(we,{children:[(0,ue.jsx)("span",{children:"Still not sure? "}),(0,ue.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var bi=v(require("styled-components"));var Li=require("react/jsx-runtime"),xi=t=>{let e=t.accentColor||"#696ffd";return(0,Li.jsx)(ts,{accentColor:e,children:t.children})},ts=bi.default.div`
1045
+ `;var ue=require("react/jsx-runtime"),Ci=()=>{let{navigateBack:t}=y();return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(E,{backFn:t},"header"),(0,ue.jsx)(Wo,{}),(0,ue.jsxs)(we,{children:[(0,ue.jsx)("span",{children:"Still not sure? "}),(0,ue.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var pe=require("react/jsx-runtime"),vi=()=>{let{navigateBack:t}=y();return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(E,{backFn:t},"header"),(0,pe.jsx)(Io,{}),(0,pe.jsxs)(we,{children:[(0,pe.jsx)("span",{children:"Still not sure? "}),(0,pe.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var bi=v(require("styled-components"));var Li=require("react/jsx-runtime"),xi=t=>{let e=t.accentColor||"#696ffd";return(0,Li.jsx)(ts,{accentColor:e,children:t.children})},ts=bi.default.div`
1046
1046
  /*! Modified from https://unpkg.com/tailwindcss@3.2.3/src/css/preflight.css */
1047
1047
 
1048
1048
  *,
@@ -1354,7 +1354,7 @@ Resources:
1354
1354
  display: none;
1355
1355
  }
1356
1356
  }
1357
- `;var Ti=require("react");var et=require("react");var mt=v(require("styled-components"));var j=require("react/jsx-runtime"),Ai={google:{name:"Google",component:Gt},discord:{name:"Discord",component:Ft},github:{name:"Github",component:Dt},twitter:{name:"Twitter",component:Ut}},os=t=>t.charAt(0).toUpperCase()+t.slice(1),Mo=()=>{let t=new URL(window.location.href);t.searchParams.delete("privy_oauth_code"),t.searchParams.delete("privy_oauth_provider"),t.searchParams.delete("privy_oauth_state"),window.history.pushState({},"",t)},Ei=()=>{var c;let[t,e]=(0,et.useState)(!1),[o,r]=(0,et.useState)(void 0),{getAuthMeta:i,initLoginWithOAuth:n,loginWithOAuth:l,closePrivyModal:u}=T(),{ready:f}=U(),m=((c=i())==null?void 0:c.provider)||"google",R=Ai[m].name,_=Ai[m].component;(0,et.useEffect)(()=>{!f||l().then(()=>{Mo(),e(!0)}).catch(L=>{let b={retryable:!1,message:"Authentication failed."};L.message.includes("Another user has already linked this")?b.detail="This account has already been linked to another user.":L.message==="Invalid code during oauth flow."?(b.retryable=!0,b.detail="Something went wrong. Try again."):L.message==="User denied confirmation during OAuth flow"&&(b.detail=`Retry and check ${os(m)} to finish connecting your account.`,b.retryable=!0),Mo(),r(b)})},[f]),(0,et.useEffect)(()=>{if(!t)return;let L=setTimeout(u,He);return()=>clearTimeout(L)},[t]);let S=t?`Successfully connected with ${R}`:o?o.message:`Verifying connection to ${R}`,C="";return t?C="You\u2019re good to go!":o?C=o.detail:C="Just a few moments more",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{}),(0,j.jsxs)(rs,{children:[(0,j.jsx)(ns,{children:(0,j.jsxs)("div",{children:[(0,j.jsx)(Ht,{success:t,fail:!!o}),(0,j.jsx)(_,{style:{width:"38px",height:"38px"},logoFill:"primary"})]})}),(0,j.jsxs)(is,{children:[(0,j.jsx)("h3",{children:S}),(0,j.jsx)("p",{children:C})]}),(0,j.jsx)(ss,{onClick:()=>{Mo(),n(m),r(void 0)},visible:!t&&(o==null?void 0:o.retryable),disabled:!t&&!(o!=null&&o.retryable),children:"Retry"})]})]})},rs=mt.default.div`
1357
+ `;var Ti=require("react");var et=require("react");var mt=v(require("styled-components"));var j=require("react/jsx-runtime"),Ai={google:{name:"Google",component:Gt},discord:{name:"Discord",component:Ft},github:{name:"Github",component:Dt},twitter:{name:"Twitter",component:Ut}},os=t=>t.charAt(0).toUpperCase()+t.slice(1),Mo=()=>{let t=new URL(window.location.href);t.searchParams.delete("privy_oauth_code"),t.searchParams.delete("privy_oauth_provider"),t.searchParams.delete("privy_oauth_state"),window.history.pushState({},"",t)},Ei=()=>{var d;let[t,e]=(0,et.useState)(!1),[o,r]=(0,et.useState)(void 0),{getAuthMeta:i,initLoginWithOAuth:n,loginWithOAuth:l,closePrivyModal:u}=T(),{ready:f}=U(),m=((d=i())==null?void 0:d.provider)||"google",R=Ai[m].name,_=Ai[m].component;(0,et.useEffect)(()=>{!f||l().then(()=>{Mo(),e(!0)}).catch(L=>{let b={retryable:!1,message:"Authentication failed."};L.message.includes("Another user has already linked this")?b.detail="This account has already been linked to another user.":L.message==="Invalid code during oauth flow."?(b.retryable=!0,b.detail="Something went wrong. Try again."):L.message==="User denied confirmation during OAuth flow"&&(b.detail=`Retry and check ${os(m)} to finish connecting your account.`,b.retryable=!0),Mo(),r(b)})},[f]),(0,et.useEffect)(()=>{if(!t)return;let L=setTimeout(u,He);return()=>clearTimeout(L)},[t]);let S=t?`Successfully connected with ${R}`:o?o.message:`Verifying connection to ${R}`,C="";return t?C="You\u2019re good to go!":o?C=o.detail:C="Just a few moments more",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{}),(0,j.jsxs)(rs,{children:[(0,j.jsx)(ns,{children:(0,j.jsxs)("div",{children:[(0,j.jsx)(Ht,{success:t,fail:!!o}),(0,j.jsx)(_,{style:{width:"38px",height:"38px"},logoFill:"primary"})]})}),(0,j.jsxs)(is,{children:[(0,j.jsx)("h3",{children:S}),(0,j.jsx)("p",{children:C})]}),(0,j.jsx)(ss,{onClick:()=>{Mo(),n(m),r(void 0)},visible:!t&&(o==null?void 0:o.retryable),disabled:!t&&!(o!=null&&o.retryable),children:"Retry"})]})]})},rs=mt.default.div`
1358
1358
  display: flex;
1359
1359
  flex-direction: column;
1360
1360
  align-items: center;
@@ -1401,7 +1401,7 @@ Resources:
1401
1401
  opacity: ${t=>t.visible?"1":"0"};
1402
1402
  transition: opacity 200ms;
1403
1403
  }
1404
- `;var ie=require("react/jsx-runtime"),ki=()=>{let{app:t}=y();return(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(E,{},"header"),(0,ie.jsx)(Xe,{title:"Connect your email",description:`Add your email to your ${t==null?void 0:t.name} account`,icon:(0,ie.jsx)(Vt,{})}),(0,ie.jsx)(Ee,{children:(0,ie.jsx)(zt,{stacked:!0})}),(0,ie.jsx)(ce,{protectedByPrivy:!0})]})};var ne=require("react/jsx-runtime"),_i=()=>{let{app:t}=y();return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(E,{},"header"),(0,ne.jsx)(Xe,{title:"Connect your phone",description:`Add your number to your ${t==null?void 0:t.name} account`,icon:(0,ne.jsx)(jt,{})}),(0,ne.jsx)(Ee,{children:(0,ne.jsx)($t,{stacked:!0})}),(0,ne.jsx)(ce,{protectedByPrivy:!0})]})};var se=require("react/jsx-runtime"),Pi=()=>{let{linkingHint:t}=T(),{app:e}=y(),o=t?`Reconnect the wallet with ${Fr(t)} to take actions.`:`Link a wallet to your ${e==null?void 0:e.name} account`;return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(E,{},"header"),(0,se.jsx)(jr,{title:`${t?"Reconnect":"Connect"} your wallet`,description:o}),(0,se.jsxs)(Ee,{children:[(0,se.jsx)(Nt,{}),(0,se.jsx)(Ot,{})]}),(0,se.jsx)(ce,{protectedByPrivy:!0})]})};var P=require("react/jsx-runtime"),as=()=>{let{ready:t}=U(),{isLinking:e}=T(),{ready:o,currentScreen:r}=y(),i;return["AWAITING_CONNECTION","AWAITING_OAUTH_SCREEN","ALLOWLIST_REJECTION_SCREEN"].includes(r)?i="compact":"WALLET_EDUCATION"===r?i="full":e?i="medium":i="full",!t||!o?(0,P.jsxs)(Kt,{"data-height":i,children:[(0,P.jsx)(E,{}),(0,P.jsx)(cs,{children:(0,P.jsx)(_e,{})}),(0,P.jsx)(we,{})]}):(0,P.jsxs)(Kt,{"data-height":i,children:[r==="LANDING"&&(0,P.jsx)(Hr,{}),r==="AWAITING_PASSWORDLESS_CODE"&&(0,P.jsx)(Kr,{}),r==="WALLET_EDUCATION"&&(0,P.jsx)(hi,{}),r==="AWAITING_CONNECTION"&&(0,P.jsx)(yi,{}),r==="AWAITING_OAUTH_SCREEN"&&(0,P.jsx)(Ei,{}),r==="ALLOWLIST_REJECTION_SCREEN"&&(0,P.jsx)(Xr,{}),r==="INSTALL_METAMASK_SCREEN"&&(0,P.jsx)(Ci,{}),r==="INSTALL_COINBASE_WALLET_SCREEN"&&(0,P.jsx)(vi,{}),r==="LINK_EMAIL_SCREEN"&&(0,P.jsx)(ki,{}),r==="LINK_PHONE_SCREEN"&&(0,P.jsx)(_i,{}),r==="LINK_WALLET_SCREEN"&&(0,P.jsx)(Pi,{})]})},Wi=()=>{let{app:t}=y();return Si.default.createPortal((0,P.jsx)(ds,{id:"privy-dialog",children:(0,P.jsx)(xi,{accentColor:t==null?void 0:t.accentColor,children:(0,P.jsx)(as,{})})}),document.body)},ls=({children:t,...e})=>((0,Ti.useEffect)(()=>{var r;(r=document==null?void 0:document.activeElement)==null||r.blur();let o=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));if(!!o)return o.setAttribute("inert","true"),()=>{let i=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));!i||i.removeAttribute("inert")}},[e.open,e.onClose]),(0,P.jsx)("dialog",{open:!0,role:"dialog",...e,children:t})),ds=(0,Qt.default)(ls)`
1404
+ `;var ie=require("react/jsx-runtime"),ki=()=>{let{app:t}=y();return(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(E,{},"header"),(0,ie.jsx)(Xe,{title:"Connect your email",description:`Add your email to your ${t==null?void 0:t.name} account`,icon:(0,ie.jsx)(Vt,{})}),(0,ie.jsx)(Ee,{children:(0,ie.jsx)(zt,{stacked:!0})}),(0,ie.jsx)(de,{protectedByPrivy:!0})]})};var ne=require("react/jsx-runtime"),_i=()=>{let{app:t}=y();return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(E,{},"header"),(0,ne.jsx)(Xe,{title:"Connect your phone",description:`Add your number to your ${t==null?void 0:t.name} account`,icon:(0,ne.jsx)(jt,{})}),(0,ne.jsx)(Ee,{children:(0,ne.jsx)($t,{stacked:!0})}),(0,ne.jsx)(de,{protectedByPrivy:!0})]})};var se=require("react/jsx-runtime"),Pi=()=>{let{linkingHint:t}=T(),{app:e}=y(),o=t?`Reconnect the wallet with ${Fr(t)} to take actions.`:`Link a wallet to your ${e==null?void 0:e.name} account`;return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(E,{},"header"),(0,se.jsx)(jr,{title:`${t?"Reconnect":"Connect"} your wallet`,description:o}),(0,se.jsxs)(Ee,{children:[(0,se.jsx)(Nt,{}),(0,se.jsx)(Ot,{})]}),(0,se.jsx)(de,{protectedByPrivy:!0})]})};var P=require("react/jsx-runtime"),as=()=>{let{ready:t}=U(),{isLinking:e}=T(),{ready:o,currentScreen:r}=y(),i;return["AWAITING_CONNECTION","AWAITING_OAUTH_SCREEN","ALLOWLIST_REJECTION_SCREEN"].includes(r)?i="compact":"WALLET_EDUCATION"===r?i="full":e?i="medium":i="full",!t||!o?(0,P.jsxs)(Kt,{"data-height":i,children:[(0,P.jsx)(E,{}),(0,P.jsx)(ds,{children:(0,P.jsx)(_e,{})}),(0,P.jsx)(we,{})]}):(0,P.jsxs)(Kt,{"data-height":i,children:[r==="LANDING"&&(0,P.jsx)(Hr,{}),r==="AWAITING_PASSWORDLESS_CODE"&&(0,P.jsx)(Kr,{}),r==="WALLET_EDUCATION"&&(0,P.jsx)(hi,{}),r==="AWAITING_CONNECTION"&&(0,P.jsx)(yi,{}),r==="AWAITING_OAUTH_SCREEN"&&(0,P.jsx)(Ei,{}),r==="ALLOWLIST_REJECTION_SCREEN"&&(0,P.jsx)(Xr,{}),r==="INSTALL_METAMASK_SCREEN"&&(0,P.jsx)(Ci,{}),r==="INSTALL_COINBASE_WALLET_SCREEN"&&(0,P.jsx)(vi,{}),r==="LINK_EMAIL_SCREEN"&&(0,P.jsx)(ki,{}),r==="LINK_PHONE_SCREEN"&&(0,P.jsx)(_i,{}),r==="LINK_WALLET_SCREEN"&&(0,P.jsx)(Pi,{})]})},Wi=()=>{let{app:t}=y();return Si.default.createPortal((0,P.jsx)(cs,{id:"privy-dialog",children:(0,P.jsx)(xi,{accentColor:t==null?void 0:t.accentColor,children:(0,P.jsx)(as,{})})}),document.body)},ls=({children:t,...e})=>((0,Ti.useEffect)(()=>{var r;(r=document==null?void 0:document.activeElement)==null||r.blur();let o=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));if(!!o)return o.setAttribute("inert","true"),()=>{let i=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));!i||i.removeAttribute("inert")}},[e.open,e.onClose]),(0,P.jsx)("dialog",{open:!0,role:"dialog",...e,children:t})),cs=(0,Qt.default)(ls)`
1405
1405
  position: fixed;
1406
1406
  top: 0;
1407
1407
  left: 0;
@@ -1454,10 +1454,10 @@ Resources:
1454
1454
  min-height: 0;
1455
1455
  }
1456
1456
  }
1457
- `,cs=Qt.default.div`
1457
+ `,ds=Qt.default.div`
1458
1458
  display: flex;
1459
1459
  flex-direction: column;
1460
1460
  align-items: center;
1461
1461
  justify-content: center;
1462
1462
  height: 100%;
1463
- `;var Ge=require("react/jsx-runtime");function ps(t){return typeof t=="string"&&t.length===25}var ft;function Ri(){if(!ft){let t=B.get(Be);return Promise.resolve(t||null)}return ft.getAccessToken()}var Mi=t=>{if(!ps(t.appId))throw new p("Cannot initialize the Privy provider with an invalid Privy app ID");return ft||(ft=new Ze({appId:t.appId,apiURL:Vo})),(0,Ge.jsx)(hs,{...t,client:ft})},us=(t,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,github:!1,[e]:!0};let o=!!(t!=null&&t.emailAuth),r=!!(t!=null&&t.smsAuth);return o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),{email:o,sms:r,wallet:!!(t!=null&&t.walletAuth),google:!!(t!=null&&t.googleOAuth),twitter:!!(t!=null&&t.twitterOAuth),discord:!!(t!=null&&t.discordOAuth),github:!!(t!=null&&t.githubOAuth)}},hs=t=>{let e=t.client,[o,r]=(0,K.useState)(!1),[i,n]=(0,K.useState)(!1),[l,u]=(0,K.useState)(!1),[f,m]=(0,K.useState)(null),[R,_]=(0,K.useState)(!1),[S,C]=(0,K.useState)({accentColor:"#696ffd",theme:"System",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,termsAndConditionsUrl:null,privacyPolicyUrl:null}),[c,L]=(0,K.useState)(null),[b,ee]=(0,K.useState)(!1),[We,O]=(0,K.useState)(null),$=us(S,c);(0,K.useEffect)(()=>{async function s(){let d=await e.getAppSettings();C(d),e.connectors.initialize(),A();let q=await e.getAuthenticatedUser();u(!!q),m(q),n(!0)}s()},[e]);let A=()=>{let s=new URLSearchParams(window.location.search),d=s.get("privy_oauth_code"),q=s.get("privy_oauth_state"),tt=s.get("privy_oauth_provider");d&&q&&tt&&(e.startAuthFlow(new Ke(tt,d,q)),L(tt),r(!0))};(0,K.useEffect)(()=>{i&&l&&f===null&&e.getAuthenticatedUser().then(m)},[i,l,f,e]);let Ie=()=>{L("wallet"),ee(!0),r(!0)},gt={ready:i,authenticated:l,user:f,walletConnectors:e.connectors,linkWallet:Ie,linkEmail:()=>{L("email"),ee(!0),r(!0)},linkPhone:()=>{L("sms"),ee(!0),r(!0)},linkGoogle:async()=>{await W.initLoginWithOAuth("google")},linkTwitter:async()=>{await W.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await W.initLoginWithOAuth("discord")},linkGithub:async()=>{await W.initLoginWithOAuth("github")},login:()=>{if(i&&l){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}r(!0)},logout:async()=>{await e.logout(),m(null),u(!1),L(null),ee(!1),r(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connectors.getEthereumProvider(),getEthersProvider:()=>new Ii.Web3Provider(new xe(e.connectors.getEthereumProvider())),getWeb3jsProvider:()=>new At(e.connectors.getEthereumProvider()),unlinkWallet:async s=>{let d=await e.unlinkWallet(s);return m(d),d},unlinkEmail:async s=>{let d=await e.unlinkEmail(s);return m(d),d},unlinkPhone:async s=>{let d=await e.unlinkPhone(s);return m(d),d},unlinkGoogle:async s=>{let d=await e.unlinkOAuth("google",s);return m(d),d},unlinkTwitter:async s=>{let d=await e.unlinkOAuth("twitter",s);return m(d),d},unlinkDiscord:async s=>{let d=await e.unlinkOAuth("discord",s);return m(d),d},unlinkGithub:async s=>{let d=await e.unlinkOAuth("github",s);return m(d),d},setActiveWallet:s=>{if(!!f)try{let d=e.setActiveWallet(s,f);m(d)}catch(d){d instanceof p&&d.message==="Error setting the active wallet."&&(O(s),Ie())}},forkSession:()=>e.forkSession()},W=(()=>({isLinking:b,linkingHint:We,getAuthFlow:()=>e.authFlow,getAuthMeta:()=>{var s;return(s=e.authFlow)==null?void 0:s.meta},closePrivyModal:()=>{var s;i&&l&&f&&((s=t.onSuccess)==null||s.call(t,f,R)),e.authFlow=void 0,L(null),O(null),ee(!1),_(!1),r(!1)},initLoginWithWallet:s=>{if(!e.connectors)throw new p("Connector not initialized");s||(s="metamask"),e.startAuthFlow(new it(e.connectors,s))},loginWithWallet:async()=>{if(!(e.authFlow instanceof it))throw new p("Must initialize SIWE flow first.");let s,d;b?(s=await e.link(),s&&(s=rt(s))):{user:s,isNewUser:d}=await e.authenticate(),m(s||f||null),_(d||!1),u(!0)},initLoginWithOAuth:async s=>{e.startAuthFlow(new Ke(s));let d=await e.authFlow.getAuthorizationUrl();d&&d.url&&window.location.assign(d.url)},loginWithOAuth:async()=>{if(!(e.authFlow instanceof Ke))throw new p("Must initialize OAuth flow before calling loginWithOAuth");let s,d;i&&l?s=await e.link():{user:s,isNewUser:d}=await e.authenticate(),m(s),_(d||!1),u(!0)},initLoginWithEmail:async s=>{let d=new nt(s);e.startAuthFlow(d),await d.sendCodeEmail()},initLoginWithSms:async s=>{let d=new st(s);e.startAuthFlow(d),await d.sendSmsCode()},resendEmailCode:async()=>{var s;await((s=e.authFlow)==null?void 0:s.sendCodeEmail())},resendSmsCode:async()=>{var s;await((s=e.authFlow)==null?void 0:s.sendSmsCode())},loginWithCode:async s=>{if(e.authFlow instanceof nt)e.authFlow.meta.emailCode=s.trim();else if(e.authFlow instanceof st)e.authFlow.meta.smsCode=s.trim();else throw new p("Must initialize a passwordless code flow first");let d,q;b?d=await e.link():{user:d,isNewUser:q}=await e.authenticate(),m(d||f||null),_(q||!1),u(!0)}}))();return(0,Ge.jsxs)(lo.Provider,{value:gt,children:[t.children,(0,Ge.jsx)(uo.Provider,{value:W,children:(0,Ge.jsx)(br,{appSettings:S,options:$,visible:o,authenticated:l,children:o&&(0,Ge.jsx)(Wi,{})})})]})};0&&(module.exports={AsExternalProvider,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,VERSION,WalletConnector,getAccessToken,usePrivy});
1463
+ `;var Ge=require("react/jsx-runtime");function us(t){return typeof t=="string"&&t.length===25}var ft;function Ri(){if(!ft){let t=B.get(Be);return Promise.resolve(t||null)}return ft.getAccessToken()}var Mi=t=>{if(!us(t.appId))throw new p("Cannot initialize the Privy provider with an invalid Privy app ID");return ft||(ft=new Ze({appId:t.appId,apiURL:Vo})),(0,Ge.jsx)(hs,{...t,client:ft})},ps=(t,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,github:!1,[e]:!0};let o=!!(t!=null&&t.emailAuth),r=!!(t!=null&&t.smsAuth);return o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),{email:o,sms:r,wallet:!!(t!=null&&t.walletAuth),google:!!(t!=null&&t.googleOAuth),twitter:!!(t!=null&&t.twitterOAuth),discord:!!(t!=null&&t.discordOAuth),github:!!(t!=null&&t.githubOAuth)}},hs=t=>{let e=t.client,[o,r]=(0,K.useState)(!1),[i,n]=(0,K.useState)(!1),[l,u]=(0,K.useState)(!1),[f,m]=(0,K.useState)(null),[R,_]=(0,K.useState)(!1),[S,C]=(0,K.useState)({accentColor:"#696ffd",theme:"System",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,termsAndConditionsUrl:null,privacyPolicyUrl:null}),[d,L]=(0,K.useState)(null),[b,ee]=(0,K.useState)(!1),[We,O]=(0,K.useState)(null),$=ps(S,d);(0,K.useEffect)(()=>{async function s(){let c=await e.getAppSettings();C(c),e.connectors.initialize(),A();let q=await e.getAuthenticatedUser();u(!!q),m(q),n(!0)}s()},[e]);let A=()=>{let s=new URLSearchParams(window.location.search),c=s.get("privy_oauth_code"),q=s.get("privy_oauth_state"),tt=s.get("privy_oauth_provider");c&&q&&tt&&(e.startAuthFlow(new Ke(tt,c,q)),L(tt),r(!0))};(0,K.useEffect)(()=>{i&&l&&f===null&&e.getAuthenticatedUser().then(m)},[i,l,f,e]);let Ie=()=>{L("wallet"),ee(!0),r(!0)},gt={ready:i,authenticated:l,user:f,walletConnectors:e.connectors,linkWallet:Ie,linkEmail:()=>{L("email"),ee(!0),r(!0)},linkPhone:()=>{L("sms"),ee(!0),r(!0)},linkGoogle:async()=>{await W.initLoginWithOAuth("google")},linkTwitter:async()=>{await W.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await W.initLoginWithOAuth("discord")},linkGithub:async()=>{await W.initLoginWithOAuth("github")},login:()=>{if(i&&l){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}r(!0)},logout:async()=>{await e.logout(),m(null),u(!1),L(null),ee(!1),r(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connectors.getEthereumProvider(),getEthersProvider:()=>new Ii.Web3Provider(new xe(e.connectors.getEthereumProvider())),getWeb3jsProvider:()=>new At(e.connectors.getEthereumProvider()),unlinkWallet:async s=>{let c=await e.unlinkWallet(s);return m(c),c},unlinkEmail:async s=>{let c=await e.unlinkEmail(s);return m(c),c},unlinkPhone:async s=>{let c=await e.unlinkPhone(s);return m(c),c},unlinkGoogle:async s=>{let c=await e.unlinkOAuth("google",s);return m(c),c},unlinkTwitter:async s=>{let c=await e.unlinkOAuth("twitter",s);return m(c),c},unlinkDiscord:async s=>{let c=await e.unlinkOAuth("discord",s);return m(c),c},unlinkGithub:async s=>{let c=await e.unlinkOAuth("github",s);return m(c),c},setActiveWallet:s=>{if(!!f)try{let c=e.setActiveWallet(s,f);m(c)}catch(c){c instanceof p&&c.message==="Error setting the active wallet."&&(O(s),Ie())}},forkSession:()=>e.forkSession()},W=(()=>({isLinking:b,linkingHint:We,getAuthFlow:()=>e.authFlow,getAuthMeta:()=>{var s;return(s=e.authFlow)==null?void 0:s.meta},closePrivyModal:()=>{var s;i&&l&&f&&((s=t.onSuccess)==null||s.call(t,f,R)),e.authFlow=void 0,L(null),O(null),ee(!1),_(!1),r(!1)},initLoginWithWallet:s=>{if(!e.connectors)throw new p("Connector not initialized");s||(s="metamask"),e.startAuthFlow(new it(e.connectors,s))},loginWithWallet:async()=>{if(!(e.authFlow instanceof it))throw new p("Must initialize SIWE flow first.");let s,c;b?(s=await e.link(),s&&(s=rt(s))):{user:s,isNewUser:c}=await e.authenticate(),m(s||f||null),_(c||!1),u(!0)},initLoginWithOAuth:async s=>{e.startAuthFlow(new Ke(s));let c=await e.authFlow.getAuthorizationUrl();c&&c.url&&window.location.assign(c.url)},loginWithOAuth:async()=>{if(!(e.authFlow instanceof Ke))throw new p("Must initialize OAuth flow before calling loginWithOAuth");let s,c;i&&l?s=await e.link():{user:s,isNewUser:c}=await e.authenticate(),m(s),_(c||!1),u(!0)},initLoginWithEmail:async s=>{let c=new nt(s);e.startAuthFlow(c),await c.sendCodeEmail()},initLoginWithSms:async s=>{let c=new st(s);e.startAuthFlow(c),await c.sendSmsCode()},resendEmailCode:async()=>{var s;await((s=e.authFlow)==null?void 0:s.sendCodeEmail())},resendSmsCode:async()=>{var s;await((s=e.authFlow)==null?void 0:s.sendSmsCode())},loginWithCode:async s=>{if(e.authFlow instanceof nt)e.authFlow.meta.emailCode=s.trim();else if(e.authFlow instanceof st)e.authFlow.meta.smsCode=s.trim();else throw new p("Must initialize a passwordless code flow first");let c,q;b?c=await e.link():{user:c,isNewUser:q}=await e.authenticate(),m(c||f||null),_(q||!1),u(!0)}}))();return(0,Ge.jsxs)(lo.Provider,{value:gt,children:[t.children,(0,Ge.jsx)(po.Provider,{value:W,children:(0,Ge.jsx)(br,{appSettings:S,options:$,visible:o,authenticated:l,children:o&&(0,Ge.jsx)(Wi,{})})})]})};0&&(module.exports={AsExternalProvider,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,VERSION,WalletConnector,getAccessToken,usePrivy});