@privy-io/react-auth 1.6.0-beta.10 → 1.6.0-beta.12

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.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Y3=Object.create;var K1=Object.defineProperty;var J3=Object.getOwnPropertyDescriptor;var X3=Object.getOwnPropertyNames;var Q3=Object.getPrototypeOf,t5=Object.prototype.hasOwnProperty;var e5=(i,e)=>{for(var a in e)K1(i,a,{get:e[a],enumerable:!0})},p4=(i,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of X3(e))!t5.call(i,l)&&l!==a&&K1(i,l,{get:()=>e[l],enumerable:!(o=J3(e,l))||o.enumerable});return i};var k=(i,e,a)=>(a=i!=null?Y3(Q3(i)):{},p4(e||!i||!i.__esModule?K1(a,"default",{value:i,enumerable:!0}):a,i)),i5=i=>p4(K1({},"__esModule",{value:!0}),i);var f6={};e5(f6,{PrivyProvider:()=>q3,VERSION:()=>J1,usePrivy:()=>v});module.exports=i5(f6);var j=require("react");var X1=k(require("axios"));var h4=k(require("axios")),K=class extends Error{constructor(a,o){super(a);o instanceof Error&&(this.cause=o)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Y1=class extends K{constructor(a,o,l,s){super(l,s);this.type=a;this.status=o}},m=class extends K{constructor(a,o){super(a,o);this.type="client_error"}};var $=class extends K{constructor(a,o){super(a,o);this.type="connector_error"}},R=i=>{if(i instanceof K)return i;if(!h4.default.isAxiosError(i))return Y(i);if(!i.response)return new Y1("api_error",null,i.message,i);let{type:e,message:a,error:o}=i.response.data;return new Y1(e||"ApiError",i.response.status,a||o,i)},Y=i=>i instanceof K?i:i instanceof Error?new m(i.message,i):new m(`Internal error: ${i}`);var f4="1.6.0-beta.10";var u4="https://api.privy.io/v0",m4=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",E2="70f97dc579834350a5baec117b3c5ae3",b4=1e4,t1=1200,k4=3e4,J1=f4;var Q1=class{constructor(e,a,o){this.appId=e,this.sdkVersion=J1,this.session=a,this.defaults=o}async get(e,a){try{return await X1.default.get(e,this.buildConfig({headers:{"Cache-Control":"no-cache"},...a}))}catch(o){throw R(o)}}async post(e,a,o){try{return await X1.default.post(e,a,this.buildConfig(o))}catch(l){throw R(l)}}async delete(e,a){try{return await X1.default.delete(e,this.buildConfig(a))}catch(o){throw R(o)}}buildConfig(e){return e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,this.session.token!==null&&(e.headers.authorization=`Bearer ${this.session.token}`),{...this.defaults,...e}}};var M4=k(require("jwt-decode")),x1=class{static parse(e){try{return new x1(e)}catch{return null}}constructor(e){this.value=e,this._decoded=(0,M4.default)(e)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}isExpired(e=0){let a=Date.now(),o=(this.expiration-e)*1e3;return a>=o}};var E1=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 A2=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,a){a!==void 0?this._cache[e]=a:this.del(e)}del(e){delete this._cache[e]}},P2=class{get(e){let a=localStorage.getItem(e);return a===null?void 0:JSON.parse(a)}put(e,a){a!==void 0?localStorage.setItem(e,JSON.stringify(a)):this.del(e)}del(e){localStorage.removeItem(e)}};function o5(){return typeof window<"u"&&window.localStorage?new P2:new A2}var J=o5();var l5=i=>{var e;return(e=i.map(a=>{if(a.type==="wallet")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3),chainType:a.chain_type}}).filter(a=>a))==null?void 0:e[0]},r5=i=>{var e;return(e=i.map(a=>{if(a.type==="email")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},n5=i=>{var e;return(e=i.map(a=>{if(a.type==="phone")return{number:a.phoneNumber,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},s5=i=>{var e;return(e=i.map(a=>{if(a.type==="google_oauth")return{subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},C5=i=>{var e;return(e=i.map(a=>{if(a.type==="twitter_oauth")return{subject:a.subject,username:a.username,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},d5=i=>{var e;return(e=i.map(a=>{if(a.type==="discord_oauth")return{subject:a.subject,username:a.username,email:a.email,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]};function f1(i){if(!i)return null;let e=r5(i.linked_accounts),a=n5(i.linked_accounts),o=l5(i.linked_accounts),l=s5(i.linked_accounts),s=C5(i.linked_accounts),c=d5(i.linked_accounts);return{id:i.id,createdAt:new Date(i.created_at*1e3),linkedAccounts:[...o?[o]:[],...e?[e]:[],...a?[a]:[],...l?[l]:[],...s?[s]:[],...c?[c]:[]],email:e&&{address:e==null?void 0:e.address},phone:a&&{number:a==null?void 0:a.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:l&&{subject:l.subject,email:l.email,name:l.name},twitter:s&&{subject:s.subject,username:s.username,name:s.name},discord:c&&{subject:c.subject,username:c.username,email:c.email}}}var g4=()=>"/api/v1/sessions",w4=()=>"/api/v1/sessions/logout",y4=()=>"/api/v1/siwe/init",v4=()=>"/api/v1/siwe/authenticate",Z4=()=>"/api/v1/passwordless/init",L4=()=>"/api/v1/passwordless/authenticate",x4=()=>"/api/v1/passwordless_sms/init",E4=()=>"/api/v1/passwordless_sms/authenticate",A4=()=>"/api/v1/oauth/init",P4=()=>"/api/v1/oauth/authenticate",_4=()=>"/api/v1/siwe/unlink",T4=()=>"/api/v1/passwordless/unlink",S4=()=>"/api/v1/passwordless_sms/unlink",I4=()=>"/api/v1/oauth/unlink";var c5=30,_2="privy:token",T2="privy:refresh_token",t2=class{constructor(){this.authenticateOnce=new E1(async e=>this._authenticate(e)),this.refreshOnce=new E1(this._refresh.bind(this)),this.destroyOnce=new E1(this._destroy.bind(this))}get token(){let e=J.get(_2);return typeof e=="string"?e:null}get refreshToken(){let e=J.get(T2);return typeof e=="string"?e:null}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=x1.parse(this.token);return e!==null&&!e.isExpired(c5)}authenticate(e){return this.authenticateOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:a,refresh_token:o,user:l}=await e.authenticate();return a&&this.storeToken(a),o&&this.storeRefreshToken(o),f1(l)}catch(a){throw console.warn("Error authenticating session"),Y(a)}}async _refresh(){if(!this.api)throw new m("Session has no API instance");let e=this.token,a=this.refreshToken;if(!e||!a)return null;try{let o=await this.api.post(g4(),{refresh_token:a});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),f1(o.data.user)}catch(o){throw Y(o)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(w4(),{})),this.destroyLocalState()}catch(a){throw console.warn("Error destroying session"),Y(a)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?J.put(_2,e):J.del(_2)}storeRefreshToken(e){typeof e=="string"?J.put(T2,e):J.del(T2)}};var W4=require("@ethersproject/address"),W2=k(require("@walletconnect/web3-provider"));var A1=class{constructor(e){this.removeListener=(e,a)=>{if(this._provider)return this._provider.removeListener(e,a)};this.setProvider=e=>{this._provider=e,this._subscriptions.forEach(a=>{var o;(o=this._provider)==null||o.on(a.eventName,a.listener)})};this._provider=e,this._subscriptions=[]}on(e,a){if(this._provider)return this._provider.on(e,a);this._subscriptions.push({eventName:e,listener:a})}request(e){if(!this._provider)throw new $(`A wallet request of type ${e.method} was made to a disconnected wallet: `);return this._provider.request(e)}},P1=class extends A1{constructor(a){super(a)}},e2=class extends A1{constructor(e){super(e)}sendAsync(e,a){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var O4=require("ethers");var R4=["metamask","coinbase_wallet","wallet_connect"];var N4=require("ethers");var i2=class extends ${constructor(){super("Wallet timeout");this.type="wallet_error"}},I2=i=>{if(i instanceof $)return i;if((i==null?void 0:i.code)&&(i==null?void 0:i.reason)){let e=new _1(i);return i.code===N4.ethers.errors.ACTION_REJECTED&&(e.details=M1.E4001_USER_REJECTED_REQUEST),e}return i!=null&&i.code?new _1(i):new $("Unknown connector error",i)},S2=class extends K{constructor(a,o,l){super(a);this.type="provider_error";this.code=o,this.data=l}},_1=class extends S2{constructor(a){var s,c,b;let o=a;super(o.message,o.code,o.data);let l=Object.values(M1).find(g=>g.eipCode===o.code);this.details=l||M1.UNKNOWN_ERROR,o.code===-32002&&((s=o.message)!=null&&s.includes("already pending for origin")?(c=o.message)!=null&&c.includes("wallet_requestPermissions")?this.details=M1.E32002_CONNECTION_ALREADY_PENDING:this.details=M1.E32002_REQUEST_ALREADY_PENDING:(b=o.message)!=null&&b.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=M1.E32002_WALLET_LOCKED))}},p5={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0}},h5={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}},f5={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}},M1={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...f5,...h5},R2={...p5,...M1};var N2="privy:wallet_type",a2=(i=new i2,e=k4)=>new Promise((a,o)=>setTimeout(()=>{o(i)},e)),O2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isMetaMask)return!0}return!1},D2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isCoinbaseWallet)return!0}return!1},o2=class{constructor(){this.walletType=null;this.getEthereumProvider=()=>this.ethProvider;this.createSiweMessage=(e,a,o,l,s,c,b)=>`${o} wants you to sign in with your Ethereum account:
1
+ "use strict";var Y3=Object.create;var K1=Object.defineProperty;var J3=Object.getOwnPropertyDescriptor;var X3=Object.getOwnPropertyNames;var Q3=Object.getPrototypeOf,t5=Object.prototype.hasOwnProperty;var e5=(i,e)=>{for(var a in e)K1(i,a,{get:e[a],enumerable:!0})},p4=(i,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of X3(e))!t5.call(i,l)&&l!==a&&K1(i,l,{get:()=>e[l],enumerable:!(o=J3(e,l))||o.enumerable});return i};var k=(i,e,a)=>(a=i!=null?Y3(Q3(i)):{},p4(e||!i||!i.__esModule?K1(a,"default",{value:i,enumerable:!0}):a,i)),i5=i=>p4(K1({},"__esModule",{value:!0}),i);var f6={};e5(f6,{PrivyProvider:()=>q3,VERSION:()=>J1,usePrivy:()=>Z});module.exports=i5(f6);var j=require("react");var X1=k(require("axios"));var h4=k(require("axios")),K=class extends Error{constructor(a,o){super(a);o instanceof Error&&(this.cause=o)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Y1=class extends K{constructor(a,o,l,s){super(l,s);this.type=a;this.status=o}},m=class extends K{constructor(a,o){super(a,o);this.type="client_error"}};var $=class extends K{constructor(a,o){super(a,o);this.type="connector_error"}},R=i=>{if(i instanceof K)return i;if(!h4.default.isAxiosError(i))return Y(i);if(!i.response)return new Y1("api_error",null,i.message,i);let{type:e,message:a,error:o}=i.response.data;return new Y1(e||"ApiError",i.response.status,a||o,i)},Y=i=>i instanceof K?i:i instanceof Error?new m(i.message,i):new m(`Internal error: ${i}`);var f4="1.6.0-beta.12";var u4="https://api.privy.io/v0",m4=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",E2="70f97dc579834350a5baec117b3c5ae3",b4=1e4,t1=1200,k4=3e4,J1=f4;var Q1=class{constructor(e,a,o){this.appId=e,this.sdkVersion=J1,this.session=a,this.defaults=o}async get(e,a){try{return await X1.default.get(e,this.buildConfig({headers:{"Cache-Control":"no-cache"},...a}))}catch(o){throw R(o)}}async post(e,a,o){try{return await X1.default.post(e,a,this.buildConfig(o))}catch(l){throw R(l)}}async delete(e,a){try{return await X1.default.delete(e,this.buildConfig(a))}catch(o){throw R(o)}}buildConfig(e){return e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,this.session.token!==null&&(e.headers.authorization=`Bearer ${this.session.token}`),{...this.defaults,...e}}};var M4=k(require("jwt-decode")),x1=class{static parse(e){try{return new x1(e)}catch{return null}}constructor(e){this.value=e,this._decoded=(0,M4.default)(e)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}isExpired(e=0){let a=Date.now(),o=(this.expiration-e)*1e3;return a>=o}};var E1=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 A2=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,a){a!==void 0?this._cache[e]=a:this.del(e)}del(e){delete this._cache[e]}},P2=class{get(e){let a=localStorage.getItem(e);return a===null?void 0:JSON.parse(a)}put(e,a){a!==void 0?localStorage.setItem(e,JSON.stringify(a)):this.del(e)}del(e){localStorage.removeItem(e)}};function o5(){return typeof window<"u"&&window.localStorage?new P2:new A2}var J=o5();var l5=i=>{var e;return(e=i.map(a=>{if(a.type==="wallet")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3),chainType:a.chain_type}}).filter(a=>a))==null?void 0:e[0]},r5=i=>{var e;return(e=i.map(a=>{if(a.type==="email")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},n5=i=>{var e;return(e=i.map(a=>{if(a.type==="phone")return{number:a.phoneNumber,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},s5=i=>{var e;return(e=i.map(a=>{if(a.type==="google_oauth")return{subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},C5=i=>{var e;return(e=i.map(a=>{if(a.type==="twitter_oauth")return{subject:a.subject,username:a.username,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},d5=i=>{var e;return(e=i.map(a=>{if(a.type==="discord_oauth")return{subject:a.subject,username:a.username,email:a.email,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]};function f1(i){if(!i)return null;let e=r5(i.linked_accounts),a=n5(i.linked_accounts),o=l5(i.linked_accounts),l=s5(i.linked_accounts),s=C5(i.linked_accounts),c=d5(i.linked_accounts);return{id:i.id,createdAt:new Date(i.created_at*1e3),linkedAccounts:[...o?[o]:[],...e?[e]:[],...a?[a]:[],...l?[l]:[],...s?[s]:[],...c?[c]:[]],email:e&&{address:e==null?void 0:e.address},phone:a&&{number:a==null?void 0:a.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:l&&{subject:l.subject,email:l.email,name:l.name},twitter:s&&{subject:s.subject,username:s.username,name:s.name},discord:c&&{subject:c.subject,username:c.username,email:c.email}}}var g4=()=>"/api/v1/sessions",w4=()=>"/api/v1/sessions/logout",y4=()=>"/api/v1/siwe/init",v4=()=>"/api/v1/siwe/authenticate",Z4=()=>"/api/v1/passwordless/init",L4=()=>"/api/v1/passwordless/authenticate",x4=()=>"/api/v1/passwordless_sms/init",E4=()=>"/api/v1/passwordless_sms/authenticate",A4=()=>"/api/v1/oauth/init",P4=()=>"/api/v1/oauth/authenticate",_4=()=>"/api/v1/siwe/unlink",T4=()=>"/api/v1/passwordless/unlink",S4=()=>"/api/v1/passwordless_sms/unlink",I4=()=>"/api/v1/oauth/unlink";var c5=30,_2="privy:token",T2="privy:refresh_token",t2=class{constructor(){this.authenticateOnce=new E1(async e=>this._authenticate(e)),this.refreshOnce=new E1(this._refresh.bind(this)),this.destroyOnce=new E1(this._destroy.bind(this))}get token(){let e=J.get(_2);return typeof e=="string"?e:null}get refreshToken(){let e=J.get(T2);return typeof e=="string"?e:null}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=x1.parse(this.token);return e!==null&&!e.isExpired(c5)}authenticate(e){return this.authenticateOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:a,refresh_token:o,user:l}=await e.authenticate();return a&&this.storeToken(a),o&&this.storeRefreshToken(o),f1(l)}catch(a){throw console.warn("Error authenticating session"),Y(a)}}async _refresh(){if(!this.api)throw new m("Session has no API instance");let e=this.token,a=this.refreshToken;if(!e||!a)return null;try{let o=await this.api.post(g4(),{refresh_token:a});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),f1(o.data.user)}catch(o){throw Y(o)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(w4(),{})),this.destroyLocalState()}catch(a){throw console.warn("Error destroying session"),Y(a)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?J.put(_2,e):J.del(_2)}storeRefreshToken(e){typeof e=="string"?J.put(T2,e):J.del(T2)}};var W4=require("@ethersproject/address"),W2=k(require("@walletconnect/web3-provider"));var A1=class{constructor(e){this.removeListener=(e,a)=>{if(this._provider)return this._provider.removeListener(e,a)};this.setProvider=e=>{this._provider=e,this._subscriptions.forEach(a=>{var o;(o=this._provider)==null||o.on(a.eventName,a.listener)})};this._provider=e,this._subscriptions=[]}on(e,a){if(this._provider)return this._provider.on(e,a);this._subscriptions.push({eventName:e,listener:a})}request(e){if(!this._provider)throw new $(`A wallet request of type ${e.method} was made to a disconnected wallet: `);return this._provider.request(e)}},P1=class extends A1{constructor(a){super(a)}},e2=class extends A1{constructor(e){super(e)}sendAsync(e,a){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var O4=require("ethers");var R4=["metamask","coinbase_wallet","wallet_connect"];var N4=require("ethers");var i2=class extends ${constructor(){super("Wallet timeout");this.type="wallet_error"}},I2=i=>{if(i instanceof $)return i;if((i==null?void 0:i.code)&&(i==null?void 0:i.reason)){let e=new _1(i);return i.code===N4.ethers.errors.ACTION_REJECTED&&(e.details=M1.E4001_USER_REJECTED_REQUEST),e}return i!=null&&i.code?new _1(i):new $("Unknown connector error",i)},S2=class extends K{constructor(a,o,l){super(a);this.type="provider_error";this.code=o,this.data=l}},_1=class extends S2{constructor(a){var s,c,b;let o=a;super(o.message,o.code,o.data);let l=Object.values(M1).find(g=>g.eipCode===o.code);this.details=l||M1.UNKNOWN_ERROR,o.code===-32002&&((s=o.message)!=null&&s.includes("already pending for origin")?(c=o.message)!=null&&c.includes("wallet_requestPermissions")?this.details=M1.E32002_CONNECTION_ALREADY_PENDING:this.details=M1.E32002_REQUEST_ALREADY_PENDING:(b=o.message)!=null&&b.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=M1.E32002_WALLET_LOCKED))}},p5={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0}},h5={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}},f5={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}},M1={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...f5,...h5},R2={...p5,...M1};var N2="privy:wallet_type",a2=(i=new i2,e=k4)=>new Promise((a,o)=>setTimeout(()=>{o(i)},e)),O2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isMetaMask)return!0}return!1},D2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isCoinbaseWallet)return!0}return!1},o2=class{constructor(){this.walletType=null;this.getEthereumProvider=()=>this.ethProvider;this.createSiweMessage=(e,a,o,l,s,c,b)=>`${o} wants you to sign in with your Ethereum account:
2
2
  ${a}
3
3
 
4
4
  ${b}
@@ -9,7 +9,7 @@ Chain ID: ${e}
9
9
  Nonce: ${c}
10
10
  Issued At: ${s}
11
11
  Resources:
12
- - https://privy.io`;this.ethProvider=new A1}initialize(){let e=J.get(N2);R4.includes(e)&&(this.walletType=e,this.connect({showPrompt:!1}))}destroy(){this.walletType=null,J.del(N2)}async connect(e){var a,o;switch(this.walletType){case"metamask":this.ethProvider.setProvider(window.ethereum),(a=window.ethereum.providers)==null||a.forEach(async s=>{s.isMetaMask&&this.ethProvider.setProvider(s)});break;case"coinbase_wallet":this.ethProvider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async s=>{s.isCoinbaseWallet&&this.ethProvider.setProvider(s)});break;case"wallet_connect":let l=new W2.default({infuraId:E2});this.ethProvider.setProvider(l);break;default:throw new $(`Unsupported wallet: ${this.walletType}`)}return!await this.isConnected()&&e.showPrompt&&await this.promptConnection(this.walletType),this.address()}async isConnected(){switch(this.walletType){case"metamask":return await this.address()!==null;case"coinbase_wallet":return await this.address()!==null;case"wallet_connect":return this.ethProvider.connected;default:throw new $(`Unsupported wallet: ${this.walletType}`)}}async promptConnection(e){try{switch(e){case"metamask":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),a2()]);break;case"coinbase_wallet":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),a2()]);break;case"wallet_connect":let a=new W2.default({infuraId:E2});this.ethProvider.setProvider(a),await Promise.race([a.enable(),a2()]),J.put(N2,e);break;default:throw new $(`Unsupported wallet: ${this.walletType}`)}}catch(a){throw I2(a)}}async sign(e){let o=new O4.providers.Web3Provider(new P1(this.getEthereumProvider())).getSigner();return Promise.race([o.signMessage(e),a2()]).catch(l=>{throw I2(l)})}prepareMessage(e,a,o){let l=window.location.host,s=window.location.origin,c=`${l} requests that you authenticate with Privy.`,b=new Date().toISOString();return this.createSiweMessage(e,a,l,s,b,o,c)}async chainId(){let e=await this.getEthereumProvider().request({method:"eth_chainId"}),a=Number(e);return String(a)}async address(){let e=await this.getEthereumProvider().request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0?(0,W4.getAddress)(e[0]):null}};var U2,l2=class{constructor(e){let a=e.apiURL||u4,o=e.timeout||b4;this.appId=e.appId,this.connector=new o2,this.connector.initialize(),U2||(U2=new t2),this.session=U2,this.api=new Q1(e.appId,this.session,{baseURL:a,timeout:o}),this.session.api=this.api}async authenticate(){if(!this.authFlow)throw new m("No auth flow in progress.");return await this.session.authenticate(this.authFlow)}async logout(){await this.session.destroy(),this.connector.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let a=await this.api.post(T4(),{address:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkPhone(e){try{let a=await this.api.post(S4(),{phoneNumber:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkWallet(e){try{let a=await this.api.post(_4(),{address:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkOAuth(e,a){try{let o=await this.api.post(I4(),{provider:e,subject:a});return f1(o.data)}catch(o){throw Y(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(){return this.session.hasActiveToken()?this.session.token: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,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,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw Y(e)}}};var $3=require("@ethersproject/providers");var r2=require("react");var f=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var F2=(0,r2.createContext)({ready:!1,authenticated:!1,user:null,login:f,linkEmail:f,linkPhone:f,linkWallet:f,linkGoogle:f,linkTwitter:f,linkDiscord:f,logout:f,getAccessToken:f,getEthereumProvider:f,getEthersProvider:f,getWeb3jsProvider:f,unlinkEmail:f,unlinkPhone:f,unlinkWallet:f,unlinkGoogle:f,unlinkTwitter:f,unlinkDiscord:f}),v=()=>(0,r2.useContext)(F2);var U1=class{constructor(e){this.connector=e,this.meta={wallet:this.connector.walletType}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.connector.walletType)throw new m("Wallet must be specified");try{let e=await this.connector.connect({showPrompt:!0}),a=await this.connector.chainId(),o=await this.api.post(y4(),{address:e}),l=this.connector.prepareMessage(a,e,o.data.nonce),s=await this.connector.sign(l),c=await this.api.post(v4(),{message:l,signature:s});return{user:c.data.user,token:c.data.token,refresh_token:c.data.refresh_token}}catch(e){throw R(e)}}getEthereumProvider(){return this.connector.getEthereumProvider()}};var F1=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new m("Email and email code must be set prior to calling authenticate.");try{let e=L4(),a=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async sendCodeEmail(e){if(!this.api)throw new m("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new m("Email must be set when initialzing authentication.");try{let a=Z4();return(await this.api.post(a,{email:this.meta.email})).data}catch(a){throw R(a)}}};var V1=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new m("phone number and sms code must be set prior to calling authenticate.");try{let e=E4(),a=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async sendSmsCode(e){if(!this.api)throw new m("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new m("phone nNumber must be set when initialzing authentication.");try{let a=x4();return(await this.api.post(a,{phoneNumber:this.meta.phoneNumber})).data}catch(a){throw R(a)}}};var H1=class{constructor(e,a,o){this.meta={provider:e},this.meta.authorizationCode=a,this.meta.stateCode=o}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new m("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");try{let e=P4(),a=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async getAuthorizationUrl(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.provider)throw new m("Provider must be set when initialzing OAuth authentication.");try{let e=A4();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw R(e)}}};var P0=require("wicg-inert"),G3=k(require("react-dom")),v2=k(require("styled-components"));var e1=require("react");var U4=require("react/jsx-runtime");function D4(i){return(0,U4.jsx)("link",{rel:"prefetch",href:i.src})}var n2=require("react/jsx-runtime"),F4=(0,e1.createContext)({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:f,navigateBack:f}),V4=i=>{let e=i.appSettings,a=i.authenticated,o=i.visible,[l,s]=(0,e1.useState)(null),[c,b]=(0,e1.useState)(null);(0,e1.useEffect)(()=>{a||s(null)},[a]),(0,e1.useEffect)(()=>{o||(b("LANDING"),s("LANDING"))},[o]);let g={ready:!!(e!=null&&e.id),app:e,options:i.options,currentScreen:l||"LANDING",lastScreen:c||"LANDING",navigate:M=>{b(l),s(M)},navigateBack:()=>{s(c)}};return(0,n2.jsxs)(F4.Provider,{value:g,children:[e&&e.logoUrl&&(0,n2.jsx)(D4,{src:e.logoUrl}),i.children]})},u=()=>(0,e1.useContext)(F4);var b2=require("react"),z1=k(require("styled-components"));var G4=k(require("styled-components"));var V2=require("react/jsx-runtime"),H4=({style:i,...e})=>(0,V2.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",...i},...e,children:(0,V2.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});var H2=require("react/jsx-runtime"),B4=({style:i,...e})=>(0,H2.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",...i},...e,children:(0,H2.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});var s2=require("react");var B2=(0,s2.createContext)({getAuthMeta:f,closePrivyModal:f,initLoginWithWallet:f,loginWithWallet:f,loginWithCode:f,loginWithEmail:f,loginWithSms:f,resendEmailCode:f,resendSmsCode:f,initLoginWithOAuth:f}),Z=()=>(0,s2.useContext)(B2);var E=require("react/jsx-runtime"),G2=()=>(0,E.jsx)("div",{}),j4=({backFn:i})=>(0,E.jsx)("div",{children:(0,E.jsx)(B4,{onClick:i})}),z4=()=>{let{closePrivyModal:i}=Z();return(0,E.jsx)("div",{children:(0,E.jsx)("div",{children:(0,E.jsx)(H4,{onClick:i})})})},u5=()=>{let{app:i}=u();return i!=null&&i.logoUrl?(0,E.jsx)("div",{children:(0,E.jsx)("img",{src:i.logoUrl,alt:`${i==null?void 0:i.name} logo`,style:{objectFit:"contain",width:"120px",height:"30px"}})}):null};var A=({backFn:i})=>(0,E.jsxs)(q4,{children:[i?(0,E.jsx)(j4,{backFn:i}):(0,E.jsx)(G2,{}),(0,E.jsx)(u5,{},"app-name"),(0,E.jsx)(z4,{})]}),$4=({backFn:i})=>(0,E.jsxs)(q4,{children:[i?(0,E.jsx)(j4,{backFn:i}):(0,E.jsx)(G2,{}),(0,E.jsx)(G2,{}),(0,E.jsx)(z4,{})]}),q4=G4.default.div`
12
+ - https://privy.io`;this.ethProvider=new A1}initialize(){let e=J.get(N2);R4.includes(e)&&(this.walletType=e,this.connect({showPrompt:!1}))}destroy(){this.walletType=null,J.del(N2)}async connect(e){var a,o;switch(this.walletType){case"metamask":this.ethProvider.setProvider(window.ethereum),(a=window.ethereum.providers)==null||a.forEach(async s=>{s.isMetaMask&&this.ethProvider.setProvider(s)});break;case"coinbase_wallet":this.ethProvider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async s=>{s.isCoinbaseWallet&&this.ethProvider.setProvider(s)});break;case"wallet_connect":let l=new W2.default({infuraId:E2});this.ethProvider.setProvider(l);break;default:throw new $(`Unsupported wallet: ${this.walletType}`)}return!await this.isConnected()&&e.showPrompt&&await this.promptConnection(this.walletType),this.address()}async isConnected(){switch(this.walletType){case"metamask":return await this.address()!==null;case"coinbase_wallet":return await this.address()!==null;case"wallet_connect":return this.ethProvider.connected;default:throw new $(`Unsupported wallet: ${this.walletType}`)}}async promptConnection(e){try{switch(e){case"metamask":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),a2()]);break;case"coinbase_wallet":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),a2()]);break;case"wallet_connect":let a=new W2.default({infuraId:E2});this.ethProvider.setProvider(a),await Promise.race([a.enable(),a2()]),J.put(N2,e);break;default:throw new $(`Unsupported wallet: ${this.walletType}`)}}catch(a){throw I2(a)}}async sign(e){let o=new O4.providers.Web3Provider(new P1(this.getEthereumProvider())).getSigner();return Promise.race([o.signMessage(e),a2()]).catch(l=>{throw I2(l)})}prepareMessage(e,a,o){let l=window.location.host,s=window.location.origin,c=`${l} requests that you authenticate with Privy.`,b=new Date().toISOString();return this.createSiweMessage(e,a,l,s,b,o,c)}async chainId(){let e=await this.getEthereumProvider().request({method:"eth_chainId"}),a=Number(e);return String(a)}async address(){let e=await this.getEthereumProvider().request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0?(0,W4.getAddress)(e[0]):null}};var U2,l2=class{constructor(e){let a=e.apiURL||u4,o=e.timeout||b4;this.appId=e.appId,this.connector=new o2,this.connector.initialize(),U2||(U2=new t2),this.session=U2,this.api=new Q1(e.appId,this.session,{baseURL:a,timeout:o}),this.session.api=this.api}async authenticate(){if(!this.authFlow)throw new m("No auth flow in progress.");return await this.session.authenticate(this.authFlow)}async logout(){await this.session.destroy(),this.connector.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let a=await this.api.post(T4(),{address:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkPhone(e){try{let a=await this.api.post(S4(),{phoneNumber:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkWallet(e){try{let a=await this.api.post(_4(),{address:e});return f1(a.data)}catch(a){throw Y(a)}}async unlinkOAuth(e,a){try{let o=await this.api.post(I4(),{provider:e,subject:a});return f1(o.data)}catch(o){throw Y(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(){return this.session.hasActiveToken()?this.session.token: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,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,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw Y(e)}}};var $3=require("@ethersproject/providers");var r2=require("react");var f=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var F2=(0,r2.createContext)({ready:!1,authenticated:!1,user:null,login:f,linkEmail:f,linkPhone:f,linkWallet:f,linkGoogle:f,linkTwitter:f,linkDiscord:f,logout:f,getAccessToken:f,getEthereumProvider:f,getEthersProvider:f,getWeb3jsProvider:f,unlinkEmail:f,unlinkPhone:f,unlinkWallet:f,unlinkGoogle:f,unlinkTwitter:f,unlinkDiscord:f}),Z=()=>(0,r2.useContext)(F2);var U1=class{constructor(e){this.connector=e,this.meta={wallet:this.connector.walletType}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.connector.walletType)throw new m("Wallet must be specified");try{let e=await this.connector.connect({showPrompt:!0}),a=await this.connector.chainId(),o=await this.api.post(y4(),{address:e}),l=this.connector.prepareMessage(a,e,o.data.nonce),s=await this.connector.sign(l),c=await this.api.post(v4(),{message:l,signature:s});return{user:c.data.user,token:c.data.token,refresh_token:c.data.refresh_token}}catch(e){throw R(e)}}getEthereumProvider(){return this.connector.getEthereumProvider()}};var F1=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new m("Email and email code must be set prior to calling authenticate.");try{let e=L4(),a=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async sendCodeEmail(e){if(!this.api)throw new m("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new m("Email must be set when initialzing authentication.");try{let a=Z4();return(await this.api.post(a,{email:this.meta.email})).data}catch(a){throw R(a)}}};var V1=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new m("phone number and sms code must be set prior to calling authenticate.");try{let e=E4(),a=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async sendSmsCode(e){if(!this.api)throw new m("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new m("phone nNumber must be set when initialzing authentication.");try{let a=x4();return(await this.api.post(a,{phoneNumber:this.meta.phoneNumber})).data}catch(a){throw R(a)}}};var H1=class{constructor(e,a,o){this.meta={provider:e},this.meta.authorizationCode=a,this.meta.stateCode=o}async authenticate(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new m("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");try{let e=P4(),a=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw R(e)}}async getAuthorizationUrl(){if(!this.api)throw new m("Auth flow has no API instance");if(!this.meta.provider)throw new m("Provider must be set when initialzing OAuth authentication.");try{let e=A4();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw R(e)}}};var P0=require("wicg-inert"),G3=k(require("react-dom")),v2=k(require("styled-components"));var e1=require("react");var U4=require("react/jsx-runtime");function D4(i){return(0,U4.jsx)("link",{rel:"prefetch",href:i.src})}var n2=require("react/jsx-runtime"),F4=(0,e1.createContext)({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:f,navigateBack:f}),V4=i=>{let e=i.appSettings,a=i.authenticated,o=i.visible,[l,s]=(0,e1.useState)(null),[c,b]=(0,e1.useState)(null);(0,e1.useEffect)(()=>{a||s(null)},[a]),(0,e1.useEffect)(()=>{o||(b("LANDING"),s("LANDING"))},[o]);let g={ready:!!(e!=null&&e.id),app:e,options:i.options,currentScreen:l||"LANDING",lastScreen:c||"LANDING",navigate:M=>{b(l),s(M)},navigateBack:()=>{s(c)}};return(0,n2.jsxs)(F4.Provider,{value:g,children:[e&&e.logoUrl&&(0,n2.jsx)(D4,{src:e.logoUrl}),i.children]})},u=()=>(0,e1.useContext)(F4);var b2=require("react"),z1=k(require("styled-components"));var G4=k(require("styled-components"));var V2=require("react/jsx-runtime"),H4=({style:i,...e})=>(0,V2.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",...i},...e,children:(0,V2.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});var H2=require("react/jsx-runtime"),B4=({style:i,...e})=>(0,H2.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",...i},...e,children:(0,H2.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});var s2=require("react");var B2=(0,s2.createContext)({getAuthMeta:f,closePrivyModal:f,initLoginWithWallet:f,loginWithWallet:f,loginWithCode:f,loginWithEmail:f,loginWithSms:f,resendEmailCode:f,resendSmsCode:f,initLoginWithOAuth:f}),L=()=>(0,s2.useContext)(B2);var E=require("react/jsx-runtime"),G2=()=>(0,E.jsx)("div",{}),j4=({backFn:i})=>(0,E.jsx)("div",{children:(0,E.jsx)(B4,{onClick:i})}),z4=()=>{let{closePrivyModal:i}=L();return(0,E.jsx)("div",{children:(0,E.jsx)("div",{children:(0,E.jsx)(H4,{onClick:i})})})},u5=()=>{let{app:i}=u();return i!=null&&i.logoUrl?(0,E.jsx)("div",{children:(0,E.jsx)("img",{src:i.logoUrl,alt:`${i==null?void 0:i.name} logo`,style:{objectFit:"contain",width:"120px",height:"30px"}})}):null};var A=({backFn:i})=>(0,E.jsxs)(q4,{children:[i?(0,E.jsx)(j4,{backFn:i}):(0,E.jsx)(G2,{}),(0,E.jsx)(u5,{},"app-name"),(0,E.jsx)(z4,{})]}),$4=({backFn:i})=>(0,E.jsxs)(q4,{children:[i?(0,E.jsx)(j4,{backFn:i}):(0,E.jsx)(G2,{}),(0,E.jsx)(G2,{}),(0,E.jsx)(z4,{})]}),q4=G4.default.div`
13
13
  height: 30px;
14
14
  display: flex;
15
15
  align-items: center;
@@ -80,7 +80,7 @@ Resources:
80
80
  @media (min-width: 441px) {
81
81
  display: none;
82
82
  }
83
- `;var I=require("react/jsx-runtime"),p2=()=>{let{navigate:i}=u(),{initLoginWithWallet:e,closePrivyModal:a}=Z();return(0,I.jsxs)(m5,{children:[(0,I.jsxs)($2,{onClick:()=>{O2()?(e("metamask"),i("AWAITING_CONNECTION")):q2.isMobile?(j2("metamask"),a()):i("INSTALL_METAMASK_SCREEN")},children:[(0,I.jsx)(g1,{}),(0,I.jsx)("span",{children:"Metamask"}),(0,I.jsx)("span",{children:O2()?"Connect":"Install"})]}),(0,I.jsxs)($2,{onClick:()=>{D2()?(e("coinbase_wallet"),i("AWAITING_CONNECTION")):q2.isMobile?(j2("coinbase_wallet"),a()):i("INSTALL_COINBASE_WALLET_SCREEN")},children:[(0,I.jsx)(T1,{}),(0,I.jsxs)("span",{children:["Coinbase",(0,I.jsx)(c2,{children:" Wallet"})]}),(0,I.jsx)("span",{children:D2()?"Connect":"Install"})]}),(0,I.jsxs)($2,{onClick:()=>{e("wallet_connect"),i("AWAITING_CONNECTION")},children:[(0,I.jsx)(C2,{}),(0,I.jsx)("span",{children:"WalletConnect"}),(0,I.jsx)("span",{children:"Connect"})]})]})},m5=K2.default.div`
83
+ `;var I=require("react/jsx-runtime"),p2=()=>{let{navigate:i}=u(),{initLoginWithWallet:e,closePrivyModal:a}=L();return(0,I.jsxs)(m5,{children:[(0,I.jsxs)($2,{onClick:()=>{O2()?(e("metamask"),i("AWAITING_CONNECTION")):q2.isMobile?(j2("metamask"),a()):i("INSTALL_METAMASK_SCREEN")},children:[(0,I.jsx)(g1,{}),(0,I.jsx)("span",{children:"Metamask"}),(0,I.jsx)("span",{children:O2()?"Connect":"Install"})]}),(0,I.jsxs)($2,{onClick:()=>{D2()?(e("coinbase_wallet"),i("AWAITING_CONNECTION")):q2.isMobile?(j2("coinbase_wallet"),a()):i("INSTALL_COINBASE_WALLET_SCREEN")},children:[(0,I.jsx)(T1,{}),(0,I.jsxs)("span",{children:["Coinbase",(0,I.jsx)(c2,{children:" Wallet"})]}),(0,I.jsx)("span",{children:D2()?"Connect":"Install"})]}),(0,I.jsxs)($2,{onClick:()=>{e("wallet_connect"),i("AWAITING_CONNECTION")},children:[(0,I.jsx)(C2,{}),(0,I.jsx)("span",{children:"WalletConnect"}),(0,I.jsx)("span",{children:"Connect"})]})]})},m5=K2.default.div`
84
84
  display: flex;
85
85
  flex-direction: column;
86
86
  align-items: flex-start;
@@ -198,7 +198,7 @@ Resources:
198
198
  margin-top: auto;
199
199
  gap: 16px;
200
200
  flex-grow: 100;
201
- `;var j1=k(require("styled-components"));var J2=require("react/jsx-runtime"),Q4=({style:i,...e})=>(0,J2.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",...i},...e,children:(0,J2.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:"white"})});var m1=require("react/jsx-runtime"),t3=({style:i,...e})=>(0,m1.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...i},...e,children:[(0,m1.jsx)("g",{clipPath:"url(#clip0)",children:(0,m1.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:"#ffffff"})}),(0,m1.jsx)("defs",{children:(0,m1.jsx)("clipPath",{id:"clip0",children:(0,m1.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var w1=require("react/jsx-runtime"),e3=({style:i,...e})=>(0,w1.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",...i},...e,children:[(0,w1.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,w1.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,w1.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,w1.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 c1=require("react/jsx-runtime"),i3=({showGoogle:i,showTwitter:e,showDiscord:a})=>{let{initLoginWithOAuth:o}=Z();return(0,c1.jsxs)(k5,{children:[i&&(0,c1.jsx)(w5,{onClick:()=>{o("google")},children:(0,c1.jsx)(e3,{})}),e&&(0,c1.jsx)(M5,{onClick:()=>{o("twitter")},children:(0,c1.jsx)(Q4,{})}),a&&(0,c1.jsx)(g5,{onClick:()=>{o("discord")},children:(0,c1.jsx)(t3,{})})]})},k5=j1.default.div`
201
+ `;var j1=k(require("styled-components"));var J2=require("react/jsx-runtime"),Q4=({style:i,...e})=>(0,J2.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",...i},...e,children:(0,J2.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:"white"})});var m1=require("react/jsx-runtime"),t3=({style:i,...e})=>(0,m1.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...i},...e,children:[(0,m1.jsx)("g",{clipPath:"url(#clip0)",children:(0,m1.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:"#ffffff"})}),(0,m1.jsx)("defs",{children:(0,m1.jsx)("clipPath",{id:"clip0",children:(0,m1.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var w1=require("react/jsx-runtime"),e3=({style:i,...e})=>(0,w1.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",...i},...e,children:[(0,w1.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,w1.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,w1.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,w1.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 c1=require("react/jsx-runtime"),i3=({showGoogle:i,showTwitter:e,showDiscord:a})=>{let{initLoginWithOAuth:o}=L();return(0,c1.jsxs)(k5,{children:[i&&(0,c1.jsx)(w5,{onClick:()=>{o("google")},children:(0,c1.jsx)(e3,{})}),e&&(0,c1.jsx)(M5,{onClick:()=>{o("twitter")},children:(0,c1.jsx)(Q4,{})}),a&&(0,c1.jsx)(g5,{onClick:()=>{o("discord")},children:(0,c1.jsx)(t3,{})})]})},k5=j1.default.div`
202
202
  display: flex;
203
203
  flex-direction: row;
204
204
  justify-content: space-between;
@@ -274,7 +274,7 @@ Resources:
274
274
  border-color: var(--fail-light);
275
275
  border-bottom-color: var(--fail-light);
276
276
  }
277
- `;var n3=require("libphonenumber-js/min");var s3=i=>!!String(i).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,}))$/),C3=i=>(0,n3.isPossiblePhoneNumber)(String(i),"US"),f2=i=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(e,function(o,l,s,c){return l+l+s+s+c+c});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return{r:parseInt((a==null?void 0:a[1])||"00",16),g:parseInt((a==null?void 0:a[2])||"00",16),b:parseInt((a==null?void 0:a[3])||"00",16)}};var D=require("react/jsx-runtime"),u2=()=>{let[i,e]=(0,S1.useState)(""),[a,o]=(0,S1.useState)(!1),[l,s]=(0,S1.useState)(null),{authenticated:c}=v(),{loginWithEmail:b}=Z(),{navigate:g,options:M}=u(),y=M.wallet;(0,S1.useEffect)(()=>{let d=document.querySelector("#email-input");d==null||d.focus()},[]);let F=s3(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(y5,{children:[(0,D.jsxs)(Z5,{children:[(0,D.jsx)(a3,{}),(0,D.jsx)("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:d=>e(d.target.value),onKeyUp:d=>{d.key==="Enter"&&(o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(x=>{(x==null?void 0:x.status)===422?s(x.message):s("Issue submitting email"),o(!1)}))},value:i,autoComplete:"email"})]}),(0,D.jsx)(v5,{disabled:a||!F,onClick:()=>{o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{(d==null?void 0:d.status)===422?s(d.message):s("Issue submitting email"),o(!1)})},children:a?(0,D.jsx)(y1,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),l?(0,D.jsx)(x5,{fail:!!l,children:l||""}):null,!c&&!l&&y?(0,D.jsx)(L5,{children:(0,D.jsx)("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},y5=I1.default.div`
277
+ `;var n3=require("libphonenumber-js/min");var s3=i=>!!String(i).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,}))$/),C3=i=>(0,n3.isPossiblePhoneNumber)(String(i),"US"),f2=i=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(e,function(o,l,s,c){return l+l+s+s+c+c});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return{r:parseInt((a==null?void 0:a[1])||"00",16),g:parseInt((a==null?void 0:a[2])||"00",16),b:parseInt((a==null?void 0:a[3])||"00",16)}};var D=require("react/jsx-runtime"),u2=()=>{let[i,e]=(0,S1.useState)(""),[a,o]=(0,S1.useState)(!1),[l,s]=(0,S1.useState)(null),{authenticated:c}=Z(),{loginWithEmail:b}=L(),{navigate:g,options:M}=u(),v=M.wallet;(0,S1.useEffect)(()=>{let d=document.querySelector("#email-input");d==null||d.focus()},[]);let F=s3(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(y5,{children:[(0,D.jsxs)(Z5,{children:[(0,D.jsx)(a3,{}),(0,D.jsx)("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:d=>e(d.target.value),onKeyUp:d=>{d.key==="Enter"&&(o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{(w==null?void 0:w.status)===422?s(w.message):s("Issue submitting email"),o(!1)}))},value:i,autoComplete:"email"})]}),(0,D.jsx)(v5,{disabled:a||!F,onClick:()=>{o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{(d==null?void 0:d.status)===422?s(d.message):s("Issue submitting email"),o(!1)})},children:a?(0,D.jsx)(y1,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),l?(0,D.jsx)(x5,{fail:!!l,children:l||""}):null,!c&&!l&&v?(0,D.jsx)(L5,{children:(0,D.jsx)("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},y5=I1.default.div`
278
278
  display: flex;
279
279
  border: 1px solid #d1d5db;
280
280
  width: 100%;
@@ -358,7 +358,7 @@ Resources:
358
358
  opacity: ${i=>i.success||i.fail?"1":"0"};
359
359
 
360
360
  transition: ${i=>i.fail?"":"all 150ms ease-in-out"};
361
- `;var R1=require("react"),v1=k(require("styled-components"));var Q2=require("react/jsx-runtime"),d3=({style:i,...e})=>(0,Q2.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",...i},...e,children:(0,Q2.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 U=require("react/jsx-runtime"),m2=()=>{let[i,e]=(0,R1.useState)(""),[a,o]=(0,R1.useState)(!1),[l,s]=(0,R1.useState)(null),{authenticated:c}=v(),{loginWithSms:b}=Z(),{navigate:g,options:M}=u(),y=M.wallet;(0,R1.useEffect)(()=>{let d=document.querySelector("#phone-number-input");d==null||d.focus()},[]);let F=C3(i);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(E5,{children:[(0,U.jsxs)(P5,{children:[(0,U.jsx)(d3,{}),(0,U.jsx)("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:d=>{e(d.target.value)},onKeyUp:d=>{d.key==="Enter"&&(o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(x=>{(x==null?void 0:x.status)===422?s(x.message):s("Issue submitting phone number"),o(!1)}))},value:i,autoComplete:"tel"})]}),(0,U.jsx)(A5,{disabled:a||!F,onClick:()=>{o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{(d==null?void 0:d.status)===422?s(d.message):s("Issue submitting phone number"),o(!1)})},children:a?(0,U.jsx)(S5,{color:"var(--disabled-fg)"}):"Submit"})]}),l?(0,U.jsx)(T5,{fail:!!l,children:l||""}):null,!c&&!l&&y?(0,U.jsx)(_5,{children:(0,U.jsx)("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},E5=v1.default.div`
361
+ `;var R1=require("react"),v1=k(require("styled-components"));var Q2=require("react/jsx-runtime"),d3=({style:i,...e})=>(0,Q2.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",...i},...e,children:(0,Q2.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 U=require("react/jsx-runtime"),m2=()=>{let[i,e]=(0,R1.useState)(""),[a,o]=(0,R1.useState)(!1),[l,s]=(0,R1.useState)(null),{authenticated:c}=Z(),{loginWithSms:b}=L(),{navigate:g,options:M}=u(),v=M.wallet;(0,R1.useEffect)(()=>{let d=document.querySelector("#phone-number-input");d==null||d.focus()},[]);let F=C3(i);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(E5,{children:[(0,U.jsxs)(P5,{children:[(0,U.jsx)(d3,{}),(0,U.jsx)("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:d=>{e(d.target.value)},onKeyUp:d=>{d.key==="Enter"&&(o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{(w==null?void 0:w.status)===422?s(w.message):s("Issue submitting phone number"),o(!1)}))},value:i,autoComplete:"tel"})]}),(0,U.jsx)(A5,{disabled:a||!F,onClick:()=>{o(!0),b(i).then(()=>{g("AWAITING_PASSWORDLESS_CODE")}).catch(d=>{(d==null?void 0:d.status)===422?s(d.message):s("Issue submitting phone number"),o(!1)})},children:a?(0,U.jsx)(S5,{color:"var(--disabled-fg)"}):"Submit"})]}),l?(0,U.jsx)(T5,{fail:!!l,children:l||""}):null,!c&&!l&&v?(0,U.jsx)(_5,{children:(0,U.jsx)("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},E5=v1.default.div`
362
362
  display: flex;
363
363
  border: 1px solid #d1d5db;
364
364
  width: 100%;
@@ -448,7 +448,7 @@ Resources:
448
448
  width: 1rem;
449
449
  border-width: 2px;
450
450
  }
451
- `;var h=require("react/jsx-runtime");var p3=()=>{let{ready:i,authenticated:e,user:a}=v(),{navigate:o,options:l}=u(),s=l.email,c=l.sms,b=l.wallet,g=l.google,M=l.twitter,y=l.discord,F=b?0:1,[d,x]=(0,b2.useState)(F);(0,b2.useEffect)(()=>{var X,O,n;i&&e&&(b&&!((X=a==null?void 0:a.wallet)!=null&&X.address)?o("CONNECT_WALLET_OPTIONAL"):s&&!((O=a==null?void 0:a.email)!=null&&O.address)?o("CONNECT_EMAIL_OPTIONAL"):c&&!((n=a==null?void 0:a.phone)!=null&&n.number)?o("CONNECT_PHONE_NUMBER_OPTIONAL"):g&&!(a!=null&&a.google)||M&&!(a!=null&&a.twitter)||y&&!(a!=null&&a.discord)||(console.error("Launched modal, but nothing left to connect."),o("FULLY_LINKED_SCREEN")))},[i]);let z=d==0,W=d==1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(A,{},"header"),(0,h.jsxs)(u1,{children:[(0,h.jsx)(t4,{children:(0,h.jsx)("h2",{children:"Connect with"})}),b&&(0,h.jsx)(I5,{active:z,onClick:()=>x(0)}),(s||c)&&(0,h.jsx)(R5,{active:W,onClick:()=>x(1),email:s,sms:c,google:g,twitter:M,discord:y})]}),(0,h.jsx)(a1,{protectedByPrivy:!0})]})};function I5(i){return(0,h.jsxs)(h3,{active:i.active,onClick:i.onClick,children:[(0,h.jsx)(t4,{active:i.active,children:(0,h.jsx)("h3",{children:"Wallet"})}),i.active&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p2,{}),(0,h.jsx)(h2,{})]})]})}function R5(i){let e=i.google||i.twitter||i.discord,a=i.email?"Email":"Phone";return(0,h.jsxs)(h3,{active:i.active,onClick:i.onClick,children:[(0,h.jsx)(t4,{active:i.active,children:(0,h.jsx)("h3",{children:e?`${a} & Social`:a})}),(0,h.jsxs)(h.Fragment,{children:[i.active&&i.email&&(0,h.jsx)(u2,{}),i.active&&i.sms&&!i.email&&(0,h.jsx)(m2,{}),i.active&&e&&(0,h.jsx)(N5,{google:i.google,twitter:i.twitter,discord:i.discord})]})]})}function N5(i){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(W5,{children:[(0,h.jsx)(c3,{}),(0,h.jsx)("p",{children:" Or "}),(0,h.jsx)(c3,{})]}),(0,h.jsx)(i3,{showGoogle:i.google,showDiscord:i.discord,showTwitter:i.twitter})]})}var t4=z1.default.div`
451
+ `;var h=require("react/jsx-runtime");var p3=()=>{let{ready:i,authenticated:e,user:a}=Z(),{navigate:o,options:l}=u(),s=l.email,c=l.sms,b=l.wallet,g=l.google,M=l.twitter,v=l.discord,F=b?0:1,[d,w]=(0,b2.useState)(F);(0,b2.useEffect)(()=>{var X,O,n;i&&e&&(b&&!((X=a==null?void 0:a.wallet)!=null&&X.address)?o("CONNECT_WALLET_OPTIONAL"):s&&!((O=a==null?void 0:a.email)!=null&&O.address)?o("CONNECT_EMAIL_OPTIONAL"):c&&!((n=a==null?void 0:a.phone)!=null&&n.number)?o("CONNECT_PHONE_NUMBER_OPTIONAL"):g&&!(a!=null&&a.google)||M&&!(a!=null&&a.twitter)||v&&!(a!=null&&a.discord)||(console.error("Launched modal, but nothing left to connect."),o("FULLY_LINKED_SCREEN")))},[i]);let z=d==0,W=d==1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(A,{},"header"),(0,h.jsxs)(u1,{children:[(0,h.jsx)(t4,{children:(0,h.jsx)("h2",{children:"Connect with"})}),b&&(0,h.jsx)(I5,{active:z,onClick:()=>w(0)}),(s||c)&&(0,h.jsx)(R5,{active:W,onClick:()=>w(1),email:s,sms:c,google:g,twitter:M,discord:v})]}),(0,h.jsx)(a1,{protectedByPrivy:!0})]})};function I5(i){return(0,h.jsxs)(h3,{active:i.active,onClick:i.onClick,children:[(0,h.jsx)(t4,{active:i.active,children:(0,h.jsx)("h3",{children:"Wallet"})}),i.active&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p2,{}),(0,h.jsx)(h2,{})]})]})}function R5(i){let e=i.google||i.twitter||i.discord,a=i.email?"Email":"Phone";return(0,h.jsxs)(h3,{active:i.active,onClick:i.onClick,children:[(0,h.jsx)(t4,{active:i.active,children:(0,h.jsx)("h3",{children:e?`${a} & Social`:a})}),(0,h.jsxs)(h.Fragment,{children:[i.active&&i.email&&(0,h.jsx)(u2,{}),i.active&&i.sms&&!i.email&&(0,h.jsx)(m2,{}),i.active&&e&&(0,h.jsx)(N5,{google:i.google,twitter:i.twitter,discord:i.discord})]})]})}function N5(i){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(W5,{children:[(0,h.jsx)(c3,{}),(0,h.jsx)("p",{children:" Or "}),(0,h.jsx)(c3,{})]}),(0,h.jsx)(i3,{showGoogle:i.google,showDiscord:i.discord,showTwitter:i.twitter})]})}var t4=z1.default.div`
452
452
  font-weight: ${i=>i.active?600:500};
453
453
  color: ${i=>i.active?"inherit":"#6b7280"};
454
454
  display: flex;
@@ -487,7 +487,7 @@ Resources:
487
487
  border-top: 1px solid #d1d5db;
488
488
  margin: 0px 8px;
489
489
  }
