UNPKG

@clerk/clerk-js

Version:
3 lines • 1.91 MB
(()=>{var e={753:function(e,t,a){"use strict";a.d(t,{O1:()=>l,Yt:()=>r,bf:()=>d,cD:()=>i,cc:()=>o,ci:()=>h,gR:()=>p,hz:()=>u,im:()=>c,v_:()=>n,w9:()=>s});let r=["redirect_url","after_sign_in_url","after_sign_up_url","sign_in_force_redirect_url","sign_in_fallback_redirect_url","sign_up_force_redirect_url","sign_up_fallback_redirect_url"],n="__clerk_modal_state",i="__clerk_synced",o="suffixed_cookies",s="__clerk_satellite_url",l={FORM_IDENTIFIER_NOT_FOUND:"form_identifier_not_found",FORM_PASSWORD_INCORRECT:"form_password_incorrect",FORM_PASSWORD_PWNED:"form_password_pwned",INVALID_STRATEGY_FOR_USER:"strategy_for_user_invalid",NOT_ALLOWED_TO_SIGN_UP:"not_allowed_to_sign_up",OAUTH_ACCESS_DENIED:"oauth_access_denied",OAUTH_EMAIL_DOMAIN_RESERVED_BY_SAML:"oauth_email_domain_reserved_by_saml",NOT_ALLOWED_ACCESS:"not_allowed_access",SAML_USER_ATTRIBUTE_MISSING:"saml_user_attribute_missing",USER_LOCKED:"user_locked",EXTERNAL_ACCOUNT_NOT_FOUND:"external_account_not_found",SIGN_UP_MODE_RESTRICTED:"sign_up_mode_restricted",SIGN_UP_MODE_RESTRICTED_WAITLIST:"sign_up_restricted_waitlist",ENTERPRISE_SSO_USER_ATTRIBUTE_MISSING:"enterprise_sso_user_attribute_missing",ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:"enterprise_sso_email_address_domain_mismatch",ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:"enterprise_sso_hosted_domain_mismatch",SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:"saml_email_address_domain_mismatch",INVITATION_ACCOUNT_NOT_EXISTS:"invitation_account_not_exists",ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:"organization_membership_quota_exceeded_for_sso",CAPTCHA_INVALID:"captcha_invalid",FRAUD_DEVICE_BLOCKED:"device_blocked",FRAUD_ACTION_BLOCKED:"action_blocked",SIGNUP_RATE_LIMIT_EXCEEDED:"signup_rate_limit_exceeded"},c=["email_address","phone_number","username"],d=["email_address","phone_number","username","first_name","last_name"],u=350,h={PUBLIC:"public",RESTRICTED:"restricted",WAITLIST:"waitlist"},p="2025-04-10"},4152:function(e,t,a){"use strict";a.d(t,{$C:()=>P,C:()=>p,Dg:()=>o,FI:()=>S,G6:()=>c,HE:()=>d,O7:()=>h,PQ:()=>C,RE:()=>j,Rz:()=>m,WC:()=>b,Ws:()=>y,Xp:()=>i,_5:()=>x,an:()=>n,cT:()=>w,ep:()=>g,k2:()=>l,lb:()=>f,qO:()=>v,qW:()=>_,rn:()=>u,sY:()=>z,xZ:()=>k,yI:()=>s});let r="ClerkJS:";function n(e,t){throw Error(`${r} Network error at "${e}" - ${t}. Please try again.`)}function i(){throw Error(`${r} Something went wrong initializing Clerk.`)}function o(e=""){throw Error(`${r} Something went wrong initializing Clerk in development mode.${e&&` ${e}`}`)}function s(e){throw Error(`${r} Missing path option. The ${e} component was mounted with path routing so you need to specify the path where the component is mounted on e.g. path="/sign-in".`)}function l(e){throw Error(`${r} You must wrap your application in a <${e}> component.`)}function c(){throw Error(`${r} Clerk is undefined`)}function d(){throw Error(`${r} The target element is empty. Provide a valid DOM element.`)}function u(){throw Error(`${r} Missing FAPI client in resources.`)}function h(e){throw Error(`${r} Something went wrong initializing Clerk during the ${e} flow. Please contact support.`)}function p(e){throw Error(`${r} You need to start a ${e} flow by calling ${e}.create() first.`)}function m(e,t){throw Error(`${r} Strategy "${t}" is not a valid strategy for ${e}.`)}function f(e){throw Error(`${r} You need to start a ${e} flow by calling ${e}.create({ identifier: 'your web3 wallet address' }) first`)}function g(){throw Error(`${r} You need to start a SignIn flow by calling SignIn.create({ strategy: 'passkey' }) first`)}function b(e=""){throw Error(`${r} Missing '${e}' option`)}function y(e,t){throw Error(`${r} Response: ${e||0} not supported yet. For more information contact us at ${t}`)}function v(){throw Error(`${r} Missing dev browser jwt. Please contact support.`)}function k(){throw Error(`${r} Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl.`)}function w(){throw Error(`${r} The signInUrl needs to be on a different origin than your satellite application.`)}function x(){throw Error(`${r} The signInUrl needs to have a absolute url format.`)}function _(){throw Error(`${r} Missing signInUrl. A satellite application needs to specify the signInUrl for development instances.`)}function z(){throw Error(`${r} Invalid redirect_url. A valid http or https url should be used for the redirection.`)}function S(e){throw Error(`${r} Unable to retrieve a third party script${e?` ${e}`:""}.`)}function C(e){throw Error(`${r} Invalid routing strategy, path cannot be used in tandem with ${e}.`)}function j(e){throw Error(`${r} Calling ${e}.reload is not currently supported. Please contact support.`)}function P(e){throw Error(`${r} Missing publicKey. When calling 'navigator.credentials.${e}()' it is required to pass a publicKey object.`)}},5:function(e,t,a){"use strict";a.d(t,{Y:()=>i,U:()=>n});var r=a(6225);a(4310);let n={TokenUpdate:"token:update",UserSignOut:"user:signOut",EnvironmentUpdate:"environment:update",SessionTokenResolved:"session:tokenResolved"},i=(0,r.n)()},4843:function(e,t,a){"use strict";a.d(t,{C9:()=>s,iL:()=>i,_G:()=>o,QE:()=>l});var r=a(750),n=a(3139);class i{getPlans=async e=>{let{for:t,...a}=e||{},i={...a,payer_type:"organization"===t?"org":"user"};return await n.i._fetch({path:"/commerce/plans",method:"GET",search:(0,r.C)(i)}).then(e=>{let{data:t,total_count:a}=e;return{total_count:a,data:t.map(e=>new n.Cs(e))}})};getPlan=async e=>{let t=await n.i._fetch({path:`/commerce/plans/${e.id}`,method:"GET"});return new n.Cs(t)};getSubscription=async e=>await n.i._fetch({path:e.orgId?`/organizations/${e.orgId}/commerce/subscription`:"/me/commerce/subscription",method:"GET"}).then(e=>new n.gU(e?.response));getSubscriptions=async e=>{let{orgId:t,...a}=e;return await n.i._fetch({path:t?`/organizations/${t}/commerce/subscriptions`:"/me/commerce/subscriptions",method:"GET",search:(0,r.C)(a)}).then(e=>{let{data:t,total_count:a}=e?.response;return{total_count:a,data:t.map(e=>new n.oq(e))}})};getStatements=async e=>{let{orgId:t,...a}=e;return await n.i._fetch({path:t?`/organizations/${t}/commerce/statements`:"/me/commerce/statements",method:"GET",search:(0,r.C)(a)}).then(e=>{let{data:t,total_count:a}=e?.response;return{total_count:a,data:t.map(e=>new n.j3(e))}})};getStatement=async e=>{let t=(await n.i._fetch({path:e.orgId?`/organizations/${e.orgId}/commerce/statements/${e.id}`:`/me/commerce/statements/${e.id}`,method:"GET"}))?.response;return new n.j3(t)};getPaymentAttempts=async e=>{let{orgId:t,...a}=e;return await n.i._fetch({path:t?`/organizations/${t}/commerce/payment_attempts`:"/me/commerce/payment_attempts",method:"GET",search:(0,r.C)(a)}).then(e=>{let{data:t,total_count:a}=e;return{total_count:a,data:t.map(e=>new n.Pm(e))}})};getPaymentAttempt=async e=>{let t=await n.i._fetch({path:e.orgId?`/organizations/${e.orgId}/commerce/payment_attempts/${e.id}`:`/me/commerce/payment_attempts/${e.id}`,method:"GET"});return new n.Pm(t)};startCheckout=async e=>{let{orgId:t,...a}=e,r=(await n.i._fetch({path:t?`/organizations/${t}/commerce/checkouts`:"/me/commerce/checkouts",method:"POST",body:a}))?.response;return new n.Dl(r,t)}}let o=async e=>{let{orgId:t,...a}=e,r=(await n.i._fetch({path:t?`/organizations/${t}/commerce/payment_sources/initialize`:"/me/commerce/payment_sources/initialize",method:"POST",body:a}))?.response;return new n.zv(r)},s=async e=>{let{orgId:t,...a}=e,r=(await n.i._fetch({path:t?`/organizations/${t}/commerce/payment_sources`:"/me/commerce/payment_sources",method:"POST",body:a}))?.response;return new n.wg(r)},l=async e=>{let{orgId:t,...a}=e;return await n.i._fetch({path:t?`/organizations/${t}/commerce/payment_sources`:"/me/commerce/payment_sources",method:"GET",search:(0,r.C)(a)}).then(e=>{let{data:t,total_count:a}=e?.response;return{total_count:a,data:t.map(e=>new n.wg(e))}})}},104:function(e,t,a){"use strict";a.d(t,{T:()=>i});var r=a(6630),n=a(3139);class i extends n.i{claimedAt=null;reverification=!1;singleSessionMode=!1;preferredChannels=null;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.claimedAt=this.withDefault(e.claimed_at?(0,r.V)(e.claimed_at):null,this.claimedAt),this.reverification=this.withDefault(e.reverification,this.reverification),this.singleSessionMode=this.withDefault(e.single_session_mode,this.singleSessionMode),this.preferredChannels=this.withDefault(e.preferred_channels,this.preferredChannels)),this}__internal_toSnapshot(){return{claimed_at:this.claimedAt?this.claimedAt.getTime():null,id:this.id??"",object:"auth_config",reverification:this.reverification,single_session_mode:this.singleSessionMode}}}},8069:function(e,t,a){"use strict";a.d(t,{i:()=>c});var r=a(2708),n=a(1402),i=a(4152),o=a(7976),s=a(3139);class l{client;CaptchaChallengeImpl;static instance;inflightException=null;captchaRetryCount=0;MAX_RETRY_ATTEMPTS=3;static getInstance(){return l.instance||(l.instance=new l(s.KU,o.E)),l.instance}constructor(e,t){this.client=e,this.CaptchaChallengeImpl=t}async execute(e,t){if(this.captchaAttemptsExceeded())throw new s.w$("Security verification failed. Please try again by refreshing the page, clearing your browser cookies, or using a different web browser.",{code:"captcha_client_attempts_exceeded"});try{return this.inflightException&&await this.inflightException,await t()}catch(r){let a;if(!(0,s.kD)(r)||r.errors[0]?.code!=="requires_captcha")throw r;if(this.inflightException)return await this.inflightException,await t();this.inflightException=new Promise(e=>a=e);try{let t=await this.managedChallenge(e);t?.captchaError!=="modal_component_not_ready"&&(await this.client.getOrCreateInstance().__internal_sendCaptchaToken(t),this.captchaRetryCount=0)}catch(e){throw this.captchaRetryCount++,e}finally{a(),this.inflightException=null}return await t()}}managedChallenge(e){return new this.CaptchaChallengeImpl(e).managedInModal({action:"verify"})}captchaAttemptsExceeded=()=>this.captchaRetryCount>=this.MAX_RETRY_ATTEMPTS}class c{static clerk;id;pathRoot="";static get fapiClient(){return c.clerk.getFapiClient()}async reload(e){let{rotatingTokenNonce:t}=e||{};return this._baseGet({forceUpdateClient:!0,rotatingTokenNonce:t})}isNew(){return!this.id}static async _fetch(e,t={}){return l.getInstance().execute(this.clerk,()=>this._baseFetch(e,t))}static async _baseFetch(e,t={}){let a;c.fapiClient||(0,i.rn)();let{fetchMaxTries:o}=t;try{a=await c.fapiClient.request(e,{fetchMaxTries:o})}catch(e){if(this.shouldRethrowOfflineNetworkErrors())throw new s.w$(e?.message||e,{code:"network_error"});if(!(0,r.af)())return console.warn(e),null;throw e}let{payload:l,status:d,statusText:u,headers:h}=a;if(h){let e=h.get("x-country");this.clerk.__internal_setCountry(e?e.toLowerCase():null)}if(("GET"!==e.method||t.forceUpdateClient)&&this._updateClient(l),d>=200&&d<=299)return l;if(d>=400){let e=l?.errors,t=e?.[0]?.long_message,a=e?.[0]?.code;401===d&&"requires_captcha"!==a&&await c.clerk.handleUnauthenticated(),function(e,t){if(!t||!t[0])return;let a=t[0],r=a.long_message;if("origin_invalid"===a.code&&(0,n.mA)(c.clerk.publishableKey)){let a=c.clerk.frontendApi.replace("clerk.","");throw new s.gO(`Clerk: Production Keys are only allowed for domain "${a}". API Error: ${r}`,{data:t,status:e})}}(d,e);let r={data:e,status:d};if(429===d&&h){let e=h.get("retry-after");if(e){let t=parseInt(e,10);isNaN(t)||(r.retryAfter=t)}}throw new s.gO(t||u,r)}return null}static _updateClient(e){if(!e)return;let t=e.client||e.meta?.client;t&&c.clerk&&c.clerk.updateClient(s.KU.getOrCreateInstance().fromJSON(t))}path(e){let t=this.pathRoot;if(this.isNew())return t;let a=t.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return e?a.replace(/[^/]$/,"$&/")+encodeURIComponent(e):a}withDefault(e,t){return e??t}async _baseGet(e={}){let t=await c._fetch({method:"GET",path:this.path(),rotatingTokenNonce:e.rotatingTokenNonce},e);return this.fromJSON(t?.response||t)}async _baseMutate(e){let{action:t,body:a,method:r,path:n}=e,i=await c._fetch({method:r,path:n||this.path(t),body:a});return this.fromJSON(i?.response||i)}async _baseMutateBypass(e){let{action:t,body:a,method:r,path:n}=e,i=await c._baseFetch({method:r,path:n||this.path(t),body:a});return this.fromJSON(i?.response||i)}async _basePost(e={}){return this._baseMutate({...e,method:"POST"})}async _basePostBypass(e={}){return this._baseMutateBypass({...e,method:"POST"})}async _basePut(e={}){return this._baseMutate({...e,method:"PUT"})}async _basePatch(e={}){return this._baseMutate({...e,method:"PATCH"})}async _baseDelete(e={}){await this._baseMutate({...e,method:"DELETE"})}static shouldRethrowOfflineNetworkErrors(){let e=c.clerk?.__internal_getOption?.("experimental");return e?.rethrowOfflineNetworkErrors||!1}}},9401:function(e,t,a){"use strict";a.d(t,{K:()=>o});var r=a(6630),n=a(7292),i=a(3139);class o extends i.i{static instance;pathRoot="/client";sessions=[];signUp=new i.Mo;signIn=new i.cL;lastActiveSessionId=null;captchaBypass=!1;cookieExpiresAt=null;createdAt=null;updatedAt=null;static getOrCreateInstance(e=null){return o.instance||(o.instance=new o(e)),o.instance}static clearInstance(){o.instance=null}static isClientResource(e){return!!e&&e instanceof o}constructor(e=null){super(),this.fromJSON(e)}get signUpAttempt(){return this.signUp}get signInAttempt(){return this.signIn}get activeSessions(){return this.sessions.filter(e=>"active"===e.status)}get signedInSessions(){return this.sessions.filter(e=>"active"===e.status||"pending"===e.status)}create(){return this._basePut()}fetch({fetchMaxTries:e}={}){return this._baseGet({fetchMaxTries:e})}async destroy(){return this._baseDelete({path:"/client"}).then(()=>{n.O.clear(),this.id="",this.sessions=[],this.signUp=new i.Mo(null),this.signIn=new i.cL(null),this.lastActiveSessionId=null,this.cookieExpiresAt=null,this.createdAt=null,this.updatedAt=null})}removeSessions(){return this._baseDelete({path:this.path()+"/sessions"}).then(e=>(n.O.clear(),e))}clearCache(){return this.sessions.forEach(e=>e.clearCache())}isEligibleForTouch(){return!!this.cookieExpiresAt&&this.cookieExpiresAt.getTime()-Date.now()<=6912e5}buildTouchUrl({redirectUrl:e}){return i.i.fapiClient.buildUrl({method:"GET",path:"/client/touch",pathPrefix:"v1",search:{redirect_url:e.toString()}}).toString()}__internal_sendCaptchaToken(e){return this._basePostBypass({body:e,path:this.path()+"/verify"})}fromJSON(e){return e&&(this.id=e.id,this.sessions=(e.sessions||[]).map(e=>new i.z_(e)),this.signUp=new i.Mo(e.sign_up),this.signIn=new i.cL(e.sign_in),this.lastActiveSessionId=e.last_active_session_id,this.captchaBypass=e.captcha_bypass||!1,this.cookieExpiresAt=e.cookie_expires_at?(0,r.V)(e.cookie_expires_at):null,this.createdAt=(0,r.V)(e.created_at||void 0),this.updatedAt=(0,r.V)(e.updated_at||void 0)),this}__internal_toSnapshot(){return{object:"client",id:this.id||"",sessions:this.sessions.map(e=>e.__internal_toSnapshot()),sign_up:this.signUp.__internal_toSnapshot(),sign_in:this.signIn.__internal_toSnapshot(),last_active_session_id:this.lastActiveSessionId,captcha_bypass:this.captchaBypass,cookie_expires_at:this.cookieExpiresAt?this.cookieExpiresAt.getTime():null,created_at:this.createdAt?.getTime()??null,updated_at:this.updatedAt?.getTime()??null}}path(){return this.pathRoot}}},4498:function(e,t,a){"use strict";a.d(t,{l:()=>n});var r=a(3139);class n extends r.i{afterCreateOrganizationUrl="";afterJoinWaitlistUrl="";afterLeaveOrganizationUrl="";afterSignInUrl="";afterSignOutAllUrl="";afterSignOutOneUrl="";afterSignOutUrl="";afterSignUpUrl="";afterSwitchSessionUrl="";applicationName="";backendHost="";branded=!1;captchaHeartbeat=!1;captchaHeartbeatIntervalMs;captchaOauthBypass=["oauth_google","oauth_microsoft","oauth_apple"];captchaProvider="turnstile";captchaPublicKey=null;captchaPublicKeyInvisible=null;captchaWidgetType=null;clerkJSVersion;createOrganizationUrl="";experimental__forceOauthFirst;faviconImageUrl="";googleOneTapClientId;homeUrl="";id="";instanceEnvironmentType="";logoImageUrl="";organizationProfileUrl="";preferredSignInStrategy="password";privacyPolicyUrl="";showDevModeWarning=!1;signInUrl="";signUpUrl="";supportEmail="";termsUrl="";theme={};userProfileUrl="";waitlistUrl="";constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.afterCreateOrganizationUrl=this.withDefault(e.after_create_organization_url,this.afterCreateOrganizationUrl),this.afterJoinWaitlistUrl=this.withDefault(e.after_join_waitlist_url,this.afterJoinWaitlistUrl),this.afterLeaveOrganizationUrl=this.withDefault(e.after_leave_organization_url,this.afterLeaveOrganizationUrl),this.afterSignInUrl=this.withDefault(e.after_sign_in_url,this.afterSignInUrl),this.afterSignOutAllUrl=this.withDefault(e.after_sign_out_all_url,this.afterSignOutAllUrl),this.afterSignOutOneUrl=this.withDefault(e.after_sign_out_one_url,this.afterSignOutOneUrl),this.afterSignUpUrl=this.withDefault(e.after_sign_up_url,this.afterSignUpUrl),this.afterSwitchSessionUrl=this.withDefault(e.after_switch_session_url,this.afterSwitchSessionUrl),this.applicationName=this.withDefault(e.application_name,this.applicationName),this.branded=this.withDefault(e.branded,this.branded),this.captchaHeartbeat=this.withDefault(e.captcha_heartbeat,this.captchaHeartbeat),this.captchaHeartbeatIntervalMs=this.withDefault(e.captcha_heartbeat_interval_ms,this.captchaHeartbeatIntervalMs),this.captchaOauthBypass=this.withDefault(e.captcha_oauth_bypass,this.captchaOauthBypass),this.captchaProvider=this.withDefault(e.captcha_provider,this.captchaProvider),this.captchaPublicKey=this.withDefault(e.captcha_public_key,this.captchaPublicKey),this.captchaPublicKeyInvisible=this.withDefault(e.captcha_public_key_invisible,this.captchaPublicKeyInvisible),this.captchaWidgetType=this.withDefault(e.captcha_widget_type,this.captchaWidgetType),this.clerkJSVersion=this.withDefault(e.clerk_js_version,this.clerkJSVersion),this.createOrganizationUrl=this.withDefault(e.create_organization_url,this.createOrganizationUrl),this.faviconImageUrl=this.withDefault(e.favicon_image_url,this.faviconImageUrl),this.googleOneTapClientId=this.withDefault(e.google_one_tap_client_id,this.googleOneTapClientId),this.homeUrl=this.withDefault(e.home_url,this.homeUrl),this.id=this.withDefault(e.id,this.id),this.instanceEnvironmentType=this.withDefault(e.instance_environment_type,this.instanceEnvironmentType),this.logoImageUrl=this.withDefault(e.logo_image_url,this.logoImageUrl),this.organizationProfileUrl=this.withDefault(e.organization_profile_url,this.organizationProfileUrl),this.preferredSignInStrategy=this.withDefault(e.preferred_sign_in_strategy,this.preferredSignInStrategy),this.privacyPolicyUrl=this.withDefault(e.privacy_policy_url,this.privacyPolicyUrl),this.showDevModeWarning=this.withDefault(e.show_devmode_warning,this.showDevModeWarning),this.signInUrl=this.withDefault(e.sign_in_url,this.signInUrl),this.signUpUrl=this.withDefault(e.sign_up_url,this.signUpUrl),this.supportEmail=this.withDefault(e.support_email,this.supportEmail),this.termsUrl=this.withDefault(e.terms_url,this.termsUrl),this.theme=this.withDefault(e.theme,this.theme),this.userProfileUrl=this.withDefault(e.user_profile_url,this.userProfileUrl),this.waitlistUrl=this.withDefault(e.waitlist_url,this.waitlistUrl)),this}__internal_toSnapshot(){return{object:"display_config",after_create_organization_url:this.afterCreateOrganizationUrl,after_join_waitlist_url:this.afterJoinWaitlistUrl,after_leave_organization_url:this.afterLeaveOrganizationUrl,after_sign_in_url:this.afterSignInUrl,after_sign_out_all_url:this.afterSignOutAllUrl,after_sign_out_one_url:this.afterSignOutOneUrl,after_sign_up_url:this.afterSignUpUrl,after_switch_session_url:this.afterSwitchSessionUrl,application_name:this.applicationName,branded:this.branded,captcha_heartbeat_interval_ms:this.captchaHeartbeatIntervalMs,captcha_heartbeat:this.captchaHeartbeat,captcha_oauth_bypass:this.captchaOauthBypass,captcha_provider:this.captchaProvider,captcha_public_key_invisible:this.captchaPublicKeyInvisible,captcha_public_key:this.captchaPublicKey,captcha_widget_type:this.captchaWidgetType,clerk_js_version:this.clerkJSVersion,create_organization_url:this.createOrganizationUrl,favicon_image_url:this.faviconImageUrl,google_one_tap_client_id:this.googleOneTapClientId,home_url:this.homeUrl,id:this.id,instance_environment_type:this.instanceEnvironmentType,logo_image_url:this.logoImageUrl,organization_profile_url:this.organizationProfileUrl,preferred_sign_in_strategy:this.preferredSignInStrategy,privacy_policy_url:this.privacyPolicyUrl,show_devmode_warning:this.showDevModeWarning,sign_in_url:this.signInUrl,sign_up_url:this.signUpUrl,support_email:this.supportEmail,terms_url:this.termsUrl,theme:this.theme,user_profile_url:this.userProfileUrl,waitlist_url:this.waitlistUrl}}}},2986:function(e,t,a){"use strict";a.d(t,{b:()=>i});var r=a(6111),n=a(3139);class i extends n.i{id;emailAddress="";matchesSsoConnection=!1;linkedTo=[];verification;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}create(){return this._basePost({body:{email_address:this.emailAddress}})}prepareVerification=e=>this._basePost({action:"prepare_verification",body:{...e}});attemptVerification=e=>{let{code:t}=e||{};return this._basePost({action:"attempt_verification",body:{code:t}})};createEmailLinkFlow=()=>{let{run:e,stop:t}=(0,r.W)();return{startEmailLinkFlow:async({redirectUrl:a})=>(await this.prepareVerification({strategy:"email_link",redirectUrl:a}),new Promise((a,r)=>{e(()=>this.reload().then(e=>{"verified"===e.verification.status&&(t(),a(e))}).catch(e=>{t(),r(e)}))})),cancelEmailLinkFlow:t}};createEnterpriseSSOLinkFlow=()=>{let{run:e,stop:t}=(0,r.W)();return{startEnterpriseSSOLinkFlow:async({redirectUrl:a})=>{if(!(await this.prepareVerification({strategy:"enterprise_sso",redirectUrl:a})).verification.externalVerificationRedirectURL)throw Error("Unexpected: External verification redirect URL is missing");return new Promise((a,r)=>{e(()=>this.reload().then(e=>{"verified"===e.verification.status&&(t(),a(e))}).catch(e=>{t(),r(e)}))})},cancelEnterpriseSSOLinkFlow:t}};destroy=()=>this._baseDelete();toString=()=>this.emailAddress;fromJSON(e){return e&&(this.id=e.id,this.emailAddress=e.email_address,this.verification=new n.GX(e.verification),this.matchesSsoConnection=e.matches_sso_connection,this.linkedTo=(e.linked_to||[]).map(e=>new n.YN(e))),this}__internal_toSnapshot(){return{object:"email_address",id:this.id,email_address:this.emailAddress,verification:this.verification.__internal_toSnapshot(),linked_to:this.linkedTo.map(e=>e.__internal_toSnapshot()),matches_sso_connection:this.matchesSsoConnection}}}},9357:function(e,t,a){"use strict";a.d(t,{q:()=>s});var r=a(5),n=a(3139);class i extends n.i{enabled=!1;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.enabled=this.withDefault(e.enabled,!1)),this}__internal_toSnapshot(){return{enabled:this.enabled}}}class o extends n.i{actions={adminDelete:!1};domains={enabled:!1,enrollmentModes:[],defaultRole:null};enabled=!1;maxAllowedMemberships=1;forceOrganizationSelection;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(e.actions&&(this.actions.adminDelete=this.withDefault(e.actions.admin_delete,this.actions.adminDelete)),e.domains&&(this.domains.enabled=this.withDefault(e.domains.enabled,this.domains.enabled),this.domains.enrollmentModes=this.withDefault(e.domains.enrollment_modes,this.domains.enrollmentModes),this.domains.defaultRole=this.withDefault(e.domains.default_role,this.domains.defaultRole)),this.enabled=this.withDefault(e.enabled,this.enabled),this.maxAllowedMemberships=this.withDefault(e.max_allowed_memberships,this.maxAllowedMemberships),this.forceOrganizationSelection=this.withDefault(e.force_organization_selection,this.forceOrganizationSelection)),this}__internal_toSnapshot(){return{actions:{admin_delete:this.actions.adminDelete},domains:{enabled:this.domains.enabled,enrollment_modes:this.domains.enrollmentModes,default_role:this.domains.defaultRole},enabled:this.enabled,max_allowed_memberships:this.maxAllowedMemberships}}}class s extends n.i{static instance;authConfig=new n.Tg;displayConfig=new n.lR;maintenanceMode=!1;pathRoot="/environment";userSettings=new n.PG;organizationSettings=new o;commerceSettings=new n.mM;apiKeysSettings=new i;static getInstance(){return s.instance||(s.instance=new s),s.instance}constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.authConfig=new n.Tg(e.auth_config),this.displayConfig=new n.lR(e.display_config),this.maintenanceMode=this.withDefault(e.maintenance_mode,this.maintenanceMode),this.organizationSettings=new o(e.organization_settings),this.userSettings=new n.PG(e.user_settings),this.commerceSettings=new n.mM(e.commerce_settings),this.apiKeysSettings=new i(e.api_keys_settings)),this}fetch({touch:e,fetchMaxTries:t}={touch:!1}){return(e?this._basePatch({}):this._baseGet({fetchMaxTries:t})).then(e=>(r.Y.emit(r.U.EnvironmentUpdate,null),e))}isDevelopmentOrStaging=()=>!this.isProduction();isProduction=()=>"production"===this.displayConfig.instanceEnvironmentType;isSingleSession=()=>this.authConfig.singleSessionMode;onWindowLocationHost=()=>this.displayConfig.backendHost===window.location.host;__internal_toSnapshot(){return{object:"environment",auth_config:this.authConfig.__internal_toSnapshot(),display_config:this.displayConfig.__internal_toSnapshot(),id:this.id??"",maintenance_mode:this.maintenanceMode,organization_settings:this.organizationSettings.__internal_toSnapshot(),user_settings:this.userSettings.__internal_toSnapshot(),commerce_settings:this.commerceSettings.__internal_toSnapshot(),api_keys_settings:this.apiKeysSettings.__internal_toSnapshot()}}}},3767:function(e,t,a){"use strict";a.d(t,{G1:()=>r.G1,N:()=>r.N,ZC:()=>r.ZC,_L:()=>r._L,ay:()=>r.ay,gO:()=>r.gO,kD:()=>r.kD,sZ:()=>r.sZ,u$:()=>r.u$,uX:()=>r.uX,w$:()=>r.w$});var r=a(3531)},6516:function(e,t,a){"use strict";a.d(t,{z:()=>o});var r=a(5027),n=a(8069),i=a(9596);class o extends n.i{id;identificationId;provider;providerUserId="";emailAddress="";approvedScopes="";firstName="";lastName="";imageUrl="";username="";phoneNumber="";publicMetadata={};label="";verification=null;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}reauthorize=e=>{let{additionalScopes:t,redirectUrl:a}=e||{};return this._basePatch({action:"reauthorize",body:{additional_scope:t,redirect_url:a}})};destroy=()=>this._baseDelete();fromJSON(e){return e&&(this.id=e.id,this.identificationId=e.identification_id,this.providerUserId=e.provider_user_id,this.approvedScopes=e.approved_scopes,this.imageUrl=e.image_url,this.emailAddress=e.email_address,this.firstName=e.first_name,this.lastName=e.last_name,this.provider=(e.provider||"").replace("oauth_",""),this.username=e.username,this.phoneNumber=e.phone_number,this.publicMetadata=e.public_metadata,this.label=e.label,e.verification&&(this.verification=new i.GX(e.verification))),this}__internal_toSnapshot(){return{object:"external_account",id:this.id,identification_id:this.identificationId,provider:this.provider,provider_user_id:this.providerUserId,email_address:this.emailAddress,approved_scopes:this.approvedScopes,first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl,username:this.username,phone_number:this.phoneNumber,public_metadata:this.publicMetadata,label:this.label,verification:this.verification?.__internal_toSnapshot()||null}}providerSlug(){return this.provider}providerTitle(){return[(0,r.MI)(this.providerSlug()),"Account"].join(" ")}accountIdentifier(){return this.username||this.emailAddress||this.label}}},1956:function(e,t,a){"use strict";a.d(t,{Y:()=>n});var r=a(8069);class n extends r.i{id;type;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.type=e.type),this}__internal_toSnapshot(){return{object:"identification_link",id:this.id,type:this.type}}}},6890:function(e,t,a){"use strict";a.d(t,{E:()=>n});var r=a(3139);class n extends r.i{id;name=null;publicUrl=null;static async create(e,t={}){let a,i=t;return"string"==typeof t.file?(i=t.file,a=new Headers({"Content-Type":"application/octet-stream"})):t.file&&(i=new FormData).append("file",t.file),new n((await r.i._fetch({path:e,method:"POST",body:i,headers:a}))?.response)}static async delete(e){return new n((await r.i._fetch({path:e,method:"DELETE"}))?.response)}constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.publicUrl=e.public_url),this}}},9210:function(e,t,a){"use strict";a.d(t,{B:()=>n});var r=a(3139);class n extends r.i{id;phoneNumber="";reservedForSecondFactor=!1;defaultSecondFactor=!1;linkedTo=[];verification;backupCodes;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}create=()=>this._basePost({body:{phone_number:this.phoneNumber}});prepareVerification=()=>this._basePost({action:"prepare_verification",body:{strategy:"phone_code"}});attemptVerification=e=>{let{code:t}=e||{};return this._basePost({action:"attempt_verification",body:{code:t}})};setReservedForSecondFactor=e=>{let{reserved:t}=e||{};return this._basePatch({body:{reserved_for_second_factor:t}})};makeDefaultSecondFactor=()=>this._basePatch({body:{default_second_factor:!0}});destroy=()=>this._baseDelete();toString=()=>{let e=this.phoneNumber.match(/^(\d{3})(\d{3})(\d{4})$/);return e?"("+e[1]+") "+e[2]+"-"+e[3]:this.phoneNumber};fromJSON(e){return e&&(this.id=e.id,this.phoneNumber=e.phone_number,this.reservedForSecondFactor=e.reserved_for_second_factor,this.defaultSecondFactor=e.default_second_factor,this.verification=new r.GX(e.verification),this.linkedTo=(e.linked_to||[]).map(e=>new r.YN(e)),this.backupCodes=e.backup_codes),this}__internal_toSnapshot(){return{object:"phone_number",id:this.id||"",phone_number:this.phoneNumber,reserved_for_second_factor:this.reservedForSecondFactor,default_second_factor:this.defaultSecondFactor,verification:this.verification.__internal_toSnapshot(),linked_to:this.linkedTo.map(e=>e.__internal_toSnapshot()),backup_codes:this.backupCodes}}}},2724:function(e,t,a){"use strict";a.d(t,{g:()=>o});var r=a(6630),n=a(8069),i=a(9596);class o extends n.i{id;provider="saml_custom";providerUserId=null;active=!1;emailAddress="";firstName="";lastName="";verification=null;samlConnection=null;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.provider=e.provider,this.providerUserId=e.provider_user_id,this.active=e.active,this.emailAddress=e.email_address,this.firstName=e.first_name,this.lastName=e.last_name,e.verification&&(this.verification=new i.GX(e.verification)),e.saml_connection&&(this.samlConnection=new s(e.saml_connection))),this}__internal_toSnapshot(){return{object:"saml_account",id:this.id,provider:this.provider,provider_user_id:this.providerUserId,active:this.active,email_address:this.emailAddress,first_name:this.firstName,last_name:this.lastName,verification:this.verification?.__internal_toSnapshot()||null,saml_connection:this.samlConnection?.__internal_toSnapshot()}}}class s extends n.i{id;name;domain;active;provider;syncUserAttributes;allowSubdomains;allowIdpInitiated;disableAdditionalIdentifications;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.domain=e.domain,this.active=e.active,this.provider=e.provider,this.syncUserAttributes=e.sync_user_attributes,this.allowSubdomains=e.allow_subdomains,this.allowIdpInitiated=e.allow_idp_initiated,this.disableAdditionalIdentifications=e.disable_additional_identifications,this.createdAt=(0,r.V)(e.created_at),this.updatedAt=(0,r.V)(e.updated_at)),this}__internal_toSnapshot(){return{object:"saml_account_connection",id:this.id,name:this.name,domain:this.domain,active:this.active,provider:this.provider,sync_user_attributes:this.syncUserAttributes,allow_subdomains:this.allowSubdomains,allow_idp_initiated:this.allowIdpInitiated,disable_additional_identifications:this.disableAdditionalIdentifications,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}}},7045:function(e,t,a){"use strict";a.d(t,{z:()=>f});var r=a(1353);a(4310);var n=a(3531),i=a(153),o=a(2208),s=a(6630),l=a(3367),c=a(4152),d=a(5),u=a(7292),h=a(3139),p=a(5027);class m extends h.i{status;level;session;supportedFirstFactors=[];supportedSecondFactors=[];firstFactorVerification=new h.GX(null);secondFactorVerification=new h.GX(null);constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.session=new h.z_(e.session),this.level=e.level,this.supportedFirstFactors=(0,p.aw)(e.supported_first_factors),this.supportedSecondFactors=(0,p.aw)(e.supported_second_factors),this.firstFactorVerification=new h.GX(e.first_factor_verification),this.secondFactorVerification=new h.GX(e.second_factor_verification)),this}}class f extends h.i{pathRoot="/client/sessions";id;status;lastActiveAt;lastActiveToken;lastActiveOrganizationId;actor;user;publicUserData;factorVerificationAge=null;tasks=null;expireAt;abandonAt;createdAt;updatedAt;static isSessionResource(e){return!!e&&e instanceof f}constructor(e){super(),this.fromJSON(e),this.#e(this.lastActiveToken)}end=()=>(u.O.clear(),this._basePost({action:"end"}));remove=()=>(u.O.clear(),this._basePost({action:"remove"}));touch=()=>this._basePost({action:"touch",body:{active_organization_id:this.lastActiveOrganizationId}}).then(e=>(e.lastActiveToken&&d.Y.emit(d.U.TokenUpdate,{token:e.lastActiveToken}),e));clearCache=()=>u.O.clear();getToken=async e=>(0,i.X)(()=>this._getToken(e),{factor:1.55,initialDelay:3e3,maxDelayBetweenRetries:5e4,jitter:!1,shouldRetry:(e,t)=>!(0,n.ix)(e)&&t<=8});checkAuthorization=e=>{let t=(this.user?.organizationMemberships||[]).find(e=>e.organization.id===this.lastActiveOrganizationId);return(0,r.QL)({userId:this.user?.id,factorVerificationAge:this.factorVerificationAge,orgId:t?.id,orgRole:t?.role,orgPermissions:t?.permissions,features:this.lastActiveToken?.jwt?.claims.fea||"",plans:this.lastActiveToken?.jwt?.claims.pla||""})(e)};#e=e=>{e&&u.O.set({tokenId:this.#t(),tokenResolver:Promise.resolve(e)})};#t(e,t){let a=void 0===t?this.lastActiveOrganizationId:t;return[this.id,e,a,this.updatedAt.getTime()].filter(Boolean).join("-")}startVerification=async({level:e})=>new m((await h.i._fetch({method:"POST",path:`/client/sessions/${this.id}/verify`,body:{level:e}}))?.response);prepareFirstFactorVerification=async e=>{let t;switch(e.strategy){case"email_code":t={emailAddressId:e.emailAddressId};break;case"phone_code":t={phoneNumberId:e.phoneNumberId,default:e.default};break;case"passkey":t={};break;default:(0,c.Rz)("Session.prepareFirstFactorVerification",e.strategy)}return new m((await h.i._fetch({method:"POST",path:`/client/sessions/${this.id}/verify/prepare_first_factor`,body:{...t,strategy:e.strategy}}))?.response)};attemptFirstFactorVerification=async e=>{let t;return t="passkey"===e.strategy?{publicKeyCredential:JSON.stringify((0,l.zQ)(e.publicKeyCredential))}:{...e},new m((await h.i._fetch({method:"POST",path:`/client/sessions/${this.id}/verify/attempt_first_factor`,body:{...t,strategy:e.strategy}}))?.response)};verifyWithPasskey=async()=>{let{nonce:e=null}=(await this.prepareFirstFactorVerification({strategy:"passkey"})).firstFactorVerification,t=f.clerk.__internal_isWebAuthnSupported||o.iW,a=f.clerk.__internal_getPublicCredentials||l.t1;if(!t())throw new n.RK("Passkeys are not supported",{code:"passkey_not_supported"});let r=e?(0,l.N7)(JSON.parse(e)):null;r||(0,c.$C)("get");let{publicKeyCredential:i,error:s}=await a({publicKeyOptions:r,conditionalUI:!1});if(!i)throw s;return this.attemptFirstFactorVerification({strategy:"passkey",publicKeyCredential:i})};prepareSecondFactorVerification=async e=>new m((await h.i._fetch({method:"POST",path:`/client/sessions/${this.id}/verify/prepare_second_factor`,body:e}))?.response);attemptSecondFactorVerification=async e=>new m((await h.i._fetch({method:"POST",path:`/client/sessions/${this.id}/verify/attempt_second_factor`,body:e}))?.response);fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.expireAt=(0,s.V)(e.expire_at),this.abandonAt=(0,s.V)(e.abandon_at),this.factorVerificationAge=e.factor_verification_age,this.lastActiveAt=(0,s.V)(e.last_active_at||void 0),this.lastActiveOrganizationId=e.last_active_organization_id,this.actor=e.actor||null,this.createdAt=(0,s.V)(e.created_at),this.updatedAt=(0,s.V)(e.updated_at),this.user=new h.n5(e.user),this.tasks=e.tasks||null,e.public_user_data&&(this.publicUserData=new h.VO(e.public_user_data)),this.lastActiveToken=e.last_active_token?new h.WU(e.last_active_token):null),this}__internal_toSnapshot(){return{object:"session",id:this.id,status:this.status,expire_at:this.expireAt.getTime(),abandon_at:this.abandonAt.getTime(),factor_verification_age:this.factorVerificationAge,last_active_at:this.lastActiveAt.getTime(),last_active_organization_id:this.lastActiveOrganizationId,actor:this.actor,tasks:this.tasks,user:this.user?.__internal_toSnapshot()||null,public_user_data:this.publicUserData.__internal_toSnapshot(),last_active_token:this.lastActiveToken?.__internal_toSnapshot()||null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}async _getToken(e){if(!this.user)return null;let{leewayInSeconds:t,template:a,skipCache:r=!1}=e||{},n=void 0===e?.organizationId?this.lastActiveOrganizationId:e?.organizationId;if(!a&&Number(t)>=60)throw Error("Leeway can not exceed the token lifespan (60 seconds)");let i=this.#t(a,n),o=r?void 0:u.O.get({tokenId:i},t),s=!a&&n===this.lastActiveOrganizationId;if(o){let e=await o.tokenResolver;return s&&d.Y.emit(d.U.TokenUpdate,{token:e}),e.getRawString()||null}let l=a?`${this.path()}/tokens/${a}`:`${this.path()}/tokens`,c=h.WU.create(l,a?{}:{organizationId:n});return u.O.set({tokenId:i,tokenResolver:c}),c.then(e=>(s&&(d.Y.emit(d.U.TokenUpdate,{token:e}),e.jwt&&(this.lastActiveToken=e,d.Y.emit(d.U.SessionTokenResolved,null))),e.getRawString()||null))}get currentTask(){let[e]=this.tasks??[];return e}}},8076:function(e,t,a){"use strict";a.d(t,{A:()=>i});var r=a(6630),n=a(3139);class i extends n.i{pathRoot="";id;status;abandonAt;expireAt;lastActiveAt;latestActivity;actor;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}static retrieve(){let e=n.i.clerk.session?.id;return this.clerk.getFapiClient().request({method:"GET",path:"/me/sessions/active",sessionId:e}).then(e=>e.payload.map(e=>new i(e,"/me/sessions"))).catch(()=>[])}revoke(){return this._basePost({action:"revoke",body:{}})}fromJSON(e){let t;return e?(this.id=e.id,this.status=e.status,this.expireAt=(0,r.V)(e.expire_at),this.abandonAt=(0,r.V)(e.abandon_at),this.lastActiveAt=(0,r.V)(e.last_active_at||void 0),this.latestActivity={id:(t=e.latest_activity??{}).id,deviceType:t.device_type,browserName:t.browser_name,browserVersion:t.browser_version,country:t.country,city:t.city,isMobile:t.is_mobile,ipAddress:t.ip_address},this.actor=e.actor,this):this}}},3898:function(e,t,a){"use strict";a.d(t,{c:()=>p});var r=a(3531),n=a(6111),i=a(5027),o=a(2208),s=a(3344),l=a(3837),c=a(3367),d=a(33),u=a(4152),h=a(3139);class p extends h.i{pathRoot="/client/sign_ins";id;status=null;supportedIdentifiers=[];supportedFirstFactors=[];supportedSecondFactors=null;firstFactorVerification=new h.GX(null);secondFactorVerification=new h.GX(null);identifier=null;createdSessionId=null;userData=new h.mt(null);constructor(e=null){super(),this.fromJSON(e)}create=e=>this._basePost({path:this.pathRoot,body:e});resetPassword=e=>this._basePost({body:e,action:"reset_password"});prepareFirstFactor=e=>{let t;switch(e.strategy){case"passkey":t={};break;case"email_link":t={emailAddressId:e.emailAddressId,redirectUrl:e.redirectUrl};break;case"email_code":case"reset_password_email_code":t={emailAddressId:e.emailAddressId};break;case"phone_code":t={phoneNumberId:e.phoneNumberId,default:e.default,channel:e.channel};break;case"web3_metamask_signature":case"web3_coinbase_wallet_signature":case"web3_okx_wallet_signature":t={web3WalletId:e.web3WalletId};break;case"reset_password_phone_code":t={phoneNumberId:e.phoneNumberId};break;case"saml":t={redirectUrl:e.redirectUrl,actionCompleteRedirectUrl:e.actionCompleteRedirectUrl};break;case"enterprise_sso":t={redirectUrl:e.redirectUrl,actionCompleteRedirectUrl:e.actionCompleteRedirectUrl,oidcPrompt:e.oidcPrompt};break;default:(0,u.Rz)("SignIn.prepareFirstFactor",e.strategy)}return this._basePost({body:{...t,strategy:e.strategy},action:"prepare_first_factor"})};attemptFirstFactor=e=>{let t;return t="passkey"===e.strategy?{publicKeyCredential:JSON.stringify((0,c.zQ)(e.publicKeyCredential))}:{...e},this._basePost({body:{...t,strategy:e.strategy},action:"attempt_first_factor"})};createEmailLinkFlow=()=>{let{run:e,stop:t}=(0,n.W)();return{startEmailLinkFlow:async({emailAddressId:a,redirectUrl:r})=>(this.id||(0,u.C)("SignIn"),await this.prepareFirstFactor({strategy:"email_link",emailAddressId:a,redirectUrl:r}),new Promise((a,r)=>{e(()=>this.reload().then(e=>{let r=e.firstFactorVerification.status;("verified"===r||"expired"===r)&&(t(),a(e))}).catch(e=>{t(),r(e)}))})),cancelEmailLinkFlow:t}};prepareSecondFactor=e=>this._basePost({body:e,action:"prepare_second_factor"});attemptSecondFactor=e=>this._basePost({body:e,action:"attempt_second_factor"});authenticateWithRedirectOrPopup=async(e,t)=>{let{strategy:a,redirectUrl:r,redirectUrlComplete:n,identifier:i,oidcPrompt:o,continueSignIn:l}=e||{},c=p.clerk.buildUrlWithAuth(r),d=p.clerk.__internal_hasAfterAuthFlows?(0,s.KV)({base:c,search:`?redirect_url=${n}`}).toString():n;this.id&&l||await this.create({strategy:a,identifier:i,redirectUrl:c,actionCompleteRedirectUrl:d}),("saml"===a||"enterprise_sso"===a)&&await this.prepareFirstFactor({strategy:a,redirectUrl:p.clerk.buildUrlWithAuth(r),actionCompleteRedirectUrl:d,oidcPrompt:o});let{status:h,externalVerificationRedirectURL:m}=this.firstFactorVerification;"unverified"===h&&m?t(m):(0,u.Ws)(h,p.fapiClient.buildEmailAddress("support"))};authenticateWithRedirect=async e=>this.authenticateWithRedirectOrPopup(e,s.T7);authenticateWithPopup=async e=>{let{popup:t}=e||{};return t||(0,u.WC)("popup"),(0,l.G)(p.clerk,"signIn",this.authenticateWithRedirectOrPopup,e,e=>{t.location.href=e.toString()})};authenticateWithWeb3=async e=>{let t,{identifier:a,generateSignature:r,strategy:n="web3_metamask_signature"}=e||{},i=n.replace("web3_","").replace("_signature","");"function"!=typeof r&&(0,u.WC)("generateSignature"),await this.create({identifier:a});let o=this.supportedFirstFactors?.find(e=>e.strategy===n);o||(0,u.lb)("SignIn"),await this.prepareFirstFactor(o);let{message:s}=this.firstFactorVerification;s||(0,u.lb)("SignIn");try{t=await r({identifier:a,nonce:s,provider:i})}catch(e){if("coinbase_wallet"===i&&4001===e.code)t=await r({identifier:a,nonce:s,provider:i});else throw e}return this.attemptFirstFactor({signature:t,strategy:n})};authenticateWithMetamask=async()=>{let e=await (0,s.M8)();return this.authenticateWithWeb3({identifier:e,generateSignature:s.wO,strategy:"web3_metamask_signature"})};authenticateWithCoinbaseWallet=async()=>{let e=await (0,s.$0)();return this.authenticateWithWeb3({identifier:e,generateSignature:s.dR,strategy:"web3_coinbase_wallet_signature"})};authenticateWithOKXWallet=async()=>{let e=await (0,s.ZE)();return this.authenticateWithWeb3({identifier:e,generateSignature:s.C3,strategy:"web3_okx_wallet_signature"})};authenticateWithPasskey=async e=>{let{flow:t}=e||{},a=p.clerk.__internal_isWebAuthnSupported||o.iW,n=p.clerk.__internal_getPublicCredentials||c.t1,i=p.clerk.__internal_isWebAuthnAutofillSupported||o.h_;if(!a())throw new r.RK("Passkeys are not supported",{code:"passkey_not_supported"});if("autofill"===t||"discoverable"===t)await this.create({strategy:"passkey"});else{let e=this.supportedFirstFactors.find(e=>"passkey"===e.strategy);e||(0,u.ep)(),await this.prepareFirstFactor(e)}let{nonce:s}=this.firstFactorVerification,l=s?(0,c.N7)(JSON.parse(s)):null;l||(0,u.$C)("get");let d=!1;"autofill"===t&&(d=await i());let{publicKeyCredential:h,error:m}=await n({publicKeyOptions:l,conditionalUI:d});if(!h)throw m;return this.attemptFirstFactor({publicKeyCredential:h,strategy:"passkey"})};validatePassword=(e,t)=>{if(p.clerk.__unstable__environment?.userSettings.passwordSettings)return(0,d.z)({...p.clerk.__unstable__environment?.userSettings.passwordSettings,validatePassword:!0})(e,t)};fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.supportedIdentifiers=e.supported_identifiers,this.identifier=e.identifier,this.supportedFirstFactors=(0,i.aw)(e.supported_first_factors),this.supportedSecondFactors=(0,i.aw)(e.supported_second_factors),this.firstFactorVerification=new h.GX(e.first_factor_verification),this.secondFactorVerification=new h.GX(e.second_factor_verification),this.createdSessionId=e.created_session_id,this.userData=new h.mt(e.user_data)),this}__internal_toSnapshot(){return{object:"sign_in",id:this.id||"",status:this.status||null,supported_identifiers:this.supportedIdentifiers,supported_first_factors:(0,i.zb)(this.supportedFirstFactors),supported_second_factors:(0,i.zb)(this.supportedSecondFactors),first_factor_verification:this.firstFactorVerification.__internal_toSnapshot(),second_factor_verification:this.secondFactorVerification.__internal_toSnapshot(),identifier:this.identifier,created_session_id:this.createdSessionId,user_data:this.userData.__internal_toSnapshot()}}}},240:function(e,t,a){"use strict";a.d(t,{M:()=>h});var r=a(3531),n=a(6111),i=a(3344),o=a(3837),s=a(7976),l=a(33),c=a(6310),d=a(4152),u=a(3139);class h extends u.i{pathRoot="/client/sign_ups";id;status=null;requiredFields=[];optionalFields=[];missingFields=[];unverifiedFields=[];verifications=new u.EJ(null);username=null;firstName=null;lastName=null;emailAddress=null;phoneNumber=null;web3wallet=null;externalAccount;hasPassword=!1;unsafeMetadata={};createdSessionId=null;createdUserId=null;abandonAt=null;legalAcceptedAt=null;constructor(e=null){super(),this.fromJSON(e)}create=async e=>{let t=e;if(!this.clientBypass()&&!this.shouldBypassCaptchaForAttempt(t)){let e=new s.E(h.clerk),a=await e.managedOrInvisible({action:"signup"});if(!a)throw new u.w$("",{code:"captcha_unavailable"});t={...t,...a}}return t.transfer&&this.shouldBypassCaptchaForAttempt(t)&&(t.strategy=h.clerk.client?.signIn.firstFactorVerification.strategy),this._basePost({path:this.pathRoot,body:(0,c.q)(t)})};prepareVerification=e=>this._basePost({body:e,action:"prepare_verification"});attemptVerification=e=>this._basePost({body:e,action:"attempt_verification"});prepareEmailAddressVerification=e=>this.prepareVerification(e||{strategy:"email_code"});attemptEmailAddressVerification=e=>this.attemptVerification({...e,strategy:"email_code"});createEmailLinkFlow=()=>{let{run:e,stop:t}=(0,n.W)();return{startEmailLinkFlow:async({redirectUrl:a})=>(this.id||(0,d.C)("SignUp"),await this.prepareEmailAddressVerification({strategy:"email_link",redirectUrl:a}),new Promise((a,r)=>{e(()=>this.reload().then(e=>{let r=e.verifications.emailAddress.status;("verified"===r||"expired"===r)&&(t(),a(e))}).catch(e=>{t(),r(e)}))})),cancelEmailLinkFlow:t}};preparePhoneNumberVerification=e=>this.prepareVerification(e||{strategy:"phone_code"});attemptPhoneNumberVerification=e=>this.attemptVerification({...e,strategy:"phone_code"});prepareWeb3WalletVerification=e=>this.prepareVerification({strategy:"web3_metamask_signature",...e});attemptWeb3WalletVerification=async e=>{let{signature:t,strategy:a="web3_metamask_signature"}=e;return this.attemptVerification({signature:t,strategy:a})};authenticateWithWeb3=async e=>{let t,{generateSignature:a,identifier:r,unsafeMetadata:n,strategy:i="web3_metamask_signature",legalAccepted:o}=e||{},s=i.replace("web3_","").replace("_signature","");"function"!=typeof a&&(0,d.WC)("generateSignature");let l=r||this.web3wallet;await this.create({web3Wallet:l,unsafeMetadata:n,legalAccepted:o}),await this.prepareWeb3WalletVerification({strategy:i});let{message:c}=this.verifications.web3Wallet;c||(0,d.lb)("SignUp");try{t=await a({identifier:r,nonce:c,provider:s})}catch(e){if("coinbase_wallet"===s&&4001===e.code)t=await a({identifier:r,nonce:c,provider:s});else throw e}return this.attemptWeb3WalletVerification({signature:t,strategy:i})};authenticateWithMetamask=async e=>{let t=await (0,i.M8)();return this.authenticateWithWeb3({identifier:t,generateSignature:i.wO,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_metamask_signature",legalAccepted:e?.legalAccepted})};authenticateWithCoinbaseWallet=async e=>{let t=await (0,i.$0)();return this.authenticateWithWeb3({identifier:t,generateSignature:i.dR,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_coinbase_wallet_signature",legalAccepted:e?.legalAccepted})};authenticateWithOKXWallet=async e=>{let t=await (0,i.ZE)();return this.authenticateWithWeb3({identifier:t,generateSignature:i.C3,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_okx_wallet_signature",legalAccepted:e?.legalAccepted})};authenticateWithRedirectOrPopup=async(e,t)=>{let{redirectUrl:a,redirectUrlComplete:n,strategy:i,continueSignUp:o=!1,unsafeMetadata:s,emailAddress:l,legalAccepted:c,oidcPrompt:u}=e,p=h.clerk.buildUrlWithAuth(a),m=h.clerk.__internal_hasAfterAuthFlows?p:n,f=()=>{let e={strategy:i,redirectUrl:p,actionCompleteRedirectUrl:m,unsafeMetadata:s,emailAddress:l,legalAccepted:c,oidcPrompt:u};return o&&this.id?this.update(e):this.create(e)},{verifications:g}=await f().catch(async e=>{if((0,r.kD)(e)&&(0,r.pG)(e))return await h.clerk.__unstable__environment.reload(),f();throw e}),{externalAccount:b}=g,{status:y,externalVerificationRedirectURL:v}=b;"unverified"===y&&v?t(v):(0,d.Ws)(y,h.fapiClient.buildEmailAddress("support"))};authenticateWithRedirect=async e=>this.authenticateWithRedirectOrPopup(e,i.T7);authenticateWithPopup=async e=>{let{popup:t}=e||{};return t||(0,d.WC)("popup"),(0,o.G)(h.clerk,"signUp",this.authenticateWithRedirectOrPopup,e,e=>{t.location.href=e instanceof URL?e.toString():e})};update=e=>this._basePatch({body:(0,c.q)(e)});upsert=e=>this.id?this.update(e):this.create(e);validatePassword=(e,t)=>{if(h.clerk.__unstable__environment?.userSettings.passwordSettings)return(0,l.z)({...h.clerk.__unst