490
- `;var b1=require("react");var $1=k(require("styled-components"));var w=require("react/jsx-runtime"),e4=6,f3=new Array(e4).fill(""),O5=1400;var u3=()=>{var h1,O1,D1;let{navigate:i,app:e,options:a}=u(),{closePrivyModal:o,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:b}=Z(),{authenticated:g,user:M}=v(),[y,F]=(0,b1.useState)(f3),[d,x]=(0,b1.useState)(!1),[z,W]=(0,b1.useState)(null),[X,O]=(0,b1.useState)(null),n=a.wallet,C=(h1=c())!=null&&h1.email?0:1;(0,b1.useEffect)(()=>{if(g&&d){let T=setTimeout(()=>{var V;let P=!!((V=M==null?void 0:M.wallet)!=null&&V.address);n&&!P?i("CONNECT_WALLET_OPTIONAL"):o()},t1);return()=>clearTimeout(T)}},[g,d,M]),(0,b1.useEffect)(()=>{if(z&&X===0){let T=setTimeout(()=>{F(f3),W(null);let P=document.querySelector("input[name=code-0]");P==null||P.focus()},O5);return()=>clearTimeout(T)}},[z]);let n1=T=>{var c4;let P=T.currentTarget.value.replace(" ","");if(P==="")return;if(isNaN(Number(P))){W("Code should be numeric"),O(1);return}W(null),O(null);let V=Number((c4=T.currentTarget.name)==null?void 0:c4.charAt(5)),Z2=[...P||[""]].slice(0,e4-V),L2=[...y.slice(0,V),...Z2,...y.slice(V+Z2.length)];F(L2);let K3=Z2.length,d4=Math.min(Math.max(V+K3,0),e4-1);if(!isNaN(Number(T.currentTarget.value))){let Q=document.querySelector(`input[name=code-${d4}]`);Q==null||Q.focus()}if(L2.every(Q=>Q&&!isNaN(+Q))){let Q=document.querySelector(`input[name=code-${d4}]`);Q==null||Q.blur(),b(L2.join("")).then(()=>x(!0)).catch(x2=>{(x2==null?void 0:x2.status)===422?W("Invalid or expired verification code"):W("Issue verifying code"),O(0)})}T.preventDefault()},_=T=>{X===1&&(W(null),O(null));let P=[...y.slice(0,T),"",...y.slice(T+1)];if(F(P),T>0){let V=document.querySelector(`input[name=code-${T-1}]`);V==null||V.focus()}},L1=C==0?`Please check ${(O1=c())==null?void 0:O1.email} for an email from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`:`Please check ${(D1=c())==null?void 0:D1.phoneNumber} for a message from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(A,{},"header"),(0,w.jsxs)(D5,{children:[(0,w.jsx)("p",{children:L1}),(0,w.jsxs)(U5,{children:[(0,w.jsx)("div",{children:y.map((T,P)=>(0,w.jsx)("input",{name:`code-${P}`,type:"text",value:y[P],onChange:n1,onKeyUp:V=>{V.key==="Backspace"&&_(P)},inputMode:"numeric",autoFocus:P===0,pattern:"[0-9]",className:`${d?"success":""} ${z?"fail":""}`,autoComplete:"one-time-code"},P))}),(0,w.jsx)(F5,{fail:!!z,success:d,children:(0,w.jsx)("span",{children:z||(d?"Success!":"")})})]}),(0,w.jsx)(V5,{children:C==0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{children:"Didn't get an email?"}),(0,w.jsx)("button",{onClick:l,children:"Resend Code"})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{children:"Didn't get a message?"}),(0,w.jsx)("button",{onClick:s,children:"Resend Code"})]})})]}),(0,w.jsx)(a1,{protectedByPrivy:!0})]})},D5=$1.default.div`
490
+ `;var b1=require("react");var $1=k(require("styled-components"));var y=require("react/jsx-runtime"),e4=6,f3=new Array(e4).fill(""),O5=1400;var u3=()=>{var h1,O1,D1;let{navigate:i,app:e,options:a}=u(),{closePrivyModal:o,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:b}=L(),{authenticated:g,user:M}=Z(),[v,F]=(0,b1.useState)(f3),[d,w]=(0,b1.useState)(!1),[z,W]=(0,b1.useState)(null),[X,O]=(0,b1.useState)(null),n=a.wallet,C=(h1=c())!=null&&h1.email?0:1;(0,b1.useEffect)(()=>{if(g&&d){let T=setTimeout(()=>{var V;let P=!!((V=M==null?void 0:M.wallet)!=null&&V.address);n&&!P?i("CONNECT_WALLET_OPTIONAL"):o()},t1);return()=>clearTimeout(T)}},[g,d,M]),(0,b1.useEffect)(()=>{if(z&&X===0){let T=setTimeout(()=>{F(f3),W(null);let P=document.querySelector("input[name=code-0]");P==null||P.focus()},O5);return()=>clearTimeout(T)}},[z]);let n1=T=>{var c4;let P=T.currentTarget.value.replace(" ","");if(P==="")return;if(isNaN(Number(P))){W("Code should be numeric"),O(1);return}W(null),O(null);let V=Number((c4=T.currentTarget.name)==null?void 0:c4.charAt(5)),Z2=[...P||[""]].slice(0,e4-V),L2=[...v.slice(0,V),...Z2,...v.slice(V+Z2.length)];F(L2);let K3=Z2.length,d4=Math.min(Math.max(V+K3,0),e4-1);if(!isNaN(Number(T.currentTarget.value))){let Q=document.querySelector(`input[name=code-${d4}]`);Q==null||Q.focus()}if(L2.every(Q=>Q&&!isNaN(+Q))){let Q=document.querySelector(`input[name=code-${d4}]`);Q==null||Q.blur(),b(L2.join("")).then(()=>w(!0)).catch(x2=>{(x2==null?void 0:x2.status)===422?W("Invalid or expired verification code"):W("Issue verifying code"),O(0)})}T.preventDefault()},_=T=>{X===1&&(W(null),O(null));let P=[...v.slice(0,T),"",...v.slice(T+1)];if(F(P),T>0){let V=document.querySelector(`input[name=code-${T-1}]`);V==null||V.focus()}},L1=C==0?`Please check ${(O1=c())==null?void 0:O1.email} for an email from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`:`Please check ${(D1=c())==null?void 0:D1.phoneNumber} for a message from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(A,{},"header"),(0,y.jsxs)(D5,{children:[(0,y.jsx)("p",{children:L1}),(0,y.jsxs)(U5,{children:[(0,y.jsx)("div",{children:v.map((T,P)=>(0,y.jsx)("input",{name:`code-${P}`,type:"text",value:v[P],onChange:n1,onKeyUp:V=>{V.key==="Backspace"&&_(P)},inputMode:"numeric",autoFocus:P===0,pattern:"[0-9]",className:`${d?"success":""} ${z?"fail":""}`,autoComplete:"one-time-code"},P))}),(0,y.jsx)(F5,{fail:!!z,success:d,children:(0,y.jsx)("span",{children:z||(d?"Success!":"")})})]}),(0,y.jsx)(V5,{children:C==0?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{children:"Didn't get an email?"}),(0,y.jsx)("button",{onClick:l,children:"Resend Code"})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{children:"Didn't get a message?"}),(0,y.jsx)("button",{onClick:s,children:"Resend Code"})]})})]}),(0,y.jsx)(a1,{protectedByPrivy:!0})]})},D5=$1.default.div`
491
491
  display: flex;
492
492
  flex-direction: column;
493
493
  align-items: flex-start;
@@ -603,7 +603,7 @@ Resources:
603
603
  border: 1px solid #e5e7eb;
604
604
  color: var(--text-dark-blue);
605
605
  }
606
- `;var H=require("react/jsx-runtime"),k3=()=>{let{user:i}=v(),{closePrivyModal:e}=Z();return(0,b3.useEffect)(()=>{var a;if((a=i==null?void 0:i.wallet)!=null&&a.address){let o=setTimeout(()=>{e()},t1);return()=>clearTimeout(o)}},[i]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(A,{},"header"),(0,H.jsxs)(H5,{children:[(0,H.jsx)(B5,{children:(0,H.jsx)("h3",{children:"Connect Wallet"})}),(0,H.jsx)(p2,{}),(0,H.jsx)(h2,{}),(0,H.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,H.jsx)(a1,{protectedByPrivy:!0})]})},H5=(0,i4.default)(u1)`
606
+ `;var H=require("react/jsx-runtime"),k3=()=>{let{user:i}=Z(),{closePrivyModal:e}=L();return(0,b3.useEffect)(()=>{var a;if((a=i==null?void 0:i.wallet)!=null&&a.address){let o=setTimeout(()=>{e()},t1);return()=>clearTimeout(o)}},[i]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(A,{},"header"),(0,H.jsxs)(H5,{children:[(0,H.jsx)(B5,{children:(0,H.jsx)("h3",{children:"Connect Wallet"})}),(0,H.jsx)(p2,{}),(0,H.jsx)(h2,{}),(0,H.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,H.jsx)(a1,{protectedByPrivy:!0})]})},H5=(0,i4.default)(u1)`
607
607
  gap: 12px;
608
608
  `,B5=i4.default.div`
609
609
  font-weight: 500;
@@ -625,14 +625,16 @@ Resources:
625
625
  justify-items: center;
626
626
  gap: 8px;
627
627
 
628
- a {
629
- text-decoration: underline;
630
- color: var(--primary-color);
631
- }
628
+ && {
629
+ a {
630
+ text-decoration: underline;
631
+ color: var(--primary-color);
632
+ }
632
633
 
633
- svg {
634
- margin-top: auto;
635
- margin-bottom: auto;
634
+ svg {
635
+ margin-top: auto;
636
+ margin-bottom: auto;
637
+ }
636
638
  }
637
639
  `;var p=require("react/jsx-runtime"),w3=({style:i,...e})=>(0,p.jsxs)("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...i},...e,children:[(0,p.jsx)("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),(0,p.jsx)("path",{d:"M236.373 144.791L225.206 153.052L227.289 148.181L236.373 144.791Z",fill:"#E17726",stroke:"#E17726",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M210.627 144.791L221.692 153.116L219.711 148.187L210.627 144.785V144.791ZM232.353 163.933L229.377 168.47L235.738 170.219L237.557 164.036L232.347 163.933H232.353ZM209.448 164.036L211.257 170.219L217.602 168.47L214.647 163.933L209.448 164.036Z",fill:"#E27625",stroke:"#E27625",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M217.262 156.27L215.497 158.939L221.783 159.23L221.579 152.46L217.262 156.281V156.27V156.27ZM229.737 156.281L225.351 152.374L225.206 159.23L231.492 158.939L229.732 156.281H229.737ZM217.602 168.475L221.417 166.64L218.14 164.089L217.607 168.475H217.602ZM225.588 166.63L229.377 168.475L228.865 164.084L225.588 166.635V166.63Z",fill:"#E27625",stroke:"#E27625",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M229.377 168.47L225.588 166.635L225.895 169.1L225.862 170.144L229.382 168.47H229.377ZM217.602 168.47L221.137 170.144L221.11 169.1L221.417 166.635L217.602 168.47V168.47Z",fill:"#D5BFB2",stroke:"#D5BFB2",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M221.197 162.448L218.054 161.533L220.282 160.516L221.207 162.453H221.197V162.448ZM225.793 162.448L226.729 160.505L228.962 161.522L225.793 162.459V162.448Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M217.602 168.47L218.156 163.933L214.647 164.035L217.602 168.47V168.47ZM228.844 163.933L229.377 168.47L232.353 164.035L228.844 163.933V163.933ZM231.503 158.939L225.217 159.23L225.793 162.459L226.729 160.505L228.962 161.522L231.503 158.939V158.939ZM218.054 161.533L220.282 160.516L221.207 162.453L221.794 159.224L215.508 158.944L218.059 161.538L218.054 161.533Z",fill:"#CC6228",stroke:"#CC6228",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M215.503 158.939L218.134 164.078L218.048 161.528L215.497 158.934L215.503 158.939ZM228.962 161.533L228.86 164.084L231.492 158.944L228.957 161.538L228.962 161.533ZM221.794 159.23L221.196 162.459L221.945 166.263L222.117 161.242L221.794 159.23ZM225.211 159.23L224.904 161.237L225.055 166.269L225.792 162.453L225.206 159.224V159.235L225.211 159.23Z",fill:"#E27525",stroke:"#E27525",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M225.793 162.448L225.055 166.263L225.588 166.635L228.86 164.084L228.962 161.528L225.793 162.448V162.448ZM218.054 161.528L218.14 164.078L221.417 166.629L221.945 166.263L221.207 162.448L218.048 161.528H218.059H218.054Z",fill:"#F5841F",stroke:"#F5841F",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M225.868 170.144L225.895 169.1L225.604 168.863H221.39L221.11 169.1L221.137 170.144L217.602 168.47L218.845 169.487L221.353 171.215H225.642L228.155 169.482L229.377 168.47L225.857 170.144H225.868V170.144Z",fill:"#C0AC9D",stroke:"#C0AC9D",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M225.588 166.63L225.055 166.264H221.945L221.417 166.635L221.11 169.1L221.39 168.863H225.604L225.895 169.1L225.588 166.635V166.624V166.63Z",fill:"#161616",stroke:"#161616",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M236.846 153.585L237.783 149.037L236.373 144.791L225.583 152.777L229.737 156.27L235.598 157.976L236.889 156.475L236.33 156.066L237.223 155.248L236.545 154.72L237.438 154.042L236.846 153.585H236.857H236.846ZM209.217 149.032L210.17 153.585L209.556 154.037L210.466 154.715L209.787 155.248L210.67 156.066L210.11 156.475L211.402 157.976L217.263 156.275L221.417 152.767L210.627 144.791L209.217 149.032V149.032Z",fill:"#763E1A",stroke:"#763E1A",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M235.598 157.976L229.737 156.275L231.502 158.934L228.871 164.073L232.353 164.03H237.562L235.598 157.97V157.976ZM217.263 156.27L211.402 157.976L209.448 164.035H214.658L218.14 164.079L215.508 158.939L217.273 156.27H217.263V156.27ZM225.206 159.224L225.588 152.766L227.289 148.176H219.711L221.412 152.766L221.794 159.224L221.939 161.248V166.263H225.055L225.071 161.248L225.206 159.224V159.224Z",fill:"#F5841F",stroke:"#F5841F",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),(0,p.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),(0,p.jsx)("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"25",fill:"url(#paint0_linear_428_81)"}),(0,p.jsx)("path",{d:"M77.3677 42.8335H74.102C74.102 36.2519 68.6881 30.9167 62.0091 30.9167C55.4129 30.9167 50.0501 36.1213 49.9189 42.5901C49.7831 49.2769 56.1492 55.0834 62.9357 55.0834H63.7893C69.7724 55.0834 77.7916 50.468 79.0445 44.8444C79.2758 43.8079 78.445 42.8335 77.3677 42.8335ZM57.1562 43.1267C57.1562 44.0068 56.4257 44.7267 55.5325 44.7267C54.6394 44.7267 53.9089 44.0065 53.9089 43.1267V40.5383C53.9089 39.6582 54.6394 38.9383 55.5325 38.9383C56.4257 38.9383 57.1562 39.6582 57.1562 40.5383V43.1267ZM62.794 43.1267C62.794 44.0068 62.0636 44.7267 61.1705 44.7267C60.2773 44.7267 59.5468 44.0065 59.5468 43.1267V40.5383C59.5468 39.6582 60.2776 38.9383 61.1705 38.9383C62.0636 38.9383 62.794 39.6582 62.794 40.5383V43.1267Z",fill:"url(#paint1_linear_428_81)"}),(0,p.jsx)("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),(0,p.jsx)("g",{clipPath:"url(#clip0_428_81)",children:(0,p.jsx)("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),(0,p.jsx)("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"white"}),(0,p.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M131.626 83.0058C128.674 83.3405 126.5 85.8652 126.5 88.8363V92.0779V103.277V105.099C126.5 108.098 128.713 110.636 131.695 110.952C134.982 111.301 139.216 111.667 142.5 111.667C147.147 111.667 153.695 110.934 156.773 110.555C157.765 110.433 158.5 109.588 158.5 108.589V92.0779C158.5 91.0782 157.765 90.2337 156.773 90.1115C153.705 89.7336 147.189 89.0046 142.545 88.9999L142.5 88.9999L142.46 88.9999C139.655 89.0025 136.165 89.2695 133.166 89.564C132.488 89.5642 131.907 89.0495 131.84 88.3608C131.768 87.6279 132.304 86.9755 133.037 86.9036C136.061 86.6067 139.621 86.3333 142.5 86.3333C145.707 86.3333 149.764 86.6728 152.989 87.007C154.039 87.1159 155.006 87.2247 155.833 87.3221V85.3898C155.833 84.3995 155.112 83.56 154.131 83.4288C151.262 83.0454 145.367 82.3333 141.167 82.3333C138.276 82.3333 134.583 82.6705 131.626 83.0058ZM153.833 102.333C154.938 102.333 155.833 101.438 155.833 100.333C155.833 99.2287 154.938 98.3333 153.833 98.3333C152.729 98.3333 151.833 99.2287 151.833 100.333C151.833 101.438 152.729 102.333 153.833 102.333Z",fill:"#696FFD"}),(0,p.jsx)("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),(0,p.jsx)("path",{d:"M269.405 111C278.27 111 285.457 103.837 285.457 95C285.457 86.1634 278.27 79 269.405 79C260.54 79 253.354 86.1634 253.354 95C253.354 103.837 260.54 111 269.405 111Z",fill:"#B9BBFE"}),(0,p.jsx)("path",{d:"M133.971 24C140.62 24 146.01 18.6274 146.01 12C146.01 5.37258 140.62 0 133.971 0C127.322 0 121.932 5.37258 121.932 12C121.932 18.6274 127.322 24 133.971 24Z",fill:"#B9BBFE"}),(0,p.jsx)("path",{d:"M15.5917 112C20.5782 112 24.6206 107.971 24.6206 103C24.6206 98.0294 20.5782 94 15.5917 94C10.6051 94 6.56274 98.0294 6.56274 103C6.56274 107.971 10.6051 112 15.5917 112Z",fill:"#B9BBFE"}),(0,p.jsx)("path",{d:"M152.029 177C157.57 177 162.061 172.523 162.061 167C162.061 161.477 157.57 157 152.029 157C146.488 157 141.997 161.477 141.997 167C141.997 172.523 146.488 177 152.029 177Z",fill:"#E9E9FF"}),(0,p.jsx)("path",{d:"M263.386 21C267.818 21 271.412 17.4183 271.412 13C271.412 8.58172 267.818 5 263.386 5C258.953 5 255.36 8.58172 255.36 13C255.36 17.4183 258.953 21 263.386 21Z",fill:"#E9E9FF"}),(0,p.jsx)("path",{d:"M7.06436 36C10.6658 36 13.5853 33.0899 13.5853 29.5C13.5853 25.9101 10.6658 23 7.06436 23C3.46296 23 0.543457 25.9101 0.543457 29.5C0.543457 33.0899 3.46296 36 7.06436 36Z",fill:"#E9E9FF"}),(0,p.jsxs)("defs",{children:[(0,p.jsxs)("linearGradient",{id:"paint0_linear_428_81",x1:"64.5",y1:"18",x2:"64.5",y2:"68",gradientUnits:"userSpaceOnUse",children:[(0,p.jsx)("stop",{stopColor:"#534BB1"}),(0,p.jsx)("stop",{offset:"1",stopColor:"#551BF9"})]}),(0,p.jsxs)("linearGradient",{id:"paint1_linear_428_81",x1:"64.5",y1:"30.9167",x2:"64.5",y2:"55.0834",gradientUnits:"userSpaceOnUse",children:[(0,p.jsx)("stop",{stopColor:"white"}),(0,p.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0.82"})]}),(0,p.jsx)("clipPath",{id:"clip0_428_81",children:(0,p.jsx)("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})]})]});var k1=k(require("react-device-detect"));var r=require("react/jsx-runtime");var l4=()=>{let{navigate:i}=u(),e="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return k1.isFirefox&&(e="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),(0,r.jsxs)(x3,{children:[(0,r.jsxs)(E3,{children:[(0,r.jsx)("h3",{children:"Create a wallet with Metamask"}),(0,r.jsx)(g1,{style:{width:"152px",height:"152px"}})]}),(0,r.jsxs)(o4,{children:[(0,r.jsx)(W1,{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"Install the "}),(0,r.jsx)("a",{href:e,target:"_blank",children:"MetaMask browser extension"})]})}),(0,r.jsx)(w2,{}),(0,r.jsx)(W1,{children:"Set up your first wallet"})]}),(0,r.jsx)(A3,{onClick:()=>i("LANDING"),children:"Done! I have my wallet"})]})},r4=()=>{let{navigate:i}=u();return(0,r.jsxs)(x3,{children:[(0,r.jsxs)(E3,{children:[(0,r.jsx)("h3",{children:"Create a wallet with Coinbase"}),(0,r.jsx)(M3,{style:{width:"152px",height:"152px"}})]}),(0,r.jsxs)(o4,{children:[(0,r.jsx)(W1,{children:"Open the camera on your phone"}),(0,r.jsx)(w2,{}),(0,r.jsx)(W1,{children:"Scan the QR code with your camera"}),(0,r.jsx)(w2,{}),(0,r.jsx)(W1,{children:"Click the link and download the app"})]}),(0,r.jsx)(A3,{onClick:()=>i("LANDING"),children:"Done! I have my wallet"})]})},L3=()=>{let[i,e]=(0,Z3.useState)("WHAT_IS_A_WALLET"),{navigateBack:a}=u();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A,{backFn:i==="WHAT_IS_A_WALLET"?a:i==="PICK_A_NEW_WALLET"?()=>e("WHAT_IS_A_WALLET"):()=>e("PICK_A_NEW_WALLET")},"header"),(0,r.jsxs)(j5,{children:[i==="WHAT_IS_A_WALLET"&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c2,{children:(0,r.jsx)(w3,{style:{width:"100%",height:"auto",borderRadius:"var(--border-radius-sm)"}})}),(0,r.jsxs)(z5,{children:[(0,r.jsx)("h3",{children:"What is a wallet?"}),(0,r.jsx)("p",{children:"Wallets are how you can store, send, and receive cryptocurrencies and NFTs. They are also a new way\xA0to\xA0log\xA0in."}),(0,r.jsx)("p",{children:"Instead of creating new accounts and passwords every time you explore crypto apps, you can just connect\xA0your\xA0wallet."})]}),(0,r.jsx)(K5,{children:(0,r.jsx)(Y5,{onClick:()=>{e("PICK_A_NEW_WALLET")},children:"Get a Wallet"})})]}),i==="PICK_A_NEW_WALLET"&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)($5,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{children:"Create a new wallet"}),(0,r.jsx)("p",{children:"Select one the wallet providers below to get started on your web3 adventure."})]}),(0,r.jsxs)(q5,{children:[(0,r.jsxs)(y3,{onClick:()=>{k1.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":k1.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":e("CREATE_METAMASK_WALLET")},children:[(0,r.jsx)(g1,{}),(0,r.jsx)(v3,{children:(0,r.jsx)("h4",{children:"MetaMask"})}),(0,r.jsx)("div",{children:(0,r.jsx)("span",{children:"Set up"})})]}),(0,r.jsxs)(y3,{onClick:()=>{k1.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":k1.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":e("CREATE_COINBASE_WALLET")},children:[(0,r.jsx)(T1,{}),(0,r.jsx)(v3,{children:(0,r.jsx)("h4",{children:"Coinbase Wallet"})}),(0,r.jsx)("div",{children:(0,r.jsx)("span",{children:"Set up"})})]})]})]})}),i==="CREATE_COINBASE_WALLET"&&(0,r.jsx)(r4,{}),i==="CREATE_METAMASK_WALLET"&&(0,r.jsx)(l4,{})]}),(0,r.jsxs)(d1,{children:[(0,r.jsx)("span",{children:"Still not sure? "}),(0,r.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})},j5=q.default.div`
638
640
  > svg {
@@ -754,7 +756,7 @@ Resources:
754
756
  background-color: #696efd1a;
755
757
  border-radius: var(--border-radius-sm);
756
758
  }
757
- `;var P3=require("react");var n4=k(require("styled-components"));var B=require("react/jsx-runtime"),_3=()=>{let{user:i}=v(),{closePrivyModal:e}=Z(),{app:a}=u();return(0,P3.useEffect)(()=>{var o;if((o=i==null?void 0:i.email)!=null&&o.address){let l=setTimeout(()=>{e()},t1);return()=>clearTimeout(l)}},[i]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(A,{},"header"),(0,B.jsxs)(X5,{children:[(0,B.jsx)("h3",{children:"Connect your Email"}),(0,B.jsxs)("p",{children:["Add your email to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),(0,B.jsxs)(J5,{children:[(0,B.jsx)(u2,{}),(0,B.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,B.jsx)(a1,{protectedByPrivy:!0})]})},J5=(0,n4.default)(u1)`
759
+ `;var P3=require("react");var n4=k(require("styled-components"));var B=require("react/jsx-runtime"),_3=()=>{let{user:i}=Z(),{closePrivyModal:e}=L(),{app:a}=u();return(0,P3.useEffect)(()=>{var o;if((o=i==null?void 0:i.email)!=null&&o.address){let l=setTimeout(()=>{e()},t1);return()=>clearTimeout(l)}},[i]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(A,{},"header"),(0,B.jsxs)(X5,{children:[(0,B.jsx)("h3",{children:"Connect your Email"}),(0,B.jsxs)("p",{children:["Add your email to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),(0,B.jsxs)(J5,{children:[(0,B.jsx)(u2,{}),(0,B.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,B.jsx)(a1,{protectedByPrivy:!0})]})},J5=(0,n4.default)(u1)`
758
760
  gap: 12px;
759
761
  `,X5=n4.default.div`
760
762
  display: flex;
@@ -774,7 +776,7 @@ Resources:
774
776
  font-size: 18px;
775
777
  color: #111827;
776
778
  }
777
- `;var T3=require("react");var s4=k(require("styled-components"));var G=require("react/jsx-runtime"),S3=()=>{let{user:i}=v(),{closePrivyModal:e}=Z(),{app:a}=u();return(0,T3.useEffect)(()=>{var o;if((o=i==null?void 0:i.phone)!=null&&o.number){let l=setTimeout(()=>{e()},t1);return()=>clearTimeout(l)}},[i]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(A,{},"header"),(0,G.jsxs)(t6,{children:[(0,G.jsx)("h3",{children:"Connect your Phone Number"}),(0,G.jsxs)("p",{children:["Add your phone to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),(0,G.jsxs)(Q5,{children:[(0,G.jsx)(m2,{}),(0,G.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,G.jsx)(a1,{protectedByPrivy:!0})]})},Q5=s4.default.div`
779
+ `;var T3=require("react");var s4=k(require("styled-components"));var G=require("react/jsx-runtime"),S3=()=>{let{user:i}=Z(),{closePrivyModal:e}=L(),{app:a}=u();return(0,T3.useEffect)(()=>{var o;if((o=i==null?void 0:i.phone)!=null&&o.number){let l=setTimeout(()=>{e()},t1);return()=>clearTimeout(l)}},[i]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(A,{},"header"),(0,G.jsxs)(t6,{children:[(0,G.jsx)("h3",{children:"Connect your Phone Number"}),(0,G.jsxs)("p",{children:["Add your phone to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),(0,G.jsxs)(Q5,{children:[(0,G.jsx)(m2,{}),(0,G.jsx)(N1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),(0,G.jsx)(a1,{protectedByPrivy:!0})]})},Q5=s4.default.div`
778
780
  display: flex;
779
781
  flex-direction: column;
780
782
  align-items: flex-start;
@@ -798,7 +800,7 @@ Resources:
798
800
  font-size: 18px;
799
801
  color: #111827;
800
802
  }
801
- `;var Z1=require("react");var q1=k(require("styled-components"));var N=require("react/jsx-runtime"),C4=2,I3={metamask:{name:"MetaMask",component:g1},coinbase_wallet:{name:"Coinbase Wallet",component:T1},wallet_connect:{name:"WalletConnect",component:C2}},R3=()=>{var n1;let[i,e]=(0,Z1.useState)(!1),[a,o]=(0,Z1.useState)(void 0),{navigate:l,navigateBack:s,options:c}=u(),{getAuthMeta:b,closePrivyModal:g,loginWithWallet:M}=Z(),[y,F]=(0,Z1.useState)(0),{user:d}=v(),x=c.email,z=c.sms;(0,Z1.useEffect)(()=>{o(void 0),M().then(()=>e(!0)).catch(_=>{_ instanceof K?console.error(_.cause):console.error(_),(_==null?void 0:_.status)===422?o(R2.ERROR_USER_EXISTS):_ instanceof _1&&!_.details.default?o(_.details):o(R2.ERROR_WALLET_CONNECTION)})},[y]),(0,Z1.useEffect)(()=>{var O1,D1,T;let _=!!((O1=d==null?void 0:d.wallet)!=null&&O1.address),L1=!!((D1=d==null?void 0:d.email)!=null&&D1.address),h1=!!((T=d==null?void 0:d.phone)!=null&&T.number);if(_){e(!0);let P=setTimeout(()=>{x&&!L1?l("CONNECT_EMAIL_OPTIONAL"):z&&!h1?l("CONNECT_PHONE_NUMBER_OPTIONAL"):g()},t1);return()=>clearTimeout(P)}},[d]);let W=((n1=b())==null?void 0:n1.wallet)||"metamask",X=I3[W].name,O=I3[W].component,n=i?`Successfully connected with ${X}`:a?a.message:`Waiting for ${X}`,C="";if(i)C="You\u2019re good to go!";else if(y>=C4&&a)C="Unable to connect wallet";else if(a)C=a.detail;else switch(W){case"wallet_connect":C="Open your mobile wallet app to continue";break;default:C="Don\u2019t see your wallet modal? Check your other browser windows."}return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)($4,{backFn:s}),(0,N.jsxs)(e6,{children:[(0,N.jsx)(a6,{children:(0,N.jsxs)("div",{children:[(0,N.jsx)(l3,{success:i,fail:!!a}),(0,N.jsx)(O,{style:{width:"38px",height:"38px"}})]})}),(0,N.jsxs)(i6,{children:[(0,N.jsx)("h3",{children:n}),(0,N.jsx)("p",{children:C})]}),(0,N.jsx)(o6,{onClick:()=>{F(y+1),o(void 0)},visible:!i&&(a==null?void 0:a.retryable)&&y<C4,disabled:!i&&(!(a!=null&&a.retryable)||y>=C4),children:"Retry"})]})]})},e6=q1.default.div`
803
+ `;var Z1=require("react");var q1=k(require("styled-components"));var N=require("react/jsx-runtime"),C4=2,I3={metamask:{name:"MetaMask",component:g1},coinbase_wallet:{name:"Coinbase Wallet",component:T1},wallet_connect:{name:"WalletConnect",component:C2}},R3=()=>{var n1;let[i,e]=(0,Z1.useState)(!1),[a,o]=(0,Z1.useState)(void 0),{navigate:l,navigateBack:s,options:c}=u(),{getAuthMeta:b,closePrivyModal:g,loginWithWallet:M}=L(),[v,F]=(0,Z1.useState)(0),{user:d}=Z(),w=c.email,z=c.sms;(0,Z1.useEffect)(()=>{o(void 0),M().then(()=>e(!0)).catch(_=>{_ instanceof K?console.error(_.cause):console.error(_),(_==null?void 0:_.status)===422?o(R2.ERROR_USER_EXISTS):_ instanceof _1&&!_.details.default?o(_.details):o(R2.ERROR_WALLET_CONNECTION)})},[v]),(0,Z1.useEffect)(()=>{var O1,D1,T;let _=!!((O1=d==null?void 0:d.wallet)!=null&&O1.address),L1=!!((D1=d==null?void 0:d.email)!=null&&D1.address),h1=!!((T=d==null?void 0:d.phone)!=null&&T.number);if(_){e(!0);let P=setTimeout(()=>{w&&!L1?l("CONNECT_EMAIL_OPTIONAL"):z&&!h1?l("CONNECT_PHONE_NUMBER_OPTIONAL"):g()},t1);return()=>clearTimeout(P)}},[d]);let W=((n1=b())==null?void 0:n1.wallet)||"metamask",X=I3[W].name,O=I3[W].component,n=i?`Successfully connected with ${X}`:a?a.message:`Waiting for ${X}`,C="";if(i)C="You\u2019re good to go!";else if(v>=C4&&a)C="Unable to connect wallet";else if(a)C=a.detail;else switch(W){case"wallet_connect":C="Open your mobile wallet app to continue";break;default:C="Don\u2019t see your wallet modal? Check your other browser windows."}return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)($4,{backFn:s}),(0,N.jsxs)(e6,{children:[(0,N.jsx)(a6,{children:(0,N.jsxs)("div",{children:[(0,N.jsx)(l3,{success:i,fail:!!a}),(0,N.jsx)(O,{style:{width:"38px",height:"38px"}})]})}),(0,N.jsxs)(i6,{children:[(0,N.jsx)("h3",{children:n}),(0,N.jsx)("p",{children:C})]}),(0,N.jsx)(o6,{onClick:()=>{F(v+1),o(void 0)},visible:!i&&(a==null?void 0:a.retryable)&&v<C4,disabled:!i&&(!(a!=null&&a.retryable)||v>=C4),children:"Retry"})]})]})},e6=q1.default.div`
802
804
  display: flex;
803
805
  flex-direction: column;
804
806
  align-items: center;
@@ -845,7 +847,7 @@ Resources:
845
847
  opacity: ${i=>i.visible?"1":"0"};
846
848
  transition: opacity 200ms;
847
849
  }
848
- `;var o1=require("react/jsx-runtime"),N3=()=>{let{navigateBack:i}=u();return(0,o1.jsxs)(o1.Fragment,{children:[(0,o1.jsx)(A,{backFn:i},"header"),(0,o1.jsx)(l4,{}),(0,o1.jsxs)(d1,{children:[(0,o1.jsx)("span",{children:"Still not sure? "}),(0,o1.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var l1=require("react/jsx-runtime"),W3=()=>{let{navigateBack:i}=u();return(0,l1.jsxs)(l1.Fragment,{children:[(0,l1.jsx)(A,{backFn:i},"header"),(0,l1.jsx)(r4,{}),(0,l1.jsxs)(d1,{children:[(0,l1.jsx)("span",{children:"Still not sure? "}),(0,l1.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var O3=require("react");var D3=k(require("styled-components"));var p1=require("react/jsx-runtime"),U3=()=>{let{closePrivyModal:i}=Z(),{authenticated:e,ready:a}=v(),{navigate:o}=u();return(0,O3.useEffect)(()=>{a&&!e&&o("LANDING")},[e,a]),(0,p1.jsxs)(p1.Fragment,{children:[(0,p1.jsx)(A,{},"header"),(0,p1.jsxs)(l6,{children:[(0,p1.jsx)("h3",{children:"You're all logged in!"}),(0,p1.jsx)(M2,{onClick:()=>{i()},children:"Go back to the app"})]})]})},l6=(0,D3.default)(u1)`
850
+ `;var o1=require("react/jsx-runtime"),N3=()=>{let{navigateBack:i}=u();return(0,o1.jsxs)(o1.Fragment,{children:[(0,o1.jsx)(A,{backFn:i},"header"),(0,o1.jsx)(l4,{}),(0,o1.jsxs)(d1,{children:[(0,o1.jsx)("span",{children:"Still not sure? "}),(0,o1.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var l1=require("react/jsx-runtime"),W3=()=>{let{navigateBack:i}=u();return(0,l1.jsxs)(l1.Fragment,{children:[(0,l1.jsx)(A,{backFn:i},"header"),(0,l1.jsx)(r4,{}),(0,l1.jsxs)(d1,{children:[(0,l1.jsx)("span",{children:"Still not sure? "}),(0,l1.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var O3=require("react");var D3=k(require("styled-components"));var p1=require("react/jsx-runtime"),U3=()=>{let{closePrivyModal:i}=L(),{authenticated:e,ready:a}=Z(),{navigate:o}=u();return(0,O3.useEffect)(()=>{a&&!e&&o("LANDING")},[e,a]),(0,p1.jsxs)(p1.Fragment,{children:[(0,p1.jsx)(A,{},"header"),(0,p1.jsxs)(l6,{children:[(0,p1.jsx)("h3",{children:"You're all logged in!"}),(0,p1.jsx)(M2,{onClick:()=>{i()},children:"Go back to the app"})]})]})},l6=(0,D3.default)(u1)`
849
851
  gap: 36px;
850
852
  `;var F3=k(require("styled-components"));var H3=require("react/jsx-runtime"),V3=i=>{let e=i.accentColor||"#696ffd";return(0,H3.jsx)(r6,{accentColor:e,children:i.children})},r6=F3.default.div`
851
853
  /*! Modified from https://unpkg.com/tailwindcss@3.2.3/src/css/preflight.css */
@@ -1145,7 +1147,7 @@ Resources:
1145
1147
  display: none;
1146
1148
  }
1147
1149
  }
1148
- `;var j3=require("react");var L=require("react/jsx-runtime"),n6=()=>{let{ready:i}=v(),{ready:e,currentScreen:a}=u(),o=a==="AWAITING_CONNECTION";return!i||!e?(0,L.jsxs)(B3,{compact:o,children:[(0,L.jsx)(A,{}),(0,L.jsx)(d6,{children:(0,L.jsx)(y1,{})}),(0,L.jsx)(d1,{})]}):(0,L.jsxs)(B3,{compact:o,children:[a==="LANDING"&&(0,L.jsx)(p3,{}),a==="AWAITING_PASSWORDLESS_CODE"&&(0,L.jsx)(u3,{}),a==="CONNECT_WALLET_OPTIONAL"&&(0,L.jsx)(k3,{}),a==="CONNECT_EMAIL_OPTIONAL"&&(0,L.jsx)(_3,{}),a==="CONNECT_PHONE_NUMBER_OPTIONAL"&&(0,L.jsx)(S3,{}),a==="WALLET_EDUCATION"&&(0,L.jsx)(L3,{}),a==="AWAITING_CONNECTION"&&(0,L.jsx)(R3,{}),a==="FULLY_LINKED_SCREEN"&&(0,L.jsx)(U3,{}),a==="INSTALL_METAMASK_SCREEN"&&(0,L.jsx)(N3,{}),a==="INSTALL_COINBASE_WALLET_SCREEN"&&(0,L.jsx)(W3,{})]})},z3=()=>{let{app:i}=u();return G3.default.createPortal((0,L.jsx)(C6,{children:(0,L.jsx)(V3,{accentColor:i==null?void 0:i.accentColor,children:(0,L.jsx)(n6,{})})}),document.body)},s6=({children:i,...e})=>((0,j3.useEffect)(()=>{var a;if(e.open){(a=document==null?void 0:document.activeElement)==null||a.blur();let o=(document==null?void 0:document.querySelector("#root"))||(document==null?void 0:document.querySelector("#__next"));o==null||o.setAttribute("inert","true")}return()=>{let o=(document==null?void 0:document.querySelector("#root"))||(document==null?void 0:document.querySelector("#__next"));o==null||o.removeAttribute("inert")}},[e.open,e.onClose]),(0,L.jsx)("dialog",{open:!0,role:"dialog",...e,children:i})),C6=(0,v2.default)(s6)`
1150
+ `;var j3=require("react");var x=require("react/jsx-runtime"),n6=()=>{let{ready:i}=Z(),{ready:e,currentScreen:a}=u(),o=a==="AWAITING_CONNECTION";return!i||!e?(0,x.jsxs)(B3,{compact:o,children:[(0,x.jsx)(A,{}),(0,x.jsx)(d6,{children:(0,x.jsx)(y1,{})}),(0,x.jsx)(d1,{})]}):(0,x.jsxs)(B3,{compact:o,children:[a==="LANDING"&&(0,x.jsx)(p3,{}),a==="AWAITING_PASSWORDLESS_CODE"&&(0,x.jsx)(u3,{}),a==="CONNECT_WALLET_OPTIONAL"&&(0,x.jsx)(k3,{}),a==="CONNECT_EMAIL_OPTIONAL"&&(0,x.jsx)(_3,{}),a==="CONNECT_PHONE_NUMBER_OPTIONAL"&&(0,x.jsx)(S3,{}),a==="WALLET_EDUCATION"&&(0,x.jsx)(L3,{}),a==="AWAITING_CONNECTION"&&(0,x.jsx)(R3,{}),a==="FULLY_LINKED_SCREEN"&&(0,x.jsx)(U3,{}),a==="INSTALL_METAMASK_SCREEN"&&(0,x.jsx)(N3,{}),a==="INSTALL_COINBASE_WALLET_SCREEN"&&(0,x.jsx)(W3,{})]})},z3=()=>{let{app:i}=u();return G3.default.createPortal((0,x.jsx)(C6,{children:(0,x.jsx)(V3,{accentColor:i==null?void 0:i.accentColor,children:(0,x.jsx)(n6,{})})}),document.body)},s6=({children:i,...e})=>((0,j3.useEffect)(()=>{var a;if(e.open){(a=document==null?void 0:document.activeElement)==null||a.blur();let o=(document==null?void 0:document.querySelector("#root"))||(document==null?void 0:document.querySelector("#__next"));o==null||o.setAttribute("inert","true")}return()=>{let o=(document==null?void 0:document.querySelector("#root"))||(document==null?void 0:document.querySelector("#__next"));o==null||o.removeAttribute("inert")}},[e.open,e.onClose]),(0,x.jsx)("dialog",{open:!0,role:"dialog",...e,children:i})),C6=(0,v2.default)(s6)`
1149
1151
  position: fixed;
1150
1152
  top: 0;
1151
1153
  left: 0;
@@ -1189,4 +1191,4 @@ Resources:
1189
1191
  align-items: center;
1190
1192
  justify-content: center;
1191
1193
  height: 100%;
1192
- `;var r1=require("react/jsx-runtime");function c6(i){return typeof i=="string"&&i.length===25}var q3=i=>{if(!c6(i.appId))throw new m("Cannot initialize the Privy provider with an invalid Privy app ID");let[e,a]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let o=new l2({appId:i.appId,apiURL:m4});a(o)},[]),e===null?(0,r1.jsx)(r1.Fragment,{}):(0,r1.jsx)(h6,{...i,client:e})},p6=(i,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,[e]:!0};let a=!!(i!=null&&i.emailAuth),o=!!(i!=null&&i.smsAuth);return a&&o&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),o=!1),{email:a,sms:o,wallet:!!(i!=null&&i.walletAuth),google:!!(i!=null&&i.googleOAuth),twitter:!!(i!=null&&i.twitterOAuth),discord:!!(i!=null&&i.discordOAuth)}},h6=i=>{let e=i.client,[a,o]=(0,j.useState)(!1),[l,s]=(0,j.useState)(!1),[c,b]=(0,j.useState)(!1),[g,M]=(0,j.useState)(null),[y,F]=(0,j.useState)({accentColor:"#696ffd",theme:"System",emailAuth:!0,smsAuth:!1,walletAuth:!0,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1}),[d,x]=(0,j.useState)(null);(0,j.useEffect)(()=>{async function n(){let C=await e.getAppSettings();F(C)}n()},[]);let z=p6(y,d),W=async()=>{var L1;let n=new URLSearchParams(window.location.search),C=n.get("privy_oauth_code"),n1=n.get("privy_oauth_state"),_=n.get("privy_oauth_provider");if(C&&n1&&C!=="undefined"&&_){e.startAuthFlow(new H1(_,C,n1)),x(_);let h1=await e.authenticate();return h1&&((L1=i.onSuccess)==null||L1.call(i,h1)),h1}return Promise.resolve(null)};(0,j.useEffect)(()=>{async function n(){let C;try{C=await W()}catch(n1){console.error("Something went wrong initializing Privy OAuth"),console.log(n1)}C||(C=await e.getAuthenticatedUser()),b(!!C),M(C),s(!0)}n()},[]),(0,j.useEffect)(()=>{l&&c&&g===null&&e.getAuthenticatedUser().then(M)},[l,c,g]);let X={ready:l,authenticated:c,user:g,linkWallet:()=>{x("wallet"),o(!0)},linkEmail:()=>{x("email"),o(!0)},linkPhone:()=>{x("sms"),o(!0)},linkGoogle:async()=>{await O.initLoginWithOAuth("google")},linkTwitter:async()=>{await O.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await O.initLoginWithOAuth("discord")},login:()=>{o(!0)},logout:async()=>{await e.logout(),M(null),b(!1),o(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connector.getEthereumProvider(),getEthersProvider:()=>new $3.Web3Provider(new P1(e.connector.getEthereumProvider())),getWeb3jsProvider:()=>new e2(e.connector.getEthereumProvider()),unlinkWallet:async n=>{let C=await e.unlinkWallet(n);return M(C),C},unlinkEmail:async n=>{let C=await e.unlinkEmail(n);return M(C),C},unlinkPhone:async n=>{let C=await e.unlinkPhone(n);return M(C),C},unlinkGoogle:async n=>{let C=await e.unlinkOAuth("google",n);return M(C),C},unlinkTwitter:async n=>{let C=await e.unlinkOAuth("twitter",n);return M(C),C},unlinkDiscord:async n=>{let C=await e.unlinkOAuth("discord",n);return M(C),C}},O={getAuthMeta:()=>{var n;return(n=e.authFlow)==null?void 0:n.meta},closePrivyModal:()=>{var n;l&&c&&g&&((n=i.onSuccess)==null||n.call(i,g)),o(!1)},initLoginWithWallet:n=>{n||(n="metamask"),e.connector.walletType=n,e.startAuthFlow(new U1(e.connector))},initLoginWithOAuth:async n=>{e.startAuthFlow(new H1(n));let C=await e.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},loginWithWallet:async()=>{if(!(e.authFlow instanceof U1))throw new m("Must initialize SIWE flow first.");let n=await e.authenticate();M(n||g||null),b(!0)},loginWithEmail:async n=>{let C=new F1(n);e.startAuthFlow(C),await C.sendCodeEmail()},loginWithSms:async n=>{let C=new V1(n);e.startAuthFlow(C),await C.sendSmsCode()},resendEmailCode:async()=>{var n;await((n=e.authFlow)==null?void 0:n.sendCodeEmail())},resendSmsCode:async()=>{var n;await((n=e.authFlow)==null?void 0:n.sendSmsCode())},loginWithCode:async n=>{if(e.authFlow instanceof F1)e.authFlow.meta.emailCode=n.trim();else if(e.authFlow instanceof V1)e.authFlow.meta.smsCode=n.trim();else throw new m("Must initialize a passwordless code flow first");let C=await e.authenticate();M(C||g||null),b(!0)}};return(0,r1.jsxs)(F2.Provider,{value:X,children:[i.children,(0,r1.jsx)(B2.Provider,{value:O,children:(0,r1.jsx)(V4,{appSettings:y,options:z,visible:a,authenticated:c,children:a&&(0,r1.jsx)(z3,{})})})]})};0&&(module.exports={PrivyProvider,VERSION,usePrivy});
1194
+ `;var r1=require("react/jsx-runtime");function c6(i){return typeof i=="string"&&i.length===25}var q3=i=>{if(!c6(i.appId))throw new m("Cannot initialize the Privy provider with an invalid Privy app ID");let[e,a]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let o=new l2({appId:i.appId,apiURL:m4});a(o)},[]),e===null?(0,r1.jsx)(r1.Fragment,{}):(0,r1.jsx)(h6,{...i,client:e})},p6=(i,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,[e]:!0};let a=!!(i!=null&&i.emailAuth),o=!!(i!=null&&i.smsAuth);return a&&o&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),o=!1),{email:a,sms:o,wallet:!!(i!=null&&i.walletAuth),google:!!(i!=null&&i.googleOAuth),twitter:!!(i!=null&&i.twitterOAuth),discord:!!(i!=null&&i.discordOAuth)}},h6=i=>{let e=i.client,[a,o]=(0,j.useState)(!1),[l,s]=(0,j.useState)(!1),[c,b]=(0,j.useState)(!1),[g,M]=(0,j.useState)(null),[v,F]=(0,j.useState)({accentColor:"#696ffd",theme:"System",emailAuth:!0,smsAuth:!1,walletAuth:!0,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1}),[d,w]=(0,j.useState)(null);(0,j.useEffect)(()=>{async function n(){let C=await e.getAppSettings();F(C)}n()},[]);let z=p6(v,d),W=async()=>{var L1;let n=new URLSearchParams(window.location.search),C=n.get("privy_oauth_code"),n1=n.get("privy_oauth_state"),_=n.get("privy_oauth_provider");if(C&&n1&&C!=="undefined"&&_){e.startAuthFlow(new H1(_,C,n1)),w(_);let h1=await e.authenticate();return h1&&((L1=i.onSuccess)==null||L1.call(i,h1)),h1}return Promise.resolve(null)};(0,j.useEffect)(()=>{async function n(){let C;try{C=await W()}catch(n1){console.error("Something went wrong initializing Privy OAuth"),console.log(n1)}C||(C=await e.getAuthenticatedUser()),b(!!C),M(C),s(!0)}n()},[]),(0,j.useEffect)(()=>{l&&c&&g===null&&e.getAuthenticatedUser().then(M)},[l,c,g]);let X={ready:l,authenticated:c,user:g,linkWallet:()=>{w("wallet"),o(!0)},linkEmail:()=>{w("email"),o(!0)},linkPhone:()=>{w("sms"),o(!0)},linkGoogle:async()=>{await O.initLoginWithOAuth("google")},linkTwitter:async()=>{await O.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await O.initLoginWithOAuth("discord")},login:()=>{o(!0)},logout:async()=>{await e.logout(),M(null),b(!1),w(null),o(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connector.getEthereumProvider(),getEthersProvider:()=>new $3.Web3Provider(new P1(e.connector.getEthereumProvider())),getWeb3jsProvider:()=>new e2(e.connector.getEthereumProvider()),unlinkWallet:async n=>{let C=await e.unlinkWallet(n);return M(C),C},unlinkEmail:async n=>{let C=await e.unlinkEmail(n);return M(C),C},unlinkPhone:async n=>{let C=await e.unlinkPhone(n);return M(C),C},unlinkGoogle:async n=>{let C=await e.unlinkOAuth("google",n);return M(C),C},unlinkTwitter:async n=>{let C=await e.unlinkOAuth("twitter",n);return M(C),C},unlinkDiscord:async n=>{let C=await e.unlinkOAuth("discord",n);return M(C),C}},O={getAuthMeta:()=>{var n;return(n=e.authFlow)==null?void 0:n.meta},closePrivyModal:()=>{var n;l&&c&&g&&((n=i.onSuccess)==null||n.call(i,g)),w(null),o(!1)},initLoginWithWallet:n=>{n||(n="metamask"),e.connector.walletType=n,e.startAuthFlow(new U1(e.connector))},initLoginWithOAuth:async n=>{e.startAuthFlow(new H1(n));let C=await e.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},loginWithWallet:async()=>{if(!(e.authFlow instanceof U1))throw new m("Must initialize SIWE flow first.");let n=await e.authenticate();M(n||g||null),b(!0)},loginWithEmail:async n=>{let C=new F1(n);e.startAuthFlow(C),await C.sendCodeEmail()},loginWithSms:async n=>{let C=new V1(n);e.startAuthFlow(C),await C.sendSmsCode()},resendEmailCode:async()=>{var n;await((n=e.authFlow)==null?void 0:n.sendCodeEmail())},resendSmsCode:async()=>{var n;await((n=e.authFlow)==null?void 0:n.sendSmsCode())},loginWithCode:async n=>{if(e.authFlow instanceof F1)e.authFlow.meta.emailCode=n.trim();else if(e.authFlow instanceof V1)e.authFlow.meta.smsCode=n.trim();else throw new m("Must initialize a passwordless code flow first");let C=await e.authenticate();M(C||g||null),b(!0)}};return(0,r1.jsxs)(F2.Provider,{value:X,children:[i.children,(0,r1.jsx)(B2.Provider,{value:O,children:(0,r1.jsx)(V4,{appSettings:v,options:z,visible:a,authenticated:c,children:a&&(0,r1.jsx)(z3,{})})})]})};0&&(module.exports={PrivyProvider,VERSION,usePrivy});
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import{useEffect as f2,useState as d1}from"react";import g2 from"axios";import F3 from"axios";var F=class extends Error{constructor(a,o){super(a);o instanceof Error&&(this.cause=o)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},W1=class extends F{constructor(a,o,l,n){super(l,n);this.type=a;this.status=o}},u=class extends F{constructor(a,o){super(a,o);this.type="client_error"}};var D=class extends F{constructor(a,o){super(a,o);this.type="connector_error"}},T=i=>{if(i instanceof F)return i;if(!F3.isAxiosError(i))return V(i);if(!i.response)return new W1("api_error",null,i.message,i);let{type:e,message:a,error:o}=i.response.data;return new W1(e||"ApiError",i.response.status,a||o,i)},V=i=>i instanceof F?i:i instanceof Error?new u(i.message,i):new u(`Internal error: ${i}`);var i4="1.6.0-beta.10";var a4="https://api.privy.io/v0",o4=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",k2="70f97dc579834350a5baec117b3c5ae3",l4=1e4,z=1200,r4=3e4,M2=i4;var O1=class{constructor(e,a,o){this.appId=e,this.sdkVersion=M2,this.session=a,this.defaults=o}async get(e,a){try{return await g2.get(e,this.buildConfig({headers:{"Cache-Control":"no-cache"},...a}))}catch(o){throw T(o)}}async post(e,a,o){try{return await g2.post(e,a,this.buildConfig(o))}catch(l){throw T(l)}}async delete(e,a){try{return await g2.delete(e,this.buildConfig(a))}catch(o){throw T(o)}}buildConfig(e){return e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,this.session.token!==null&&(e.headers.authorization=`Bearer ${this.session.token}`),{...this.defaults,...e}}};import H3 from"jwt-decode";var p1=class{static parse(e){try{return new p1(e)}catch{return null}}constructor(e){this.value=e,this._decoded=H3(e)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}isExpired(e=0){let a=Date.now(),o=(this.expiration-e)*1e3;return a>=o}};var h1=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 w2=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,a){a!==void 0?this._cache[e]=a:this.del(e)}del(e){delete this._cache[e]}},y2=class{get(e){let a=localStorage.getItem(e);return a===null?void 0:JSON.parse(a)}put(e,a){a!==void 0?localStorage.setItem(e,JSON.stringify(a)):this.del(e)}del(e){localStorage.removeItem(e)}};function B3(){return typeof window<"u"&&window.localStorage?new y2:new w2}var H=B3();var G3=i=>{var e;return(e=i.map(a=>{if(a.type==="wallet")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3),chainType:a.chain_type}}).filter(a=>a))==null?void 0:e[0]},j3=i=>{var e;return(e=i.map(a=>{if(a.type==="email")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},z3=i=>{var e;return(e=i.map(a=>{if(a.type==="phone")return{number:a.phoneNumber,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},$3=i=>{var e;return(e=i.map(a=>{if(a.type==="google_oauth")return{subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},q3=i=>{var e;return(e=i.map(a=>{if(a.type==="twitter_oauth")return{subject:a.subject,username:a.username,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},K3=i=>{var e;return(e=i.map(a=>{if(a.type==="discord_oauth")return{subject:a.subject,username:a.username,email:a.email,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]};function Q(i){if(!i)return null;let e=j3(i.linked_accounts),a=z3(i.linked_accounts),o=G3(i.linked_accounts),l=$3(i.linked_accounts),n=q3(i.linked_accounts),d=K3(i.linked_accounts);return{id:i.id,createdAt:new Date(i.created_at*1e3),linkedAccounts:[...o?[o]:[],...e?[e]:[],...a?[a]:[],...l?[l]:[],...n?[n]:[],...d?[d]:[]],email:e&&{address:e==null?void 0:e.address},phone:a&&{number:a==null?void 0:a.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:l&&{subject:l.subject,email:l.email,name:l.name},twitter:n&&{subject:n.subject,username:n.username,name:n.name},discord:d&&{subject:d.subject,username:d.username,email:d.email}}}var n4=()=>"/api/v1/sessions",s4=()=>"/api/v1/sessions/logout",C4=()=>"/api/v1/siwe/init",d4=()=>"/api/v1/siwe/authenticate",c4=()=>"/api/v1/passwordless/init",p4=()=>"/api/v1/passwordless/authenticate",h4=()=>"/api/v1/passwordless_sms/init",f4=()=>"/api/v1/passwordless_sms/authenticate",u4=()=>"/api/v1/oauth/init",m4=()=>"/api/v1/oauth/authenticate",b4=()=>"/api/v1/siwe/unlink",k4=()=>"/api/v1/passwordless/unlink",M4=()=>"/api/v1/passwordless_sms/unlink",g4=()=>"/api/v1/oauth/unlink";var Y3=30,v2="privy:token",Z2="privy:refresh_token",D1=class{constructor(){this.authenticateOnce=new h1(async e=>this._authenticate(e)),this.refreshOnce=new h1(this._refresh.bind(this)),this.destroyOnce=new h1(this._destroy.bind(this))}get token(){let e=H.get(v2);return typeof e=="string"?e:null}get refreshToken(){let e=H.get(Z2);return typeof e=="string"?e:null}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=p1.parse(this.token);return e!==null&&!e.isExpired(Y3)}authenticate(e){return this.authenticateOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:a,refresh_token:o,user:l}=await e.authenticate();return a&&this.storeToken(a),o&&this.storeRefreshToken(o),Q(l)}catch(a){throw console.warn("Error authenticating session"),V(a)}}async _refresh(){if(!this.api)throw new u("Session has no API instance");let e=this.token,a=this.refreshToken;if(!e||!a)return null;try{let o=await this.api.post(n4(),{refresh_token:a});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),Q(o.data.user)}catch(o){throw V(o)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(s4(),{})),this.destroyLocalState()}catch(a){throw console.warn("Error destroying session"),V(a)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?H.put(v2,e):H.del(v2)}storeRefreshToken(e){typeof e=="string"?H.put(Z2,e):H.del(Z2)}};import{getAddress as e5}from"@ethersproject/address";import y4 from"@walletconnect/web3-provider";var f1=class{constructor(e){this.removeListener=(e,a)=>{if(this._provider)return this._provider.removeListener(e,a)};this.setProvider=e=>{this._provider=e,this._subscriptions.forEach(a=>{var o;(o=this._provider)==null||o.on(a.eventName,a.listener)})};this._provider=e,this._subscriptions=[]}on(e,a){if(this._provider)return this._provider.on(e,a);this._subscriptions.push({eventName:e,listener:a})}request(e){if(!this._provider)throw new D(`A wallet request of type ${e.method} was made to a disconnected wallet: `);return this._provider.request(e)}},u1=class extends f1{constructor(a){super(a)}},U1=class extends f1{constructor(e){super(e)}sendAsync(e,a){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};import{providers as i5}from"ethers";var w4=["metamask","coinbase_wallet","wallet_connect"];import{ethers as J3}from"ethers";var F1=class extends D{constructor(){super("Wallet timeout");this.type="wallet_error"}},x2=i=>{if(i instanceof D)return i;if((i==null?void 0:i.code)&&(i==null?void 0:i.reason)){let e=new m1(i);return i.code===J3.errors.ACTION_REJECTED&&(e.details=a1.E4001_USER_REJECTED_REQUEST),e}return i!=null&&i.code?new m1(i):new D("Unknown connector error",i)},L2=class extends F{constructor(a,o,l){super(a);this.type="provider_error";this.code=o,this.data=l}},m1=class extends L2{constructor(a){var n,d,m;let o=a;super(o.message,o.code,o.data);let l=Object.values(a1).find(k=>k.eipCode===o.code);this.details=l||a1.UNKNOWN_ERROR,o.code===-32002&&((n=o.message)!=null&&n.includes("already pending for origin")?(d=o.message)!=null&&d.includes("wallet_requestPermissions")?this.details=a1.E32002_CONNECTION_ALREADY_PENDING:this.details=a1.E32002_REQUEST_ALREADY_PENDING:(m=o.message)!=null&&m.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=a1.E32002_WALLET_LOCKED))}},X3={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0}},Q3={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}},t5={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}},a1={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...t5,...Q3},E2={...X3,...a1};var A2="privy:wallet_type",V1=(i=new F1,e=r4)=>new Promise((a,o)=>setTimeout(()=>{o(i)},e)),P2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isMetaMask)return!0}return!1},_2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isCoinbaseWallet)return!0}return!1},H1=class{constructor(){this.walletType=null;this.getEthereumProvider=()=>this.ethProvider;this.createSiweMessage=(e,a,o,l,n,d,m)=>`${o} wants you to sign in with your Ethereum account:
1
+ import{useEffect as f2,useState as d1}from"react";import g2 from"axios";import F3 from"axios";var F=class extends Error{constructor(a,o){super(a);o instanceof Error&&(this.cause=o)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},W1=class extends F{constructor(a,o,l,n){super(l,n);this.type=a;this.status=o}},u=class extends F{constructor(a,o){super(a,o);this.type="client_error"}};var D=class extends F{constructor(a,o){super(a,o);this.type="connector_error"}},T=i=>{if(i instanceof F)return i;if(!F3.isAxiosError(i))return V(i);if(!i.response)return new W1("api_error",null,i.message,i);let{type:e,message:a,error:o}=i.response.data;return new W1(e||"ApiError",i.response.status,a||o,i)},V=i=>i instanceof F?i:i instanceof Error?new u(i.message,i):new u(`Internal error: ${i}`);var i4="1.6.0-beta.12";var a4="https://api.privy.io/v0",o4=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",k2="70f97dc579834350a5baec117b3c5ae3",l4=1e4,z=1200,r4=3e4,M2=i4;var O1=class{constructor(e,a,o){this.appId=e,this.sdkVersion=M2,this.session=a,this.defaults=o}async get(e,a){try{return await g2.get(e,this.buildConfig({headers:{"Cache-Control":"no-cache"},...a}))}catch(o){throw T(o)}}async post(e,a,o){try{return await g2.post(e,a,this.buildConfig(o))}catch(l){throw T(l)}}async delete(e,a){try{return await g2.delete(e,this.buildConfig(a))}catch(o){throw T(o)}}buildConfig(e){return e=e||{},e.headers=e.headers||{},e.headers["privy-app-id"]=this.appId,e.headers["privy-client"]=`react-auth:${this.sdkVersion}`,this.session.token!==null&&(e.headers.authorization=`Bearer ${this.session.token}`),{...this.defaults,...e}}};import H3 from"jwt-decode";var p1=class{static parse(e){try{return new p1(e)}catch{return null}}constructor(e){this.value=e,this._decoded=H3(e)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}isExpired(e=0){let a=Date.now(),o=(this.expiration-e)*1e3;return a>=o}};var h1=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 w2=class{constructor(){this._cache={}}get(e){return this._cache[e]}put(e,a){a!==void 0?this._cache[e]=a:this.del(e)}del(e){delete this._cache[e]}},y2=class{get(e){let a=localStorage.getItem(e);return a===null?void 0:JSON.parse(a)}put(e,a){a!==void 0?localStorage.setItem(e,JSON.stringify(a)):this.del(e)}del(e){localStorage.removeItem(e)}};function B3(){return typeof window<"u"&&window.localStorage?new y2:new w2}var H=B3();var G3=i=>{var e;return(e=i.map(a=>{if(a.type==="wallet")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3),chainType:a.chain_type}}).filter(a=>a))==null?void 0:e[0]},j3=i=>{var e;return(e=i.map(a=>{if(a.type==="email")return{address:a.address,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},z3=i=>{var e;return(e=i.map(a=>{if(a.type==="phone")return{number:a.phoneNumber,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},$3=i=>{var e;return(e=i.map(a=>{if(a.type==="google_oauth")return{subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},q3=i=>{var e;return(e=i.map(a=>{if(a.type==="twitter_oauth")return{subject:a.subject,username:a.username,name:a.name,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]},K3=i=>{var e;return(e=i.map(a=>{if(a.type==="discord_oauth")return{subject:a.subject,username:a.username,email:a.email,type:a.type,verifiedAt:new Date(a.verified_at*1e3)}}).filter(a=>a))==null?void 0:e[0]};function Q(i){if(!i)return null;let e=j3(i.linked_accounts),a=z3(i.linked_accounts),o=G3(i.linked_accounts),l=$3(i.linked_accounts),n=q3(i.linked_accounts),d=K3(i.linked_accounts);return{id:i.id,createdAt:new Date(i.created_at*1e3),linkedAccounts:[...o?[o]:[],...e?[e]:[],...a?[a]:[],...l?[l]:[],...n?[n]:[],...d?[d]:[]],email:e&&{address:e==null?void 0:e.address},phone:a&&{number:a==null?void 0:a.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletType:o.walletType},google:l&&{subject:l.subject,email:l.email,name:l.name},twitter:n&&{subject:n.subject,username:n.username,name:n.name},discord:d&&{subject:d.subject,username:d.username,email:d.email}}}var n4=()=>"/api/v1/sessions",s4=()=>"/api/v1/sessions/logout",C4=()=>"/api/v1/siwe/init",d4=()=>"/api/v1/siwe/authenticate",c4=()=>"/api/v1/passwordless/init",p4=()=>"/api/v1/passwordless/authenticate",h4=()=>"/api/v1/passwordless_sms/init",f4=()=>"/api/v1/passwordless_sms/authenticate",u4=()=>"/api/v1/oauth/init",m4=()=>"/api/v1/oauth/authenticate",b4=()=>"/api/v1/siwe/unlink",k4=()=>"/api/v1/passwordless/unlink",M4=()=>"/api/v1/passwordless_sms/unlink",g4=()=>"/api/v1/oauth/unlink";var Y3=30,v2="privy:token",Z2="privy:refresh_token",D1=class{constructor(){this.authenticateOnce=new h1(async e=>this._authenticate(e)),this.refreshOnce=new h1(this._refresh.bind(this)),this.destroyOnce=new h1(this._destroy.bind(this))}get token(){let e=H.get(v2);return typeof e=="string"?e:null}get refreshToken(){let e=H.get(Z2);return typeof e=="string"?e:null}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasActiveToken(){let e=p1.parse(this.token);return e!==null&&!e.isExpired(Y3)}authenticate(e){return this.authenticateOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(e){try{let{token:a,refresh_token:o,user:l}=await e.authenticate();return a&&this.storeToken(a),o&&this.storeRefreshToken(o),Q(l)}catch(a){throw console.warn("Error authenticating session"),V(a)}}async _refresh(){if(!this.api)throw new u("Session has no API instance");let e=this.token,a=this.refreshToken;if(!e||!a)return null;try{let o=await this.api.post(n4(),{refresh_token:a});return this.storeToken(o.data.token),this.storeRefreshToken(o.data.refresh_token),Q(o.data.user)}catch(o){throw V(o)}}async _destroy(){var e;try{await((e=this.api)==null?void 0:e.post(s4(),{})),this.destroyLocalState()}catch(a){throw console.warn("Error destroying session"),V(a)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null)}storeToken(e){typeof e=="string"?H.put(v2,e):H.del(v2)}storeRefreshToken(e){typeof e=="string"?H.put(Z2,e):H.del(Z2)}};import{getAddress as e5}from"@ethersproject/address";import y4 from"@walletconnect/web3-provider";var f1=class{constructor(e){this.removeListener=(e,a)=>{if(this._provider)return this._provider.removeListener(e,a)};this.setProvider=e=>{this._provider=e,this._subscriptions.forEach(a=>{var o;(o=this._provider)==null||o.on(a.eventName,a.listener)})};this._provider=e,this._subscriptions=[]}on(e,a){if(this._provider)return this._provider.on(e,a);this._subscriptions.push({eventName:e,listener:a})}request(e){if(!this._provider)throw new D(`A wallet request of type ${e.method} was made to a disconnected wallet: `);return this._provider.request(e)}},u1=class extends f1{constructor(a){super(a)}},U1=class extends f1{constructor(e){super(e)}sendAsync(e,a){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};import{providers as i5}from"ethers";var w4=["metamask","coinbase_wallet","wallet_connect"];import{ethers as J3}from"ethers";var F1=class extends D{constructor(){super("Wallet timeout");this.type="wallet_error"}},x2=i=>{if(i instanceof D)return i;if((i==null?void 0:i.code)&&(i==null?void 0:i.reason)){let e=new m1(i);return i.code===J3.errors.ACTION_REJECTED&&(e.details=a1.E4001_USER_REJECTED_REQUEST),e}return i!=null&&i.code?new m1(i):new D("Unknown connector error",i)},L2=class extends F{constructor(a,o,l){super(a);this.type="provider_error";this.code=o,this.data=l}},m1=class extends L2{constructor(a){var n,d,m;let o=a;super(o.message,o.code,o.data);let l=Object.values(a1).find(k=>k.eipCode===o.code);this.details=l||a1.UNKNOWN_ERROR,o.code===-32002&&((n=o.message)!=null&&n.includes("already pending for origin")?(d=o.message)!=null&&d.includes("wallet_requestPermissions")?this.details=a1.E32002_CONNECTION_ALREADY_PENDING:this.details=a1.E32002_REQUEST_ALREADY_PENDING:(m=o.message)!=null&&m.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=a1.E32002_WALLET_LOCKED))}},X3={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0}},Q3={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}},t5={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}},a1={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...t5,...Q3},E2={...X3,...a1};var A2="privy:wallet_type",V1=(i=new F1,e=r4)=>new Promise((a,o)=>setTimeout(()=>{o(i)},e)),P2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isMetaMask)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isMetaMask)return!0}return!1},_2=()=>{if(!window.ethereum)return!1;if(window.ethereum.isCoinbaseWallet)return!0;if(window.ethereum.providers){for(let i of window.ethereum.providers)if(i.isCoinbaseWallet)return!0}return!1},H1=class{constructor(){this.walletType=null;this.getEthereumProvider=()=>this.ethProvider;this.createSiweMessage=(e,a,o,l,n,d,m)=>`${o} wants you to sign in with your Ethereum account:
2
2
  ${a}
3
3
 
4
4
  ${m}
@@ -9,7 +9,7 @@ Chain ID: ${e}
9
9
  Nonce: ${d}
10
10
  Issued At: ${n}
11
11
  Resources:
12
- - https://privy.io`;this.ethProvider=new f1}initialize(){let e=H.get(A2);w4.includes(e)&&(this.walletType=e,this.connect({showPrompt:!1}))}destroy(){this.walletType=null,H.del(A2)}async connect(e){var a,o;switch(this.walletType){case"metamask":this.ethProvider.setProvider(window.ethereum),(a=window.ethereum.providers)==null||a.forEach(async n=>{n.isMetaMask&&this.ethProvider.setProvider(n)});break;case"coinbase_wallet":this.ethProvider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async n=>{n.isCoinbaseWallet&&this.ethProvider.setProvider(n)});break;case"wallet_connect":let l=new y4({infuraId:k2});this.ethProvider.setProvider(l);break;default:throw new D(`Unsupported wallet: ${this.walletType}`)}return!await this.isConnected()&&e.showPrompt&&await this.promptConnection(this.walletType),this.address()}async isConnected(){switch(this.walletType){case"metamask":return await this.address()!==null;case"coinbase_wallet":return await this.address()!==null;case"wallet_connect":return this.ethProvider.connected;default:throw new D(`Unsupported wallet: ${this.walletType}`)}}async promptConnection(e){try{switch(e){case"metamask":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),V1()]);break;case"coinbase_wallet":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),V1()]);break;case"wallet_connect":let a=new y4({infuraId:k2});this.ethProvider.setProvider(a),await Promise.race([a.enable(),V1()]),H.put(A2,e);break;default:throw new D(`Unsupported wallet: ${this.walletType}`)}}catch(a){throw x2(a)}}async sign(e){let o=new i5.Web3Provider(new u1(this.getEthereumProvider())).getSigner();return Promise.race([o.signMessage(e),V1()]).catch(l=>{throw x2(l)})}prepareMessage(e,a,o){let l=window.location.host,n=window.location.origin,d=`${l} requests that you authenticate with Privy.`,m=new Date().toISOString();return this.createSiweMessage(e,a,l,n,m,o,d)}async chainId(){let e=await this.getEthereumProvider().request({method:"eth_chainId"}),a=Number(e);return String(a)}async address(){let e=await this.getEthereumProvider().request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0?e5(e[0]):null}};var T2,B1=class{constructor(e){let a=e.apiURL||a4,o=e.timeout||l4;this.appId=e.appId,this.connector=new H1,this.connector.initialize(),T2||(T2=new D1),this.session=T2,this.api=new O1(e.appId,this.session,{baseURL:a,timeout:o}),this.session.api=this.api}async authenticate(){if(!this.authFlow)throw new u("No auth flow in progress.");return await this.session.authenticate(this.authFlow)}async logout(){await this.session.destroy(),this.connector.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let a=await this.api.post(k4(),{address:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkPhone(e){try{let a=await this.api.post(M4(),{phoneNumber:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkWallet(e){try{let a=await this.api.post(b4(),{address:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkOAuth(e,a){try{let o=await this.api.post(g4(),{provider:e,subject:a});return Q(o.data)}catch(o){throw V(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(){return this.session.hasActiveToken()?this.session.token: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,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,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw V(e)}}};import{Web3Provider as J6}from"@ethersproject/providers";import{createContext as a5,useContext as o5}from"react";var h=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var S2=a5({ready:!1,authenticated:!1,user:null,login:h,linkEmail:h,linkPhone:h,linkWallet:h,linkGoogle:h,linkTwitter:h,linkDiscord:h,logout:h,getAccessToken:h,getEthereumProvider:h,getEthersProvider:h,getWeb3jsProvider:h,unlinkEmail:h,unlinkPhone:h,unlinkWallet:h,unlinkGoogle:h,unlinkTwitter:h,unlinkDiscord:h}),y=()=>o5(S2);var L1=class{constructor(e){this.connector=e,this.meta={wallet:this.connector.walletType}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.connector.walletType)throw new u("Wallet must be specified");try{let e=await this.connector.connect({showPrompt:!0}),a=await this.connector.chainId(),o=await this.api.post(C4(),{address:e}),l=this.connector.prepareMessage(a,e,o.data.nonce),n=await this.connector.sign(l),d=await this.api.post(d4(),{message:l,signature:n});return{user:d.data.user,token:d.data.token,refresh_token:d.data.refresh_token}}catch(e){throw T(e)}}getEthereumProvider(){return this.connector.getEthereumProvider()}};var x1=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new u("Email and email code must be set prior to calling authenticate.");try{let e=p4(),a=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async sendCodeEmail(e){if(!this.api)throw new u("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new u("Email must be set when initialzing authentication.");try{let a=c4();return(await this.api.post(a,{email:this.meta.email})).data}catch(a){throw T(a)}}};var E1=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new u("phone number and sms code must be set prior to calling authenticate.");try{let e=f4(),a=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async sendSmsCode(e){if(!this.api)throw new u("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new u("phone nNumber must be set when initialzing authentication.");try{let a=h4();return(await this.api.post(a,{phoneNumber:this.meta.phoneNumber})).data}catch(a){throw T(a)}}};var A1=class{constructor(e,a,o){this.meta={provider:e},this.meta.authorizationCode=a,this.meta.stateCode=o}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new u("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");try{let e=m4(),a=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async getAuthorizationUrl(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.provider)throw new u("Provider must be set when initialzing OAuth authentication.");try{let e=u4();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw T(e)}}};import"wicg-inert";import j6 from"react-dom";import Q2 from"styled-components";import{createContext as r5,useContext as n5,useEffect as Z4,useState as L4}from"react";import{jsx as l5}from"react/jsx-runtime";function v4(i){return l5("link",{rel:"prefetch",href:i.src})}import{jsx as s5,jsxs as C5}from"react/jsx-runtime";var x4=r5({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:h,navigateBack:h}),E4=i=>{let e=i.appSettings,a=i.authenticated,o=i.visible,[l,n]=L4(null),[d,m]=L4(null);Z4(()=>{a||n(null)},[a]),Z4(()=>{o||(m("LANDING"),n("LANDING"))},[o]);let k={ready:!!(e!=null&&e.id),app:e,options:i.options,currentScreen:l||"LANDING",lastScreen:d||"LANDING",navigate:b=>{m(l),n(b)},navigateBack:()=>{n(d)}};return C5(x4.Provider,{value:k,children:[e&&e.logoUrl&&s5(v4,{src:e.logoUrl}),i.children]})},f=()=>n5(x4);import{useEffect as X5,useState as Q5}from"react";import t2 from"styled-components";import p5 from"styled-components";import{jsx as A4}from"react/jsx-runtime";var P4=({style:i,...e})=>A4("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",...i},...e,children:A4("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});import{jsx as _4}from"react/jsx-runtime";var T4=({style:i,...e})=>_4("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",...i},...e,children:_4("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});import{createContext as d5,useContext as c5}from"react";var I2=d5({getAuthMeta:h,closePrivyModal:h,initLoginWithWallet:h,loginWithWallet:h,loginWithCode:h,loginWithEmail:h,loginWithSms:h,resendEmailCode:h,resendSmsCode:h,initLoginWithOAuth:h}),g=()=>c5(I2);import{jsx as _,jsxs as W4}from"react/jsx-runtime";var R2=()=>_("div",{}),S4=({backFn:i})=>_("div",{children:_(T4,{onClick:i})}),I4=()=>{let{closePrivyModal:i}=g();return _("div",{children:_("div",{children:_(P4,{onClick:i})})})},h5=()=>{let{app:i}=f();return i!=null&&i.logoUrl?_("div",{children:_("img",{src:i.logoUrl,alt:`${i==null?void 0:i.name} logo`,style:{objectFit:"contain",width:"120px",height:"30px"}})}):null};var v=({backFn:i})=>W4(N4,{children:[i?_(S4,{backFn:i}):_(R2,{}),_(h5,{},"app-name"),_(I4,{})]}),R4=({backFn:i})=>W4(N4,{children:[i?_(S4,{backFn:i}):_(R2,{}),_(R2,{}),_(I4,{})]}),N4=p5.div`
12
+ - https://privy.io`;this.ethProvider=new f1}initialize(){let e=H.get(A2);w4.includes(e)&&(this.walletType=e,this.connect({showPrompt:!1}))}destroy(){this.walletType=null,H.del(A2)}async connect(e){var a,o;switch(this.walletType){case"metamask":this.ethProvider.setProvider(window.ethereum),(a=window.ethereum.providers)==null||a.forEach(async n=>{n.isMetaMask&&this.ethProvider.setProvider(n)});break;case"coinbase_wallet":this.ethProvider.setProvider(window.ethereum),(o=window.ethereum.providers)==null||o.forEach(async n=>{n.isCoinbaseWallet&&this.ethProvider.setProvider(n)});break;case"wallet_connect":let l=new y4({infuraId:k2});this.ethProvider.setProvider(l);break;default:throw new D(`Unsupported wallet: ${this.walletType}`)}return!await this.isConnected()&&e.showPrompt&&await this.promptConnection(this.walletType),this.address()}async isConnected(){switch(this.walletType){case"metamask":return await this.address()!==null;case"coinbase_wallet":return await this.address()!==null;case"wallet_connect":return this.ethProvider.connected;default:throw new D(`Unsupported wallet: ${this.walletType}`)}}async promptConnection(e){try{switch(e){case"metamask":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),V1()]);break;case"coinbase_wallet":await Promise.race([this.ethProvider.request({method:"eth_requestAccounts"}),V1()]);break;case"wallet_connect":let a=new y4({infuraId:k2});this.ethProvider.setProvider(a),await Promise.race([a.enable(),V1()]),H.put(A2,e);break;default:throw new D(`Unsupported wallet: ${this.walletType}`)}}catch(a){throw x2(a)}}async sign(e){let o=new i5.Web3Provider(new u1(this.getEthereumProvider())).getSigner();return Promise.race([o.signMessage(e),V1()]).catch(l=>{throw x2(l)})}prepareMessage(e,a,o){let l=window.location.host,n=window.location.origin,d=`${l} requests that you authenticate with Privy.`,m=new Date().toISOString();return this.createSiweMessage(e,a,l,n,m,o,d)}async chainId(){let e=await this.getEthereumProvider().request({method:"eth_chainId"}),a=Number(e);return String(a)}async address(){let e=await this.getEthereumProvider().request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0?e5(e[0]):null}};var T2,B1=class{constructor(e){let a=e.apiURL||a4,o=e.timeout||l4;this.appId=e.appId,this.connector=new H1,this.connector.initialize(),T2||(T2=new D1),this.session=T2,this.api=new O1(e.appId,this.session,{baseURL:a,timeout:o}),this.session.api=this.api}async authenticate(){if(!this.authFlow)throw new u("No auth flow in progress.");return await this.session.authenticate(this.authFlow)}async logout(){await this.session.destroy(),this.connector.destroy(),this.authFlow=void 0}startAuthFlow(e){e.api=this.api,this.authFlow=e}async unlinkEmail(e){try{let a=await this.api.post(k4(),{address:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkPhone(e){try{let a=await this.api.post(M4(),{phoneNumber:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkWallet(e){try{let a=await this.api.post(b4(),{address:e});return Q(a.data)}catch(a){throw V(a)}}async unlinkOAuth(e,a){try{let o=await this.api.post(g4(),{provider:e,subject:a});return Q(o.data)}catch(o){throw V(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(){return this.session.hasActiveToken()?this.session.token: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,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,createdAt:new Date(e.data.created_at*1e3),updatedAt:new Date(e.data.updated_at*1e3)}}catch(e){throw V(e)}}};import{Web3Provider as J6}from"@ethersproject/providers";import{createContext as a5,useContext as o5}from"react";var h=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var S2=a5({ready:!1,authenticated:!1,user:null,login:h,linkEmail:h,linkPhone:h,linkWallet:h,linkGoogle:h,linkTwitter:h,linkDiscord:h,logout:h,getAccessToken:h,getEthereumProvider:h,getEthersProvider:h,getWeb3jsProvider:h,unlinkEmail:h,unlinkPhone:h,unlinkWallet:h,unlinkGoogle:h,unlinkTwitter:h,unlinkDiscord:h}),y=()=>o5(S2);var L1=class{constructor(e){this.connector=e,this.meta={wallet:this.connector.walletType}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.connector.walletType)throw new u("Wallet must be specified");try{let e=await this.connector.connect({showPrompt:!0}),a=await this.connector.chainId(),o=await this.api.post(C4(),{address:e}),l=this.connector.prepareMessage(a,e,o.data.nonce),n=await this.connector.sign(l),d=await this.api.post(d4(),{message:l,signature:n});return{user:d.data.user,token:d.data.token,refresh_token:d.data.refresh_token}}catch(e){throw T(e)}}getEthereumProvider(){return this.connector.getEthereumProvider()}};var x1=class{constructor(e){this.meta={email:e}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new u("Email and email code must be set prior to calling authenticate.");try{let e=p4(),a=await this.api.post(e,{email:this.meta.email,code:this.meta.emailCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async sendCodeEmail(e){if(!this.api)throw new u("Auth flow has no API instance");if(e&&(this.meta.email=e),!this.meta.email)throw new u("Email must be set when initialzing authentication.");try{let a=c4();return(await this.api.post(a,{email:this.meta.email})).data}catch(a){throw T(a)}}};var E1=class{constructor(e){this.meta={phoneNumber:e}}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new u("phone number and sms code must be set prior to calling authenticate.");try{let e=f4(),a=await this.api.post(e,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async sendSmsCode(e){if(!this.api)throw new u("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),!this.meta.phoneNumber)throw new u("phone nNumber must be set when initialzing authentication.");try{let a=h4();return(await this.api.post(a,{phoneNumber:this.meta.phoneNumber})).data}catch(a){throw T(a)}}};var A1=class{constructor(e,a,o){this.meta={provider:e},this.meta.authorizationCode=a,this.meta.stateCode=o}async authenticate(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new u("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");try{let e=m4(),a=await this.api.post(e,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:a.data.user,token:a.data.token,refresh_token:a.data.refresh_token}}catch(e){throw T(e)}}async getAuthorizationUrl(){if(!this.api)throw new u("Auth flow has no API instance");if(!this.meta.provider)throw new u("Provider must be set when initialzing OAuth authentication.");try{let e=u4();return(await this.api.post(e,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(e){throw T(e)}}};import"wicg-inert";import j6 from"react-dom";import Q2 from"styled-components";import{createContext as r5,useContext as n5,useEffect as Z4,useState as L4}from"react";import{jsx as l5}from"react/jsx-runtime";function v4(i){return l5("link",{rel:"prefetch",href:i.src})}import{jsx as s5,jsxs as C5}from"react/jsx-runtime";var x4=r5({ready:!1,app:null,options:{email:!0,sms:!1,wallet:!0,google:!1,twitter:!1,discord:!1},currentScreen:"LANDING",lastScreen:"LANDING",navigate:h,navigateBack:h}),E4=i=>{let e=i.appSettings,a=i.authenticated,o=i.visible,[l,n]=L4(null),[d,m]=L4(null);Z4(()=>{a||n(null)},[a]),Z4(()=>{o||(m("LANDING"),n("LANDING"))},[o]);let k={ready:!!(e!=null&&e.id),app:e,options:i.options,currentScreen:l||"LANDING",lastScreen:d||"LANDING",navigate:b=>{m(l),n(b)},navigateBack:()=>{n(d)}};return C5(x4.Provider,{value:k,children:[e&&e.logoUrl&&s5(v4,{src:e.logoUrl}),i.children]})},f=()=>n5(x4);import{useEffect as X5,useState as Q5}from"react";import t2 from"styled-components";import p5 from"styled-components";import{jsx as A4}from"react/jsx-runtime";var P4=({style:i,...e})=>A4("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",...i},...e,children:A4("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});import{jsx as _4}from"react/jsx-runtime";var T4=({style:i,...e})=>_4("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",...i},...e,children:_4("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})});import{createContext as d5,useContext as c5}from"react";var I2=d5({getAuthMeta:h,closePrivyModal:h,initLoginWithWallet:h,loginWithWallet:h,loginWithCode:h,loginWithEmail:h,loginWithSms:h,resendEmailCode:h,resendSmsCode:h,initLoginWithOAuth:h}),w=()=>c5(I2);import{jsx as _,jsxs as W4}from"react/jsx-runtime";var R2=()=>_("div",{}),S4=({backFn:i})=>_("div",{children:_(T4,{onClick:i})}),I4=()=>{let{closePrivyModal:i}=w();return _("div",{children:_("div",{children:_(P4,{onClick:i})})})},h5=()=>{let{app:i}=f();return i!=null&&i.logoUrl?_("div",{children:_("img",{src:i.logoUrl,alt:`${i==null?void 0:i.name} logo`,style:{objectFit:"contain",width:"120px",height:"30px"}})}):null};var v=({backFn:i})=>W4(N4,{children:[i?_(S4,{backFn:i}):_(R2,{}),_(h5,{},"app-name"),_(I4,{})]}),R4=({backFn:i})=>W4(N4,{children:[i?_(S4,{backFn:i}):_(R2,{}),_(R2,{}),_(I4,{})]}),N4=p5.div`
13
13
  height: 30px;
14
14
  display: flex;
15
15
  align-items: center;
@@ -80,7 +80,7 @@ Resources:
80
80
  @media (min-width: 441px) {
81
81
  display: none;
82
82
  }
83
- `;import{jsx as Y,jsxs as P1}from"react/jsx-runtime";var z1=()=>{let{navigate:i}=f(),{initLoginWithWallet:e,closePrivyModal:a}=g();return P1(M5,{children:[P1(W2,{onClick:()=>{P2()?(e("metamask"),i("AWAITING_CONNECTION")):U4?(N2("metamask"),a()):i("INSTALL_METAMASK_SCREEN")},children:[Y(o1,{}),Y("span",{children:"Metamask"}),Y("span",{children:P2()?"Connect":"Install"})]}),P1(W2,{onClick:()=>{_2()?(e("coinbase_wallet"),i("AWAITING_CONNECTION")):U4?(N2("coinbase_wallet"),a()):i("INSTALL_COINBASE_WALLET_SCREEN")},children:[Y(b1,{}),P1("span",{children:["Coinbase",Y(j1,{children:" Wallet"})]}),Y("span",{children:_2()?"Connect":"Install"})]}),P1(W2,{onClick:()=>{e("wallet_connect"),i("AWAITING_CONNECTION")},children:[Y(G1,{}),Y("span",{children:"WalletConnect"}),Y("span",{children:"Connect"})]})]})},M5=F4.div`
83
+ `;import{jsx as Y,jsxs as P1}from"react/jsx-runtime";var z1=()=>{let{navigate:i}=f(),{initLoginWithWallet:e,closePrivyModal:a}=w();return P1(M5,{children:[P1(W2,{onClick:()=>{P2()?(e("metamask"),i("AWAITING_CONNECTION")):U4?(N2("metamask"),a()):i("INSTALL_METAMASK_SCREEN")},children:[Y(o1,{}),Y("span",{children:"Metamask"}),Y("span",{children:P2()?"Connect":"Install"})]}),P1(W2,{onClick:()=>{_2()?(e("coinbase_wallet"),i("AWAITING_CONNECTION")):U4?(N2("coinbase_wallet"),a()):i("INSTALL_COINBASE_WALLET_SCREEN")},children:[Y(b1,{}),P1("span",{children:["Coinbase",Y(j1,{children:" Wallet"})]}),Y("span",{children:_2()?"Connect":"Install"})]}),P1(W2,{onClick:()=>{e("wallet_connect"),i("AWAITING_CONNECTION")},children:[Y(G1,{}),Y("span",{children:"WalletConnect"}),Y("span",{children:"Connect"})]})]})},M5=F4.div`
84
84
  display: flex;
85
85
  flex-direction: column;
86
86
  align-items: flex-start;
@@ -198,7 +198,7 @@ Resources:
198
198
  margin-top: auto;
199
199
  gap: 16px;
200
200
  flex-grow: 100;
201
- `;import Y1 from"styled-components";import{jsx as G4}from"react/jsx-runtime";var j4=({style:i,...e})=>G4("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...i},...e,children:G4("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:"white"})});import{jsx as _1,jsxs as E5}from"react/jsx-runtime";var z4=({style:i,...e})=>E5("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...i},...e,children:[_1("g",{clipPath:"url(#clip0)",children:_1("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:"#ffffff"})}),_1("defs",{children:_1("clipPath",{id:"clip0",children:_1("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as K1,jsxs as A5}from"react/jsx-runtime";var $4=({style:i,...e})=>A5("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...i},...e,children:[K1("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"}),K1("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"}),K1("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"}),K1("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as M1,jsxs as I5}from"react/jsx-runtime";var q4=({showGoogle:i,showTwitter:e,showDiscord:a})=>{let{initLoginWithOAuth:o}=g();return I5(P5,{children:[i&&M1(S5,{onClick:()=>{o("google")},children:M1($4,{})}),e&&M1(_5,{onClick:()=>{o("twitter")},children:M1(j4,{})}),a&&M1(T5,{onClick:()=>{o("discord")},children:M1(z4,{})})]})},P5=Y1.div`
201
+ `;import Y1 from"styled-components";import{jsx as G4}from"react/jsx-runtime";var j4=({style:i,...e})=>G4("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...i},...e,children:G4("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:"white"})});import{jsx as _1,jsxs as E5}from"react/jsx-runtime";var z4=({style:i,...e})=>E5("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...i},...e,children:[_1("g",{clipPath:"url(#clip0)",children:_1("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:"#ffffff"})}),_1("defs",{children:_1("clipPath",{id:"clip0",children:_1("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as K1,jsxs as A5}from"react/jsx-runtime";var $4=({style:i,...e})=>A5("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...i},...e,children:[K1("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"}),K1("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"}),K1("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"}),K1("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as M1,jsxs as I5}from"react/jsx-runtime";var q4=({showGoogle:i,showTwitter:e,showDiscord:a})=>{let{initLoginWithOAuth:o}=w();return I5(P5,{children:[i&&M1(S5,{onClick:()=>{o("google")},children:M1($4,{})}),e&&M1(_5,{onClick:()=>{o("twitter")},children:M1(j4,{})}),a&&M1(T5,{onClick:()=>{o("discord")},children:M1(z4,{})})]})},P5=Y1.div`
202
202
  display: flex;
203
203
  flex-direction: row;
204
204
  justify-content: space-between;
@@ -274,7 +274,7 @@ Resources:
274
274
  border-color: var(--fail-light);
275
275
  border-bottom-color: var(--fail-light);
276
276
  }
277
- `;import{isPossiblePhoneNumber as W5}from"libphonenumber-js/min";var X4=i=>!!String(i).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,}))$/),Q4=i=>W5(String(i),"US"),J1=i=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(e,function(o,l,n,d){return l+l+n+n+d+d});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return{r:parseInt((a==null?void 0:a[1])||"00",16),g:parseInt((a==null?void 0:a[2])||"00",16),b:parseInt((a==null?void 0:a[3])||"00",16)}};import{Fragment as B5,jsx as r1,jsxs as D2}from"react/jsx-runtime";var X1=()=>{let[i,e]=O2(""),[a,o]=O2(!1),[l,n]=O2(null),{authenticated:d}=y(),{loginWithEmail:m}=g(),{navigate:k,options:b}=f(),M=b.wallet;O5(()=>{let C=document.querySelector("#email-input");C==null||C.focus()},[]);let R=X4(i);return D2(B5,{children:[D2(D5,{children:[D2(F5,{children:[r1(Y4,{}),r1("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:C=>e(C.target.value),onKeyUp:C=>{C.key==="Enter"&&(o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{(w==null?void 0:w.status)===422?n(w.message):n("Issue submitting email"),o(!1)}))},value:i,autoComplete:"email"})]}),r1(U5,{disabled:a||!R,onClick:()=>{o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{(C==null?void 0:C.status)===422?n(C.message):n("Issue submitting email"),o(!1)})},children:a?r1(l1,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),l?r1(H5,{fail:!!l,children:l||""}):null,!d&&!l&&M?r1(V5,{children:r1("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},D5=T1.div`
277
+ `;import{isPossiblePhoneNumber as W5}from"libphonenumber-js/min";var X4=i=>!!String(i).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,}))$/),Q4=i=>W5(String(i),"US"),J1=i=>{var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(e,function(o,l,n,d){return l+l+n+n+d+d});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return{r:parseInt((a==null?void 0:a[1])||"00",16),g:parseInt((a==null?void 0:a[2])||"00",16),b:parseInt((a==null?void 0:a[3])||"00",16)}};import{Fragment as B5,jsx as r1,jsxs as D2}from"react/jsx-runtime";var X1=()=>{let[i,e]=O2(""),[a,o]=O2(!1),[l,n]=O2(null),{authenticated:d}=y(),{loginWithEmail:m}=w(),{navigate:k,options:b}=f(),g=b.wallet;O5(()=>{let C=document.querySelector("#email-input");C==null||C.focus()},[]);let R=X4(i);return D2(B5,{children:[D2(D5,{children:[D2(F5,{children:[r1(Y4,{}),r1("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:C=>e(C.target.value),onKeyUp:C=>{C.key==="Enter"&&(o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(M=>{(M==null?void 0:M.status)===422?n(M.message):n("Issue submitting email"),o(!1)}))},value:i,autoComplete:"email"})]}),r1(U5,{disabled:a||!R,onClick:()=>{o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{(C==null?void 0:C.status)===422?n(C.message):n("Issue submitting email"),o(!1)})},children:a?r1(l1,{color:"var(--disabled-fg)",style:{height:"1rem",width:"1rem",borderWidth:"2px"}}):"Submit"})]}),l?r1(H5,{fail:!!l,children:l||""}):null,!d&&!l&&g?r1(V5,{children:r1("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},D5=T1.div`
278
278
  display: flex;
279
279
  border: 1px solid #d1d5db;
280
280
  width: 100%;
@@ -358,7 +358,7 @@ Resources:
358
358
  opacity: ${i=>i.success||i.fail?"1":"0"};
359
359
 
360
360
  transition: ${i=>i.fail?"":"all 150ms ease-in-out"};
361
- `;import{useEffect as G5,useState as U2}from"react";import g1 from"styled-components";import{jsx as t3}from"react/jsx-runtime";var e3=({style:i,...e})=>t3("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",...i},...e,children:t3("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"})});import{Fragment as J5,jsx as n1,jsxs as F2}from"react/jsx-runtime";var Q1=()=>{let[i,e]=U2(""),[a,o]=U2(!1),[l,n]=U2(null),{authenticated:d}=y(),{loginWithSms:m}=g(),{navigate:k,options:b}=f(),M=b.wallet;G5(()=>{let C=document.querySelector("#phone-number-input");C==null||C.focus()},[]);let R=Q4(i);return F2(J5,{children:[F2(j5,{children:[F2($5,{children:[n1(e3,{}),n1("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:C=>{e(C.target.value)},onKeyUp:C=>{C.key==="Enter"&&(o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(w=>{(w==null?void 0:w.status)===422?n(w.message):n("Issue submitting phone number"),o(!1)}))},value:i,autoComplete:"tel"})]}),n1(z5,{disabled:a||!R,onClick:()=>{o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{(C==null?void 0:C.status)===422?n(C.message):n("Issue submitting phone number"),o(!1)})},children:a?n1(Y5,{color:"var(--disabled-fg)"}):"Submit"})]}),l?n1(K5,{fail:!!l,children:l||""}):null,!d&&!l&&M?n1(q5,{children:n1("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},j5=g1.div`
361
+ `;import{useEffect as G5,useState as U2}from"react";import g1 from"styled-components";import{jsx as t3}from"react/jsx-runtime";var e3=({style:i,...e})=>t3("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",...i},...e,children:t3("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"})});import{Fragment as J5,jsx as n1,jsxs as F2}from"react/jsx-runtime";var Q1=()=>{let[i,e]=U2(""),[a,o]=U2(!1),[l,n]=U2(null),{authenticated:d}=y(),{loginWithSms:m}=w(),{navigate:k,options:b}=f(),g=b.wallet;G5(()=>{let C=document.querySelector("#phone-number-input");C==null||C.focus()},[]);let R=Q4(i);return F2(J5,{children:[F2(j5,{children:[F2($5,{children:[n1(e3,{}),n1("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:C=>{e(C.target.value)},onKeyUp:C=>{C.key==="Enter"&&(o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(M=>{(M==null?void 0:M.status)===422?n(M.message):n("Issue submitting phone number"),o(!1)}))},value:i,autoComplete:"tel"})]}),n1(z5,{disabled:a||!R,onClick:()=>{o(!0),m(i).then(()=>{k("AWAITING_PASSWORDLESS_CODE")}).catch(C=>{(C==null?void 0:C.status)===422?n(C.message):n("Issue submitting phone number"),o(!1)})},children:a?n1(Y5,{color:"var(--disabled-fg)"}):"Submit"})]}),l?n1(K5,{fail:!!l,children:l||""}):null,!d&&!l&&g?n1(q5,{children:n1("span",{children:"You\u2019ll be able to connect a wallet later."})}):null]})},j5=g1.div`
362
362
  display: flex;
363
363
  border: 1px solid #d1d5db;
364
364
  width: 100%;
@@ -448,7 +448,7 @@ Resources:
448
448
  width: 1rem;
449
449
  border-width: 2px;
450
450
  }
451
- `;import{Fragment as e2,jsx as L,jsxs as e1}from"react/jsx-runtime";var a3=()=>{let{ready:i,authenticated:e,user:a}=y(),{navigate:o,options:l}=f(),n=l.email,d=l.sms,m=l.wallet,k=l.google,b=l.twitter,M=l.discord,R=m?0:1,[C,w]=Q5(R);X5(()=>{var G,I,r;i&&e&&(m&&!((G=a==null?void 0:a.wallet)!=null&&G.address)?o("CONNECT_WALLET_OPTIONAL"):n&&!((I=a==null?void 0:a.email)!=null&&I.address)?o("CONNECT_EMAIL_OPTIONAL"):d&&!((r=a==null?void 0:a.phone)!=null&&r.number)?o("CONNECT_PHONE_NUMBER_OPTIONAL"):k&&!(a!=null&&a.google)||b&&!(a!=null&&a.twitter)||M&&!(a!=null&&a.discord)||(console.error("Launched modal, but nothing left to connect."),o("FULLY_LINKED_SCREEN")))},[i]);let O=C==0,S=C==1;return e1(e2,{children:[L(v,{},"header"),e1(t1,{children:[L(V2,{children:L("h2",{children:"Connect with"})}),m&&L(t6,{active:O,onClick:()=>w(0)}),(n||d)&&L(e6,{active:S,onClick:()=>w(1),email:n,sms:d,google:k,twitter:b,discord:M})]}),L(q,{protectedByPrivy:!0})]})};function t6(i){return e1(o3,{active:i.active,onClick:i.onClick,children:[L(V2,{active:i.active,children:L("h3",{children:"Wallet"})}),i.active&&e1(e2,{children:[L(z1,{}),L($1,{})]})]})}function e6(i){let e=i.google||i.twitter||i.discord,a=i.email?"Email":"Phone";return e1(o3,{active:i.active,onClick:i.onClick,children:[L(V2,{active:i.active,children:L("h3",{children:e?`${a} & Social`:a})}),e1(e2,{children:[i.active&&i.email&&L(X1,{}),i.active&&i.sms&&!i.email&&L(Q1,{}),i.active&&e&&L(i6,{google:i.google,twitter:i.twitter,discord:i.discord})]})]})}function i6(i){return e1(e2,{children:[e1(a6,{children:[L(i3,{}),L("p",{children:" Or "}),L(i3,{})]}),L(q4,{showGoogle:i.google,showDiscord:i.discord,showTwitter:i.twitter})]})}var V2=t2.div`
451
+ `;import{Fragment as e2,jsx as L,jsxs as e1}from"react/jsx-runtime";var a3=()=>{let{ready:i,authenticated:e,user:a}=y(),{navigate:o,options:l}=f(),n=l.email,d=l.sms,m=l.wallet,k=l.google,b=l.twitter,g=l.discord,R=m?0:1,[C,M]=Q5(R);X5(()=>{var G,I,r;i&&e&&(m&&!((G=a==null?void 0:a.wallet)!=null&&G.address)?o("CONNECT_WALLET_OPTIONAL"):n&&!((I=a==null?void 0:a.email)!=null&&I.address)?o("CONNECT_EMAIL_OPTIONAL"):d&&!((r=a==null?void 0:a.phone)!=null&&r.number)?o("CONNECT_PHONE_NUMBER_OPTIONAL"):k&&!(a!=null&&a.google)||b&&!(a!=null&&a.twitter)||g&&!(a!=null&&a.discord)||(console.error("Launched modal, but nothing left to connect."),o("FULLY_LINKED_SCREEN")))},[i]);let O=C==0,S=C==1;return e1(e2,{children:[L(v,{},"header"),e1(t1,{children:[L(V2,{children:L("h2",{children:"Connect with"})}),m&&L(t6,{active:O,onClick:()=>M(0)}),(n||d)&&L(e6,{active:S,onClick:()=>M(1),email:n,sms:d,google:k,twitter:b,discord:g})]}),L(q,{protectedByPrivy:!0})]})};function t6(i){return e1(o3,{active:i.active,onClick:i.onClick,children:[L(V2,{active:i.active,children:L("h3",{children:"Wallet"})}),i.active&&e1(e2,{children:[L(z1,{}),L($1,{})]})]})}function e6(i){let e=i.google||i.twitter||i.discord,a=i.email?"Email":"Phone";return e1(o3,{active:i.active,onClick:i.onClick,children:[L(V2,{active:i.active,children:L("h3",{children:e?`${a} & Social`:a})}),e1(e2,{children:[i.active&&i.email&&L(X1,{}),i.active&&i.sms&&!i.email&&L(Q1,{}),i.active&&e&&L(i6,{google:i.google,twitter:i.twitter,discord:i.discord})]})]})}function i6(i){return e1(e2,{children:[e1(a6,{children:[L(i3,{}),L("p",{children:" Or "}),L(i3,{})]}),L(q4,{showGoogle:i.google,showDiscord:i.discord,showTwitter:i.twitter})]})}var V2=t2.div`
452
452
  font-weight: ${i=>i.active?600:500};
453
453
  color: ${i=>i.active?"inherit":"#6b7280"};
454
454
  display: flex;
@@ -487,7 +487,7 @@ Resources:
487
487
  border-top: 1px solid #d1d5db;
488
488
  margin: 0px 8px;
489
489
  }
490
- `;import{useEffect as l3,useState as i2}from"react";import a2 from"styled-components";import{Fragment as H2,jsx as U,jsxs as S1}from"react/jsx-runtime";var B2=6,r3=new Array(B2).fill(""),o6=1400;var n3=()=>{var X,v1,Z1;let{navigate:i,app:e,options:a}=f(),{closePrivyModal:o,resendEmailCode:l,resendSmsCode:n,getAuthMeta:d,loginWithCode:m}=g(),{authenticated:k,user:b}=y(),[M,R]=i2(r3),[C,w]=i2(!1),[O,S]=i2(null),[G,I]=i2(null),r=a.wallet,s=(X=d())!=null&&X.email?0:1;l3(()=>{if(k&&C){let A=setTimeout(()=>{var N;let Z=!!((N=b==null?void 0:b.wallet)!=null&&N.address);r&&!Z?i("CONNECT_WALLET_OPTIONAL"):o()},z);return()=>clearTimeout(A)}},[k,C,b]),l3(()=>{if(O&&G===0){let A=setTimeout(()=>{R(r3),S(null);let Z=document.querySelector("input[name=code-0]");Z==null||Z.focus()},o6);return()=>clearTimeout(A)}},[O]);let K=A=>{var e4;let Z=A.currentTarget.value.replace(" ","");if(Z==="")return;if(isNaN(Number(Z))){S("Code should be numeric"),I(1);return}S(null),I(null);let N=Number((e4=A.currentTarget.name)==null?void 0:e4.charAt(5)),u2=[...Z||[""]].slice(0,B2-N),m2=[...M.slice(0,N),...u2,...M.slice(N+u2.length)];R(m2);let U3=u2.length,t4=Math.min(Math.max(N+U3,0),B2-1);if(!isNaN(Number(A.currentTarget.value))){let j=document.querySelector(`input[name=code-${t4}]`);j==null||j.focus()}if(m2.every(j=>j&&!isNaN(+j))){let j=document.querySelector(`input[name=code-${t4}]`);j==null||j.blur(),m(m2.join("")).then(()=>w(!0)).catch(b2=>{(b2==null?void 0:b2.status)===422?S("Invalid or expired verification code"):S("Issue verifying code"),I(0)})}A.preventDefault()},E=A=>{G===1&&(S(null),I(null));let Z=[...M.slice(0,A),"",...M.slice(A+1)];if(R(Z),A>0){let N=document.querySelector(`input[name=code-${A-1}]`);N==null||N.focus()}},c1=s==0?`Please check ${(v1=d())==null?void 0:v1.email} for an email from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`:`Please check ${(Z1=d())==null?void 0:Z1.phoneNumber} for a message from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`;return S1(H2,{children:[U(v,{},"header"),S1(l6,{children:[U("p",{children:c1}),S1(r6,{children:[U("div",{children:M.map((A,Z)=>U("input",{name:`code-${Z}`,type:"text",value:M[Z],onChange:K,onKeyUp:N=>{N.key==="Backspace"&&E(Z)},inputMode:"numeric",autoFocus:Z===0,pattern:"[0-9]",className:`${C?"success":""} ${O?"fail":""}`,autoComplete:"one-time-code"},Z))}),U(n6,{fail:!!O,success:C,children:U("span",{children:O||(C?"Success!":"")})})]}),U(s6,{children:s==0?S1(H2,{children:[U("span",{children:"Didn't get an email?"}),U("button",{onClick:l,children:"Resend Code"})]}):S1(H2,{children:[U("span",{children:"Didn't get a message?"}),U("button",{onClick:n,children:"Resend Code"})]})})]}),U(q,{protectedByPrivy:!0})]})},l6=a2.div`
490
+ `;import{useEffect as l3,useState as i2}from"react";import a2 from"styled-components";import{Fragment as H2,jsx as U,jsxs as S1}from"react/jsx-runtime";var B2=6,r3=new Array(B2).fill(""),o6=1400;var n3=()=>{var X,v1,Z1;let{navigate:i,app:e,options:a}=f(),{closePrivyModal:o,resendEmailCode:l,resendSmsCode:n,getAuthMeta:d,loginWithCode:m}=w(),{authenticated:k,user:b}=y(),[g,R]=i2(r3),[C,M]=i2(!1),[O,S]=i2(null),[G,I]=i2(null),r=a.wallet,s=(X=d())!=null&&X.email?0:1;l3(()=>{if(k&&C){let A=setTimeout(()=>{var N;let Z=!!((N=b==null?void 0:b.wallet)!=null&&N.address);r&&!Z?i("CONNECT_WALLET_OPTIONAL"):o()},z);return()=>clearTimeout(A)}},[k,C,b]),l3(()=>{if(O&&G===0){let A=setTimeout(()=>{R(r3),S(null);let Z=document.querySelector("input[name=code-0]");Z==null||Z.focus()},o6);return()=>clearTimeout(A)}},[O]);let K=A=>{var e4;let Z=A.currentTarget.value.replace(" ","");if(Z==="")return;if(isNaN(Number(Z))){S("Code should be numeric"),I(1);return}S(null),I(null);let N=Number((e4=A.currentTarget.name)==null?void 0:e4.charAt(5)),u2=[...Z||[""]].slice(0,B2-N),m2=[...g.slice(0,N),...u2,...g.slice(N+u2.length)];R(m2);let U3=u2.length,t4=Math.min(Math.max(N+U3,0),B2-1);if(!isNaN(Number(A.currentTarget.value))){let j=document.querySelector(`input[name=code-${t4}]`);j==null||j.focus()}if(m2.every(j=>j&&!isNaN(+j))){let j=document.querySelector(`input[name=code-${t4}]`);j==null||j.blur(),m(m2.join("")).then(()=>M(!0)).catch(b2=>{(b2==null?void 0:b2.status)===422?S("Invalid or expired verification code"):S("Issue verifying code"),I(0)})}A.preventDefault()},E=A=>{G===1&&(S(null),I(null));let Z=[...g.slice(0,A),"",...g.slice(A+1)];if(R(Z),A>0){let N=document.querySelector(`input[name=code-${A-1}]`);N==null||N.focus()}},c1=s==0?`Please check ${(v1=d())==null?void 0:v1.email} for an email from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`:`Please check ${(Z1=d())==null?void 0:Z1.phoneNumber} for a message from ${(e==null?void 0:e.name)||"privy.io"} and enter your code below.`;return S1(H2,{children:[U(v,{},"header"),S1(l6,{children:[U("p",{children:c1}),S1(r6,{children:[U("div",{children:g.map((A,Z)=>U("input",{name:`code-${Z}`,type:"text",value:g[Z],onChange:K,onKeyUp:N=>{N.key==="Backspace"&&E(Z)},inputMode:"numeric",autoFocus:Z===0,pattern:"[0-9]",className:`${C?"success":""} ${O?"fail":""}`,autoComplete:"one-time-code"},Z))}),U(n6,{fail:!!O,success:C,children:U("span",{children:O||(C?"Success!":"")})})]}),U(s6,{children:s==0?S1(H2,{children:[U("span",{children:"Didn't get an email?"}),U("button",{onClick:l,children:"Resend Code"})]}):S1(H2,{children:[U("span",{children:"Didn't get a message?"}),U("button",{onClick:n,children:"Resend Code"})]})})]}),U(q,{protectedByPrivy:!0})]})},l6=a2.div`
491
491
  display: flex;
492
492
  flex-direction: column;
493
493
  align-items: flex-start;
@@ -603,7 +603,7 @@ Resources:
603
603
  border: 1px solid #e5e7eb;
604
604
  color: var(--text-dark-blue);
605
605
  }
606
- `;import{Fragment as p6,jsx as s1,jsxs as C3}from"react/jsx-runtime";var c3=()=>{let{user:i}=y(),{closePrivyModal:e}=g();return C6(()=>{var a;if((a=i==null?void 0:i.wallet)!=null&&a.address){let o=setTimeout(()=>{e()},z);return()=>clearTimeout(o)}},[i]),C3(p6,{children:[s1(v,{},"header"),C3(d6,{children:[s1(c6,{children:s1("h3",{children:"Connect Wallet"})}),s1(z1,{}),s1($1,{}),s1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),s1(q,{protectedByPrivy:!0})]})},d6=d3(t1)`
606
+ `;import{Fragment as p6,jsx as s1,jsxs as C3}from"react/jsx-runtime";var c3=()=>{let{user:i}=y(),{closePrivyModal:e}=w();return C6(()=>{var a;if((a=i==null?void 0:i.wallet)!=null&&a.address){let o=setTimeout(()=>{e()},z);return()=>clearTimeout(o)}},[i]),C3(p6,{children:[s1(v,{},"header"),C3(d6,{children:[s1(c6,{children:s1("h3",{children:"Connect Wallet"})}),s1(z1,{}),s1($1,{}),s1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),s1(q,{protectedByPrivy:!0})]})},d6=d3(t1)`
607
607
  gap: 12px;
608
608
  `,c6=d3.div`
609
609
  font-weight: 500;
@@ -625,14 +625,16 @@ Resources:
625
625
  justify-items: center;
626
626
  gap: 8px;
627
627
 
628
- a {
629
- text-decoration: underline;
630
- color: var(--primary-color);
631
- }
628
+ && {
629
+ a {
630
+ text-decoration: underline;
631
+ color: var(--primary-color);
632
+ }
632
633
 
633
- svg {
634
- margin-top: auto;
635
- margin-bottom: auto;
634
+ svg {
635
+ margin-top: auto;
636
+ margin-bottom: auto;
637
+ }
636
638
  }
637
639
  `;import{jsx as p,jsxs as n2}from"react/jsx-runtime";var u3=({style:i,...e})=>n2("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...i},...e,children:[p("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),p("path",{d:"M236.373 144.791L225.206 153.052L227.289 148.181L236.373 144.791Z",fill:"#E17726",stroke:"#E17726",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M210.627 144.791L221.692 153.116L219.711 148.187L210.627 144.785V144.791ZM232.353 163.933L229.377 168.47L235.738 170.219L237.557 164.036L232.347 163.933H232.353ZM209.448 164.036L211.257 170.219L217.602 168.47L214.647 163.933L209.448 164.036Z",fill:"#E27625",stroke:"#E27625",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M217.262 156.27L215.497 158.939L221.783 159.23L221.579 152.46L217.262 156.281V156.27V156.27ZM229.737 156.281L225.351 152.374L225.206 159.23L231.492 158.939L229.732 156.281H229.737ZM217.602 168.475L221.417 166.64L218.14 164.089L217.607 168.475H217.602ZM225.588 166.63L229.377 168.475L228.865 164.084L225.588 166.635V166.63Z",fill:"#E27625",stroke:"#E27625",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M229.377 168.47L225.588 166.635L225.895 169.1L225.862 170.144L229.382 168.47H229.377ZM217.602 168.47L221.137 170.144L221.11 169.1L221.417 166.635L217.602 168.47V168.47Z",fill:"#D5BFB2",stroke:"#D5BFB2",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M221.197 162.448L218.054 161.533L220.282 160.516L221.207 162.453H221.197V162.448ZM225.793 162.448L226.729 160.505L228.962 161.522L225.793 162.459V162.448Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M217.602 168.47L218.156 163.933L214.647 164.035L217.602 168.47V168.47ZM228.844 163.933L229.377 168.47L232.353 164.035L228.844 163.933V163.933ZM231.503 158.939L225.217 159.23L225.793 162.459L226.729 160.505L228.962 161.522L231.503 158.939V158.939ZM218.054 161.533L220.282 160.516L221.207 162.453L221.794 159.224L215.508 158.944L218.059 161.538L218.054 161.533Z",fill:"#CC6228",stroke:"#CC6228",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M215.503 158.939L218.134 164.078L218.048 161.528L215.497 158.934L215.503 158.939ZM228.962 161.533L228.86 164.084L231.492 158.944L228.957 161.538L228.962 161.533ZM221.794 159.23L221.196 162.459L221.945 166.263L222.117 161.242L221.794 159.23ZM225.211 159.23L224.904 161.237L225.055 166.269L225.792 162.453L225.206 159.224V159.235L225.211 159.23Z",fill:"#E27525",stroke:"#E27525",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M225.793 162.448L225.055 166.263L225.588 166.635L228.86 164.084L228.962 161.528L225.793 162.448V162.448ZM218.054 161.528L218.14 164.078L221.417 166.629L221.945 166.263L221.207 162.448L218.048 161.528H218.059H218.054Z",fill:"#F5841F",stroke:"#F5841F",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M225.868 170.144L225.895 169.1L225.604 168.863H221.39L221.11 169.1L221.137 170.144L217.602 168.47L218.845 169.487L221.353 171.215H225.642L228.155 169.482L229.377 168.47L225.857 170.144H225.868V170.144Z",fill:"#C0AC9D",stroke:"#C0AC9D",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M225.588 166.63L225.055 166.264H221.945L221.417 166.635L221.11 169.1L221.39 168.863H225.604L225.895 169.1L225.588 166.635V166.624V166.63Z",fill:"#161616",stroke:"#161616",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M236.846 153.585L237.783 149.037L236.373 144.791L225.583 152.777L229.737 156.27L235.598 157.976L236.889 156.475L236.33 156.066L237.223 155.248L236.545 154.72L237.438 154.042L236.846 153.585H236.857H236.846ZM209.217 149.032L210.17 153.585L209.556 154.037L210.466 154.715L209.787 155.248L210.67 156.066L210.11 156.475L211.402 157.976L217.263 156.275L221.417 152.767L210.627 144.791L209.217 149.032V149.032Z",fill:"#763E1A",stroke:"#763E1A",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("path",{d:"M235.598 157.976L229.737 156.275L231.502 158.934L228.871 164.073L232.353 164.03H237.562L235.598 157.97V157.976ZM217.263 156.27L211.402 157.976L209.448 164.035H214.658L218.14 164.079L215.508 158.939L217.273 156.27H217.263V156.27ZM225.206 159.224L225.588 152.766L227.289 148.176H219.711L221.412 152.766L221.794 159.224L221.939 161.248V166.263H225.055L225.071 161.248L225.206 159.224V159.224Z",fill:"#F5841F",stroke:"#F5841F",strokeWidth:"0.47",strokeLinecap:"round",strokeLinejoin:"round"}),p("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),p("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),p("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"25",fill:"url(#paint0_linear_428_81)"}),p("path",{d:"M77.3677 42.8335H74.102C74.102 36.2519 68.6881 30.9167 62.0091 30.9167C55.4129 30.9167 50.0501 36.1213 49.9189 42.5901C49.7831 49.2769 56.1492 55.0834 62.9357 55.0834H63.7893C69.7724 55.0834 77.7916 50.468 79.0445 44.8444C79.2758 43.8079 78.445 42.8335 77.3677 42.8335ZM57.1562 43.1267C57.1562 44.0068 56.4257 44.7267 55.5325 44.7267C54.6394 44.7267 53.9089 44.0065 53.9089 43.1267V40.5383C53.9089 39.6582 54.6394 38.9383 55.5325 38.9383C56.4257 38.9383 57.1562 39.6582 57.1562 40.5383V43.1267ZM62.794 43.1267C62.794 44.0068 62.0636 44.7267 61.1705 44.7267C60.2773 44.7267 59.5468 44.0065 59.5468 43.1267V40.5383C59.5468 39.6582 60.2776 38.9383 61.1705 38.9383C62.0636 38.9383 62.794 39.6582 62.794 40.5383V43.1267Z",fill:"url(#paint1_linear_428_81)"}),p("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),p("g",{clipPath:"url(#clip0_428_81)",children:p("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),p("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"white"}),p("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M131.626 83.0058C128.674 83.3405 126.5 85.8652 126.5 88.8363V92.0779V103.277V105.099C126.5 108.098 128.713 110.636 131.695 110.952C134.982 111.301 139.216 111.667 142.5 111.667C147.147 111.667 153.695 110.934 156.773 110.555C157.765 110.433 158.5 109.588 158.5 108.589V92.0779C158.5 91.0782 157.765 90.2337 156.773 90.1115C153.705 89.7336 147.189 89.0046 142.545 88.9999L142.5 88.9999L142.46 88.9999C139.655 89.0025 136.165 89.2695 133.166 89.564C132.488 89.5642 131.907 89.0495 131.84 88.3608C131.768 87.6279 132.304 86.9755 133.037 86.9036C136.061 86.6067 139.621 86.3333 142.5 86.3333C145.707 86.3333 149.764 86.6728 152.989 87.007C154.039 87.1159 155.006 87.2247 155.833 87.3221V85.3898C155.833 84.3995 155.112 83.56 154.131 83.4288C151.262 83.0454 145.367 82.3333 141.167 82.3333C138.276 82.3333 134.583 82.6705 131.626 83.0058ZM153.833 102.333C154.938 102.333 155.833 101.438 155.833 100.333C155.833 99.2287 154.938 98.3333 153.833 98.3333C152.729 98.3333 151.833 99.2287 151.833 100.333C151.833 101.438 152.729 102.333 153.833 102.333Z",fill:"#696FFD"}),p("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),p("path",{d:"M269.405 111C278.27 111 285.457 103.837 285.457 95C285.457 86.1634 278.27 79 269.405 79C260.54 79 253.354 86.1634 253.354 95C253.354 103.837 260.54 111 269.405 111Z",fill:"#B9BBFE"}),p("path",{d:"M133.971 24C140.62 24 146.01 18.6274 146.01 12C146.01 5.37258 140.62 0 133.971 0C127.322 0 121.932 5.37258 121.932 12C121.932 18.6274 127.322 24 133.971 24Z",fill:"#B9BBFE"}),p("path",{d:"M15.5917 112C20.5782 112 24.6206 107.971 24.6206 103C24.6206 98.0294 20.5782 94 15.5917 94C10.6051 94 6.56274 98.0294 6.56274 103C6.56274 107.971 10.6051 112 15.5917 112Z",fill:"#B9BBFE"}),p("path",{d:"M152.029 177C157.57 177 162.061 172.523 162.061 167C162.061 161.477 157.57 157 152.029 157C146.488 157 141.997 161.477 141.997 167C141.997 172.523 146.488 177 152.029 177Z",fill:"#E9E9FF"}),p("path",{d:"M263.386 21C267.818 21 271.412 17.4183 271.412 13C271.412 8.58172 267.818 5 263.386 5C258.953 5 255.36 8.58172 255.36 13C255.36 17.4183 258.953 21 263.386 21Z",fill:"#E9E9FF"}),p("path",{d:"M7.06436 36C10.6658 36 13.5853 33.0899 13.5853 29.5C13.5853 25.9101 10.6658 23 7.06436 23C3.46296 23 0.543457 25.9101 0.543457 29.5C0.543457 33.0899 3.46296 36 7.06436 36Z",fill:"#E9E9FF"}),n2("defs",{children:[n2("linearGradient",{id:"paint0_linear_428_81",x1:"64.5",y1:"18",x2:"64.5",y2:"68",gradientUnits:"userSpaceOnUse",children:[p("stop",{stopColor:"#534BB1"}),p("stop",{offset:"1",stopColor:"#551BF9"})]}),n2("linearGradient",{id:"paint1_linear_428_81",x1:"64.5",y1:"30.9167",x2:"64.5",y2:"55.0834",gradientUnits:"userSpaceOnUse",children:[p("stop",{stopColor:"white"}),p("stop",{offset:"1",stopColor:"white",stopOpacity:"0.82"})]}),p("clipPath",{id:"clip0_428_81",children:p("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})]})]});import*as i1 from"react-device-detect";import{Fragment as $2,jsx as c,jsxs as P}from"react/jsx-runtime";var q2=()=>{let{navigate:i}=f(),e="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return i1.isFirefox&&(e="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),P(M3,{children:[P(g3,{children:[c("h3",{children:"Create a wallet with Metamask"}),c(o1,{style:{width:"152px",height:"152px"}})]}),P(z2,{children:[c(y1,{children:P("div",{children:[c("span",{children:"Install the "}),c("a",{href:e,target:"_blank",children:"MetaMask browser extension"})]})}),c(r2,{}),c(y1,{children:"Set up your first wallet"})]}),c(w3,{onClick:()=>i("LANDING"),children:"Done! I have my wallet"})]})},K2=()=>{let{navigate:i}=f();return P(M3,{children:[P(g3,{children:[c("h3",{children:"Create a wallet with Coinbase"}),c(p3,{style:{width:"152px",height:"152px"}})]}),P(z2,{children:[c(y1,{children:"Open the camera on your phone"}),c(r2,{}),c(y1,{children:"Scan the QR code with your camera"}),c(r2,{}),c(y1,{children:"Click the link and download the app"})]}),c(w3,{onClick:()=>i("LANDING"),children:"Done! I have my wallet"})]})},k3=()=>{let[i,e]=m6("WHAT_IS_A_WALLET"),{navigateBack:a}=f();return P($2,{children:[c(v,{backFn:i==="WHAT_IS_A_WALLET"?a:i==="PICK_A_NEW_WALLET"?()=>e("WHAT_IS_A_WALLET"):()=>e("PICK_A_NEW_WALLET")},"header"),P(b6,{children:[i==="WHAT_IS_A_WALLET"&&P($2,{children:[c(j1,{children:c(u3,{style:{width:"100%",height:"auto",borderRadius:"var(--border-radius-sm)"}})}),P(k6,{children:[c("h3",{children:"What is a wallet?"}),c("p",{children:"Wallets are how you can store, send, and receive cryptocurrencies and NFTs. They are also a new way\xA0to\xA0log\xA0in."}),c("p",{children:"Instead of creating new accounts and passwords every time you explore crypto apps, you can just connect\xA0your\xA0wallet."})]}),c(w6,{children:c(y6,{onClick:()=>{e("PICK_A_NEW_WALLET")},children:"Get a Wallet"})})]}),i==="PICK_A_NEW_WALLET"&&c($2,{children:P(M6,{children:[P("div",{children:[c("h3",{children:"Create a new wallet"}),c("p",{children:"Select one the wallet providers below to get started on your web3 adventure."})]}),P(g6,{children:[P(m3,{onClick:()=>{i1.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":i1.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":e("CREATE_METAMASK_WALLET")},children:[c(o1,{}),c(b3,{children:c("h4",{children:"MetaMask"})}),c("div",{children:c("span",{children:"Set up"})})]}),P(m3,{onClick:()=>{i1.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":i1.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":e("CREATE_COINBASE_WALLET")},children:[c(b1,{}),c(b3,{children:c("h4",{children:"Coinbase Wallet"})}),c("div",{children:c("span",{children:"Set up"})})]})]})]})}),i==="CREATE_COINBASE_WALLET"&&c(K2,{}),i==="CREATE_METAMASK_WALLET"&&c(q2,{})]}),P(J,{children:[c("span",{children:"Still not sure? "}),c("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})},b6=B.div`
638
640
  > svg {
@@ -754,7 +756,7 @@ Resources:
754
756
  background-color: #696efd1a;
755
757
  border-radius: var(--border-radius-sm);
756
758
  }
757
- `;import{useEffect as v6}from"react";import y3 from"styled-components";import{Fragment as x6,jsx as I1,jsxs as s2}from"react/jsx-runtime";var v3=()=>{let{user:i}=y(),{closePrivyModal:e}=g(),{app:a}=f();return v6(()=>{var o;if((o=i==null?void 0:i.email)!=null&&o.address){let l=setTimeout(()=>{e()},z);return()=>clearTimeout(l)}},[i]),s2(x6,{children:[I1(v,{},"header"),s2(L6,{children:[I1("h3",{children:"Connect your Email"}),s2("p",{children:["Add your email to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),s2(Z6,{children:[I1(X1,{}),I1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),I1(q,{protectedByPrivy:!0})]})},Z6=y3(t1)`
759
+ `;import{useEffect as v6}from"react";import y3 from"styled-components";import{Fragment as x6,jsx as I1,jsxs as s2}from"react/jsx-runtime";var v3=()=>{let{user:i}=y(),{closePrivyModal:e}=w(),{app:a}=f();return v6(()=>{var o;if((o=i==null?void 0:i.email)!=null&&o.address){let l=setTimeout(()=>{e()},z);return()=>clearTimeout(l)}},[i]),s2(x6,{children:[I1(v,{},"header"),s2(L6,{children:[I1("h3",{children:"Connect your Email"}),s2("p",{children:["Add your email to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),s2(Z6,{children:[I1(X1,{}),I1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),I1(q,{protectedByPrivy:!0})]})},Z6=y3(t1)`
758
760
  gap: 12px;
759
761
  `,L6=y3.div`
760
762
  display: flex;
@@ -774,7 +776,7 @@ Resources:
774
776
  font-size: 18px;
775
777
  color: #111827;
776
778
  }
777
- `;import{useEffect as E6}from"react";import Z3 from"styled-components";import{Fragment as _6,jsx as R1,jsxs as C2}from"react/jsx-runtime";var L3=()=>{let{user:i}=y(),{closePrivyModal:e}=g(),{app:a}=f();return E6(()=>{var o;if((o=i==null?void 0:i.phone)!=null&&o.number){let l=setTimeout(()=>{e()},z);return()=>clearTimeout(l)}},[i]),C2(_6,{children:[R1(v,{},"header"),C2(P6,{children:[R1("h3",{children:"Connect your Phone Number"}),C2("p",{children:["Add your phone to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),C2(A6,{children:[R1(Q1,{}),R1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),R1(q,{protectedByPrivy:!0})]})},A6=Z3.div`
779
+ `;import{useEffect as E6}from"react";import Z3 from"styled-components";import{Fragment as _6,jsx as R1,jsxs as C2}from"react/jsx-runtime";var L3=()=>{let{user:i}=y(),{closePrivyModal:e}=w(),{app:a}=f();return E6(()=>{var o;if((o=i==null?void 0:i.phone)!=null&&o.number){let l=setTimeout(()=>{e()},z);return()=>clearTimeout(l)}},[i]),C2(_6,{children:[R1(v,{},"header"),C2(P6,{children:[R1("h3",{children:"Connect your Phone Number"}),C2("p",{children:["Add your phone to your ",a==null?void 0:a.name," account so they can contact you about your account activity."]})]}),C2(A6,{children:[R1(Q1,{}),R1(w1,{onClick:()=>{e()},className:"hide-on-mobile",children:"I\u2019ll do this later"})]}),R1(q,{protectedByPrivy:!0})]})},A6=Z3.div`
778
780
  display: flex;
779
781
  flex-direction: column;
780
782
  align-items: flex-start;
@@ -798,7 +800,7 @@ Resources:
798
800
  font-size: 18px;
799
801
  color: #111827;
800
802
  }
801
- `;import{useEffect as x3,useState as Y2}from"react";import c2 from"styled-components";import{Fragment as N6,jsx as C1,jsxs as d2}from"react/jsx-runtime";var J2=2,E3={metamask:{name:"MetaMask",component:o1},coinbase_wallet:{name:"Coinbase Wallet",component:b1},wallet_connect:{name:"WalletConnect",component:G1}},A3=()=>{var K;let[i,e]=Y2(!1),[a,o]=Y2(void 0),{navigate:l,navigateBack:n,options:d}=f(),{getAuthMeta:m,closePrivyModal:k,loginWithWallet:b}=g(),[M,R]=Y2(0),{user:C}=y(),w=d.email,O=d.sms;x3(()=>{o(void 0),b().then(()=>e(!0)).catch(E=>{E instanceof F?console.error(E.cause):console.error(E),(E==null?void 0:E.status)===422?o(E2.ERROR_USER_EXISTS):E instanceof m1&&!E.details.default?o(E.details):o(E2.ERROR_WALLET_CONNECTION)})},[M]),x3(()=>{var v1,Z1,A;let E=!!((v1=C==null?void 0:C.wallet)!=null&&v1.address),c1=!!((Z1=C==null?void 0:C.email)!=null&&Z1.address),X=!!((A=C==null?void 0:C.phone)!=null&&A.number);if(E){e(!0);let Z=setTimeout(()=>{w&&!c1?l("CONNECT_EMAIL_OPTIONAL"):O&&!X?l("CONNECT_PHONE_NUMBER_OPTIONAL"):k()},z);return()=>clearTimeout(Z)}},[C]);let S=((K=m())==null?void 0:K.wallet)||"metamask",G=E3[S].name,I=E3[S].component,r=i?`Successfully connected with ${G}`:a?a.message:`Waiting for ${G}`,s="";if(i)s="You\u2019re good to go!";else if(M>=J2&&a)s="Unable to connect wallet";else if(a)s=a.detail;else switch(S){case"wallet_connect":s="Open your mobile wallet app to continue";break;default:s="Don\u2019t see your wallet modal? Check your other browser windows."}return d2(N6,{children:[C1(R4,{backFn:n}),d2(T6,{children:[C1(I6,{children:d2("div",{children:[C1(J4,{success:i,fail:!!a}),C1(I,{style:{width:"38px",height:"38px"}})]})}),d2(S6,{children:[C1("h3",{children:r}),C1("p",{children:s})]}),C1(R6,{onClick:()=>{R(M+1),o(void 0)},visible:!i&&(a==null?void 0:a.retryable)&&M<J2,disabled:!i&&(!(a!=null&&a.retryable)||M>=J2),children:"Retry"})]})]})},T6=c2.div`
803
+ `;import{useEffect as x3,useState as Y2}from"react";import c2 from"styled-components";import{Fragment as N6,jsx as C1,jsxs as d2}from"react/jsx-runtime";var J2=2,E3={metamask:{name:"MetaMask",component:o1},coinbase_wallet:{name:"Coinbase Wallet",component:b1},wallet_connect:{name:"WalletConnect",component:G1}},A3=()=>{var K;let[i,e]=Y2(!1),[a,o]=Y2(void 0),{navigate:l,navigateBack:n,options:d}=f(),{getAuthMeta:m,closePrivyModal:k,loginWithWallet:b}=w(),[g,R]=Y2(0),{user:C}=y(),M=d.email,O=d.sms;x3(()=>{o(void 0),b().then(()=>e(!0)).catch(E=>{E instanceof F?console.error(E.cause):console.error(E),(E==null?void 0:E.status)===422?o(E2.ERROR_USER_EXISTS):E instanceof m1&&!E.details.default?o(E.details):o(E2.ERROR_WALLET_CONNECTION)})},[g]),x3(()=>{var v1,Z1,A;let E=!!((v1=C==null?void 0:C.wallet)!=null&&v1.address),c1=!!((Z1=C==null?void 0:C.email)!=null&&Z1.address),X=!!((A=C==null?void 0:C.phone)!=null&&A.number);if(E){e(!0);let Z=setTimeout(()=>{M&&!c1?l("CONNECT_EMAIL_OPTIONAL"):O&&!X?l("CONNECT_PHONE_NUMBER_OPTIONAL"):k()},z);return()=>clearTimeout(Z)}},[C]);let S=((K=m())==null?void 0:K.wallet)||"metamask",G=E3[S].name,I=E3[S].component,r=i?`Successfully connected with ${G}`:a?a.message:`Waiting for ${G}`,s="";if(i)s="You\u2019re good to go!";else if(g>=J2&&a)s="Unable to connect wallet";else if(a)s=a.detail;else switch(S){case"wallet_connect":s="Open your mobile wallet app to continue";break;default:s="Don\u2019t see your wallet modal? Check your other browser windows."}return d2(N6,{children:[C1(R4,{backFn:n}),d2(T6,{children:[C1(I6,{children:d2("div",{children:[C1(J4,{success:i,fail:!!a}),C1(I,{style:{width:"38px",height:"38px"}})]})}),d2(S6,{children:[C1("h3",{children:r}),C1("p",{children:s})]}),C1(R6,{onClick:()=>{R(g+1),o(void 0)},visible:!i&&(a==null?void 0:a.retryable)&&g<J2,disabled:!i&&(!(a!=null&&a.retryable)||g>=J2),children:"Retry"})]})]})},T6=c2.div`
802
804
  display: flex;
803
805
  flex-direction: column;
804
806
  align-items: center;
@@ -845,7 +847,7 @@ Resources:
845
847
  opacity: ${i=>i.visible?"1":"0"};
846
848
  transition: opacity 200ms;
847
849
  }
848
- `;import{Fragment as W6,jsx as p2,jsxs as P3}from"react/jsx-runtime";var _3=()=>{let{navigateBack:i}=f();return P3(W6,{children:[p2(v,{backFn:i},"header"),p2(q2,{}),P3(J,{children:[p2("span",{children:"Still not sure? "}),p2("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};import{Fragment as O6,jsx as h2,jsxs as T3}from"react/jsx-runtime";var S3=()=>{let{navigateBack:i}=f();return T3(O6,{children:[h2(v,{backFn:i},"header"),h2(K2,{}),T3(J,{children:[h2("span",{children:"Still not sure? "}),h2("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};import{useEffect as D6}from"react";import U6 from"styled-components";import{Fragment as V6,jsx as X2,jsxs as I3}from"react/jsx-runtime";var R3=()=>{let{closePrivyModal:i}=g(),{authenticated:e,ready:a}=y(),{navigate:o}=f();return D6(()=>{a&&!e&&o("LANDING")},[e,a]),I3(V6,{children:[X2(v,{},"header"),I3(F6,{children:[X2("h3",{children:"You're all logged in!"}),X2(o2,{onClick:()=>{i()},children:"Go back to the app"})]})]})},F6=U6(t1)`
850
+ `;import{Fragment as W6,jsx as p2,jsxs as P3}from"react/jsx-runtime";var _3=()=>{let{navigateBack:i}=f();return P3(W6,{children:[p2(v,{backFn:i},"header"),p2(q2,{}),P3(J,{children:[p2("span",{children:"Still not sure? "}),p2("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};import{Fragment as O6,jsx as h2,jsxs as T3}from"react/jsx-runtime";var S3=()=>{let{navigateBack:i}=f();return T3(O6,{children:[h2(v,{backFn:i},"header"),h2(K2,{}),T3(J,{children:[h2("span",{children:"Still not sure? "}),h2("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};import{useEffect as D6}from"react";import U6 from"styled-components";import{Fragment as V6,jsx as X2,jsxs as I3}from"react/jsx-runtime";var R3=()=>{let{closePrivyModal:i}=w(),{authenticated:e,ready:a}=y(),{navigate:o}=f();return D6(()=>{a&&!e&&o("LANDING")},[e,a]),I3(V6,{children:[X2(v,{},"header"),I3(F6,{children:[X2("h3",{children:"You're all logged in!"}),X2(o2,{onClick:()=>{i()},children:"Go back to the app"})]})]})},F6=U6(t1)`
849
851
  gap: 36px;
850
852
  `;import H6 from"styled-components";import{jsx as G6}from"react/jsx-runtime";var N3=i=>{let e=i.accentColor||"#696ffd";return G6(B6,{accentColor:e,children:i.children})},B6=H6.div`
851
853
  /*! Modified from https://unpkg.com/tailwindcss@3.2.3/src/css/preflight.css */
@@ -1189,4 +1191,4 @@ Resources:
1189
1191
  align-items: center;
1190
1192
  justify-content: center;
1191
1193
  height: 100%;
1192
- `;import{Fragment as i7,jsx as N1,jsxs as a7}from"react/jsx-runtime";function X6(i){return typeof i=="string"&&i.length===25}var Q6=i=>{if(!X6(i.appId))throw new u("Cannot initialize the Privy provider with an invalid Privy app ID");let[e,a]=d1(null);return f2(()=>{let o=new B1({appId:i.appId,apiURL:o4});a(o)},[]),e===null?N1(i7,{}):N1(e7,{...i,client:e})},t7=(i,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,[e]:!0};let a=!!(i!=null&&i.emailAuth),o=!!(i!=null&&i.smsAuth);return a&&o&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),o=!1),{email:a,sms:o,wallet:!!(i!=null&&i.walletAuth),google:!!(i!=null&&i.googleOAuth),twitter:!!(i!=null&&i.twitterOAuth),discord:!!(i!=null&&i.discordOAuth)}},e7=i=>{let e=i.client,[a,o]=d1(!1),[l,n]=d1(!1),[d,m]=d1(!1),[k,b]=d1(null),[M,R]=d1({accentColor:"#696ffd",theme:"System",emailAuth:!0,smsAuth:!1,walletAuth:!0,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1}),[C,w]=d1(null);f2(()=>{async function r(){let s=await e.getAppSettings();R(s)}r()},[]);let O=t7(M,C),S=async()=>{var c1;let r=new URLSearchParams(window.location.search),s=r.get("privy_oauth_code"),K=r.get("privy_oauth_state"),E=r.get("privy_oauth_provider");if(s&&K&&s!=="undefined"&&E){e.startAuthFlow(new A1(E,s,K)),w(E);let X=await e.authenticate();return X&&((c1=i.onSuccess)==null||c1.call(i,X)),X}return Promise.resolve(null)};f2(()=>{async function r(){let s;try{s=await S()}catch(K){console.error("Something went wrong initializing Privy OAuth"),console.log(K)}s||(s=await e.getAuthenticatedUser()),m(!!s),b(s),n(!0)}r()},[]),f2(()=>{l&&d&&k===null&&e.getAuthenticatedUser().then(b)},[l,d,k]);let G={ready:l,authenticated:d,user:k,linkWallet:()=>{w("wallet"),o(!0)},linkEmail:()=>{w("email"),o(!0)},linkPhone:()=>{w("sms"),o(!0)},linkGoogle:async()=>{await I.initLoginWithOAuth("google")},linkTwitter:async()=>{await I.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await I.initLoginWithOAuth("discord")},login:()=>{o(!0)},logout:async()=>{await e.logout(),b(null),m(!1),o(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connector.getEthereumProvider(),getEthersProvider:()=>new J6(new u1(e.connector.getEthereumProvider())),getWeb3jsProvider:()=>new U1(e.connector.getEthereumProvider()),unlinkWallet:async r=>{let s=await e.unlinkWallet(r);return b(s),s},unlinkEmail:async r=>{let s=await e.unlinkEmail(r);return b(s),s},unlinkPhone:async r=>{let s=await e.unlinkPhone(r);return b(s),s},unlinkGoogle:async r=>{let s=await e.unlinkOAuth("google",r);return b(s),s},unlinkTwitter:async r=>{let s=await e.unlinkOAuth("twitter",r);return b(s),s},unlinkDiscord:async r=>{let s=await e.unlinkOAuth("discord",r);return b(s),s}},I={getAuthMeta:()=>{var r;return(r=e.authFlow)==null?void 0:r.meta},closePrivyModal:()=>{var r;l&&d&&k&&((r=i.onSuccess)==null||r.call(i,k)),o(!1)},initLoginWithWallet:r=>{r||(r="metamask"),e.connector.walletType=r,e.startAuthFlow(new L1(e.connector))},initLoginWithOAuth:async r=>{e.startAuthFlow(new A1(r));let s=await e.authFlow.getAuthorizationUrl();s&&s.url&&window.location.assign(s.url)},loginWithWallet:async()=>{if(!(e.authFlow instanceof L1))throw new u("Must initialize SIWE flow first.");let r=await e.authenticate();b(r||k||null),m(!0)},loginWithEmail:async r=>{let s=new x1(r);e.startAuthFlow(s),await s.sendCodeEmail()},loginWithSms:async r=>{let s=new E1(r);e.startAuthFlow(s),await s.sendSmsCode()},resendEmailCode:async()=>{var r;await((r=e.authFlow)==null?void 0:r.sendCodeEmail())},resendSmsCode:async()=>{var r;await((r=e.authFlow)==null?void 0:r.sendSmsCode())},loginWithCode:async r=>{if(e.authFlow instanceof x1)e.authFlow.meta.emailCode=r.trim();else if(e.authFlow instanceof E1)e.authFlow.meta.smsCode=r.trim();else throw new u("Must initialize a passwordless code flow first");let s=await e.authenticate();b(s||k||null),m(!0)}};return a7(S2.Provider,{value:G,children:[i.children,N1(I2.Provider,{value:I,children:N1(E4,{appSettings:M,options:O,visible:a,authenticated:d,children:a&&N1(D3,{})})})]})};export{Q6 as PrivyProvider,M2 as VERSION,y as usePrivy};
1194
+ `;import{Fragment as i7,jsx as N1,jsxs as a7}from"react/jsx-runtime";function X6(i){return typeof i=="string"&&i.length===25}var Q6=i=>{if(!X6(i.appId))throw new u("Cannot initialize the Privy provider with an invalid Privy app ID");let[e,a]=d1(null);return f2(()=>{let o=new B1({appId:i.appId,apiURL:o4});a(o)},[]),e===null?N1(i7,{}):N1(e7,{...i,client:e})},t7=(i,e)=>{if(e)return{email:!1,sms:!1,wallet:!1,google:!1,twitter:!1,discord:!1,[e]:!0};let a=!!(i!=null&&i.emailAuth),o=!!(i!=null&&i.smsAuth);return a&&o&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),o=!1),{email:a,sms:o,wallet:!!(i!=null&&i.walletAuth),google:!!(i!=null&&i.googleOAuth),twitter:!!(i!=null&&i.twitterOAuth),discord:!!(i!=null&&i.discordOAuth)}},e7=i=>{let e=i.client,[a,o]=d1(!1),[l,n]=d1(!1),[d,m]=d1(!1),[k,b]=d1(null),[g,R]=d1({accentColor:"#696ffd",theme:"System",emailAuth:!0,smsAuth:!1,walletAuth:!0,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1}),[C,M]=d1(null);f2(()=>{async function r(){let s=await e.getAppSettings();R(s)}r()},[]);let O=t7(g,C),S=async()=>{var c1;let r=new URLSearchParams(window.location.search),s=r.get("privy_oauth_code"),K=r.get("privy_oauth_state"),E=r.get("privy_oauth_provider");if(s&&K&&s!=="undefined"&&E){e.startAuthFlow(new A1(E,s,K)),M(E);let X=await e.authenticate();return X&&((c1=i.onSuccess)==null||c1.call(i,X)),X}return Promise.resolve(null)};f2(()=>{async function r(){let s;try{s=await S()}catch(K){console.error("Something went wrong initializing Privy OAuth"),console.log(K)}s||(s=await e.getAuthenticatedUser()),m(!!s),b(s),n(!0)}r()},[]),f2(()=>{l&&d&&k===null&&e.getAuthenticatedUser().then(b)},[l,d,k]);let G={ready:l,authenticated:d,user:k,linkWallet:()=>{M("wallet"),o(!0)},linkEmail:()=>{M("email"),o(!0)},linkPhone:()=>{M("sms"),o(!0)},linkGoogle:async()=>{await I.initLoginWithOAuth("google")},linkTwitter:async()=>{await I.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await I.initLoginWithOAuth("discord")},login:()=>{o(!0)},logout:async()=>{await e.logout(),b(null),m(!1),M(null),o(!1)},getAccessToken:()=>e.getAccessToken(),getEthereumProvider:()=>e.connector.getEthereumProvider(),getEthersProvider:()=>new J6(new u1(e.connector.getEthereumProvider())),getWeb3jsProvider:()=>new U1(e.connector.getEthereumProvider()),unlinkWallet:async r=>{let s=await e.unlinkWallet(r);return b(s),s},unlinkEmail:async r=>{let s=await e.unlinkEmail(r);return b(s),s},unlinkPhone:async r=>{let s=await e.unlinkPhone(r);return b(s),s},unlinkGoogle:async r=>{let s=await e.unlinkOAuth("google",r);return b(s),s},unlinkTwitter:async r=>{let s=await e.unlinkOAuth("twitter",r);return b(s),s},unlinkDiscord:async r=>{let s=await e.unlinkOAuth("discord",r);return b(s),s}},I={getAuthMeta:()=>{var r;return(r=e.authFlow)==null?void 0:r.meta},closePrivyModal:()=>{var r;l&&d&&k&&((r=i.onSuccess)==null||r.call(i,k)),M(null),o(!1)},initLoginWithWallet:r=>{r||(r="metamask"),e.connector.walletType=r,e.startAuthFlow(new L1(e.connector))},initLoginWithOAuth:async r=>{e.startAuthFlow(new A1(r));let s=await e.authFlow.getAuthorizationUrl();s&&s.url&&window.location.assign(s.url)},loginWithWallet:async()=>{if(!(e.authFlow instanceof L1))throw new u("Must initialize SIWE flow first.");let r=await e.authenticate();b(r||k||null),m(!0)},loginWithEmail:async r=>{let s=new x1(r);e.startAuthFlow(s),await s.sendCodeEmail()},loginWithSms:async r=>{let s=new E1(r);e.startAuthFlow(s),await s.sendSmsCode()},resendEmailCode:async()=>{var r;await((r=e.authFlow)==null?void 0:r.sendCodeEmail())},resendSmsCode:async()=>{var r;await((r=e.authFlow)==null?void 0:r.sendSmsCode())},loginWithCode:async r=>{if(e.authFlow instanceof x1)e.authFlow.meta.emailCode=r.trim();else if(e.authFlow instanceof E1)e.authFlow.meta.smsCode=r.trim();else throw new u("Must initialize a passwordless code flow first");let s=await e.authenticate();b(s||k||null),m(!0)}};return a7(S2.Provider,{value:G,children:[i.children,N1(I2.Provider,{value:I,children:N1(E4,{appSettings:g,options:O,visible:a,authenticated:d,children:a&&N1(D3,{})})})]})};export{Q6 as PrivyProvider,M2 as VERSION,y as usePrivy};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.6.0-beta.10",
3
+ "version": "1.6.0-beta.12",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -87,42 +87,5 @@
87
87
  "directories": {
88
88
  "test": "test"
89
89
  },
90
- "author": "privy.io",
91
- "release": {
92
- "branches": [
93
- "release",
94
- {
95
- "name": "main",
96
- "prerelease": "beta",
97
- "channel": "beta"
98
- }
99
- ],
100
- "plugins": [
101
- "@semantic-release/commit-analyzer",
102
- "@semantic-release/release-notes-generator",
103
- "@semantic-release/npm",
104
- "@semantic-release/github",
105
- [
106
- "@semantic-release/git",
107
- {
108
- "assets": [
109
- "package.json"
110
- ],
111
- "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
112
- }
113
- ],
114
- [
115
- "@saithodev/semantic-release-backmerge",
116
- {
117
- "branches": [
118
- {
119
- "from": "release",
120
- "to": "main"
121
- }
122
- ],
123
- "clearWorkspace": true
124
- }
125
- ]
126
- ]
127
- }
90
+ "author": "privy.io"
128
91
  }