PageSourceSearch

https://clerk.copilotkit.ai/npm/@clerk/[email protected]/dist/clerk.headless.browser.js

js copilotkit.ai collected 2026-10-02 03:04:54 UTC 270,273 bytes, 19 lines download raw bytes

1!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(globalThis,()=>(()=>{var e={5056:function(e,t,i){"use strict";let n,r,s;try{let e=new URL(document.currentScript.src),t=new URL(e.href.split("/").slice(0,-1).join("/")).href;i.p=(t+=t.endsWith("/")?"":"/").replace(/(^.*\/@clerk\/clerk-js@)(.+?)(\/dist.*)/,"$15.128.0$3")}catch{}function a(){return"undefined"!=typeof window}i(4096);let o=RegExp("bot|spider|crawl|APIs-Google|AdsBot|Googlebot|mediapartners|Google Favicon|FeedFetcher|Google-Read-Aloud|DuplexWeb-Google|googleweblight|bing|yandex|baidu|duckduck|yahoo|ecosia|ia_archiver|facebook|instagram|pinterest|reddit|slack|twitter|whatsapp|youtube|semrush","i");function l(){var e;let t=a()?window?.navigator:null;return!!t&&!((e=t?.userAgent)&&o.test(e))&&!t?.webdriver}function c(){let e=a()?window?.navigator:null;if(!e)return!1;let t=e?.onLine;return e?.connection?.rtt!==0&&e?.connection?.downlink!==0&&t}function d(){return c()&&l()}let h=(e,t,i,n,r)=>{let{notify:s}=r||{},a=e.get(i);a||(a=[],e.set(i,a)),a.push(n),s&&t.has(i)&&n(t.get(i))},u=(e,t,i)=>(e.get(t)||[]).map(e=>e(i)),p=(e,t,i)=>{let n=e.get(t);n&&(i?n.splice(n.indexOf(i)>>>0,1):e.set(t,[]))},f=()=>{let e=new Map,t=new Map,i=new Map;return{on:(...i)=>h(e,t,...i),prioritizedOn:(...e)=>h(i,t,...e),emit:(n,r)=>{t.set(n,r),u(i,n,r),u(e,n,r)},off:(...t)=>p(e,...t),prioritizedOff:(...e)=>p(i,...e),internal:{retrieveListeners:t=>e.get(t)||[]}}},m="status",_=new Set;function g(e){return function(t){let i=t??this;if(!i)throw TypeError(`${e.kind||e.name} type guard requires an error object`);return!!e.kind&&"object"==typeof i&&null!==i&&"constructor"in i&&i.constructor?.kind===e.kind||i instanceof e}}var y,b,w=class{static kind="ClerkApiError";code;message;longMessage;meta;constructor(e){let t={code:e.code,message:e.message,longMessage:e.long_message,meta:{paramName:e.meta?.param_name,sessionId:e.meta?.session_id,emailAddresses:e.meta?.email_addresses,identifiers:e.meta?.identifiers,zxcvbn:e.meta?.zxcvbn,plan:e.meta?.plan,isPlanUpgradePossible:e.meta?.is_plan_upgrade_possible}};this.code=t.code,this.message=t.message,this.longMessage=t.longMessage,this.meta=t.meta}};g(w);var v=class e extends Error{static kind="ClerkError";clerkError=!0;code;longMessage;docsUrl;cause;get name(){return this.constructor.name}constructor(t){super(new.target.formatMessage(new.target.kind,t.message,t.code,t.docsUrl),{cause:t.cause}),Object.setPrototypeOf(this,e.prototype),this.code=t.code,this.docsUrl=t.docsUrl,this.longMessage=t.longMessage,this.cause=t.cause}toString(){return`[${this.name}]
2Message:${this.message}`}static formatMessage(e,t,i,n){let r="Clerk:",s=RegExp(r.replace(" ","\\s*"),"i");return t=t.replace(s,""),t=`${r} ${t.trim()}
3
4(code="${i}")
5
6`,n&&(t+=`
7
8Docs: ${n}`),t}},k=class e extends v{static kind="ClerkAPIResponseError";status;clerkTraceId;retryAfter;errors;constructor(t,i){let{data:n,status:r,clerkTraceId:s,retryAfter:a}=i;super({...i,message:t,code:"api_response_error"}),Object.setPrototypeOf(this,e.prototype),this.status=r,this.clerkTraceId=s,this.retryAfter=a,this.errors=(n||[]).map(e=>new w(e))}toString(){let e=`[${this.name}]
9Message:${this.message}
10Status:${this.status}
11Serialized errors: ${this.errors.map(e=>JSON.stringify(e))}`;return this.clerkTraceId&&(e+=`
12Clerk Trace ID: ${this.clerkTraceId}`),e}static formatMessage(e,t,i,n){return t}};let S=g(k);var C=class e extends k{static kind="MissingExpiredTokenError";static ERROR_CODE="missing_expired_token";static STATUS=422;static is(t){return S(t)&&t.status===e.STATUS&&t.errors.length>0&&t.errors[0].code===e.ERROR_CODE}};let A=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invali
12d. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});var U=class e extends Error{code;constructor(t){super(t),this.code=t,this.name="EmailLinkError",Object.setPrototypeOf(this,e.prototype)}},I=class e extends v{static kind="ClerkRuntimeError";clerkRuntimeError=!0;constructor(t,i){super({...i,message:t}),Object.setPrototypeOf(this,e.prototype)}};let P=g(I);var T=class extends I{code;constructor(e,{code:t}){super(e,{code:t}),this.code=t}};function O(e){return["captcha_invalid","captcha_not_enabled","captcha_missing_token"].includes(e.errors[0].code)}function E(e){let t=e?.status;return!!t&&t>=400&&t<500}function x(e){for(let[t,i]of Object.entries({isClerkAPIResponseError:S,isClerkRuntimeError:P}))Object.assign(e,{[t]:i});return e}let R=[".lcl.dev",".lclstage.dev",".lclclerk.com"],M=[".accounts.dev",".accountsstage.dev",".accounts.lclclerk.com"],z=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],N=e=>"undefined"!=typeof atob&&"function"==typeof atob?atob(e):"undefined"!=typeof global&&global.Buffer?new global.Buffer(e,"base64").toString():e,F="pk_live_";function D(e){if(!e.endsWith("$"))return!1;let t=e.slice(0,-1);return!t.includes("$")&&t.includes(".")}function W(e,t={}){let i;if(!(e=e||"")||!L(e)){if(t.fatal&&!e)throw Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(t.fatal&&!L(e))throw Error("Publishable key not valid.");return null}let n=e.startsWith(F)?"production":"development";try{i=N(e.split("_")[2])}catch{if(t.fatal)throw Error("Publishable key not valid: Failed to decode key.");return null}if(!D(i)){if(t.fatal)throw Error("Publishable key not valid: Decoded key has invalid format.");return null}let r=i.slice(0,-1);return t.proxyUrl?r=t.proxyUrl:"development"!==n&&t.domain&&t.isSatellite&&(r=`clerk.${t.domain}`),{instanceType:n,frontendApi:r}}function L(e=""){try{if(!(e.startsWith(F)||e.startsWith("pk_test_")))return!1;let t=e.split("_");if(3!==t.length)return!1;let i=t[2];if(!i)return!1;return D(N(i))}catch{return!1}}async function $(e,t=globalThis.crypto.subtle){var i;let n=new TextEncoder().encode(e);return(i=String.fromCharCode(...new Uint8Array(await t.digest("sha-1",n))),"undefined"!=typeof btoa&&"function"==typeof btoa?btoa(i):"undefined"!=typeof global&&global.Buffer?new global.Buffer(i).toString("base64"):i).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}let j=(e,t)=>`${e}_${t}`,J=new Set,K=e=>{J.has(e)||(J.add(e),console.warn(e))},B="__clerk_netlify_cache_bust";function V(e){return/^http(s)?:\/\//.test(e||"")}function q(e){return e.startsWith("/")}function H(e){return e?e.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace(/-|_/,"")):""}function G(e){return e?e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`):""}let Z=e=>{let t=i=>{if(!i)return i;if(Array.isArray(i))return i.map(e=>"object"==typeof e||Array.isArray(e)?t(e):e);let n={...i};for(let i of Object.keys(n)){let r=e(i.toString());r!==i&&(n[r]=n[i],delete n[i]),"object"==typeof n[r]&&(n[r]=t(n[r]))}return n};return t},Y=Z(G),Q=Z(H);function X(e){if("boolean"==typeof e)return e;if(null==e)return!1;if("string"==typeof e){if("true"===e.toLowerCase())return!0;if("false"===e.toLowerCase())return!1}let t=parseInt(e,10);return!isNaN(t)&&t>0}var ee=class{#e;#t=864e5;constructor(e){this.#e=e}isEventThrottled(e){let t=Date.now(),i=this.#i(e),n=this.#e.getItem(i);return!!n&&!(t-n>this.#t)||(this.#e.setItem(i,t),!1)}#i(e){let{sk:t,pk:i,payload:n,...r}=e,s={...n,...r};return JSON.stringify(Object.keys({...n,...r}).sort().map(e=>s[e]))}},et=class{#n="clerk_telemetry_throttler";getItem(e){return this.#r()[e]}setItem(e,t){try{let i=this.#r();i[e]=t,localStorage.setItem(this.#n,JSON.stringify(i))}catch(e){e instanceof DOMException&&("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&localStorage.length>0&&localStorage.removeItem(this.#n)}}removeItem(e){try{let t=this.#r();delete t[e],localStorage.setItem(this.#n,JSON.stringify(t))}catch{}}#r(){try{let e=localStorage.getItem(this.#n);if(!e)return{};return JSON.parse(e)}catch{return{}}}static isSupported(){return"undefined"!=typeof window&&!!window.localStorage}},ei=class{#e=new Map;#s=1e4;getItem(e){return this.#e.size>this.#s?void this.#e.clear():this.#e.get(e)}setItem(e,t){this.#e.set(e,t)}removeItem(e){this.#e.delete(e)}};let en=new Set(["error","warn","info","debug","trace"]);var er=class{#a;#o;#l={};#c=[];#d=null;constructor(e){this.#a={maxBufferSize:e.maxBufferSize??5,samplingRate:e.samplingRate??1,perEventSampling:e.perEventSampling??!0,disabled:e.disabled??!1,debug:e.debug??!1,endpoint:"https://clerk-telemetry.com"},e.clerkVersion||"undefined"!=typeof window?this.#l.clerkVersion=e.clerkVersion??"":this.#l.clerkVersion="",this.#l.sdk=e.sdk,this.#l.sdkVersion=e.sdkVersion,this.#l.publishableKey=e.publishableKey??"";let t=W(e.publishableKey);
12t&&(this.#l.instanceType=t.instanceType),e.secretKey&&(this.#l.secretKey=e.secretKey.substring(0,16)),this.#o=new ee(et.isSupported()?new et:new ei)}get isEnabled(){return!("development"!==this.#l.instanceType||this.#a.disabled||"undefined"!=typeof process&&process.env&&X(process.env.CLERK_TELEMETRY_DISABLED)||"undefined"!=typeof window&&window?.navigator?.webdriver)}get isDebug(){return this.#a.debug||"undefined"!=typeof process&&process.env&&X(process.env.CLERK_TELEMETRY_DEBUG)}record(e){try{let t=this.#h(e.event,e.payload);if(this.#u(t.event,t),!this.#p(t,e.eventSamplingRate))return;this.#c.push({kind:"event",value:t}),this.#f()}catch(e){console.error("[clerk/telemetry] Error recording telemetry event",e)}}recordLog(e){try{if(!this.#m(e))return;let t="string"==typeof e?.level&&en.has(e.level),i="string"==typeof e?.message&&e.message.trim().length>0,n=null,r=e?.timestamp;if("number"==typeof r||"string"==typeof r){let e=new Date(r);Number.isNaN(e.getTime())||(n=e)}if(!t||!i||null===n){this.isDebug&&"undefined"!=typeof console&&console.warn("[clerk/telemetry] Dropping invalid telemetry log entry",{levelIsValid:t,messageIsValid:i,timestampIsValid:null!==n});return}let s=this.#_(),a={sdk:s.name,sdkv:s.version,cv:this.#l.clerkVersion??"",lvl:e.level,msg:e.message,ts:n.toISOString(),pk:this.#l.publishableKey||null,payload:this.#g(e.context)};this.#c.push({kind:"log",value:a}),this.#f()}catch(e){console.error("[clerk/telemetry] Error recording telemetry log entry",e)}}#p(e,t){return this.isEnabled&&!this.isDebug&&this.#y(e,t)}#m(e){return!0}#y(e,t){let i=Math.random();return!!(i<=this.#a.samplingRate&&(!1===this.#a.perEventSampling||void 0===t||i<=t))&&!this.#o.isEventThrottled(e)}#f(){if("undefined"==typeof window)return void this.#b();if(this.#c.length>=this.#a.maxBufferSize){this.#d&&("undefined"!=typeof cancelIdleCallback?cancelIdleCallback(Number(this.#d)):clearTimeout(Number(this.#d))),this.#b();return}this.#d||("requestIdleCallback"in window?this.#d=requestIdleCallback(()=>{this.#b(),this.#d=null}):this.#d=setTimeout(()=>{this.#b(),this.#d=null},0))}#b(){let e=[...this.#c];if(this.#c=[],this.#d=null,0===e.length)return;let t=e.filter(e=>"event"===e.kind).map(e=>e.value),i=e.filter(e=>"log"===e.kind).map(e=>e.value);t.length>0&&fetch(new URL("/v1/event",this.#a.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({events:t})}).catch(()=>void 0),i.length>0&&fetch(new URL("/v1/logs",this.#a.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({logs:i})}).catch(()=>void 0)}#u(e,t){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",e),console.log(t),console.groupEnd()):console.log("[clerk/telemetry]",e,t))}
12#_(){let e={name:this.#l.sdk,version:this.#l.sdkVersion};if("undefined"!=typeof window){let t=window;if(t.Clerk){let i=t.Clerk;if("object"==typeof i&&null!==i&&"constructor"in i&&"function"==typeof i.constructor&&i.constructor.sdkMetadata){let{name:t,version:n}=i.constructor.sdkMetadata;void 0!==t&&(e.name=t),void 0!==n&&(e.version=n)}}}return e}#h(e,t){let i=this.#_();return{event:e,cv:this.#l.clerkVersion??"",it:this.#l.instanceType??"",sdk:i.name,sdkv:i.version,...this.#l.publishableKey?{pk:this.#l.publishableKey}:{},...this.#l.secretKey?{sk:this.#l.secretKey}:{},payload:t}}#g(e){if(null==e||"object"!=typeof e)return null;try{let t=JSON.parse(JSON.stringify(e));if(t&&"object"==typeof t&&!Array.isArray(t))return t;return null}catch{return null}}};let es="COMPONENT_MOUNTED",ea=new Set(["SignIn","SignUp"]);function eo(e){return function(t,i,n){return{event:e,eventSamplingRate:e===es?ea.has(t)?1:.1:.1,payload:{component:t,appearanceProp:!!i?.appearance,baseTheme:!!i?.appearance?.baseTheme,elements:!!i?.appearance?.elements,variables:!!i?.appearance?.variables,...n}}}}function el(e,t,i){return eo(es)(e,t,i)}function ec(e,t,i){return eo("COMPONENT_OPENED")(e,t,i)}function ed(e){return"string"==typeof e?e:"object"==typeof e&&null!==e&&"name"in e&&"string"==typeof e.name?e.name:void 0}let eh=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/;var eu=i(2823);let ep=!1,ef=null,em=!1,e_=[];function eg(e,t,i,n){ep&&(e_.push({level:e,message:t,context:i,source:n,ts:Date.now()}),e_.length>200&&e_.shift())}async function ey(e){try{if(!ep||ef)return;let{getDebugLogger:t}=await i.e("785").then(i.bind(i,3656)),n=await t({logLevel:e?.logLevel,telemetryCollector:e?.telemetryCollector});if(n&&(ef=n)&&0!==e_.length){for(let e of e_){let t={...e.context||{},__preInit:!0,__preInitTs:e.ts};switch(e.level){case"error":ef.error(e.message,t,e.source);break;case"warn":ef.warn(e.message,t,e.source);break;case"info":ef.info(e.message,t,e.source);break;case"debug":ef.debug(e.message,t,e.source)}}e_.length=0}}catch(e){try{console.debug?.("Debug logger initialization failed",e)}catch{}return}}let eb={debug(e,t,i){if(!ef)return void eg("debug",e,t,i);ef.debug(e,t,i)},error(e,t,i){if(!ef)return void eg("error",e,t,i);ef.error(e,t,i)},info(e,t,i){if(!ef)return void eg("info",e,t,i);ef.info(e,t,i)},warn(e,t,i){if(!ef)return void eg("warn",e,t,i);ef.warn(e,t,i)}},ew="clerk:beforeunload",ev=["http:","https:","wails:","chrome-extension:"];function ek(e){let t=new URL(e,window.location.href);window.dispatchEvent(new CustomEvent(ew)),window.location.href=t.href}let eS=(e=!1)=>{if(!e)return{track:async e=>{await e()},isUnloading:()=>!1};let t=(()=>{let e=!1,t=()=>e=!0;return{startListening:()=>{window.addEventListener("beforeunload",t),window.addEventListener(ew,t)},stopListening:()=>{window.removeEventListener("beforeunload",t),window.removeEventListener(ew,t)},isUnloading:()=>e}})();return{track:async e=>{t.startListening(),await e(),t.stopListening()},isUnloading:t.isUnloading}},eC=e=>({amount:e.amount,amountFormatted:e.amount_formatted,currency:e.currency,currencySymbol:e.currency_symbol}),eA=e=>({proration:e.proration?{amount:eC(e.proration.amount),cycleDaysRemaining:e.proration.cycle_days_remaining,cycleDaysTotal:e.proration.cycle_days_total,cycleRemainingPercent:e.proration.cycle_remaining_percent}:null,payer:e.payer?{remainingBalance:eC(e.payer.remaining_balance),appliedAmount:eC(e.payer.applied_amount)}:null,total:eC(e.total)}),eU=e=>{let t={grandTotal:eC(e.grand_total),subtotal:eC(e.subtotal),taxTotal:eC(e.tax_total)};return"past_due"in e&&(t.pastDue=e.past_due?eC(e.past_due):null),"credit"in e&&(t.credit=e.credit?eC(e.credit):null),"credits"in e&&(t.credits=e.credits?eA(e.credits):null),"total_due_now"in e&&(t.totalDueNow=eC(e.total_due_now)),"total_due_after_free_trial"in e&&(t.totalDueAfterFreeTrial=e.total_due_after_free_trial?eC(e.total_due_after_free_trial):null),t},eI="__clerk_satellite_url",eP="suffixed_cookies",eT="__clerk_synced",eO=["__clerk_status","__clerk_created_session","__clerk_invitation_token","__clerk_ticket","__clerk_modal_state","__clerk_handshake","__clerk_handshake_nonce","__clerk_help",B,eT,eI,eP];function eE(e){return new URL(window.location.href).searchParams.get(e)||null}function ex(e){let t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState(window.history.state,"",t))}function eR(e){let t=new URLSearchParams(window.location.search),i=e||new URLSearchParams;for(let e of eO){let n=t.get(e);n&&i.set(e,n)}return i}let eM=(e,t)=>!!(e.isSignedIn&&t?.authConfig.singleSessionMode),ez=(e,t)=>!t?.commerceSettings.billing.user.enabled&&!t?.commerceSettings.billing.organization.enabled,eN=(e,t)=>!t?.apiKeysSettings?.user_api_keys_enabled,eF=(e,t)=>!t?.apiKeysSettings?.orgs_api_keys_enabled;function eD(e,t=""){return e.errors&&!!e.errors.find(e=>e.code===t)}let eW=function({packageName:e,customMessages:t}){let i=e;function n(e,t){if(!t)return`${i}: ${e}`;let n=e;for(let i of e.matchAll(/{{([a-zA-Z0-9-_]+)}}/g)){let e=(t[i[1]]||"").toString();n=n.replace(`{{${i[1]}}}`,e)}return`${i}: ${n}`}let r={...A,...t};return{setPackageName({packageName:e}){return"string"==typeof e&&(i=e),this},setMessages({customMessages:e}){return Object.assign(r,e||{}),this},throwInvalidPublishableKeyError(e){throw Error(n(r.InvalidPublishableKeyErrorMessage,e))},throwInvalidProxyUrl(e){throw Error(n(r.InvalidProxyUrlErrorMessage,e))},throwMissingPublishableKeyError(){throw Error(n(r.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw Error(n(r.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(e){throw Error(n(r.MissingClerkProvider,e))},throw(e){throw Error(n(e))}}}({packageName:"@clerk/clerk-js"});var eL=i(4763);let e$=RegExp("/{1,}","g"),ej=(e,t={})=>
12{if(null==e||!e||"object"!=typeof e)return"";let i=new URLSearchParams;return Object.keys(e).forEach(n=>{let r=t.keyEncoder?t.keyEncoder(n):n,s=e[n];if(Array.isArray(s))s.forEach(e=>void 0!==e&&i.append(r,e||""));else{if(void 0===s)return;"object"==typeof s&&null!==s?i.append(r,JSON.stringify(s)):i.append(r,String(s??""))}}),i.toString()},eJ="http://clerk-dummy",eK=["javascript:"],{isDevOrStagingUrl:eB}=function(){let e=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;let i="string"==typeof t?t:t.hostname,n=e.get(i);return void 0===n&&(n=z.some(e=>i.endsWith(e)),e.set(i,n)),n}}}(),eV=new Map;function eq(e){return e.replace("clerk.","")}function eH(e,t={}){let{base:i,hashPath:n,hashSearch:r,searchParams:s,hashSearchParams:a,...o}=e,l=new URL(i||"","undefined"!=typeof window&&window.location?window.location.href:"http://react-native-fake-base-url");if(s instanceof URLSearchParams&&s.forEach((e,t)=>{null!=e&&l.searchParams.set(G(t),e)}),Object.assign(l,o),n||r||a){var c;let e=new URL(eJ+l.hash.substring(1));for(let[t,i]of(c=e.pathname,e.pathname=[c,n||""].filter(e=>e).join("/").replace(e$,"/"),Object.entries((e=>{let t={};return new URLSearchParams(e).forEach((e,i)=>{if(i in t){let n=t[i];Array.isArray(n)?n.push(e):t[i]=[n,e]}else t[i]=e}),t})(r||""))))e.searchParams.append(t,i);if(a)for(let t of Array.isArray(a)?a:[a])(t instanceof URLSearchParams||"object"==typeof t)&&new URLSearchParams(t).forEach((t,i)=>{null!=t&&e.searchParams.set(G(i),t)});let t=e.href.replace(eJ,"");"/"!==t&&(l.hash=t)}let{stringify:d,skipOrigin:h}=t;return d?h?l.href.replace(l.origin,""):l.href:l}function eG(e){return void 0===window.location&&"string"==typeof e?e:(e=new URL(e.toString(),window.location.origin)).href.replace(e.origin,"")}let eZ=e=>(e||"").replace(/\/+$/,"");function eY(e,t){try{return new URL(e)}catch{return new URL(e,t)}}let eQ=[/\0/,/^\/\//,/[\x00-\x1F]/],eX=["/oauth/authorize"],e0=["/v1/verify","/v1/tickets/accept","/oauth/authorize-with-immediate-redirect","/oauth/end_session"];function e1(e){var t;return t=e.replace(/_/g,"/").replace(/-/g,"+"),decodeURIComponent(i.g.atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}function e3(e){let t=(e||"").split("."),[i,n,r]=t;if(3!==t.length||!i||!n||!r)throw Error("JWT could not be decoded");let s=JSON.parse(e1(n)),a={__raw:e};return Object.keys(s).forEach(e=>{a[e]=s[e]}),{encoded:{header:i,payload:n,signature:r},header:JSON.parse(e1(i)),claims:a}}function e2(){if(!a())return null;try{let e=navigator?.language;if(!e||"string"!=typeof e||""===e.trim())return null;return e}catch{return null}}function e4(){return void 0!==globalThis.document}function e5(){if(!function(){if(!e4())return!1;try{return window.self!==window.top}catch{return!0}}())return!1;try{return window.top?.location.href,!1}catch{return!0}}class e6{#w=void 0;#v=!1;static #k=null;constructor(){}async #S(){if(this.#v)return;this.#v=!0;let e=await i.e("825").then(i.bind(i,2854)).then(e=>e.getWallets());this.#w=e.get(),e.on("register",()=>{this.#w=e.get()}),e.on("unregister",()=>{this.#w=e.get()})}#C(e){return e.chains?.some(e=>e.startsWith("solana:"))??!1}#A(e){return"solana:signMessage"in e.features}static getInstance(){return e6.#k||(e6.#k=new e6),e6.#k}get=async e=>{await this.#S();let t=(this.#w||[]).find(t=>t.name===e&&this.#C(t)&&this.#A(t));if(t&&this.#C(t))return t;if("undefined"==typeof window)return;let i=window.solana;if(i&&"function"==typeof i.connect&&"function"==typeof i.signMessage)return i}}class e8{#U=[];#I={metamask:"MetaMask",okx_wallet:"OKX Wallet"};static #k=null;constructor(){if("undefined"==typeof window)return;window.addEventListener("eip6963:announceProvider",this.#P),window.dispatchEvent(new Event("eip6963:requestProvider"))}static getInstance(){return e8.#k||(e8.#k=new e8),e8.#k}get=e=>{let t=this.#U.find(t=>t.info.name===this.#I[e])?.provider;return void 0!==t?t:window.ethereum};#P=e=>{this.#U.some(t=>t.info.uuid===e.detail.info.uuid)||this.#U.push(e.detail)}}async function e9(e){let{provider:t,walletName:i}=e,n=await td(t,i);if(!n)return"";if("solana"===t){let e=await n.features["standard:connect"].connect();return e&&e.accounts[0].address||""}let r=await n.request({method:"eth_requestAccounts"});return r&&r[0]||""}let e7=async e=>{let{identifier:t,nonce:i,provider:n,walletName:r=""}=e,s=await td(n,r);if(!s)return"";if("solana"===n)try{let e=s.accounts.find(e=>e.address===t);if(!e)return console.warn(`Wallet account with address ${t} not found`),"";let n=await s.features["solana:signMessage"]?.signMessage({account:e,message:new TextEncoder().encode(i)});return n?.[0]?.signature?btoa(String.fromCharCode(...n[0].signature)):""}catch(e){if(e instanceof Error&&e.message.includes("User rejected the request."))throw new I("Web3 signature request was rejected by the user.",{code:"web3_signature_request_rejected"});throw new I("An error occurred while generating the Solana signature.",{c
12ode:"web3_solana_signature_generation_failed",cause:e})}return await s.request({method:"personal_sign",params:[`0x${i.split("").map(e=>e.charCodeAt(0).toString(16).padStart(2,"0")).join("")}`,t]})};async function te(){return await e9({provider:"metamask"})}async function tt(){return await e9({provider:"coinbase_wallet"})}async function ti(){return await e9({provider:"okx_wallet"})}async function tn(){return await e9({provider:"base"})}async function tr(e){return await e9({provider:"solana",walletName:e})}async function ts(e){return await e7({...e,provider:"metamask"})}async function ta(e){return await e7({...e,provider:"coinbase_wallet"})}async function to(e){return await e7({...e,provider:"okx_wallet"})}async function tl(e){return await e7({...e,provider:"base"})}async function tc(e){return await e7({...e,provider:"solana"})}async function td(e,t){if("coinbase_wallet"===e)return(await Promise.all([i.e("514"),i.e("956"),i.e("192")]).then(i.bind(i,4334)).then(e=>e.createCoinbaseWalletSDK))({preference:{options:"all"}}).getProvider();if("base"===e)try{return(await Promise.all([i.e("514"),i.e("956"),i.e("192")]).then(i.bind(i,4599)).then(e=>e.createBaseAccountSDK))({appName:"undefined"!=typeof window&&window.Clerk?.__unstable__environment?.displayConfig?.applicationName||"undefined"!=typeof document&&document.title||"Web3 Application"}).getProvider()}catch{return null}return"solana"===e?t&&0!==t.length?await e6.getInstance().get(t):void eW.throw("Wallet name must be provided to get Solana wallet provider"):e8.getInstance().get(e)}function th(e){let t=["redirectUrl","afterSignInUrl","afterSignUpUrl","after_sign_in_url","after_sign_up_url"],i=Object.keys(e).find(e=>t.includes(e));i&&e[i]&&K(`Clerk: The prop "${i}" is deprecated and should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead. Learn more: https://clerk.com/docs/guides/custom-redirects#redirect-url-props`)}let tu="environment",tp=JSON.stringify,tf=JSON.parse;class tm{static _key(e){return`__clerk_${e}`}static isExpired(e){return!!e.exp&&Date.now()>e.exp}static setItem(e,t,i){try{let n={value:t,...i&&{exp:Date.now()+i}};window.localStorage.setItem(this._key(e),tp(n))}catch{}}static getItem(e,t){try{let i=window.localStorage.getItem(this._key(e));if(!i)return t;let n=tf(i);if(!n)return t;if(this.isExpired(n))return this.removeItem(e),t;return n?.value??t}catch{return t}}static removeItem(e){try{window.localStorage.removeItem(this._key(e))}catch{}}}let t_="ClerkJS:";function tg(e=""){throw Error(`${t_} Something went wrong initializing Clerk in development mode.${e&&` ${e}`}`)}function ty(e){throw Error(`${t_} Something went wrong initializing Clerk during the ${e} flow. Please contact support.`)}function tb(e){throw Error(`${t_} You need to start a ${e} flow by calling ${e}.create() first.`)}function tw(e,t){throw Error(`${t_} Strategy "${t}" is not a valid strategy for ${e}.`)}function tv(e){throw Error(`${t_} You need to start a ${e} flow by calling ${e}.create({ identifier: 'your web3 wallet address' }) first`)}function tk(e=""){throw Error(`${t_} Missing '${e}' option`)}function tS(e,t){throw Error(`${t_} Response: ${e||0} not supported yet.
13For more information contact us at ${t}`)}function tC(e){throw Error(`${t_} Missing publicKey. When calling 'navigator.credentials.${e}()' it is required to pass a publicKey object.`)}let tA={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(e,t)=>t<5,retryImmediately:!1,jitter:!0},tU=async e=>new Promise(t=>setTimeout(t,e)),tI=(e,t)=>t?e*(1+Math.random()):e,tP=async(e,t={})=>{var i;let n,r=0,{shouldRetry:s,initialDelay:a,maxDelayBetweenRetries:o,factor:l,retryImmediately:c,jitter:d,onBeforeRetry:h}={...tA,...t},u=(i={initialDelay:a,maxDelayBetweenRetries:o,factor:l,jitter:d},n=0,async()=>{let e;await tU((e=tI(e=i.initialDelay*Math.pow(i.factor,n),i.jitter),Math.min(i.maxDelayBetweenRetries||e,e))),n++});for(;;)try{return await e()}catch(e){if(!s(e,++r))throw e;h&&await h(r),c&&1===r?await tU(tI(100,d)):await u()}};async function tT(e="",t){let{async:i,defer:n,beforeLoad:r,crossOrigin:s,nonce:a}=t||{};return tP(()=>new Promise((t,o)=>{e||o(Error("loadScript cannot be called without a src")),document&&document.body||o(Error("loadScript cannot be called when document does not exist"));
13let l=document.createElement("script");s&&l.setAttribute("crossorigin",s),l.async=i||!1,l.defer=n||!1,l.addEventListener("load",()=>{l.remove(),t(l)}),l.addEventListener("error",t=>{l.remove(),o(t.error??Error(`failed to load script: ${e}`))}),l.src=e,l.nonce=a,r?.(l),document.body.appendChild(l)}),{shouldRetry:(e,t)=>t<=5})}let tO="clerk-captcha",tE="clerk-invisible-captcha";async function tx(e){return window.turnstile||await tR(e).catch(()=>{throw{captchaError:"captcha_script_failed_to_load"}}),window.turnstile}async function tR(e){try{return await tT("https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",{defer:!0,nonce:e})}catch(e){throw console.warn("Clerk: Failed to load the CAPTCHA script from Cloudflare. If you see a CSP error in your browser, please add the necessary CSP rules to your app. Visit https://clerk.com/docs/security/clerk-csp for more information."),e}}function tM(e){try{let t=e.getAttribute("data-cl-theme")||void 0,i=e.getAttribute("data-cl-language")||void 0,n=e.getAttribute("data-cl-size")||void 0;return{theme:t,language:i,size:n}}catch{return{theme:void 0,language:void 0,size:void 0}}}let tz=async e=>{let t,i,n,r,{siteKey:s,widgetType:a,invisibleSiteKey:o,nonce:l}=e,{modalContainerQuerySelector:c,modalWrapperQuerySelector:d,closeModal:h,openModal:u}=e,p=await tx(l),f=[],m=0,_=[],g="";try{m=Date.now(),g="undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2,9)}catch{}let y="",b="",w=s,v=0,k=null,S="invisible";if(c&&d){k=a,r=c,S="modal";try{await u?.()}catch{throw{captchaError:"modal_component_not_ready"}}let e=await new Promise(e=>{if(document.querySelector(c))return e(document.querySelector(c));let t=new MutationObserver(()=>{document.querySelector(c)&&(t.disconnect(),e(document.querySelector(c)))});t.observe(document.body,{childList:!0,subtree:!0})});if(e){let{theme:r,language:s,size:a}=tM(e);t=r,n=s,i=a}}if(!r&&"smart"===a){let e=document.getElementById(tO);if(e){S="smart",k="smart",r=`#${tO}`,e.style.maxHeight="0";let{theme:s,language:a,size:o}=tM(e);t=s,n=a,i=o}else console.error("Cannot initialize Smart CAPTCHA widget because the `clerk-captcha` DOM element was not found; falling back to Invisible CAPTCHA widget. If you are using a custom flow, visit https://clerk.com/docs/guides/development/custom-flows/bot-sign-up-protection for instructions")}if(!r){S="invisible",w=o,k="invisible",r=`.${tE}`;let e=document.createElement("div");e.classList.add(tE),e.style.display="none",document.body.appendChild(e)}let C=async()=>new Promise((s,a)=>{try{let o=p.render(r,{sitekey:w,appearance:"interaction-only",theme:t||"auto",size:i||"normal",language:n||"auto",action:e.action,retry:"never","refresh-expired":"auto",callback:function(e){h?.(),s([e,o])},"before-interactive-callback":()=>{if(d){let e=document.querySelector(d);e?.style.setProperty("visibility","visible"),e?.style.setProperty("pointer-events","all")}else{let e=document.getElementById(tO);e&&(e.style.maxHeight="unset",e.style.minHeight="compact"===i?"140px":"68px",e.style.marginBottom="1.5rem",e.dataset.clInteractive="true")}},"error-callback":function(e){var t;f.push(e);try{_.push({code:e,t:Date.now()-m})}catch{}if(v<2&&(t=e.toString(),["crashed","undefined_error","102","103","104","106","110600","300","600"].find(e=>t.startsWith(e))))return void setTimeout(()=>{if(r&&!document.querySelector(r))return void a([f.join(","),o]);p.reset(o),v++},250);a([f.join(","),o])},"unsupported-callback":function(){return a(["This browser is not supported by the CAPTCHA.",o]),!0}})}catch(e){a([e,void 0])}});try{[y,b]=await C(),p.remove(b)}catch([e,t]){t&&p.remove(t);try{let t=!!r&&!!document.querySelector(r);eb.error("Turnstile captcha challenge failed",{captchaAttemptId:g,errorTimeline:_,lastErrorCode:_.length>0?_[_.length-1].code:null,finalError:String(e),retriesAttempted:v,widgetType:S,containerExistsAtFailure:t,totalDurationMs:Date.now()-m},"captcha")}catch{}throw{captchaError:e}}finally{if("modal"===S&&h?.(),"invisible"===S){let e=document.querySelector(`.${tE}`);e&&document.body.removeChild(e)}if("smart"===S){let e=document.getElementById(tO);e&&(delete e.dataset.clInteractive,e.style.maxHeight="0",e.style.minHeight="unset",e.style.marginBottom="unset")}}return{captchaToken:y,captchaWidgetType:k}},tN=e=>tz(e),tF=e=>{let t=e.__unstable__environment,i=t?t.displayConfig.captchaProvider:"turnstile",n=e.__internal_getOption?.("nonce");return{captchaSiteKey:t?t.displayConfig.captchaPublicKey:null,captchaWidgetType:t?t.dis
vendor: 11,295 bytes, lines 13-14
13playConfig.captchaWidgetType:null,captchaProvider:i,captchaPublicKeyInvisible:t?t.displayConfig.captchaPublicKeyInvisible:null,canUseCaptcha:t?t.userSettings.signUp.captcha_enabled&&e.isStandardBrowser:null,nonce:n||void 0}};class tD{clerk;constructor(e){this.clerk=e}async invisible(e){let{captchaSiteKey:t,canUseCaptcha:i,captchaPublicKeyInvisible:n,nonce:r}=tF(this.clerk);return i&&t&&n?{...await tN({action:e?.action,captchaProvider:"turnstile",invisibleSiteKey:n,nonce:e?.nonce||r||void 0,siteKey:n,widgetType:"invisible"}).catch(e=>e.captchaError?{captchaError:e.captchaError}:{captchaError:e?.message||e||"unexpected_captcha_error"}),captchaAction:e?.action}:{captchaError:"captcha_unavailable",captchaAction:e?.action}}async managedOrInvisible(e){let{captchaSiteKey:t,canUseCaptcha:i,captchaWidgetType:n,captchaProvider:r,captchaPublicKeyInvisible:s,nonce:a}=tF(this.clerk);if(i&&t&&s){let i=await tN({captchaProvider:r,invisibleSiteKey:s,nonce:a||void 0,siteKey:t,widgetType:n,...e}).catch(t=>t.captchaError?{captchaError:t.captchaError}:e?.action==="verify"?{captchaError:t?.message||t||"unexpected_captcha_error"}:void 0);return e?.action==="verify"?{...i,captchaAction:"verify"}:i}return e?.action==="verify"?{captchaError:"captcha_unavailable",captchaAction:e?.action}:{}}async managedInModal(e){return this.managedOrInvisible({modalWrapperQuerySelector:"#cl-modal-captcha-wrapper",modalContainerQuerySelector:"#cl-modal-captcha-container",openModal:()=>this.clerk.__internal_openBlankCaptchaModal(),closeModal:()=>this.clerk.__internal_closeBlankCaptchaModal(),action:e?.action})}}class tW{client;CaptchaChallengeImpl;static instance;inflightException=null;captchaRetryCount=0;MAX_RETRY_ATTEMPTS=3;static getInstance(){return tW.instance||(tW.instance=new tW(t4,tD)),tW.instance}constructor(e,t){this.client=e,this.CaptchaChallengeImpl=t}async execute(e,t){if(this.captchaAttemptsExceeded())throw new I("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(n){let i;if(!S(n)||P(n)&&"network_error"===n.code||n.errors[0]?.code!=="requires_captcha")throw n;if(this.inflightException)return await this.inflightException,await t();this.inflightException=new Promise(e=>i=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{i(),this.inflightException=null}return await t()}}managedChallenge(e){return new this.CaptchaChallengeImpl(e).managedInModal({action:"verify"})}captchaAttemptsExceeded=()=>this.captchaRetryCount>=this.MAX_RETRY_ATTEMPTS}class tL{static clerk;id;pathRoot="";static get fapiClient(){return tL.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 tW.getInstance().execute(this.clerk,()=>this._baseFetch(e,t))}static async _baseFetch(e,t={}){let i;tL.fapiClient||function(){throw Error(`${t_} Missing FAPI client in resources.`)}();let{fetchMaxTries:n}=t;try{i=await tL.fapiClient.request(e,{fetchMaxTries:n})}catch(t){if(this.shouldRethrowOfflineNetworkErrors())throw new I(t?.message||t,{code:"network_error"});if(!d())return eb.warn("Network request failed while offline, returning null",{method:e.method,path:e.path},"baseResource"),null;throw t}let{payload:r,status:s,statusText:a,headers:o}=i;if(o){let e=o.get("x-country");this.clerk.__internal_setCountry(e?e.toLowerCase():null)}if(("GET"!==e.method||t.forceUpdateClient)&&this._updateClient(r),s>=200&&s<=299)return r;if(s>=400){let e=r?.errors,t=e?.[0]?.long_message,i=e?.[0]?.code;401===s&&"requires_captcha"!==i&&await tL.clerk.handleUnauthenticated(),function(e,t){var i;if(!t||!t[0])return;let n=t[0],r=n.long_message;if("origin_invalid"===n.code&&((i=tL.clerk.publishableKey).startsWith("live_")||i.startsWith("pk_live_"))){let i=tL.clerk.frontendApi.replace("clerk.","");throw new k(`Clerk: Production Keys are only allowed for domain "${i}". 
14API Error: ${r}`,{data:t,status:e})}}(s,e);let n={data:e,status:s};if(429===s&&o){let e=o.get("retry-after");if(e){let t=parseInt(e,10);isNaN(t)||(n.retryAfter=t)}}throw new k(t||a,n)}return null}static _updateClient(e){if(!e)return;let t=e.client||e.meta?.client;t&&tL.clerk&&tL.clerk.updateClient(t4.getOrCreateInstance().fromJSON(t))}path(e){let t=this.pathRoot;if(this.isNew())return t;let i=t.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return e?i.replace(/[^/]$/,"$&/")+encodeURIComponent(e):i}withDefault(e,t){return e??t}async _baseGet(e={}){let t=await tL._fetch({method:"GET",path:this.path(),rotatingTokenNonce:e.rotatingTokenNonce,signal:e.abortSignal},e);return this.fromJSON(t?.response||t)}async _baseMutate(e){let{action:t,body:i,method:n,path:r}=e,s=await tL._fetch({method:n,path:r||this.path(t),body:i});return this.fromJSON(s?.response||s)}async _baseMutateBypass(e){let{action:t,body:i,method:n,path:r}=e,s=await tL._baseFetch({method:n,path:r||this.path(t),body:i});return this.fromJSON(s?.response||s)}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=tL.clerk?.__internal_getOption?.("experimental");return e?.rethrowOfflineNetworkErrors||!1}}let t$={enabled:!1,first_factors:[],name:"phone_number",required:!1,second_factors:[],used_for_first_factor:!1,used_for_second_factor:!1,verifications:[],verify_at_sign_up:!1};class tj extends tL{id=void 0;actions={create_organization:!1,delete_self:!1};attributes={email_address:{enabled:!0,first_factors:["email_code"],name:"email_address",required:!0,second_factors:[],used_for_first_factor:!0,used_for_second_factor:!1,verifications:["email_code"],verify_at_sign_up:!0},phone_number:{...t$,name:"phone_number"},username:{...t$,name:"username"},web3_wallet:{...t$,name:"web3_wallet"},first_name:{...t$,name:"first_name"},last_name:{...t$,name:"last_name"},password:{enabled:!0,first_factors:[],name:"password",required:!0,second_factors:[],used_for_first_factor:!1,used_for_second_factor:!1,verifications:[],verify_at_sign_up:!1},authenticator_app:{...t$,name:"authenticator_app"},backup_code:{...t$,name:"backup_code"},passkey:{...t$,name:"passkey"}};enterpriseSSO={enabled:!1};passkeySettings={allow_autofill:!1,show_sign_in_button:!1};passwordSettings={};saml={enabled:!1};signIn={second_factor:{required:!1,enabled:!1}};signUp={allowlist_only:!1,captcha_enabled:!1,legal_consent_enabled:!1,mode:"public",progressive:!0,mfa:{required:!1}};social={};usernameSettings={};get authenticatableSocialStrategies(){return this.social?Object.entries(this.social).filter(([,e])=>e.enabled&&e.authenticatable).map(([,e])=>e.strategy).sort():[]}get enabledFirstFactorIdentifiers(){return this.attributes?Object.entries(this.attributes).filter(([e,t])=>t.used_for_first_factor&&!e.startsWith("web3")).map(([e])=>e):[]}get socialProviderStrategies(){return this.social?Object.entries(this.social).filter(([,e])=>e.enabled).map(([,e])=>e.strategy).sort():[]}get web3FirstFactors(){return this.attributes?Object.entries(this.attributes).filter(([e,t])=>t.used_for_first_factor&&e.startsWith("web3")).map(([,e])=>e.first_factors).flat():[]}get alternativePhoneCodeChannels(){return this.attributes?Object.entries(this.attributes).filter(([e,t])=>t.used_for_first_factor&&"phone_number"===e).map(([,e])=>e?.channels?.filter(e=>"sms"!==e)||[]).flat():[]}constructor(e=null){super(),this.fromJSON(e)}get instanceIsPasswordBased(){return!!this.attributes?.password?.enabled}get hasValidAuthFactor(){return!!(this.attributes?.email_address?.enabled||this.attributes?.phone_number?.enabled||this.attributes.password?.required&&this.attributes.username?.required)}fromJSON(e){return e&&(this.attributes=this.withDefault(e.attributes?Object.fromEntries(Object.entries(e.attributes).map(e=>[e[0],{...e[1],name:e[0]}])):null,this.attributes),this.actions=this.withDefault(e.actions,this.actions),this.enterpriseSSO=this.withDefault(e.enterprise_sso,this.enterpriseSSO),this.passkeySettings=this.withDefault(e.passkey_settings,this.passkeySettings),this.passwordSettings=e.password_settings?{...e.password_settings,min_length:Math.max(e.password_settings?.min_length??8,8),max_length:e.password_settings?.max_length===0?72:Math.min(e.password_settings?.max_length??72,72)}:this.passwordSettings,this.saml=this.withDefault(e.saml,this.saml),this.signIn=this.withDefault(e.sign_in,this.signIn),this.signUp=this.withDefault(e.sign_up,this.signUp),this.social=this.withDefault(e.social,this.social),this.usernameSettings=e.username_settings?{...e.username_settings,min_length:Math.max(e.username_settings?.min_length??4,4),max_length:Math.min(e.username_settings?.max_length??64,64)}:this.usernameSettings),this}__internal_toSnapshot(){return{actions:this.actions,attributes:this.attributes,passkey_settings:this.passkeySettings,password_settings:this.passwordSettings,saml:this.saml,sign_in:this.signIn,sign_up:this.signUp,social:this.social}}}class tJ extends tL{billing={stripePublishableKey:null,organization:{enabled:!1,hasPaidPlans:!1},user:{enabled:!1,hasPaidPlans:!1}};constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.billing.stripePublishableKey=e.billing.stripe_publishable_key,this.billing.organization.enabled=e.billing.organization.enabled,this.billing.organization.hasPaidPlans=e.billing.organization.has_paid_plans,this.billing.user.enabled=e.billing.user.enabled,this.billing.user.hasPaidPlans=e.billing.user.has_paid_plans),this}__internal_toSnapshot(){return{billing:{stripe_publishable_key:this.billing.stripePublishableKey,organization:{enabled:this.billing.organization.enabled,has_paid_plans:this.billing.organization.hasPaidPlans},user:{enabled:this.billing.user.enabled,has_paid_plans:this.billing.user.hasPaidPlans}}}}}function tK(e){let t=new Date(e||new Date);return t instanceof Date&&!isNaN(t.getTime())?t:new Date}class tB extends tL{claimedAt=null;reverification=!1;singleSessionMode=!1;preferredChannels=null;sessionMinter=!1;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.claimedAt=this.withDefault(e.claimed_at?tK(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.sessionMinter=this.withDefault(e.session_minter,this.sessionMinter)),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,session_minter:this.sessionMinter}}}let tV={build:(e,t,i)=>
14[e,t,i].filter(Boolean).join("-"),parse:(e,t,i)=>{let n=tV.extractTemplate(e,t,i);return{organizationId:i,sessionId:t,template:n}},extractTemplate:(e,t,i)=>{if(e===t||i&&e===`${t}-${i}`)return;let n=e.slice(t.length+1);return i&&n.endsWith(`-${i}`)&&(n=n.slice(0,-(i.length+1))),n||void 0}};function tq(e){return"getRawString"in e?e.jwt:e}function tH(e,t){if(null==e)return t;let i=tq(e)?.header?.oiat,n=tq(t)?.header?.oiat;return null==i&&null==n?t:null==n?e:null==i?t:i>n?e:i<n?t:(tq(e)?.claims?.iat??0)>(tq(t)?.claims?.iat??0)?e:t}function tG(e){return tq(e)?.header?.oiat}function tZ(e){return tq(e)?.claims?.sid}function tY(e){let t=tq(e)?.claims;return t?.org_id||(t?.o?.id??"")}let tQ="clerk",tX=10,t0={broadcast:!0},t1={broadcast:!1};class t3{prefix;data;static fromKey(e){let[t,i,n=""]=e.split("::");return new t3(t,{audience:n,tokenId:i})}constructor(e,t){this.prefix=e,this.data=t,this.prefix=e,this.data=t}toKey(){let{tokenId:e,audience:t}=this.data;return[this.prefix,e,t||""].join("::")}}let t2=((e=tQ)=>{let t=new Map,i=Math.random().toString(36).slice(2),n=null,r=()=>n||("undefined"==typeof BroadcastChannel?null:((n=new BroadcastChannel("clerk:session_token")).addEventListener("message",e=>{a(e)}),n));r();let s=(i,n=tX)=>{r();let s=new t3(e,i),a=t.get(s.toKey());if(!a)return;let o=Math.floor(Date.now()/1e3)-a.createdAt;if(a.expiresIn-o<(n||1)+5){void 0!==a.timeoutId&&clearTimeout(a.timeoutId),t.delete(s.toKey());return}return a.entry},a=async({data:e})=>{let t,n=tV.build(e.sessionId,e.template,e.organizationId);if(e.tokenId!==n)return void eb.warn("Ignoring token broadcast with mismatched tokenId",{expectedTokenId:n,organizationId:e.organizationId,receivedTokenId:e.tokenId,tabId:i,template:e.template,traceId:e.traceId},"tokenCache");try{t=new nA({id:e.tokenId,jwt:e.tokenRaw,object:"token"})}catch(t){eb.warn("Failed to parse token from broadcast, skipping cache update",{error:t,tabId:i,tokenId:e.tokenId,traceId:e.traceId},"tokenCache");return}let r=t.jwt?.claims?.iat,a=t.jwt?.claims?.exp;if(!r||!a)return void eb.warn("Token missing iat/exp claim, skipping cache update",{tabId:i,tokenId:e.tokenId,traceId:e.traceId},"tokenCache");try{let i=s({tokenId:e.tokenId});if(i){let n=await i.tokenResolver;if(tH(n,t)===n)return void eb.debug("Ignoring staler token broadcast",{tokenId:e.tokenId,traceId:e.traceId},"tokenCache")}}catch(t){eb.warn("Existing entry compare failed; proceeding with broadcast update",{error:t,tabId:i,tokenId:e.tokenId,traceId:e.traceId},"tokenCache")}eb.info("Updating token cache from broadcast",{iat:r,organizationId:e.organizationId,tabId:i,template:e.template,tokenId:e.tokenId,traceId:e.traceId},"tokenCache"),o({createdAt:r,tokenId:e.tokenId,tokenResolver:Promise.resolve(t)},t1)},o=(r,s=t0)=>{let a=new t3(e,{audience:r.audience,tokenId:r.tokenId}).toKey(),o=Math.floor(Date.now()/1e3),l={createdAt:r.createdAt??o,entry:r,expiresIn:void 0},c=()=>{let e=t.get(a);e===l&&(void 0!==e.timeoutId&&clearTimeout(e.timeoutId),t.delete(a))};r.tokenResolver.then(e=>{let t=e.jwt?.claims;if(!t||"number"!=typeof t.exp||"number"!=typeof t.iat)return c();let a=t.exp-t.iat;l.expiresIn=a;let o=setTimeout(c,1e3*a);l.timeoutId=o,"function"==typeof o.unref&&o.unref();let d=n;if(d&&s.broadcast){let n=e.getRawString();if(n&&t.sid){let e=t.sid,s=t.org_id||t.o?.id,a=tV.extractTemplate(r.tokenId,e,s),o=tV.build(e,a,s);if(r.tokenId===o){let t=`bc_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;eb.info("Broadcasting token update to other tabs",{organizationId:s,sessionId:e,tabId:i,template:a,tokenId:r.tokenId,traceId:t},"tokenCache");let o={organizationId:s,sessionId:e,template:a,tokenId:r.tokenId,tokenRaw:n,traceId:t};d.postMessage(o)}}}}).catch(()=>{c()}),t.set(a,l)};return{clear:()=>{t.forEach(e=>{void 0!==e.timeoutId&&clearTimeout(e.timeoutId)}),t.clear()},close:()=>{n&&(n.close(),n=null)},get:s,set:e=>{r(),o(e,t0)},size:()=>t.size}})();class t4 extends tL{static instance;pathRoot="/client";sessions=[];signUp=new nk;signIn=new ny;lastActiveSessionId=null;captchaBypass=!1;cookieExpiresAt=null;lastAuthenticationStrategy=null;createdAt=null;updatedAt=null;static getOrCreateInstance(e=null){return t4.instance||(t4.instance=new t4(e)),t4.instance}static clearInstance(){t4.instance=null}static isClientResource(e){return!!e&&e instanceof t4}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()}
vendor: 8,094 bytes, line 14
14fetch({fetchMaxTries:e,abortSignal:t}={}){return this._baseGet({fetchMaxTries:e,abortSignal:t})}async destroy(){return this._baseDelete({path:"/client"}).then(()=>{t2.clear(),this.id="",this.sessions=[],this.signUp=new nk(null),this.signIn=new ny(null),this.lastActiveSessionId=null,this.lastAuthenticationStrategy=null,this.cookieExpiresAt=null,this.createdAt=null,this.updatedAt=null})}removeSessions(){return this._baseDelete({path:this.path()+"/sessions"}).then(e=>(t2.clear(),e))}clearCache(){return this.sessions.forEach(e=>e.clearCache())}isEligibleForTouch(){return!!this.cookieExpiresAt&&this.cookieExpiresAt.getTime()-Date.now()<=6912e5}buildTouchUrl({redirectUrl:e}){return tL.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 no(e)),this.signUp=new nk(e.sign_up),this.signIn=new ny(e.sign_in),this.lastActiveSessionId=e.last_active_session_id,this.captchaBypass=e.captcha_bypass||!1,this.cookieExpiresAt=e.cookie_expires_at?tK(e.cookie_expires_at):null,this.lastAuthenticationStrategy=e.last_authentication_strategy||null,this.createdAt=tK(e.created_at||void 0),this.updatedAt=tK(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,last_authentication_strategy:this.lastAuthenticationStrategy??null,created_at:this.createdAt?.getTime()??null,updated_at:this.updatedAt?.getTime()??null}}path(){return this.pathRoot}}function t5(e){let{pageSize:t,initialPage:i,...n}=e||{},r=t??10;return new URLSearchParams({...Object.entries(n).reduce((e,[t,i])=>(void 0!==i&&(e[t]=i),e),{}),limit:r+"",offset:((i??1)-1)*r+""})}class t6{static #T="/billing";static path(e,t){let{orgId:i}=t||{},n=i?`/organizations/${i}`:"/me";return`${n}${t6.#T}${e}`}getPlans=async e=>{let{for:t,...i}=e||{},n={...i,payer_type:"organization"===t?"org":"user"};return await tL._fetch({path:`${t6.#T}/plans`,method:"GET",search:t5(n)}).then(e=>{let{data:t,total_count:i}=e;return{total_count:i,data:t.map(e=>new id(e))}})};getPlan=async e=>new id(await tL._fetch({path:`${t6.#T}/plans/${e.id}`,method:"GET"}));getSubscription=async e=>await tL._fetch({path:t6.path("/subscription",{orgId:e.orgId}),method:"GET"}).then(e=>new ih(e?.response));getStatements=async e=>{let{orgId:t,...i}=e;return await tL._fetch({path:t6.path("/statements",{orgId:t}),method:"GET",search:t5(i)}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new ie(e))}})};getStatement=async e=>new ie((await tL._fetch({path:t6.path(`/statements/${e.id}`,{orgId:e.orgId}),method:"GET"}))?.response);getPaymentAttempts=async e=>{let{orgId:t,...i}=e;return await tL._fetch({path:t6.path("/payment_attempts",{orgId:t}),method:"GET",search:t5(i)}).then(e=>{let{data:t,total_count:i}=e;return{total_count:i,data:t.map(e=>new ii(e))}})};getPaymentAttempt=async e=>new ii(await tL._fetch({path:t6.path(`/payment_attempts/${e.id}`,{orgId:e.orgId}),method:"GET"}));startCheckout=async e=>{let{orgId:t,...i}=e;return new t9((await tL._fetch({path:t6.path("/checkouts",{orgId:t}),method:"POST",body:i}))?.response)}}class t8 extends tL{id;createdAt;updatedAt;imageUrl;userId=null;email;firstName;lastName;organizationId=null;organizationName;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,e.created_at&&(this.createdAt=tK(e.created_at)),e.updated_at&&(this.updatedAt=tK(e.updated_at)),this.imageUrl=e.image_url,this.userId=e.user_id,this.email=e.email,this.firstName=e.first_name,this.lastName=e.last_name,this.organizationId=e.organization_id,this.organizationName=e.organization_name),this}}class t9 extends tL{id;externalClientSecret;externalGatewayId;paymentMethod;plan;planPeriod;planPeriodStart;status;totals;isImmediatePlanChange;freeTrialEndsAt;payer;needsPaymentMethod;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.externalClientSecret=e.external_client_secret,this.externalGatewayId=e.external_gateway_id,this.paymentMethod=e.payment_method?new il(e.payment_method):void 0,this.plan=new id(e.plan),this.planPeriod=e.plan_period,this.planPeriodStart=e.plan_period_start,this.status=e.status,this.totals=eU(e.totals),this.isImmediatePlanChange=e.is_immediate_plan_change,e.free_trial_ends_at&&(this.freeTrialEndsAt=tK(e.free_trial_ends_at)),this.payer=new t8(e.payer),this.needsPaymentMethod=e.needs_payment_method),this}confirm=e=>tP(()=>this._basePatch({path:t6.path(`/checkouts/${this.id}/confirm`,{orgId:this.payer.organizationId}),body:e}),{factor:1.1,maxDelayBetweenRetries:2e3,initialDelay:2e3,jitter:!1,shouldRetry(e,t){if(!S(e)||t>=4)return!1;let i=e?.status,n=409===i&&e.errors?.[0]?.code==="checkout_already_in_progress";return i>=500||n}})}class t7 extends tL{id;name;description=null;slug;avatarUrl=null;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.description=e.description,this.slug=e.slug,this.avatarUrl=e.avatar_url),this}}class ie extends tL{id;status;timestamp;totals;groups;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.timestamp=tK(e.timestamp),this.totals=eU(e.totals),this.groups=e.groups.map(e=>new it(e))),this}}class it{id;timestamp;items;constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.timestamp=tK(e.timestamp),this.items=e.items.map(e=>new ii(e))),this}}class ii extends tL{id;amount;failedAt=null;paidAt=null;updatedAt;paymentMethod=null;subscriptionItem;chargeType;status;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.amount=eC(e.amount),this.paidAt=e.paid_at?tK(e.paid_at):null,this.failedAt=e.failed_at?tK(e.failed_at):null,this.updatedAt=tK(e.updated_at),this.paymentMethod=e.payment_method?new il(e.payment_method):null,this.subscriptionItem=new iu(e.subscription_item),this.chargeType=e.charge_type,this.status=e.status),this}}let ir="/payment_methods",is=async e=>{let{orgId:t,...i}=e;return new ic((await tL._fetch({path:t6.path(`${ir}/initialize`,{orgId:t}),method:"POST",body:i}))?.response)},ia=async e=>{let{orgId:t,...i}=e;return new il((await tL._fetch({path:t6.path(ir,{orgId:t}),method:"POST",body:i}))?.response)},io=async e=>{let{orgId:t,...i}=e??{};return await tL._fetch({path:t6.path(ir,{orgId:t}),method:"GET",search:t5(i)}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new il(e))}})};class il extends tL{id;last4=null;paymentType;cardType=null;isDefault;isRemovable;status;walletType;expiryYear;expiryMonth;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.last4=e.last4,this.paymentType=e.payment_type,this.cardType=e.card_type,this.isDefault=e.is_default,this.isRemovable=e.is_removable,this.status=e.status,this.walletType=e.wallet_type,this.expiryYear=e.expiry_year,this.expiryMonth=e.expiry_month,this.createdAt=null==e.created_at?e.created_at:tK(e.created_at),this.updatedAt=null==e.updated_at?e.updated_at:tK(e.updated_at)),this}async remove(e){let{orgId:t}=e??{};return new ip((await tL._fetch({path:t6.path(`/payment_methods/${this.id}`,{orgId:t}),method:"DELETE"}))?.response)}async makeDefault(e){let{orgId:t}=e??{};return await tL._fetch({path:t6.path("/payers/default_payment_method",{orgId:t}),method:"PUT",body:{payment_method_id:this.id}}),null}}class ic extends tL{externalClientSecret;externalGatewayId;paymentMethodOrder;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.externalClientSecret=e.external_client_secret,this.externalGatewayId=e.external_gateway_id,this.paymentMethodOrder=e.payment_method_order??["card"]),this}}
14class id extends tL{id;name;fee;annualFee=null;annualMonthlyFee=null;description=null;isDefault;isRecurring;hasBaseFee;forPayerType;publiclyVisible;slug;avatarUrl=null;features;freeTrialDays;freeTrialEnabled;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.fee=eC(e.fee),this.annualFee=e.annual_fee?eC(e.annual_fee):null,this.annualMonthlyFee=e.annual_monthly_fee?eC(e.annual_monthly_fee):null,this.description=e.description,this.isDefault=e.is_default,this.isRecurring=e.is_recurring,this.hasBaseFee=e.has_base_fee,this.forPayerType=e.for_payer_type,this.publiclyVisible=e.publicly_visible,this.slug=e.slug,this.avatarUrl=e.avatar_url,this.freeTrialDays=this.withDefault(e.free_trial_days,null),this.freeTrialEnabled=this.withDefault(e.free_trial_enabled,!1),this.features=(e.features||[]).map(e=>new t7(e))),this}}class ih extends tL{id;status;activeAt;createdAt;pastDueAt;updatedAt;nextPayment;subscriptionItems;eligibleForFreeTrial;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.createdAt=tK(e.created_at),this.updatedAt=e.updated_at?tK(e.updated_at):null,this.activeAt=tK(e.active_at),this.pastDueAt=e.past_due_at?tK(e.past_due_at):null,e.next_payment&&(this.nextPayment={amount:eC(e.next_payment.amount),date:tK(e.next_payment.date)}),this.subscriptionItems=(e.subscription_items||[]).map(e=>new iu(e)),this.eligibleForFreeTrial=this.withDefault(e.eligible_for_free_trial,!1)),this}}class iu extends tL{id;plan;planPeriod;status;createdAt;periodStart;periodEnd;canceledAt;pastDueAt;amount;credit;credits;isFreeTrial;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.plan=new id(e.plan),this.planPeriod=e.plan_period,this.status=e.status,this.createdAt=tK(e.created_at),this.pastDueAt=e.past_due_at?tK(e.past_due_at):null,this.periodStart=tK(e.period_start),this.periodEnd=e.period_end?tK(e.period_end):null,this.canceledAt=e.canceled_at?tK(e.canceled_at):null,this.amount=e.amount?eC(e.amount):void 0,this.credit=e.credit&&e.credit.amount?{amount:eC(e.credit.amount)}:void 0,this.credits=e.credits?eA(e.credits):void 0,this.isFreeTrial=this.withDefault(e.is_free_trial,!1)),this}async cancel(e){let{orgId:t}=e;return new ip((await tL._fetch({path:t6.path(`/subscription_items/${this.id}`,{orgId:t}),method:"DELETE"}))?.response)}}class ip{object="";id;slug;deleted=!1;constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.object=e.object,this.id=e.id,this.slug=e.slug,this.deleted=e.deleted),this}}class im extends tL{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}}}var i_=i(5851),ig='const respond=r=>{self.postMessage(r)},workerToTabIds={};self.addEventListener("message",r=>{const e=r.data;switch(e.type){case"setTimeout":workerToTabIds[e.id]=setTimeout(()=>{respond({id:e.id}),delete workerToTabIds[e.id]},e.ms);break;case"clearTimeout":workerToTabIds[e.id]&&(clearTimeout(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break;case"setInterval":workerToTabIds[e.id]=setInterval(()=>{respond({id:e.id})},e.ms);break;case"clearInterval":workerToTabIds[e.id]&&(clearInterval(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break}});\n';let iy=(e,t={})=>
vendor: 16,619 bytes, line 14
14{if("undefined"==typeof Worker)return null;try{let i=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=globalThis.URL.createObjectURL(i);return new Worker(n,t)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},ib=()=>{let e=0,t=()=>e++,i=new Map,n=(e,t)=>e?.postMessage(t),r=e=>{i.get(e.data.id)?.()},s=iy(ig,{name:"clerk-timers"});if(s?.addEventListener("message",r),!s)return{setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis),cleanup:i_.Z};let a=()=>{s||(s=iy(ig,{name:"clerk-timers"}),s?.addEventListener("message",r))};return{setTimeout:(e,r)=>{a();let o=t();return i.set(o,()=>{e(),i.delete(o)}),n(s,{type:"setTimeout",id:o,ms:r}),o},setInterval:(e,r)=>{a();let o=t();return i.set(o,e),n(s,{type:"setInterval",id:o,ms:r}),o},clearTimeout:e=>{a(),i.delete(e),n(s,{type:"clearTimeout",id:e})},clearInterval:e=>{a(),i.delete(e),n(s,{type:"clearInterval",id:e})},cleanup:()=>{s&&(s.terminate(),s=null,i.clear())}}};function iw({delayInMs:e}={delayInMs:1e3}){let t,i=ib(),n=!1,r=()=>{t&&(i.clearTimeout(t),i.cleanup()),n=!0},s=async a=>{n=!1,await a(r),n||(t=i.setTimeout(()=>{s(a)},e))};return{run:s,stop:r}}class iv extends tL{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}=iw();return{startEmailLinkFlow:async({redirectUrl:i})=>(await this.prepareVerification({strategy:"email_link",redirectUrl:i}),new Promise((i,n)=>{e(()=>this.reload().then(e=>{"verified"===e.verification.status&&(t(),i(e))}).catch(e=>{t(),n(e)}))})),cancelEmailLinkFlow:t}};createEnterpriseSSOLinkFlow=()=>{let{run:e,stop:t}=iw();return{startEnterpriseSSOLinkFlow:async({redirectUrl:i})=>{if(!(await this.prepareVerification({strategy:"enterprise_sso",redirectUrl:i})).verification.externalVerificationRedirectURL)throw Error("Unexpected: External verification redirect URL is missing");return new Promise((i,n)=>{e(()=>this.reload().then(e=>{"verified"===e.verification.status&&(t(),i(e))}).catch(e=>{t(),n(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 iL(e.verification),this.matchesSsoConnection=e.matches_sso_connection,this.linkedTo=(e.linked_to||[]).map(e=>new iq(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}}}let ik="token:update",iS="user:signOut",iC="environment:update",iA="session:tokenResolved",iU=f();class iI extends tL{user_api_keys_enabled=!1;orgs_api_keys_enabled=!1;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.user_api_keys_enabled=e.user_api_keys_enabled,this.orgs_api_keys_enabled=e.orgs_api_keys_enabled),this}__internal_toSnapshot(){return{user_api_keys_enabled:this.user_api_keys_enabled,orgs_api_keys_enabled:this.orgs_api_keys_enabled}}}class iP extends tL{actions={adminDelete:!1};domains={enabled:!1,enrollmentModes:[],defaultRole:null};slug={disabled:!1};organizationCreationDefaults={enabled:!1};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)),e.slug&&(this.slug.disabled=this.withDefault(e.slug.disabled,this.slug.disabled)),e.organization_creation_defaults&&(this.organizationCreationDefaults.enabled=this.withDefault(e.organization_creation_defaults.enabled,this.organizationCreationDefaults.enabled)),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 iT extends tL{static instance;authConfig=new tB;displayConfig=new im;maintenanceMode=!1;clientDebugMode=!1;partitionedCookies=!1;pathRoot="/environment";userSettings=new tj;organizationSettings=new iP;commerceSettings=new tJ;apiKeysSettings=new iI;protectConfig=new nc;static getInstance(){return iT.instance||(iT.instance=new iT),iT.instance}constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.authConfig=new tB(e.auth_config),this.displayConfig=new im(e.display_config),this.maintenanceMode=this.withDefault(e.maintenance_mode,this.maintenanceMode),this.clientDebugMode=this.withDefault(e.client_debug_mode,this.clientDebugMode),this.partitionedCookies=this.withDefault(e.partitioned_cookies,this.partitionedCookies),this.organizationSettings=new iP(e.organization_settings),this.userSettings=new tj(e.user_settings),this.commerceSettings=new tJ(e.commerce_settings),this.apiKeysSettings=new iI(e.api_keys_settings),this.protectConfig=new nc(e.protect_config)),this}fetch({touch:e,fetchMaxTries:t}={touch:!1}){return(e?this._basePatch({}):this._baseGet({fetchMaxTries:t})).then(e=>(iU.emit(iC,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,client_debug_mode:this.clientDebugMode,partitioned_cookies:this.partitionedCookies,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(),protect_config:this.protectConfig.__internal_toSnapshot()}}}class iO{static encode(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}static decode(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),i=t.length,n=new Uint8Array(i);for(let e=0;e<i;e++)n[e]=t.charCodeAt(e);return n.buffer}}async function iE(e){try{let t=await navigator.credentials.create({publicKey:e});if(!t)return{error:new T("Browser failed to create credential",{code:"passkey_registration_failed"}),publicKeyCredential:null};return{publicKeyCredential:t,error:null}}catch(e){var t;return{error:"InvalidStateError"===(t=e).name?new T(t.message,{code:"passkey_already_exists"}):"NotAllowedError"===t.name?new T(t.message,{code:"passkey_registration_cancelled"}):iM(t),publicKeyCredential:null}}}let ix=new class{controller;__abort(){if(!this.controller)return;let e=Error();e.name="AbortError",this.controller.abort(e)}createAbortSignal(){this.__abort();let e=new AbortController;return this.controller=e,e.signal}abort(){this.__abort(),this.controller=void 0}};async function iR({publicKeyOptions:e,conditionalUI:t}){try{let i=await navigator.credentials.get({publicKey:e,mediation:t?"conditional":"optional",signal:ix.createAbortSignal()});if(!i)return{error:new T("Browser failed to get credential",{code:"passkey_retrieval_failed"}),publicKeyCredential:null};return{publicKeyCredential:i,error:null}}catch(e){var i;return{error:"NotAllowedError"===(i=e).name?new T(i.message,{code:"passkey_retrieval_cancelled"}):iM(i),publicKeyCredential:null}}}function iM(e){return"AbortError"===e.name?new T(e.message,{code:"passkey_operation_aborted"}):"SecurityError"===e.name?new T(e.message,{code:"passkey_invalid_rpID_or_domain"}):e}function iz(e){let t=iW(e.challenge),i=(e.allowCredentials||[]).map(e=>({...e,id:iW(e.id)}));return{...e,allowCredentials:i,challenge:t}}function iN(e){return{type:e.type,id:e.id,rawId:iD(e.rawId),authenticatorAttachment:e.authenticatorAttachment}}function iF(e){let t=e.response;return{...iN(e),response:{clientDataJSON:iD(t.clientDataJSON),authenticatorData:iD(t.authenticatorData),signature:iD(t.signature),userHandle:t.userHandle?iD(t.userHandle):null}}}let iD=iO.encode.bind(iO),iW=iO.decode.bind(iO);class iL extends tL{pathRoot="";status=null;strategy=null;nonce=null;message=null;externalVerificationRedirectURL=null;attempts=null;expireAt=null;error=null;verifiedAtClient=null;channel;constructor(e){super(),this.fromJSON(e)}verifiedFromTheSameClient=()=>this.verifiedAtClient===tL.clerk?.client?.id;fromJSON(e){return e&&(this.status=e.status,this.verifiedAtClient=e.verified_at_client,this.strategy=e.strategy,this.nonce=e.nonce||null,this.message=e.message||null,e.external_verification_redirect_url?this.externalVerificationRedirectURL=new URL(e.external_verification_redirect_url):this.externalVerificationRedirectURL=null,this.attempts=e.attempts,this.expireAt=tK(e.expire_at||void 0),this.error=e.error?new w(e.error):null,this.channel=e.channel||void 0),this}__internal_toSnapshot(){var e;return{object:"verification",id:this.id||"",status:this.status,strategy:this.strategy,nonce:this.nonce,message:this.message,external_verification_redirect_url:this.externalVerificationRedirectURL?.toString()||null,attempts:this.attempts,expire_at:this.expireAt?.getTime()||null,error:(e=this.error,{code:e?.code||"",message:e?.message||"",long_message:e?.longMessage,meta:{param_name:e?.meta?.paramName,session_id:e?.meta?.sessionId,email_addresses:e?.meta?.emailAddresses,identifiers:e?.meta?.identifiers,zxcvbn:e?.meta?.zxcvbn,plan:e?.meta?.plan,is_plan_upgrade_possible:e?.meta?.isPlanUpgradePossible}}),verified_at_client:this.verifiedAtClient}}}class i$ extends iL{publicKey=null;constructor(e){super(e),this.fromJSON(e)}fromJSON(e){return super.fromJSON(e),e?.nonce&&(this.publicKey=function(e){let t=iW(e.user.id),i=iW(e.challenge),n=(e.excludeCredentials||[]).map(e=>({...e,id:iW(e.id)}));return{...e,excludeCredentials:n,challenge:i,user:{...e.user,id:t}}}(JSON.parse(e.nonce))),this}}class ij{emailAddress;phoneNumber;web3Wallet;externalAccount;constructor(e){e?(this.emailAddress=new iJ(e.email_address),this.phoneNumber=new iJ(e.phone_number),this.web3Wallet=new iJ(e.web3_wallet),this.externalAccount=new iL(e.external_account)):(this.emailAddress=new iJ(null),this.phoneNumber=new iJ(null),this.web3Wallet=new iJ(null),this.externalAccount=new iL(null))}__internal_toSnapshot(){return{email_address:this.emailAddress.__internal_toSnapshot(),phone_number:this.phoneNumber.__internal_toSnapshot(),web3_wallet:this.web3Wallet.__internal_toSnapshot(),external_account:this.externalAccount.__internal_toSnapshot()}}}class iJ extends iL{nextAction;supportedStrategies;constructor(e){super(e),e?(this.nextAction=e.next_action,this.supportedStrategies=e.supported_strategies):(this.nextAction="",this.supportedStrategies=[])}__internal_toSnapshot(){return{...super.__internal_toSnapshot(),next_action:this.nextAction,supported_strategies:this.supportedStrategies}}}class iK extends tL{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:i}=e||{};return this._basePatch({action:"reauthorize",body:{additional_scope:t,redirect_url:i}})};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 iL(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[function(e){let t=e||"";return t.charAt(0).toUpperCase()+t.slice(1)}(this.providerSlug()),"Account"].join(" ")}accountIdentifier(){return this.username||this.emailAddress||this.label}}class iB extends tL{id;protocol;provider;providerUserId=null;active;emailAddress="";firstName="";lastName="";publicMetadata={};verification=null;enterpriseConnection=null;lastAuthenticatedAt=null;enterpriseConnectionId=null;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.provider=e.provider,this.protocol=e.protocol,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,this.publicMetadata=e.public_metadata,this.lastAuthenticatedAt=e.last_authenticated_at?tK(e.last_authenticated_at):null,this.enterpriseConnectionId=e.enterprise_connection_id,e.verification&&(this.verification=new iL(e.verification)),e.enterprise_connection&&(this.enterpriseConnection=new iV(e.enterprise_connection))),this}__internal_toSnapshot(){return{object:"enterprise_account",id:this.id,provider:this.provider,protocol:this.protocol,provider_user_id:this.providerUserId,active:this.active,email_address:this.emailAddress,first_name:this.firstName,last_name:this.lastName,public_metadata:this.publicMetadata,verification:this.verification?.__internal_toSnapshot()||null,enterprise_connection:this.enterpriseConnection?.__internal_toSnapshot()||null,last_authenticated_at:this.lastAuthenticatedAt?this.lastAuthenticatedAt.getTime():null,enterprise_connection_id:this.enterpriseConnectionId}}}class iV extends tL{id;active;allowIdpInitiated;allowSubdomains;disableAdditionalIdentifications;domain;logoPublicUrl="";name;protocol;provider;syncUserAttributes;createdAt;updatedAt;enterpriseConnectionId="";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.logoPublicUrl=e.logo_public_url,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=tK(e.created_at),this.updatedAt=tK(e.updated_at),this.enterpriseConnectionId=e.enterprise_connection_id),this}__internal_toSnapshot(){return{object:"enterprise_account_connection",id:this.id,name:this.name,domain:this.domain,active:this.active,protocol:this.protocol,provider:this.provider,logo_public_url:this.logoPublicUrl,sync_user_attributes:this.syncUserAttributes,allow_subdomains:this.allowSubdomains,allow_idp_initiated:this.allowIdpInitiated,disable_additional_identifications:this.disableAdditionalIdentifications,enterprise_connection_id:this.enterpriseConnectionId,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}}class iq extends tL{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.t
vendor: 4,810 bytes, line 14
14ype}}}class iH extends tL{id;name=null;publicUrl=null;static async create(e,t={}){let i,n=t;return"string"==typeof t.file?(n=t.file,i=new Headers({"Content-Type":"application/octet-stream"})):t.file&&(n=new FormData).append("file",t.file),new iH((await tL._fetch({path:e,method:"POST",body:n,headers:i}))?.response)}static async delete(e){return new iH((await tL._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}}class iG extends tL{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 iL(e.verification),this.linkedTo=(e.linked_to||[]).map(e=>new iq(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}}}class iZ extends tL{id;name;organizationId;enrollmentMode;verification;affiliationEmailAddress;createdAt;updatedAt;totalPendingInvitations;totalPendingSuggestions;constructor(e){super(),this.fromJSON(e)}static async create(e,{name:t}){return new iZ((await tL._fetch({path:`/organizations/${e}/domains`,method:"POST",body:{name:t}}))?.response)}prepareAffiliationVerification=async e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/prepare_affiliation_verification`,method:"POST",body:e});attemptAffiliationVerification=async e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/attempt_affiliation_verification`,method:"POST",body:e});updateEnrollmentMode=e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/update_enrollment_mode`,body:e});delete=()=>this._baseDelete({path:`/organizations/${this.organizationId}/domains/${this.id}`});fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.organizationId=e.organization_id,this.enrollmentMode=e.enrollment_mode,this.affiliationEmailAddress=e.affiliation_email_address,this.totalPendingSuggestions=e.total_pending_suggestions,this.totalPendingInvitations=e.total_pending_invitations,e.verification?this.verification={status:e.verification.status,strategy:e.verification.strategy,attempts:e.verification.attempts,expiresAt:tK(e.verification.expires_at)}:this.verification=null),this}}class iY extends tL{id;organizationId;status;publicUserData;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}accept=async()=>await this._basePost({path:`/organizations/${this.organizationId}/membership_requests/${this.id}/accept`});reject=async()=>await this._basePost({path:`/organizations/${this.organizationId}/membership_requests/${this.id}/reject`});fromJSON(e){return e&&(this.id=e.id,this.organizationId=e.organization_id,this.status=e.status,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at),e.public_user_data&&(this.publicUserData=new nd(e.public_user_data))),this}}class iQ extends tL{id;key;name;description;type;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.key=e.key,this.name=e.name,this.description=e.description,this.type=e.type,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}}class iX extends tL{id;key;name;description;permissions=[];createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.key=e.key,this.name=e.name,this.description=e.description,this.permissions=e.permissions.map(e=>new iQ(e)),this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}}class i0 extends tL{pathRoot="/organizations";id;name;slug;imageUrl;hasImage;publicMetadata={};adminDeleteEnabled;createdAt;updatedAt;membersCount=0;
vendor: 7,024 bytes, line 14
14pendingInvitationsCount=0;maxAllowedMemberships;exclusiveMembership=!1;constructor(e){super(),this.fromJSON(e)}static async create(e){return new i0((await tL._fetch({path:"/organizations",method:"POST",body:e}))?.response)}static async get(e){return new i0((await tL._fetch({path:`/organizations/${e}`,method:"GET"}))?.response)}update=async e=>this._basePatch({body:e});getRoles=async e=>await tL._fetch({path:`/organizations/${this.id}/roles`,method:"GET",search:t5(e)},{forceUpdateClient:!0}).then(e=>{let{data:t,total_count:i,has_role_set_migration:n}=e?.response;return{total_count:i,data:t.map(e=>new iX(e)),has_role_set_migration:n}});getDomains=async e=>await tL._fetch({path:`/organizations/${this.id}/domains`,method:"GET",search:t5(e)},{forceUpdateClient:!0}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new iZ(e))}});getDomain=async({domainId:e})=>new iZ((await tL._fetch({path:`/organizations/${this.id}/domains/${e}`,method:"GET"}))?.response);getMembershipRequests=async e=>await tL._fetch({path:`/organizations/${this.id}/membership_requests`,method:"GET",search:t5(e)}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new iY(e))}});createDomain=async e=>iZ.create(this.id,{name:e});getMemberships=async e=>await tL._fetch({path:`/organizations/${this.id}/memberships`,method:"GET",search:t5({...e,paginated:!0})}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new i3(e))}});getInvitations=async e=>await tL._fetch({path:`/organizations/${this.id}/invitations`,method:"GET",search:t5(e)},{forceUpdateClient:!0}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new i1(e))}});addMember=async({userId:e,role:t})=>await tL._fetch({method:"POST",path:`/organizations/${this.id}/memberships`,body:{userId:e,role:t}}).then(e=>new i3(e?.response));inviteMember=async e=>i1.create(this.id,e);inviteMembers=async e=>i1.createBulk(this.id,e);updateMember=async({userId:e,role:t})=>await tL._fetch({method:"PATCH",path:`/organizations/${this.id}/memberships/${e}`,body:{role:t}}).then(e=>new i3(e?.response));removeMember=async e=>await tL._fetch({method:"DELETE",path:`/organizations/${this.id}/memberships/${e}`}).then(e=>new i3(e?.response));destroy=async()=>this._baseDelete();setLogo=async({file:e})=>{let t,i;return null===e?await tL._fetch({path:`/organizations/${this.id}/logo`,method:"DELETE"}).then(e=>new i0(e?.response)):("string"==typeof e?(t=e,i=new Headers({"Content-Type":"application/octet-stream"})):(t=new FormData).append("file",e),await tL._fetch({path:`/organizations/${this.id}/logo`,method:"PUT",body:t,headers:i}).then(e=>new i0(e?.response)))};initializePaymentMethod=e=>is({...e,orgId:this.id});addPaymentMethod=e=>ia({...e,orgId:this.id});getPaymentMethods=e=>io({...e,orgId:this.id});fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.slug=e.slug,this.imageUrl=e.image_url||"",this.hasImage=e.has_image||!1,this.publicMetadata=e.public_metadata||{},this.membersCount=e.members_count||0,this.pendingInvitationsCount=e.pending_invitations_count||0,this.maxAllowedMemberships=e.max_allowed_memberships||0,this.adminDeleteEnabled=e.admin_delete_enabled||!1,this.exclusiveMembership=e.exclusive_membership||!1,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}__internal_toSnapshot(){return{object:"organization",id:this.id,name:this.name,slug:this.slug,image_url:this.imageUrl,has_image:this.hasImage,public_metadata:this.publicMetadata,members_count:this.membersCount,pending_invitations_count:this.pendingInvitationsCount,max_allowed_memberships:this.maxAllowedMemberships,admin_delete_enabled:this.adminDeleteEnabled,exclusive_membership:this.exclusiveMembership,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}async reload(e){let{rotatingTokenNonce:t}=e||{},i=(await tL._fetch({path:`/organizations/${this.id}`,method:"GET",rotatingTokenNonce:t},{forceUpdateClient:!0}))?.response;return this.fromJSON(i)}}class i1 extends tL{id;emailAddress;organizationId;publicMetadata={};status;role;roleName;createdAt;updatedAt;static async create(e,{emailAddress:t,role:i}){return new i1((await tL._fetch({path:`/organizations/${e}/invitations`,method:"POST",body:{email_address:t,role:i}}))?.response)}static async createBulk(e,t){let{emailAddresses:i,role:n}=t;return((await tL._fetch({path:`/organizations/${e}/invitations/bulk`,method:"POST",body:{email_address:i,role:n}}))?.response).map(e=>new i1(e))}constructor(e){super(),this.fromJSON(e)}revoke=async()=>await this._basePost({path:`/organizations/${this.organizationId}/invitations/${this.id}/revoke`});fromJSON(e){return e&&(this.id=e.id,this.emailAddress=e.email_address,this.organizationId=e.organization_id,this.publicMetadata=e.public_metadata,this.role=e.role,this.roleName=e.role_name,this.status=e.status,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}}class i3 extends tL{id;publicMetadata={};publicUserData;organization;permissions=[];role;roleName;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}static retrieve=async e=>await tL._fetch({path:"/me/organization_memberships",method:"GET",search:t5({...e,paginated:!0})}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new i3(e))}});destroy=async()=>await this._baseDelete({path:`/organizations/${this.organization.id}/memberships/${this.publicUserData?.userId}`});update=async({role:e})=>await this._basePatch({path:`/organizations/${this.organization.id}/memberships/${this.publicUserData?.userId}`,body:{role:e}});fromJSON(e){return e&&(this.id=e.id,this.organization=new i0(e.organization),this.publicMetadata=e.public_metadata||{},e.public_user_data&&(this.publicUserData=new nd(e.public_user_data)),this.permissions=Array.isArray(e.permissions)?[...e.permissions]:[],this.role=e.role,this.roleName=e.role_name,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}__internal_toSnapshot(){return{object:"organization_membership",id:this.id,organization:this.organization.__internal_toSnapshot(),public_metadata:this.publicMetadata,public_user_data:this.publicUserData?.__internal_toSnapshot(),permissions:this.permissions,role:this.role,role_name:this.roleName,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}reload(e){throw Error(`${t_} Calling OrganizationMembership.reload is not currently supported. Please contact support.`)}}class i2 extends tL{id;publicOrganizationData;status;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}static async retrieve(e){return await tL._fetch({path:"/me/organization_suggestions",method:"GET",search:t5(e)}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new i2(e))}})}accept=async()=>await this._basePost({path:`/me/organization_suggestions/${this.id}/accept`});fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.publicOrganizationData={hasImage:e.public_organization_data.has_
14image,imageUrl:e.public_organization_data.image_url,name:e.public_organization_data.name,id:e.public_organization_data.id,slug:e.public_organization_data.slug},this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}}class i4 extends tL{id;provider="saml_custom";providerUserId=null;active=!1;emailAddress="";firstName="";lastName="";verification=null;samlConnection=null;lastAuthenticatedAt=null;enterpriseConnectionId=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,this.enterpriseConnectionId=e.enterprise_connection_id,e.verification&&(this.verification=new iL(e.verification)),e.saml_connection&&(this.samlConnection=new i5(e.saml_connection)),this.lastAuthenticatedAt=e.last_authenticated_at?tK(e.last_authenticated_at):null),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(),enterprise_connection_id:this.enterpriseConnectionId,last_authenticated_at:this.lastAuthenticatedAt?this.lastAuthenticatedAt.getTime():null}}}class i5 extends tL{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=tK(e.created_at),this.updatedAt=tK(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()}}}let i6={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},i8=new Set(["first_factor","second_factor","multi_factor"]),i9=new Set(["strict_mfa","strict","moderate","lax"]),i7=e=>"number"==typeof e&&Number.isFinite(e)&&(-1===e||e>=0),ne=e=>e.replace(/^(org:)*/,"org:"),nt=(e,t)=>{let{org:i,user:n}=ni(e),[r,s]=t.split(":"),a=s||r;return"org"===r?i.includes(a):"user"===r?n.includes(a):[...i,...n].includes(a)},ni=e=>{let t=e?e.split(",").map(e=>e.trim()):[];return{org:t.filter(e=>e.split(":")[0].includes("o")).map(e=>e.split(":")[1]),user:t.filter(e=>e.split(":")[0].includes("u")).map(e=>e.split(":")[1])}};function nn(){return l()&&"function"==typeof window.PublicKeyCredential}async function nr(){try{return nn()&&await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function ns(){try{return"undefined"!=typeof window&&await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}class na extends tL{status;level;session;supportedFirstFactors=[];supportedSecondFactors=[];firstFactorVerification=new iL(null);secondFactorVerification=new iL(null);constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.session=new no(e.session),this.level=e.level,this.supportedFirstFactors=Q(e.supported_first_factors),this.supportedSecondFactors=Q(e.supported_second_factors),this.firstFactorVerification=new iL(e.first_factor_verification),this.secondFactorVerification=new iL(e.second_factor_verification)),this}}class no extends tL{pathRoot="/client/sessions";id;status;lastActiveAt;lastActiveToken;lastActiveOrganizationId;actor;agent;user;publicUserData;factorVerificationAge=null;tasks=null;expireAt;abandonAt;createdAt;updatedAt;static isSessionResource(e){return!!e&&e instanceof no}constructor(e){super(),this.fromJSON(e),this.#O(this.lastActiveToken)}end=()=>(t2.clear(),this._basePost({action:"end"}));remove=()=>(t2.clear(),this._basePost({action:"remove"}));touch=({intent:e}={})=>this._basePost({action:"touch",body:{active_organization_id:this.lastActiveOrganizationId,intent:e}}).then(e=>(e.lastActiveToken&&iU.emit(ik,{token:e.lastActiveToken}),e));clearCache=()=>t2.clear();getToken=async e=>tP(()=>this._getToken(e),{factor:1.55,initialDelay:3e3,maxDelayBetweenRetries:5e4,jitter:!1,shouldRetry:(e,t)=>!E(e)&&t<=8});checkAuthorization=e=>{let t=(this.user?.organizationMemberships||[]).find(e=>e.organization.id===this.lastActiveOrganizationId);return(e=>t=>{let i;return!!e.userId&&(i=[((e,t)=>{let{orgId:i,orgRole:n,orgPermissions:r}=t,s=void 0!==e.role,a=void 0!==e.permission;return s||a?s&&"string"!=typeof e.role||a&&"string"!=typeof e.permission||!i||s&&("string"!=typeof n||!n||ne(n)!==ne(e.role))||a&&(!Array.isArray(r)||!r.includes(ne(e.permission)))?"fail":"pass":"skip"})(t,e),((e,t)=>{let{features:i,plans:n}=t,r=void 0!==e.feature,s=void 0!==e.plan;if(!r&&!s)return"skip";if(r&&"string"!=typeof e.feature||s&&"string"!=typeof e.plan)return"fail";if(r){if("string"!=typeof i||!i)return"fail";try{if(!nt(i,e.feature))return"fail"}catch{return"fail"}}if(s){if("string"!=typeof n||!n)return"fail";try{if(!nt(n,e.plan))return"fail"}catch{return"fail"}}return"pass"})(t,e),((e,{factorVerificationAge:t})=>{if(void 0===e.reverification)return"skip";if(!t||!Array.isArray(t)||2!==t.length||!i7(t[0])||!i7(t[1]))return"fail";let i=(e=>{let t,i;if(!e)return!1;let n="string"==typeof e&&i9.has(e),r="object"==typeof e&&(t=e.level,i8.has(t))&&"number"==typeof(i=e.afterMinutes)&&i>0;return(!!n||!!r)&&(e=>"string"==typeof e?i6[e]:e).bind(null,e)})(e.reverification);if(!i)return"fail";let{level:n,afterMinutes:r}=i(),[s,a]=t;if(-1===s&&-1===a)return"fail";let o=-1!==s&&r>s,l=-1!==a&&r>a;switch(n){case"first_factor":return o?"pass":"fail";case"second_factor":if(-1===a)return o?"pass":"fail";return l?"pass":"fail";case"multi_factor":if(-1===a)return o?"pass":"fail";if(-1===s)return"fail";return o&&l?"pass":"fail"}})(t,e)]).some(e=>"pass"===e)&&i.every(e=>"pass"===e||"skip"===e)})({userId:this.user?.id,factorVerificationAge:this.factorVerificationAge,orgId:t?.organization?.id,orgRole:t?.role,orgPermissions:t?.permissions,features:this.lastActiveToken?.jwt?.claims.fea||"",plans:this.lastActiveToken?.jwt?.claims.pla||""})(e)};#O=e=>{e&&t2.set({tokenId:this.#E(),tokenResolver:Promise.resolve(e)})};#E(e,t){let i=void 0===t?this.lastActiveOrganizationId:t;return tV.build(this.id,e,i)}startVerification=async({level:e})=>new na((await tL._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;case"enterprise_sso":t={emailAddressId:e.emailAddressId,enterpriseConnectionId:e.enterpriseConnectionId,redirectUrl:e.redirectUrl};break;default:tw("Session.prepareFirstFactorVerification",e.strategy)}return new na((await tL._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(iF(e.publicKeyCredential))}:{...e},new na((await tL._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=no.clerk.__internal_isWebAuthnSupported||nn,i=no.clerk.__internal_getPublicCredentials||iR;if(!t())throw new T("Passkeys are not supported",{code:"passkey_not_supported"});let n=e?iz(JSON.parse(e)):null;n||tC("get");let{publicKeyCredential:r,error:s}=await i({publicKeyOptions:n,conditionalUI:!1});if(!r)throw s;return this.attemptFirstFactorVerification({strategy:"passkey",publicKeyCredential:r})};prepareSecondFactorVerification=async e=>new na((await tL._fetch({method:"POST",path:`/client/sessions/${this.id}/verify/prepare_second_factor`,body:e}))?.response);attemptSecondFactorVerification=async e=>new na((await tL._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=tK(e.expire_at),this.abandonAt=tK(e.abandon_at),this.factorVerificationAge=e.factor_verification_age,this.lastActiveAt=tK(e.last_active_at||void 0),this.lastActiveOrganizationId=e.last_active_organization_id,this.actor=e.actor||null,this.agent=e.actor?.type==="agent"?e.actor:null,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at),this.user=new nT(e.user),this.tasks=e.tasks||null,e.public_user_data&&(this.publicUserData=new nd(e.public_user_data)),this.lastActiveToken=e.last_active_token?new nA(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:i,skipCache:n=!1}=e||{},r=void 0===e?.organizationId?this.lastActiveOrganizationId:e?.organizationId;if(!i&&Number(t)>=60)throw Error("Leeway can not exceed the token lifespan (60 seconds)");let s=this.#E(i,r),a=n?void 0:t2.get({tokenId:s},t),o=!i&&r===this.lastActiveOrganizationId;if(a){eb.debug("Using cached token (no fetch needed)",{tokenId:s},"session");
14let e=await a.tokenResolver;return o&&iU.emit(ik,{token:e}),e.getRawString()||null}eb.info("Fetching new token from API",{organizationId:r,template:i,tokenId:s},"session");let l=i?`${this.path()}/tokens/${i}`:`${this.path()}/tokens`,c=no.clerk?.__unstable__environment?.authConfig?.sessionMinter,d=i?{}:{organizationId:r,...c&&this.lastActiveToken?{token:this.lastActiveToken.getRawString()}:{},...c&&n?{forceOrigin:"true"}:{}},h=this.lastActiveToken?.getRawString(),u=c?nA.create(l,d,n?{debug:"skip_cache"}:void 0):nA.create(l,d,n?{debug:"skip_cache"}:void 0).catch(e=>{if(C.is(e)&&h)return nA.create(l,{...d},{expired_token:h});throw e});return t2.set({tokenId:s,tokenResolver:u}),u.then(e=>{let t=e.jwt?.claims?.sid;return t&&t!==this.id&&eb.warn("Token session mismatch: requested token for one session but received token for another",{requestedSessionId:this.id,returnedSessionId:t,tokenId:s,hasActor:!!this.actor},"session"),o&&(iU.emit(ik,{token:e}),e.jwt&&!this.#x(e)&&(this.lastActiveToken=e,iU.emit(iA,null))),e.getRawString()||null})}#x(e){let t=this.lastActiveToken;return!!t?.jwt&&tZ(t)===tZ(e)&&(tY(t)||"")===(tY(e)||"")&&tH(t,e)!==e}get currentTask(){let[e]=this.tasks??[];return e}}class nl extends tL{id;pathRoot="/me/passkeys";verification=null;name=null;lastUsedAt=null;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}static async create(){return tL._fetch({path:"/me/passkeys",method:"POST"}).then(e=>new nl(e?.response))}static async attemptVerification(e,t){let i=function(e){let t=e.response;return{...iN(e),response:{clientDataJSON:iD(t.clientDataJSON),attestationObject:iD(t.attestationObject),transports:t.getTransports()}}}(t);return tL._fetch({path:`/me/passkeys/${e}/attempt_verification`,method:"POST",body:{strategy:"passkey",publicKeyCredential:JSON.stringify(i)}}).then(e=>new nl(e?.response))}static async registerPasskey(){let e=nl.clerk.__internal_isWebAuthnSupported||nn,t=nl.clerk.__internal_createPublicCredentials||iE,i=nl.clerk.__internal_isWebAuthnPlatformAuthenticatorSupported||ns;if(!e())throw new T("Passkeys are not supported on this device.",{code:"passkey_not_supported"});let n=await this.create(),{verification:r}=n,s=r?.publicKey;if(s||tC("create"),s.authenticatorSelection?.authenticatorAttachment==="platform"&&!await i())throw new T("Registration requires a platform authenticator but the device does not support it.",{code:"passkey_pa_not_supported"});let{publicKeyCredential:a,error:o}=await t(s);if(!a)throw o;return this.attemptVerification(n.id,a)}update=e=>this._basePatch({body:e});delete=async()=>new ip((await tL._fetch({path:this.path(),method:"DELETE"}))?.response);fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.lastUsedAt=e.last_used_at?tK(e.last_used_at):null,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at),e.verification&&(this.verification=new i$(e.verification))),this}__internal_toSnapshot(){return{object:"passkey",id:this.id,name:this.name,verification:this.verification?.__internal_toSnapshot()||null,last_used_at:this.lastUsedAt?.getTime()||null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}}class nc extends tL{id="";loaders;tokens_invalid_before;rollout;constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=this.withDefault(e.id,this.id),this.loaders=this.withDefault(e.loaders,this.loaders),this.tokens_invalid_before=this.withDefault(e.tokens_invalid_before,this.tokens_invalid_before)),this}__internal_toSnapshot(){return{object:"protect_config",id:this.id,loaders:this.loaders,tokens_invalid_before:this.tokens_invalid_before}}}class nd{firstName;lastName;imageUrl;hasImage;identifier;userId;username;constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.firstName=e.first_name||null,this.lastName=e.last_name||null,this.imageUrl=e.image_url||"",this.hasImage=e.has_image||!1,this.identifier=e.identifier||"",this.userId=e.user_id,this.username=e.username),this}__internal_toSnapshot(){return{first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl,has_image:this.hasImage,identifier:this.identifier,user_id:this.userId,username:this.username}}}class nh extends tL{pathRoot="";id;status;abandonAt;expireAt;lastActiveAt;latestActivity;actor;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}static retrieve(){let e=tL.clerk.session?.id;return this.clerk.getFapiClient().request({method:"GET",path:"/me/sessions/active",sessionId:e}).then(e=>e.payload.map(e=>new nh(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=tK(e.expire_at),this.abandonAt=tK(e.abandon_at),this.lastActiveAt=tK(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}}function nu(e){return e?`https://${e.replace(/clerk\.accountsstage\./,"accountsstage.").replace(/clerk\.accounts\.|clerk\./,"accounts.")}`:""}async function np(e,t,i,n,r){if(!e.client||!n.popup)return;let s=nu(e.frontendApi),{redirectUrl:a}=n,o=new URL(a);o.searchParams.set("sign_in_force_redirect_url",n.redirectUrlComplete),o.searchParams.set("sign_up_force_redirect_url",n.redirectUrlComplete),o.searchParams.set("intent",t);let l=e.buildUrlWithAuth(o.toString()),c=e.buildUrlWithAuth(`${s}/popup-callback`),d=e.buildUrlWithAuth(`${s}/popup-callback?return_url=${encodeURIComponent(l)}`),h=async t=>{if(t.origin!==s)return;let i=!1;if(t.data.session){if(!e.client?.sessions.find(e=>e.id===t.data.session))try{await e.client?.reload()}catch(e){console.error(e)}await e.setActive({session:t.data.session,redirectUrl:n.redirectUrlComplete}),i=!0}else t.data.return_url&&(e.navigate(t.data.return_url),i=!0);i&&window.removeEventListener("message",h)};window.addEventListener("message",h),await i({...n,redirectUrlComplete:c,redirectUrl:d},r)}function nf(e,{redirectCallbackUrl:t,redirectUrl:i}
14){let n=nu(e.frontendApi),r=new URL(t);r.searchParams.set("sign_in_force_redirect_url",i),r.searchParams.set("sign_up_force_redirect_url",i);let s=e.buildUrlWithAuth(r.toString()),a=e.buildUrlWithAuth(`${n}/popup-callback`);return{redirectCallbackUrl:e.buildUrlWithAuth(`${n}/popup-callback?return_url=${encodeURIComponent(s)}`),redirectUrl:a}}function nm(e,t){return new Promise((i,n)=>{if(!e.client||!t.popup)return void n();let r=async t=>{t.origin===nu(e.frontendApi)&&(t.data.session||t.data.return_url?(window.removeEventListener("message",r),i()):n())};window.addEventListener("message",r),t.popup.location.href=t.externalVerificationRedirectURL.toString()})}let n_=(e,t)=>{let{onValidation:n=eu.ZT,onValidationComplexity:r=eu.ZT}=t||{},{show_zxcvbn:s,validatePassword:a}=e,o=t=>((e,t)=>{let{max_length:i,min_length:n,require_special_char:r,require_lowercase:s,require_numbers:a,require_uppercase:o}=t,l=(e=>{let t;if(e.allowed_special_characters){let i=e.allowed_special_characters.replace("[","\\[");i=i.replace("]","\\]"),t=RegExp(`[${i}]`)}else t=/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/;return(e,{minLength:i,maxLength:n})=>({max_length:e.length<n,min_length:e.length>=i,require_numbers:/\d/.test(e),require_lowercase:/[a-z]/.test(e),require_uppercase:/[A-Z]/.test(e),require_special_char:t.test(e)})})(t)(e,{maxLength:t.max_length,minLength:t.min_length}),c={max_length:i,min_length:n,require_special_char:r,require_lowercase:s,require_numbers:a,require_uppercase:o},d=new Map;for(let e in c)c[e]&&!l[e]&&d.set(e,!0);return Object.freeze(Object.fromEntries(d))})(t,e),l=(({min_zxcvbn_strength:e,onResult:t})=>i=>n=>{let r=i(n);return(t?.(r),r.score>=e&&r.score<3)?{state:"pass",keys:["unstable__errors.zxcvbn.couldBeStronger"],result:r}:r.score>=e?{state:"excellent",result:r}:{state:"fail",keys:["unstable__errors.zxcvbn.notEnough",...r.feedback.suggestions.map(e=>`unstable__errors.zxcvbn.suggestions.${e}`)],result:r}})(e),c={};return(e,t)=>{let{onValidation:d=n,onValidationComplexity:h=r}=t||{};if(!a)return;let u=o(e);h(0===Object.keys(u).length),c={...c,complexity:u},s&&Promise.all([i.e("708").then(i.bind(i,384)),i.e("325").then(i.bind(i,7706))]).then(([e,t])=>{let{zxcvbnOptions:i,zxcvbn:n}=e,{dictionary:r,adjacencyGraphs:s}=t;return i.setOptions({dictionary:{...r},graphs:s}),n}).then(t=>{let i=l(t)(e);d({...c={...c,strength:i},strength:i})}),c.complexity&&0===Object.keys(c.complexity).length&&s||d(c)}};async function ng(e,t){iU.emit("resource:error",{resource:e,error:null}),iU.emit("resource:fetch",{resource:e,status:"fetching"});try{return{result:await t(),error:null}}catch(t){return iU.emit("resource:error",{resource:e,error:t}),{error:t}}finally{iU.emit("resource:fetch",{resource:e,status:"idle"})}}class ny extends tL{pathRoot="/client/sign_ins";id;_status=null;supportedIdentifiers=[];supportedFirstFactors=[];supportedSecondFactors=null;firstFactorVerification=new iL(null);secondFactorVerification=new iL(null);identifier=null;createdSessionId=null;userData=new nw(null);clientTrustState;get status(){return this._status}set status(e){let t=this._status;this._status=e,e&&t!==e&&eb.debug("SignIn.status",{id:this.id,from:t,to:e})}__internal_future=new nb(this);__internal_basePost=this._basePost.bind(this);__internal_baseGet=this._baseGet.bind(this);constructor(e=null){super(),this.fromJSON(e)}create=e=>{eb.debug("SignIn.create",{id:this.id,strategy:"strategy"in e?e.strategy:void 0});let t=e2();return this._basePost({path:this.pathRoot,body:t?{locale:t,...e}:e})};resetPassword=e=>this._basePost({body:e,action:"reset_password"});prepareFirstFactor=e=>{let t;switch(eb.debug("SignIn.prepareFirstFactor",{id:this.id,strategy:e.strategy}),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_base_signature":case"web3_coinbase_wallet_signature":case"web3_okx_wallet_signature":case"web3_solana_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,enterpriseConnectionId:e.enterpriseConnectionId};break;default:tw("SignIn.prepareFirstFactor",e.strategy)}return this._basePost({body:{...t,strategy:e.strategy},action:"prepare_first_factor"})};attemptFirstFactor=e=>{let t;
14return eb.debug("SignIn.attemptFirstFactor",{id:this.id,strategy:e.strategy}),t="passkey"===e.strategy?{publicKeyCredential:JSON.stringify(iF(e.publicKeyCredential))}:{...e},this._basePost({body:{...t,strategy:e.strategy},action:"attempt_first_factor"})};createEmailLinkFlow=()=>{let{run:e,stop:t}=iw();return{startEmailLinkFlow:async({emailAddressId:i,redirectUrl:n})=>{this.id||tb("SignIn");let r={strategy:"email_link",emailAddressId:i,redirectUrl:n},s="needs_second_factor"===this.status,a=s?"secondFactorVerification":"firstFactorVerification";return s?await this.prepareSecondFactor(r):await this.prepareFirstFactor(r),new Promise((i,n)=>{e(()=>this.reload().then(e=>{let n=e[a].status;("verified"===n||"expired"===n)&&(t(),i(e))}).catch(e=>{t(),n(e)}))})},cancelEmailLinkFlow:t}};prepareSecondFactor=e=>(eb.debug("SignIn.prepareSecondFactor",{id:this.id,strategy:e.strategy}),this._basePost({body:e,action:"prepare_second_factor"}));attemptSecondFactor=e=>(eb.debug("SignIn.attemptSecondFactor",{id:this.id,strategy:e.strategy}),this._basePost({body:e,action:"attempt_second_factor"}));authenticateWithRedirectOrPopup=async(e,t)=>{let{strategy:i,redirectUrlComplete:n,identifier:r,oidcPrompt:s,continueSignIn:a,enterpriseConnectionId:o}=e||{},l=ny.clerk.buildUrlWithAuth(e.redirectUrl);this.id&&a||await this.create({strategy:i,identifier:r,redirectUrl:l,actionCompleteRedirectUrl:n}),("saml"===i||"enterprise_sso"===i)&&await this.prepareFirstFactor({strategy:i,redirectUrl:l,actionCompleteRedirectUrl:n,oidcPrompt:s,enterpriseConnectionId:o});let{status:c,externalVerificationRedirectURL:d}=this.firstFactorVerification;"unverified"===c&&d?t(d):tS(c,ny.fapiClient.buildEmailAddress("support"))};authenticateWithRedirect=async e=>this.authenticateWithRedirectOrPopup(e,ek);authenticateWithPopup=async e=>{let{popup:t}=e||{};return t||tk("popup"),np(ny.clerk,"signIn",this.authenticateWithRedirectOrPopup,e,e=>{t.location.href=e.toString()})};authenticateWithWeb3=async e=>{let t,{identifier:i,generateSignature:n,strategy:r="web3_metamask_signature",walletName:s}=e||{},a=r.replace("web3_","").replace("_signature","");"function"!=typeof n&&tk("generateSignature"),"solana"!==a||s||tk("walletName"),await this.create({identifier:i});let o=this.supportedFirstFactors?.find(e=>e.strategy===r);o||tv("SignIn"),await this.prepareFirstFactor(o);let{message:l}=this.firstFactorVerification;l||tv("SignIn");try{t=await n({identifier:i,nonce:l,walletName:s,provider:a})}catch(e){if("coinbase_wallet"===a&&4001===e.code)t=await n({identifier:i,nonce:l,provider:a,walletName:s});else throw e}return this.attemptFirstFactor({signature:t,strategy:r})};authenticateWithMetamask=async()=>{let e=await te();return this.authenticateWithWeb3({identifier:e,generateSignature:ts,strategy:"web3_metamask_signature"})};authenticateWithCoinbaseWallet=async()=>{let e=await tt();return this.authenticateWithWeb3({identifier:e,generateSignature:ta,strategy:"web3_coinbase_wallet_signature"})};authenticateWithBase=async()=>{let e=await tn();return this.authenticateWithWeb3({identifier:e,generateSignature:tl,strategy:"web3_base_signature"})};authenticateWithOKXWallet=async()=>{let e=await ti();return this.authenticateWithWeb3({identifier:e,generateSignature:to,strategy:"web3_okx_wallet_signature"})};authenticateWithSolana=async({walletName:e})=>{let t=await tr(e);return this.authenticateWithWeb3({identifier:t,generateSignature:t=>tc({...t,walletName:e}),strategy:"web3_solana_signature",walletName:e})};authenticateWithPasskey=async e=>{let{flow:t}=e||{},i=ny.clerk.__internal_isWebAuthnSupported||nn,n=ny.clerk.__internal_getPublicCredentials||iR,r=ny.clerk.__internal_isWebAuthnAutofillSupported||nr;if(!i())throw new T("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||function(){throw Error(`${t_} You need to start a SignIn flow by calling SignIn.create({ strategy: 'passkey' }) first`)}(),await this.prepareFirstFactor(e)}let{nonce:s}=this.firstFactorVerification,a=s?iz(JSON.parse(s)):null;a||tC("get");let o=!1;"autofill"===t&&(o=await r());let{publicKeyCredential:l,error:c}=await n({publicKeyOptions:a,conditionalUI:o});if(!l)throw c;return this.attemptFirstFactor({publicKeyCredential:l,strategy:"passkey"})};validatePassword=(e,t)=>{if(ny.clerk.__unstable__environment?.userSettings.passwordSettings)return n_({...ny.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=Q(e.supported_first_factors),this.supportedSecondFactors=Q(e.supported_second_factors),this.firstFactorVerification=new iL(e.first_factor_verification),this.secondFactorVerification=new iL(e.second_factor_verification),this.createdSe
vendor: 4,184 bytes, line 14
14ssionId=e.created_session_id,this.userData=new nw(e.user_data),this.clientTrustState=e.client_trust_state??void 0),iU.emit("resource:update",{resource:this}),this}__internal_toSnapshot(){return{object:"sign_in",id:this.id||"",status:this.status||null,supported_identifiers:this.supportedIdentifiers,supported_first_factors:Y(this.supportedFirstFactors),supported_second_factors:Y(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()}}}class nb{emailCode={sendCode:this.sendEmailCode.bind(this),verifyCode:this.verifyEmailCode.bind(this)};emailLink={sendLink:this.sendEmailLink.bind(this),waitForVerification:this.waitForEmailLinkVerification.bind(this),get verification(){if(!a())return null;let e=eE("__clerk_status"),t=eE("__clerk_created_session");if(!e||!t)return null;let i="verified"===e&&void 0!==ny.clerk.client&&ny.clerk.client.sessions.some(e=>e.id===t);return{status:e,createdSessionId:t,verifiedFromTheSameClient:i}}};resetPasswordEmailCode={sendCode:this.sendResetPasswordEmailCode.bind(this),verifyCode:this.verifyResetPasswordEmailCode.bind(this),submitPassword:this.submitResetPassword.bind(this)};phoneCode={sendCode:this.sendPhoneCode.bind(this),verifyCode:this.verifyPhoneCode.bind(this)};mfa={sendPhoneCode:this.sendMFAPhoneCode.bind(this),verifyPhoneCode:this.verifyMFAPhoneCode.bind(this),verifyTOTP:this.verifyTOTP.bind(this),verifyBackupCode:this.verifyBackupCode.bind(this)};#R;constructor(e){this.#R=e}get id(){return this.#R.id}get identifier(){return this.#R.identifier}get createdSessionId(){return this.#R.createdSessionId}get userData(){return this.#R.userData}get status(){return this.#R.status||"needs_identifier"}get supportedFirstFactors(){return this.#R.supportedFirstFactors??[]}get supportedSecondFactors(){return this.#R.supportedSecondFactors??[]}get isTransferable(){return"transferable"===this.#R.firstFactorVerification.status}get existingSession(){if("failed"===this.#R.firstFactorVerification.status&&this.#R.firstFactorVerification.error?.code==="identifier_already_signed_in"&&this.#R.firstFactorVerification.error?.meta?.sessionId)return{sessionId:this.#R.firstFactorVerification.error?.meta?.sessionId}}get firstFactorVerification(){return this.#R.firstFactorVerification}get secondFactorVerification(){return this.#R.secondFactorVerification}async sendResetPasswordEmailCode(){if(!this.#R.id)throw Error("Cannot reset password without a sign in.");return ng(this.#R,async()=>{let e=this.#R.supportedFirstFactors?.find(e=>"reset_password_email_code"===e.strategy);if(!e)throw new I("Reset password email code factor not found",{code:"factor_not_found"});let{emailAddressId:t}=e;await this.#R.__internal_basePost({body:{emailAddressId:t,strategy:"reset_password_email_code"},action:"prepare_first_factor"})})}async verifyResetPasswordEmailCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"reset_password_email_code"},action:"attempt_first_factor"})})}async submitResetPassword(e){let{password:t,signOutOfOtherSessions:i=!0}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{password:t,signOutOfOtherSessions:i},action:"reset_password"})})}async _create(e){let t=e2();await this.#R.__internal_basePost({path:this.#R.pathRoot,body:t?{locale:t,...e}:e})}async create(e){return ng(this.#R,async()=>{await this._create(e)})}async password(e){if([e.identifier,e.emailAddress,e.phoneNumber].filter(Boolean).length>1)throw Error("Only one of identifier, emailAddress, or phoneNumber can be provided");return ng(this.#R,async()=>{let t=e.identifier||e.emailAddress||e.phoneNumber,i=this.#R.identifier,n=e2();await this.#R.__internal_basePost({path:this.#R.pathRoot,body:{identifier:t||i,password:e.password,...n?{locale:n}:{}}})})}async sendEmailCode(e={}){let{emailAddress:t,emailAddressId:i}=e;if(!this.#R.id&&i)throw Error("signIn.emailCode.sendCode() cannot be called with an emailAddressId if an existing sign
14In does not exist.");if(!this.#R.id&&!t)throw Error("signIn.emailCode.sendCode() cannot be called without an emailAddress if an existing signIn does not exist.");return ng(this.#R,async()=>{t&&await this._create({identifier:t});let e=this.selectFirstFactor({strategy:"email_code",emailAddressId:i});if(!e)throw new I("Email code factor not found",{code:"factor_not_found"});await this.#R.__internal_basePost({body:{emailAddressId:e.emailAddressId,strategy:"email_code"},action:"prepare_first_factor"})})}async verifyEmailCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"email_code"},action:"attempt_first_factor"})})}async sendEmailLink(e){let{emailAddress:t,verificationUrl:i,emailAddressId:n}=e;if(!this.#R.id&&n)throw Error("signIn.emailLink.sendLink() cannot be called with an emailAddressId if an existing signIn does not exist.");if(!this.#R.id&&!t)throw Error("signIn.emailLink.sendLink() cannot be called without an emailAddress if an existing signIn does not exist.");return ng(this.#R,async()=>{t&&await this._create({identifier:t});let e=this.selectFirstFactor({strategy:"email_link",emailAddressId:n});if(!e)throw new I("Email link factor not found",{code:"factor_not_found"});let r=i;try{new URL(i)}catch{r=window.location.origin+i}await this.#R.__internal_basePost({body:{emailAddressId:e.emailAddressId,redirectUrl:r,strategy:"email_link"},action:"prepare_first_factor"})})}async waitForEmailLinkVerification(){return ng(this.#R,async()=>{let{run:e,stop:t}=iw();await new Promise((i,n)=>{e(async()=>{try{let e=await this.#R.__internal_baseGet(),n=e.firstFactorVerification.status;("verified"===n||"expired"===n)&&(t(),i(e))}catch(e){t(),n(e)}})})})}async sendPhoneCode(e={}){let{phoneNumber:t,phoneNumberId:i,channel:n="sms"}=e;if(!this.#R.id&&i)throw Error("signIn.phoneCode.sendCode() cannot be called with an phoneNumberId if an existing signIn does not exist.");if(!this.#R.id&&!t)throw Error("signIn.phoneCode.sendCode() cannot be called without an phoneNumber if an existing signIn does not exist.");return ng(this.#R,async()=>{t&&await this._create({identifier:t});let e=this.selectFirstFactor({strategy:"phone_code",phoneNumberId:i});if(!e)throw new I("Phone code factor not found",{code:"factor_not_found"});await this.#R.__internal_basePost({body:{phoneNumberId:e.phoneNumberId,strategy:"phone_code",channel:n},action:"prepare_first_factor"})})}async verifyPhoneCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"phone_code"},action:"attempt_first_factor"})})}async sso(e){let{strategy:t,redirectUrl:i,redirectCallbackUrl:n,popup:r,oidcPrompt:s,enterpriseConnectionId:a,identifier:o}=e;return ng(this.#R,async()=>{let e=i;try{new URL(i)}catch{e=window.location.origin+i}let l={redirectUrl:ny.clerk.buildUrlWithAuth(n),actionCompleteRedirectUrl:e};if(r){let t=nf(ny.clerk,{redirectCallbackUrl:l.redirectUrl,redirectUrl:e});l.redirectUrl=t.redirectCallbackUrl,l.actionCompleteRedirectUrl=t.redirectUrl}await this._create({strategy:t,...l,identifier:o}),"enterprise_sso"===t&&await this.#R.__internal_basePost({body:{...l,oidcPrompt:s,enterpriseConnectionId:a,strategy:"enterprise_sso"},action:"prepare_first_factor"});let{status:c,externalVerificationRedirectURL:d}=this.#R.firstFactorVerification;"unverified"===c&&d&&(r?(await nm(ny.clerk,{popup:r,externalVerificationRedirectURL:d}),await this.#R.reload()):ek(d))})}async web3(e){let{strategy:t}=e,i=t.replace("web3_","").replace("_signature","");return ng(this.#R,async()=>{let n,r,s;switch(i){case"metamask":n=await te(),r=ts;break;case"coinbase_wallet":n=await tt(),r=ta;break;case"base":n=await tn(),r=tl;break;case"okx_wallet":n=await ti(),r=to;break;case"solana":if(!e.walletName)throw new I("Wallet name is required for Solana authentication.",{code:"web3_solana_wallet_name_required"});n=await tr(e.walletName),r=t=>tc({...t,walletName:e.walletName});break;default:throw Error(`Unsupported Web3 provider: ${i}`)}await this._create({identifier:n});let a=this.#R.supportedFirstFactors?.find(e=>e.strategy===t);if(!a)throw new I("Web3 first factor not found",{code:"factor_not_found"});await this.#R.__internal_basePost({body:{web3WalletId:a.web3WalletId,strategy:t},action:"prepare_first_factor"});let{message:o}=this.firstFactorVerification;if(!o)throw new I("Web3 nonce not found",{code:"web3_nonce_not_found"});try{s=await r({identifier:n,nonce:o,walletName:e?.walletName,provider:i})}catch(e){if("coinbase_wallet"===i&&4001===e.code)s=await r({identifier:n,nonce:o,provider:i});else throw e}await this.#R.__internal_basePost({body:{signature:s,strategy:t},action:"attempt_first_factor"})})}async passkey(e){let{flow:t}=e||{},i=ny.clerk.__internal_isWebAuthnSupported||nn,n=ny.clerk.__internal_getPublicCredentials||iR,r=ny.clerk.__internal_isWebAuthnAutofillSupported||nr;if(!i())throw new T("Passkeys are not supported",{code:"passkey_not_supported"});return ng(this.#R,async()=>
vendor: 9,011 bytes, line 14
14{if("autofill"===t||"discoverable"===t)await this._create({strategy:"passkey"});else{if(!this.supportedFirstFactors.find(e=>"passkey"===e.strategy))throw new I("Passkey factor not found",{code:"factor_not_found"});await this.#R.__internal_basePost({body:{strategy:"passkey"},action:"prepare_first_factor"})}let{nonce:e}=this.firstFactorVerification,i=e?iz(JSON.parse(e)):null;if(!i)throw new I("Missing public key options",{code:"missing_public_key_options"});let s=!1;"autofill"===t&&(s=await r());let{publicKeyCredential:a,error:o}=await n({publicKeyOptions:i,conditionalUI:s});if(!a)throw new T(o.message,{code:"passkey_retrieval_failed"});await this.#R.__internal_basePost({body:{publicKeyCredential:JSON.stringify(iF(a)),strategy:"passkey"},action:"attempt_first_factor"})})}async sendMFAPhoneCode(){return ng(this.#R,async()=>{let e=this.#R.supportedSecondFactors?.find(e=>"phone_code"===e.strategy);if(!e)throw new I("Phone code factor not found",{code:"factor_not_found"});let{phoneNumberId:t}=e;await this.#R.__internal_basePost({body:{phoneNumberId:t,strategy:"phone_code"},action:"prepare_second_factor"})})}async verifyMFAPhoneCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"phone_code"},action:"attempt_second_factor"})})}async verifyTOTP(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"totp"},action:"attempt_second_factor"})})}async verifyBackupCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{code:t,strategy:"backup_code"},action:"attempt_second_factor"})})}async ticket(e){let t=e?.ticket??eE("__clerk_ticket");return this.create({ticket:t??void 0})}async finalize(e){let{navigate:t}=e||{};if(!this.#R.createdSessionId)throw Error("Cannot finalize sign-in without a created session.");return ng(this.#R,async()=>{await ny.clerk.client?.reload(),await ny.clerk.setActive({session:this.#R.createdSessionId,navigate:t})})}selectFirstFactor({strategy:e,emailAddressId:t,phoneNumberId:i}){if(!this.#R.supportedFirstFactors)return null;if(t){let i=this.#R.supportedFirstFactors.find(i=>i.strategy===e&&i.emailAddressId===t);if(i)return i}if(i){let t=this.#R.supportedFirstFactors.find(t=>t.strategy===e&&t.phoneNumberId===i);if(t)return t}let n=this.#R.supportedFirstFactors.find(t=>t.strategy===e&&t.safeIdentifier===this.#R.identifier);if(n)return n;let r=this.#R.supportedFirstFactors.find(t=>t.strategy===e);return r||null}}class nw{firstName;lastName;imageUrl;hasImage;constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.firstName=e.first_name,this.lastName=e.last_name,this.imageUrl=e.image_url??void 0,this.hasImage=e.has_image??void 0),this}__internal_toSnapshot(){return{first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl||null,has_image:this.hasImage||null}}}function nv(e){let{unsafeMetadata:t}={...e},i=t?"object"==typeof t?JSON.stringify(t):t:"";return{...e,...t?{unsafeMetadata:i}:{}}}class nk extends tL{pathRoot="/client/sign_ups";id;_status=null;requiredFields=[];missingFields=[];optionalFields=[];unverifiedFields=[];verifications=new ij(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;locale=null;get status(){return this._status}set status(e){let t=this._status;this._status=e,e&&t!==e&&eb.debug("SignUp.status",{id:this.id,from:t,to:e})}__internal_future=new nS(this);__internal_basePost=this._basePost.bind(this);__internal_basePatch=this._basePatch.bind(this);constructor(e=null){super(),this.fromJSON(e)}create=async e=>{eb.debug("SignUp.create",{id:this.id,strategy:e.strategy});let t={...e};if(!t.locale){let e=e2();e&&(t.locale=e)}if(!this.clientBypass()&&!this.shouldBypassCaptchaForAttempt(e)){let e=new tD(nk.clerk),i=await e.managedOrInvisible({action:"signup"});if(!i)throw new I("",{code:"captcha_unavailable"});t={...t,...i}}return this._basePost({path:this.pathRoot,body:nv(t)})};prepareVerification=e=>(eb.debug("SignUp.prepareVerification",{id:this.id,strategy:e.strategy}),this._basePost({body:e,action:"prepare_verification"}));attemptVerification=e=>(eb.debug("SignUp.attemptVerification",{id:this.id,strategy:e.strategy}),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}=iw();return{startEmailLinkFlow:async({redirectUrl:i})=>(this.id||tb("SignUp"),await this.prepareEmailAddressVerification({strategy:"email_link",redirectUrl:i}),new Promise((i,n)=>{e(()=>this.reload().then(e=>{let n=e.verifications.emailAddress.status;("verified"===n||"expired"===n)&&(t(),i(e))}).catch(e=>{t(),n(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:i="web3_metamask_signature"}=e;return this.attemptVerification({signature:t,strategy:i})};authenticateWithWeb3=async e=>{let t,{generateSignature:i,identifier:n,unsafeMetadata:r,strategy:s="web3_metamask_signature",legalAccepted:a,walletName:o}=e||{},l=s.replace("web3_","").replace("_signature","");"function"!=typeof i&&tk("generateSignature");let c=n||this.web3wallet;await this.create({web3Wallet:c,unsafeMetadata:r,legalAccepted:a}),await this.prepareWeb3WalletVerification({strategy:s});let{message:d}=this.verifications.web3Wallet;d||tv("SignUp");try{t=await i({identifier:n,nonce:d,provider:l,walletName:o})}catch(e){if("coinbase_wallet"===l&&4001===e.code)t=await i({identifier:n,nonce:d,provider:l});else throw e}return this.attemptWeb3WalletVerification({signature:t,strategy:s})};authenticateWithMetamask=async e=>{let t=await te();return this.authenticateWithWeb3({identifier:t,generateSignature:ts,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_metamask_signature",legalAccepted:e?.legalAccepted})};authenticateWithCoinbaseWallet=async e=>{let t=await tt();return this.authenticateWithWeb3({identifier:t,generateSignature:ta,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_coinbase_wallet_signature",legalAccepted:e?.legalAccepted})};authenticateWithBase=async e=>{let t=await tn();return this.authenticateWithWeb3({identifier:t,generateSignature:tl,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_base_signature",legalAccepted:e?.legalAccepted})};authenticateWithOKXWallet=async e=>{let t=await ti();return this.authenticateWithWeb3({identifier:t,generateSignature:to,unsafeMetadata:e?.unsafeMetadata,strategy:"web3_okx_wallet_signature",legalAccepted:e?.legalAccepted})};authenticateWithSolana=async({walletName:e,unsafeMetadata:t,legalAccepted:i})=>{let n=await tr(e);return this.authenticateWithWeb3({identifier:n,generateSignature:t=>tc({...t,walletName:e}),unsafeMetadata:t,strategy:"web3_solana_signature",legalAccepted:i,walletName:e})};authenticateWithRedirectOrPopup=async(e,t)=>{let{redirectUrl:i,redirectUrlComplete:n,strategy:r,continueSignUp:s=!1,unsafeMetadata:a,emailAddress:o,legalAccepted:l,oidcPrompt:c,enterpriseConnectionId:d}=e,h=nk.clerk.buildUrlWithAuth(i),u=()=>{let e={strategy:r,redirectUrl:h,actionCompleteRedirectUrl:n,unsafeMetadata:a,emailAddress:o,legalAccepted:l,oidcPrompt:c,enterpriseConnectionId:d};return s&&this.id?this.update(e):this.create(e)},{verifications:p}=await u().catch(async e=>{if(S(e)&&O(e))return await nk.clerk.__unstable__environment.reload(),u();throw e}),{externalAccount:f}=p,{status:m,externalVerificationRedirectURL:_}=f;"unverified"===m&&_?t(_):tS(m,nk.fapiClient.buildEmailAddress("support"))};authenticateWithRedirect=async e=>this.authenticateWithRedirectOrPopup(e,ek);authenticateWithPopup=async e=>{let{popup:t}=e||{};return t||tk("popup"),np(nk.clerk,"signUp",this.authenticateWithRedirectOrPopup,e,e=>{t.location.href=e instanceof URL?e.toString():e})};update=e=>this._basePatch({body:nv(e)});upsert=e=>this.id?this.update(e):this.create(e);validatePassword=(e,t)=>{if(nk.clerk.__unstable__environment?.userSettings.passwordSettings)return n_({...nk.clerk.__unstable__environment?.userSettings.passwordSettings,validatePassword:!0})(e,t)};fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.requiredFields=e.required_fields,this.optionalFields=e.optional_fields,this.missingFields=e.missing_fields,this.unverifiedFields=e.unverified_fields,this.verifications=new ij(e.verifications),this.username=e.username,this.firstName=e.first_name,this.lastName=e.last_name,this.emailAddress=e.email_address,this.phoneNumber=e.phone_number,this.hasPassword=e.has_password,this.unsafeMetadata=e.unsafe_metadata,this.createdSe
14ssionId=e.created_session_id,this.createdUserId=e.created_user_id,this.abandonAt=e.abandon_at,this.web3wallet=e.web3_wallet,this.legalAcceptedAt=e.legal_accepted_at,this.locale=e.locale),iU.emit("resource:update",{resource:this}),this}__internal_toSnapshot(){return{object:"sign_up",id:this.id||"",status:this.status||null,required_fields:this.requiredFields,optional_fields:this.optionalFields,missing_fields:this.missingFields,unverified_fields:this.unverifiedFields,verifications:this.verifications.__internal_toSnapshot(),username:this.username,first_name:this.firstName,last_name:this.lastName,email_address:this.emailAddress,phone_number:this.phoneNumber,has_password:this.hasPassword,unsafe_metadata:this.unsafeMetadata,created_session_id:this.createdSessionId,created_user_id:this.createdUserId,abandon_at:this.abandonAt,web3_wallet:this.web3wallet,legal_accepted_at:this.legalAcceptedAt,locale:this.locale,external_account:this.externalAccount,external_account_strategy:this.externalAccount?.strategy}}clientBypass(){return nk.clerk.client?.captchaBypass}shouldBypassCaptchaForAttempt(e){let t=nk.clerk.__unstable__environment.displayConfig.captchaOauthBypass;return!!(e.transfer&&t.some(e=>e===nk.clerk.client.signIn.firstFactorVerification.strategy)||e.strategy&&t.some(t=>t===e.strategy))}__experimental_getEnterpriseConnections=()=>tL._fetch({path:`/client/sign_ups/${this.id}/enterprise_connections`,method:"GET"}).then(e=>(e?.response).map(e=>new nC(e)))}class nS{verifications={sendEmailCode:this.sendEmailCode.bind(this),verifyEmailCode:this.verifyEmailCode.bind(this),sendPhoneCode:this.sendPhoneCode.bind(this),verifyPhoneCode:this.verifyPhoneCode.bind(this)};#R;constructor(e){this.#R=e}get id(){return this.#R.id}get requiredFields(){return this.#R.requiredFields}get optionalFields(){return this.#R.optionalFields}get missingFields(){return this.#R.missingFields}get status(){return this.#R.status||"missing_requirements"}get username(){return this.#R.username}get firstName(){return this.#R.firstName}get lastName(){return this.#R.lastName}get emailAddress(){return this.#R.emailAddress}get phoneNumber(){return this.#R.phoneNumber}get web3Wallet(){return this.#R.web3wallet}get hasPassword(){return this.#R.hasPassword}get unsafeMetadata(){return this.#R.unsafeMetadata}get createdSessionId(){return this.#R.createdSessionId}get createdUserId(){return this.#R.createdUserId}get abandonAt(){return this.#R.abandonAt}get legalAcceptedAt(){return this.#R.legalAcceptedAt}get locale(){return this.#R.locale}get unverifiedFields(){return this.#R.unverifiedFields}get isTransferable(){return"transferable"===this.#R.verifications.externalAccount.status&&this.#R.verifications.externalAccount.error?.code==="external_account_exists"}get existingSession(){if(("failed"===this.#R.verifications.externalAccount.status||"unverified"===this.#R.verifications.externalAccount.status)&&this.#R.verifications.externalAccount.error?.code==="identifier_already_signed_in"&&this.#R.verifications.externalAccount.error?.meta?.sessionId)return{sessionId:this.#R.verifications.externalAccount.error?.meta?.sessionId}}async getCaptchaToken(){let e=new tD(nk.clerk),t=await e.managedOrInvisible({action:"signup"});if(!t)throw Error("Captcha challenge failed");let{captchaError:i,captchaToken:n,captchaWidgetType:r}=t;return{captchaToken:n,captchaWidgetType:r,captchaError:i}}async _create(e){let{captchaToken:t,captchaWidgetType:i,captchaError:n}=await this.getCaptchaToken(),r={transfer:e.transfer,captchaToken:t,captchaWidgetType:i,captchaError:n,...e,unsafeMetadata:e.unsafeMetadata?nv(e.unsafeMetadata):void 0,locale:e.locale??e2()};await this.#R.__internal_basePost({path:this.#R.pathRoot,body:r})}async create(e){return ng(this.#R,async()=>{await this._create(e)})}async update(e){return ng(this.#R,async()=>{let t={...e,unsafeMetadata:e.unsafeMetadata?nv(e.unsafeMetadata):void 0};await this.#R.__internal_basePatch({path:this.#R.pathRoot,body:t})})}async password(e){return ng(this.#R,async()=>{let{captchaToken:t,captchaWidgetType:i,captchaError:n}=await this.getCaptchaToken(),r={strategy:"password",captchaToken:t,captchaWidgetType:i,captchaError:n,...e,unsafeMetadata:e.unsafeMetadata?nv(e.unsafeMetadata):void 0};await this.#R.__internal_basePost({path:this.#R.pathRoot,body:r})})}async sendEmailCode(){return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{strategy:"email_code"},action:"prepare_verification"})})}
vendor: 7,476 bytes, line 14
14async verifyEmailCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{strategy:"email_code",code:t},action:"attempt_verification"})})}async sendPhoneCode(e){let{phoneNumber:t,channel:i="sms"}=e;return ng(this.#R,async()=>{if(!this.#R.id){let{captchaToken:e,captchaWidgetType:i,captchaError:n}=await this.getCaptchaToken();await this.#R.__internal_basePost({path:this.#R.pathRoot,body:{phoneNumber:t,captchaToken:e,captchaWidgetType:i,captchaError:n}})}await this.#R.__internal_basePost({body:{strategy:"phone_code",channel:i},action:"prepare_verification"})})}async verifyPhoneCode(e){let{code:t}=e;return ng(this.#R,async()=>{await this.#R.__internal_basePost({body:{strategy:"phone_code",code:t},action:"attempt_verification"})})}async sso(e){let{strategy:t,redirectUrl:i,redirectCallbackUrl:n,unsafeMetadata:r,legalAccepted:s,oidcPrompt:a,enterpriseConnectionId:o,emailAddress:l,popup:c}=e;return ng(this.#R,async()=>{let{captchaToken:e,captchaWidgetType:d,captchaError:h}=await this.getCaptchaToken(),u=i;try{new URL(i)}catch{u=window.location.origin+i}let p={redirectUrl:nk.clerk.buildUrlWithAuth(n),actionCompleteRedirectUrl:u};if(c){let e=nf(nk.clerk,{redirectCallbackUrl:p.redirectUrl,redirectUrl:u});p.redirectUrl=e.redirectCallbackUrl,p.actionCompleteRedirectUrl=e.redirectUrl}let f=()=>this.#R.__internal_basePost({path:this.#R.pathRoot,body:{strategy:t,...p,unsafeMetadata:r,legalAccepted:s,oidcPrompt:a,enterpriseConnectionId:o,emailAddress:l,captchaToken:e,captchaWidgetType:d,captchaError:h}});await f().catch(async e=>{if(S(e)&&O(e))return await nk.clerk.__unstable__environment.reload(),f();throw e});let{status:m,externalVerificationRedirectURL:_}=this.#R.verifications.externalAccount;"unverified"===m&&_&&(c?(await nm(nk.clerk,{popup:c,externalVerificationRedirectURL:_}),await this.#R.reload()):ek(_))})}async web3(e){let{strategy:t,unsafeMetadata:i,legalAccepted:n}=e,r=t.replace("web3_","").replace("_signature","");return ng(this.#R,async()=>{let e,s,a;switch(r){case"metamask":e=await te(),s=ts;break;case"coinbase_wallet":e=await tt(),s=ta;break;case"base":e=await tn(),s=tl;break;case"okx_wallet":e=await ti(),s=to;break;default:throw Error(`Unsupported Web3 provider: ${r}`)}let o=e||this.#R.web3wallet;await this._create({web3Wallet:o,unsafeMetadata:i,legalAccepted:n}),await this.#R.__internal_basePost({body:{strategy:t},action:"prepare_verification"});let{message:l}=this.#R.verifications.web3Wallet;l||tv("SignUp");try{a=await s({identifier:e,nonce:l})}catch(t){if("coinbase_wallet"===r&&4001===t.code)a=await s({identifier:e,nonce:l});else throw t}await this.#R.__internal_basePost({body:{signature:a,strategy:t},action:"attempt_verification"})})}async ticket(e){let t=e?.ticket??eE("__clerk_ticket");return this.create({...e,ticket:t??void 0})}async finalize(e){let{navigate:t}=e||{};return ng(this.#R,async()=>{if(!this.#R.createdSessionId)throw Error("Cannot finalize sign-up without a created session.");await nk.clerk.setActive({session:this.#R.createdSessionId,navigate:t})})}}class nC extends tL{id;name;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name),this}}class nA extends tL{pathRoot="tokens";jwt;static async create(e,t={},i={}){return new nA(await tL._fetch({method:"POST",path:e,body:t,search:i}),e)}constructor(e,t){super(),t&&(this.pathRoot=t),e?.jwt&&(this.jwt=e3(e.jwt))}getRawString=()=>this.jwt?.claims.__raw||"";fromJSON(e){return e&&(this.jwt=e3(e.jwt)),this}__internal_toSnapshot(){return{object:"token",id:this.id||"",jwt:this.getRawString()}}}class nU extends tL{pathRoot="/me";id="";secret;uri;verified=!1;backupCodes;updatedAt=null;createdAt=null;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.secret=e.secret,this.uri=e.uri,this.verified=e.verified,this.backupCodes=e.backup_codes,this.updatedAt=tK(e.updated_at),this.createdAt=tK(e.created_at)),this}}class nI extends tL{pathRoot="/me";id;codes=[];updatedAt=null;createdAt=null;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.codes=e.codes,this.updatedAt=tK(e.updated_at),this.createdAt=tK(e.created_at)),this}}class nP extends tL{advisory=null;form={name:"",slug:"",logo:null,blurHash:null};constructor(e=null){super(),this.fromJSON(e)}fromJSON(e){return e&&(e.advisory&&(this.advisory=this.withDefault(e.advisory,this.advisory??null)),e.form&&(this.form.name=this.withDefault(e.form.name,this.form.name),this.form.slug=this.withDefault(e.form.slug,this.form.slug),this.form.logo=this.withDefault(e.form.logo,this.form.logo),this.form.blurHash=this.withDefault(e.form.blur_hash,this.form.blurHash))),this}static async retrieve(){return await tL._fetch({path:"/me/organization_creation_defaults",method:"GET"}).then(e=>new nP(e?.response))}__internal_toSnapshot(){return{advisory:this.advisory?{code:this.advisory.code,meta:this.advisory.meta,severity:this.advisory.severity}:null,form:{name:this.form.name,slug:this.form.slug,logo:this.form.logo,blur_hash:this.form.blurHash}}}}class nT extends tL{pathRoot="/me";id="";externalId=null;username=null;emailAddresses=[];phoneNumbers=[];web3Wallets=[];externalAccounts=[];enterpriseAccounts=[];passkeys=[];samlAccounts=[];organizationMemberships=[];passwordEnabled=!1;firstName=null;lastName=null;fullName=null;primaryEmailAddressId=null;primaryEmailAddress=null;primaryPhoneNumberId=null;primaryPhoneNumber=null;primaryWeb3WalletId=null;primaryWeb3Wallet=null;imageUrl="";hasImage=!1;twoFactorEnabled=!1;totpEnabled=!1;backupCodeEnabled=!1;publicMetadata={};unsafeMetadata={};createOrganizationEnabled=!1;createOrganizationsLimit=null;deleteSelfEnabled=!1;lastSignInAt=null;legalAcceptedAt=null;updatedAt=null;createdAt=null;cachedSessionsWithActivities=null;static isUserResource(e){return!!e&&e instanceof nT}constructor(e){super(),this.fromJSON(e)}path(){return this.pathRoot}isPrimaryIdentification=e=>{switch(e.constructor){case iv:return this.primaryEmailAddressId===e.id;case iG:return this.primaryPhoneNumberId===e.id;case nE:return this.primaryWeb3WalletId===e.id;default:return!1}};createEmailAddress=e=>{let{email:t}=e||{};return new iv({email_address:t},this.path()+"/email_addresses/").create()};createPasskey=()=>nl.registerPasskey();createPhoneNumber=e=>{let{phoneNumber:t}=e||{};return new iG({phone_number:t},this.path()+"/phone_numbers/").create()};createWeb3Wallet=e=>{let{web3Wallet:t}=e||{};return new nE({web3_wallet:t},this.path()+"/web3_wallets/").create()};createExternalAccount=async e=>{let{strategy:t,redirectUrl:i,additionalScopes:n}=e||{};return new iK((await tL._fetch({path:"/me/external_accounts",method:"POST",body:{strategy:t,redirect_url:i,additional_scope:n}}))?.response,this.path()+"/external_accounts")};createTOTP=async()=>new nU((await tL._fetch({path:"/me/totp",method:"POST"}))?.response);verifyTOTP=async({code:e})=>new nU((await tL._fetch({path:"/me/totp/attempt_verification",method:"POST",body:{code:e}}))?.response);disableTOTP=async()=>new ip((await tL._fetch({path:"/me/totp",method:"DELETE"}))?.response);createBackupCode=async()=>new nI((await tL._fetch({path:this.path()+"/backup_codes/",method:"POST"}))?.response);update=e=>this._basePatch({body:nv(e)});updatePassword=e=>this._basePost({body:e,path:`${this.path()}/change_password`});removePassword=e=>this._basePost({body:e,path:`${this.path()}/remove_password`});delete=()=>this._baseDelete({path:"/me"}).then(e=>(iU.emit(iS,null),e));getSessions=async()=>
vendor: 5,544 bytes, line 14
14{if(this.cachedSessionsWithActivities)return this.cachedSessionsWithActivities;let e=await nh.retrieve();return this.cachedSessionsWithActivities=e,e};setProfileImage=e=>{let{file:t}=e||{};return null===t?iH.delete(`${this.path()}/profile_image`):iH.create(`${this.path()}/profile_image`,{file:t})};getOrganizationInvitations=e=>nO.retrieve(e);getOrganizationSuggestions=e=>i2.retrieve(e);getOrganizationMemberships=e=>i3.retrieve(e);getOrganizationCreationDefaults=()=>nP.retrieve();leaveOrganization=async e=>new ip((await tL._fetch({path:`${this.path()}/organization_memberships/${e}`,method:"DELETE"}))?.response);initializePaymentMethod=e=>is(e);addPaymentMethod=e=>ia(e);getPaymentMethods=e=>io(e);get verifiedExternalAccounts(){return this.externalAccounts.filter(e=>e.verification?.status=="verified")}get unverifiedExternalAccounts(){return this.externalAccounts.filter(e=>e.verification?.status!="verified")}get verifiedWeb3Wallets(){return this.web3Wallets.filter(e=>e.verification?.status=="verified")}get hasVerifiedEmailAddress(){return this.emailAddresses.filter(e=>"verified"===e.verification.status).length>0}get hasVerifiedPhoneNumber(){return this.phoneNumbers.filter(e=>"verified"===e.verification.status).length>0}fromJSON(e){return e&&(this.id=e.id,this.externalId=e.external_id||null,this.firstName=e.first_name||null,this.lastName=e.last_name||null,(this.firstName||this.lastName)&&(this.fullName=(({firstName:e,lastName:t,name:i})=>i||[e,t].join(" ").trim()||"")({firstName:this.firstName,lastName:this.lastName})),this.imageUrl=e.image_url||"",this.hasImage=e.has_image||!1,this.username=e.username||null,this.passwordEnabled=e.password_enabled||!1,this.emailAddresses=(e.email_addresses||[]).map(e=>new iv(e,this.path()+"/email_addresses")),this.primaryEmailAddressId=e.primary_email_address_id||null,this.primaryEmailAddress=this.emailAddresses.find(({id:e})=>e===this.primaryEmailAddressId)||null,this.phoneNumbers=(e.phone_numbers||[]).map(e=>new iG(e,this.path()+"/phone_numbers")),this.primaryPhoneNumberId=e.primary_phone_number_id||null,this.primaryPhoneNumber=this.phoneNumbers.find(({id:e})=>e===this.primaryPhoneNumberId)||null,this.web3Wallets=(e.web3_wallets||[]).map(e=>new nE(e,this.path()+"/web3_wallets")),this.primaryWeb3WalletId=e.primary_web3_wallet_id||null,this.primaryWeb3Wallet=this.web3Wallets.find(({id:e})=>e===this.primaryWeb3WalletId)||null,this.externalAccounts=(e.external_accounts||[]).map(e=>new iK(e,this.path()+"/external_accounts")),this.passkeys=(e.passkeys||[]).map(e=>new nl(e)),this.organizationMemberships=(e.organization_memberships||[]).map(e=>new i3(e)),this.samlAccounts=(e.saml_accounts||[]).map(e=>new i4(e,this.path()+"/saml_accounts")),this.enterpriseAccounts=(e.enterprise_accounts||[]).map(e=>new iB(e,this.path()+"/enterprise_accounts")),this.publicMetadata=e.public_metadata||{},this.unsafeMetadata=e.unsafe_metadata||{},this.totpEnabled=e.totp_enabled||!1,this.backupCodeEnabled=e.backup_code_enabled||!1,this.twoFactorEnabled=e.two_factor_enabled||!1,this.createOrganizationEnabled=e.create_organization_enabled||!1,this.createOrganizationsLimit=e.create_organizations_limit||null,this.deleteSelfEnabled=e.delete_self_enabled||!1,e.last_sign_in_at&&(this.lastSignInAt=tK(e.last_sign_in_at)),e.legal_accepted_at&&(this.legalAcceptedAt=tK(e.legal_accepted_at)),this.updatedAt=tK(e.updated_at||void 0),this.createdAt=tK(e.created_at||void 0)),this}__internal_toSnapshot(){return{object:"user",id:this.id,external_id:this.externalId,first_name:this.firstName,last_name:this.lastName,username:this.username,public_metadata:this.publicMetadata,unsafe_metadata:this.unsafeMetadata,image_url:this.imageUrl,has_image:this.hasImage,email_addresses:this.emailAddresses.map(e=>e.__internal_toSnapshot()),phone_numbers:this.phoneNumbers.map(e=>e.__internal_toSnapshot()),web3_wallets:this.web3Wallets.map(e=>e.__internal_toSnapshot()),external_accounts:this.externalAccounts.map(e=>e.__internal_toSnapshot()),passkeys:this.passkeys.map(e=>e.__internal_toSnapshot()),organization_memberships:this.organizationMemberships.map(e=>e.__internal_toSnapshot()),saml_accounts:this.samlAccounts.map(e=>e.__internal_toSnapshot()),enterprise_accounts:this.enterpriseAccounts.map(e=>e.__internal_toSnapshot()),totp_enabled:this.totpEnabled,backup_code_enabled:this.backupCodeEnabled,two_factor_enabled:this.twoFactorEnabled,create_organization_enabled:this.createOrganizationEnabled,create_organizations_limit:this.createOrganizationsLimit,delete_self_enabled:this.deleteSelfEnabled,primary_email_address_id:this.primaryEmailAddressId,primary_phone_number_id:this.primaryPhoneNumberId,primary_web3_wallet_id:this.primaryWeb3WalletId,password_enabled:this.passwordEnabled,profile_image_id:this.imageUrl,last_sign_in_at:this.lastSignInAt?.getTime()||null,legal_accepted_at:this.legalAcceptedAt?.getTime()||null,updated_at:this.updatedAt?.getTime()||null,created_at:this.createdAt?.getTime()||null}}}class nO extends tL{id;emailAddress;publicOrganizationData;publicMetadata={};status;role;createdAt;updatedAt;static async retrieve(e){return await tL._fetch({path:"/me/organization_invitations",method:"GET",search:t5(e)}).then(e=>{let{data:t,total_count:i}=e?.response;return{total_count:i,data:t.map(e=>new nO(e))}})}constructor(e){super(),this.fromJSON(e)}accept=async()=>await this._basePost({path:`/me/organization_invitations/${this.id}/accept`});fromJSON(e){return e&&(this.id=e.id,this.emailAddress=e.email_address,this.publicOrganizationData={hasImage:e.public_organization_data.has_
14image,imageUrl:e.public_organization_data.image_url,name:e.public_organization_data.name,id:e.public_organization_data.id,slug:e.public_organization_data.slug},this.publicMetadata=e.public_metadata,this.role=e.role,this.status=e.status,this.createdAt=tK(e.created_at),this.updatedAt=tK(e.updated_at)),this}}class nE extends tL{id;web3Wallet="";verification;constructor(e,t){super(),this.pathRoot=t,this.fromJSON(e)}create(){return this._basePost({body:{web3_wallet:this.web3Wallet}})}prepareVerification=e=>this._basePost({action:"prepare_verification",body:{...e}});attemptVerification=e=>{let{signature:t}=e;return this._basePost({action:"attempt_verification",body:{signature:t}})};destroy(){return this._baseDelete()}toString(){return this.web3Wallet}fromJSON(e){return e&&(this.id=e.id,this.web3Wallet=e.web3_wallet,this.verification=new iL(e.verification)),this}__internal_toSnapshot(){return{object:"web3_wallet",id:this.id,web3_wallet:this.web3Wallet,verification:this.verification.__internal_toSnapshot()}}}class nx extends tL{pathRoot="/waitlist";id="";updatedAt=null;createdAt=null;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.updatedAt=tK(e.updated_at),this.createdAt=tK(e.created_at)),this}static async join(e){return new nx((await tL._fetch({path:"/waitlist",method:"POST",body:e}))?.response)}}class nR extends tL{pathRoot="/api_keys";id;type;name;subject;scopes;claims;revoked;revocationReason;expired;expiration;createdBy;description;secret;lastUsedAt;createdAt;updatedAt;constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.type=e.type,this.name=e.name,this.subject=e.subject,this.scopes=e.scopes,this.claims=e.claims,this.revoked=e.revoked,this.revocationReason=e.revocation_reason,this.expired=e.expired,this.expiration=e.expiration?tK(e.expiration):null,this.createdBy=e.created_by,this.description=e.description,this.secret=e.secret,this.lastUsedAt=e.last_used_at?tK(e.last_used_at):null,this.updatedAt=tK(e.updated_at),this.createdAt=tK(e.created_at)),this}__internal_toSnapshot(){return{object:"api_key",id:this.id,type:this.t
14ype,name:this.name,subject:this.subject,scopes:this.scopes,claims:this.claims,revoked:this.revoked,revocation_reason:this.revocationReason,expired:this.expired,expiration:this.expiration?this.expiration.getTime():null,created_by:this.createdBy,description:this.description,last_used_at:this.lastUsedAt?this.lastUsedAt.getTime():null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}}function nM(e,t){var i,n;return e.id!==t.id||e.updatedAt.getTime()<t.updatedAt.getTime()||(i=t,n=e,i.organizationMemberships.length!==n.organizationMemberships.length||i.organizationMemberships[0]?.updatedAt!==n.organizationMemberships[0]?.updatedAt)}function nz(e,t){return!function(e,t){if(!e&&t||e&&!t)return!0;if(!e&&e===t)return!1;if(!e||!t)return!0;try{if(t4.isClientResource(e))return e.id!==t.id||e.updatedAt.getTime()<t.updatedAt.getTime()||e.sessions.length!==t.sessions.length;if(no.isSessionResource(e)){var i,n;return e.id!==t.id||e.updatedAt.getTime()<t.updatedAt.getTime()||e.lastActiveToken?.jwt?.claims?.__raw!==t.lastActiveToken?.jwt?.claims?.__raw||function(e,t){if(e.lastActiveOrganizationId!==t.lastActiveOrganizationId)return!0;let i=e.user?.organizationMemberships?.find(t=>t.organization.id===e.lastActiveOrganizationId),n=t.user?.organizationMemberships?.find(t=>t.organization.id===e.lastActiveOrganizationId);return i?.permissions?.length!==n?.permissions?.length}(e,t)||(i=e,n=t,!!i.user!=!!n.user||!!i.user&&!!n.user&&nM(i.user,n.user))}if(nT.isUserResource(e))return nM(e,t)}catch{}return!0}(e,t)?e:t}let nN=(e,t)=>{let i={};for(let n in e)i[n]=t(e[n],n);return i},nF=(e,t)=>{let i={};for(let n in e)e[n]&&t(e[n])&&(i[n]=e[n]);return i};class nD{static keys=["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","afterSignInUrl","afterSignUpUrl","redirectUrl"];static preserved=["redirectUrl"];options;fromOptions;fromProps;fromSearchParams;mode;constructor(e,t={},i={},n){this.options=e,this.fromOptions=this.#M(e||{}),this.fromProps=this.#M(t||{}),this.fromSearchParams=this.#z(i||{}),this.mode=n}getAfterSignInUrl(){return this.#N("signIn")}getAfterSignUpUrl(){return this.#N("signUp")}getPreservedSearchParams(){return this.#F(this.#D())}toSearchParams(){return this.#F(this.#W())}#F(e){return new URLSearchParams(Object.entries(Object.fromEntries(Object.entries(e).map(([e,t])=>[G(e),t]))).reduce((e,[t,i])=>(null!=i&&(e[t]=i),e),{}))}#D(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter(([e])=>nD.preserved.includes(e)))}#W(){let e=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,t=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,i=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,n=this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,r=this.fromSearchParams.afterSignInUrl||this.fromProps.afterSignInUrl||this.fromOptions.afterSignInUrl,s={signUpForceRedirectUrl:e,signUpFallbackRedirectUrl:t,signInFallbackRedirectUrl:n,signInForceRedirectUrl:i,afterSignInUrl:r,afterSignUpUrl:this.fromSearchParams.afterSignUpUrl||this.fromProps.afterSignUpUrl||this.fromOptions.afterSignUpUrl,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl||this.fromOptions.redirectUrl};return e&&delete s.signUpFallbackRedirectUrl,i&&delete s.signInFallbackRedirectUrl,s}#N(e){var t,i;let n,r,s=`${e}ForceRedirectUrl`,a=`${e}FallbackRedirectUrl`,o=`after${e[0].toUpperCase()}${e.slice(1)}Url`;(r=this.fromSearchParams[s]||this.fromProps[s]||this.fromOptions[s])&&(n=s),(r||=this.fromSearchParams.redirectUrl)&&(n="redirectUrl"),(r||=this.fromSearchParams[a]||this.fromProps[a]||this.fromOptions[a])&&(n=a);let l=this.fromSearchParams[o]||this.fromProps[o]||this.fromProps.redirectUrl||this.fromOptions[o];return(t=n,(i=r)&&l&&K(`Clerk: The "${t}" prop ("${i}") has priority over the legacy "${o}" (or "redirectUrl") ("${l}"), which will be completely ignored in this case. "${o}" (or "redirectUrl" prop) should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead. Learn more: https://clerk.c
14om/docs/guides/custom-redirects#redirect-url-props`),(r||=l)||"modal"!==this.mode)?r||"/":window.location.href}#M(e){th(e);let t={};return nD.keys.forEach(i=>{t[i]=e[i]}),nN(this.#L(this.#$(nF(t,Boolean))),e=>e.toString())}#z(e){th(e);let t={};return nD.keys.forEach(i=>{e instanceof URLSearchParams?t[i]=e.get(G(i)):t[i]=e[G(i)]}),nN(this.#L(this.#$(nF(t,Boolean))),e=>e.toString())}#$(e){return nN(e,e=>eY(e,window.location.origin))}#L=e=>nF(e,((e,t)=>i=>{let n=i;if("string"==typeof n&&(n=eY(n,t)),!e)return!0;let r=t===n.origin,s=!function(e){if(function(e){if(!function(e){if(!e)return!1;try{return new URL(e),!0}catch{return!1}}(e))return!1;let t=new URL(e).protocol;return eK.some(e=>e===t)}(e))return!0;for(let t of eQ)if(t.test(e.pathname))return!0;return!1}(n)&&(r||e.map(e=>"string"==typeof e?(e=>{try{return eL(e)}catch(t){throw Error(`Invalid pattern: ${e}.
15Consult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.
16${t.message}`)}})(eZ(e)):e).some(e=>e.test(eZ(n.origin))));return s||K(`Clerk: Redirect URL ${n} is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.`),s})(this.options?.allowedRedirectOrigins,window.location.origin))}let nW="__clerk_db_jwt";function nL(e,t){let i=new URL(e),n=i.searchParams.get(nW);i.searchParams.delete(nW);let r=n||t;return r&&i.searchParams.set(nW,r),i}let n$=e=>nj(nJ(e)),nj=e=>{let t=new URL(e);return t.searchParams.delete(nW),t},nJ=e=>{let t=new URL(e);return t.searchParams.delete("__dev_session"),t.hash=decodeURI(t.hash).replace(/__clerk_db_jwt\[(.*)\]/,""),t.href.endsWith("#")&&(t.hash=""),t};function nK(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)"__proto__"!==n&&(e[n]=i[n])}return e}var nB=function e(t,i){function n(e,n,r){if("undefined"!=typeof document){"number"==typeof(r=nK({},i,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in r)r[a]&&(s+="; "+a,!0!==r[a]&&(s+="="+r[a].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],n={},r=0;r<i.length;r++){var s=i[r].split("="),a=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(o in n||(n[o]=t.read(a,o)),e===o)break}catch{}}return e?n[e]:n}},remove:function(e,t){n(e,"",nK({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,nK({},this.attributes,t))},withConverter:function(t){return e(nK({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function nV(e){return{get:()=>nB.get(e),set(t,i={}){nB.set(e,t,i)},remove(t){nB.remove(e,t)}}}let nq=e=>"https:"===window.location.protocol||"None"===e&&void 0===window.safari&&(void 0!==window.isSecureContext?window.isSecureContext:"localhost"===window.location.hostname);function nH(e,t){let i=function(e){try{return new Date(e||new Date)}catch{return new Date}}(e);return i.setFullYear(i.getFullYear()+t),i}let nG=nV("__clerk_test_etld"),nZ=[".lovable.app",".lovableproject.com",".webcontainer-api.io",".vusercontent.net",".v0.dev",".v0.app",".lp.dev",".replit.dev"];function nY(){try{return nZ.some(e=>window.location.hostname.endsWith(e))}catch{return!1}}let nQ="__client_uat",nX="__session",n0=e=>{let t=e.usePartitionedCookies(),i=t||e5()||nY()?"None":"Lax",n=nq(i);return{sameSite:i,secure:n,partitioned:t&&n}};async function n1(e){let t;try{t=await $(e)}catch(o){var n;n=`Suffixed cookie failed due to ${o.message} (secure-context: ${window.isSecureContext}, url: ${window.location.href})`,J.has(n)||(console.log(n),J.add(n));let{default:r}=await Promise.all([i.e("192"),i.e("199")]).then(i.t.bind(i,394,23)),{default:s}=await Promise.all([i.e("192"),i.e("199")]).then(i.t.bind(i,7202,23)),a=r(e);t=s.stringify(a).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}return t}let n3=e=>{let t=e.usePartitionedCookies(),i=t||e5()||nY()?"None":"Lax",n=nq(i);return{sameSite:i,secure:n,partitioned:t&&n}};var n2=i(2788),n4=i.n(n2);function n5(e){let t=new(n4());return{acquireLockAndRun:async i=>{if("locks"in navigator&&isSecureContext){let t=new AbortController,n=setTimeout(()=>t.abort(),4999);return await navigator.locks.request(e,{signal:t.signal},async()=>(clearTimeout(n),await i())).catch(()=>!1)}if(await t.acquireLock(e,5e3))try{return await i()}finally{await t.releaseLock(e)}}}}class n6{lock=n5("clerk.lock.refreshSessionToken");workerTimers=ib();timerId=null;initiated=!1;startPollingForSessionToken(e){if(this.timerId||this.initiated)return;let t=async()=>{this.initiated=!0,await this.lock.acquireLockAndRun(e),this.timerId=this.workerTimers.setTimeout(t,5e3)};t()}stopPollingForSessionToken(){null!=this.timerId&&(this.workerTimers.clearTimeout(this.timerId),this.timerId=null),this.initiated=!1}}class n8{clerk;instanceType;clerkEventBus;poller=null;clientUat;sessionCookie;activeCookie;devBrowser;static async create(e,t,i,n){let r=await n1(e.publishableKey),s=new n8(e,t,r,i,n);return await s.setup(),s}constructor(e,t,i,r,s){this.clerk=e,this.instanceType=r,this.clerkEventBus=s,iU.on(ik,({token:e})=>{this.updateSessionCookie(e&&e.getRawString()),this.setClientUatCookieForDevelopmentInstances()}),iU.on(iS,()=>this.handleSignOut()),iU.on(iC,()=>
16{this.devBrowser.refreshCookies()}),this.refreshTokenOnFocus(),this.startPollingForToken();let a={usePartitionedCookies:()=>iT.getInstance().partitionedCookies};this.clientUat=((e,t)=>{let i=nV(nQ),r=nV(j(nQ,e));return{set:e=>{let s=nH(Date.now(),1),a=t.usePartitionedCookies(),o=a||e5()||nY()?"None":"Strict",l=nq(o),c=a&&l,d=function(e=window.location.hostname,t=nG,i){if(n)return n;if(["localhost","127.0.0.1","0.0.0.0"].includes(e))return e;let r=e.split(".");if(1===r.length)return e;for(let e=r.length-2;e>=0;e--){let s=r.slice(e).join(".");if(t.set("1",{...i,domain:s}),"1"===t.get())return t.remove({...i,domain:s}),n=s,s;t.remove({...i,domain:s})}return n=e,e}(void 0,void 0,{sameSite:o,secure:l}),h="0";e&&e.updatedAt&&e.signedInSessions.length>0&&(h=Math.floor(e.updatedAt.getTime()/1e3).toString()),r.remove(),i.remove(),r.set(h,{domain:d,expires:s,partitioned:c,sameSite:o,secure:l}),i.set(h,{domain:d,expires:s,partitioned:c,sameSite:o,secure:l})},get:()=>parseInt(r.get()||i.get()||"0",10)}})(i,a),this.sessionCookie=((e,t)=>{let i=nV(nX),n=nV(j(nX,e));return{set:e=>{let r=nH(Date.now(),1),{sameSite:s,secure:a,partitioned:o}=n0(t);o&&(i.remove(),n.remove()),i.set(e,{expires:r,sameSite:s,secure:a,partitioned:o}),n.set(e,{expires:r,sameSite:s,secure:a,partitioned:o})},remove:()=>{let e=n0(t);i.remove(e),n.remove(e),e.partitioned&&(i.remove(),n.remove())},get:()=>n.get()||i.get()}})(i,a),this.activeCookie=(()=>{let e=nV("clerk_active_context"),t={secure:nq("None")};return{set:i=>{e.set(i,t)},get:()=>e.get(),remove:()=>e.remove(t)}})(),this.devBrowser=function({cookieSuffix:e,frontendApi:t,fapiClient:i,cookieOptions:n}){let r,s=((e,t)=>{let i=nV(nW),n=nV(j(nW,e));return{get:()=>n.get()||i.get(),set:e=>{let r=nH(Date.now(),1),{sameSite:s,secure:a,partitioned:o}=n3(t);o&&(n.remove(),i.remove()),n.set(e,{expires:r,sameSite:s,secure:a,partitioned:o}),i.set(e,{expires:r,sameSite:s,secure:a,partitioned:o})},remove:()=>{let e=n3(t);n.remove(e),i.remove(e),e.partitioned&&(n.remove(),i.remove())}}})(e,n);function a(){return r||s.get()}function o(e){r=e,s.set(e)}function l(){r=void 0,s.remove()}return{clear:function(){l()},setup:async function e(){if(!eB(t))return;i.onBeforeRequest(e=>{let t=a();t&&e?.url&&(e.url=nL(e.url,t))}),i.onAfterResponse((e,t)=>
16{let i=t?.headers?.get("Clerk-Db-Jwt");i&&o(i)});let e=function(e){let t=e.searchParams.get(nW)||"";return n$(e).href!==e.href&&void 0!==globalThis.history&&globalThis.history.replaceState(null,"",n$(e)),t}(new URL(window.location.href));if(e)return void o(e);let n=s.get();if(n){r=n;return}let l=i.buildUrl({path:"/dev_browser"}),c=await fetch(l.toString(),{method:"POST"});if(!c.ok){let e=function(e=[]){return e.length>0?e.map(e=>new w(e)):[]}((await c.json()).errors);e[0]?tg(e[0].longMessage):tg()}let d=await c.json();o(d?.id)},getDevBrowserJWT:a,setDevBrowserJWT:o,removeDevBrowserJWT:l,refreshCookies:function(){let e=a();e&&o(e)}}}({frontendApi:e.frontendApi,fapiClient:t,cookieSuffix:i,cookieOptions:a})}async setup(){return"production"===this.instanceType?this.setupProduction():this.setupDevelopment()}isSignedOut(){return this.clerk.loaded?!!this.clerk.user:0>=this.clientUat.get()}async handleUnauthenticatedDevBrowser(){this.devBrowser.clear(),await this.devBrowser.setup()}decorateUrlWithDevBrowserToken(e){let t=this.devBrowser.getDevBrowserJWT();if(!t)throw Error(`${t_} Missing dev browser jwt. Please contact support.`);return nL(e,t)}async setupDevelopment(){await this.devBrowser.setup()}setupProduction(){this.devBrowser.clear()}startPollingForToken(){this.poller||(this.poller=new n6,this.poller.startPollingForSessionToken(()=>this.refreshSessionToken()))}stopPollingForToken(){this.poller&&(this.poller.stopPollingForSessionToken(),this.poller=null)}refreshTokenOnFocus(){window.addEventListener("focus",()=>{"visible"===document.visibilityState&&this.refreshSessionToken({updateCookieImmediately:!0})})}async refreshSessionToken({updateCookieImmediately:e=!1}={}){if(this.clerk.session)try{let t=await this.clerk.session.getToken();e&&this.updateSessionCookie(t)}catch(e){return this.handleGetTokenError(e)}}updateSessionCookie(e){if(!document.hasFocus()&&!this.isCurrentContextActive()||e&&this.#j(e))return;let t=this.clerk.client?.sessions;return t?.length>1&&e&&eb.info("Updating session cookie (multi-session client)",{activeSessionId:this.clerk.session?.id,sessionCount:t.length,hasActor:!!this.clerk.session?.actor},"authCookieService"),e||d()||eb.warn("Removing session cookie (offline)",{sessionId:this.clerk.session?.id},"authCookieService"),this.setActiveContextInStorage(),e?this.sessionCookie.set(e):this.sessionCookie.remove()}#j(e){let t=this.#J(e);if(!t||null==tG(t))return!1;let i=this.#J(this.sessionCookie.get());if(!i||null==tG(i))return!1;let n=i.jwt?.claims?.exp;return!("number"!=typeof n||n<=Math.floor(Date.now()/1e3))&&tZ(i)===tZ(t)&&(tY(i)||"")===(tY(t)||"")&&tH(i,t)===i}#J(e){if(!e)return null;try{let t=new nA({id:"__session",jwt:e,object:"token"});return t.jwt?t:null}catch{return null}}setClientUatCookieForDevelopmentInstances(){"production"!==this.instanceType&&this.inCustomDevelopmentDomain()&&this.clientUat.set(this.clerk.client)}inCustomDevelopmentDomain(){let e=this.clerk.frontendApi.replace("clerk.","");return!window.location.host.endsWith(e)}handleGetTokenError(e){if(S(e)||P(e)||(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")){if(E(e)){eb.warn("Token fetch failed with 4xx, triggering unauthenticated flow",{errorCode:S(e)?e.errors[0]?.code:void 0,sessionId:this.clerk.session?.id},"authCookieService"),this.clerk.handleUnauthenticated().catch(eu.ZT);return}this.clerkEventBus.emit(m,"degraded"),eb.warn("Token fetch failed, status degraded",{errorName:e?.name,sessionId:this.clerk.session?.id},"authCookieService")}}handleSignOut(){this.activeCookie.remove(),this.sessionCookie.remove(),this.setClientUatCookieForDevelopmentInstances()}setActiveContextInStorage(){let e=this.clerk.session?.id||"",t=this.clerk.organization?.id||"",i=`${e}:${t}`;":"!==i?this.activeCookie.set(i):this.activeCookie.remove()}isCurrentContextActive(){let e=this.activeCookie.get();if(!e)return!0;let[t,i]=e.split(":"),n=this.clerk.session?.id||"",r=this.clerk.organization?.id||"";return t===n&&i===r}getSessionCookie(){return this.sessionCookie.get()}}class n9{clerk;captchaChallenge;timers;constructor(e,t=new tD(e),i=ib()){this.clerk=e,this.captchaChallenge=t,this.timers=i}async start(){this.isEnabled()&&(await this.challengeAndSend(),this.timers.setInterval(()=>{this.challengeAndSend()},this.intervalInMs()))}
16async challengeAndSend(){if(!(!this.clerk.client||this.clientBypass()))try{let e=await this.captchaChallenge.invisible({action:"heartbeat"});await this.clerk.client.__internal_sendCaptchaToken(e)}catch{}}isEnabled(){return!!this.clerk.__unstable__environment?.displayConfig?.captchaHeartbeat}clientBypass(){return this.clerk.client?.captchaBypass}intervalInMs(){return this.clerk.__unstable__environment?.displayConfig?.captchaHeartbeatIntervalMs??6e5}}let n7=["/client","/waitlist"],re=["/client/sign_ins","/client/sign_ups"];function rt(e){let t;try{t=new nA({jwt:e||"",object:"token",id:void 0})}catch{t=null}if(t4.clearInstance(),!t?.jwt)return t4.getOrCreateInstance({object:"client",last_active_session_id:null,id:"client_init",sessions:[]});let{sessionId:i,userId:n,orgId:r,orgRole:s,orgPermissions:a,orgSlug:o,factorVerificationAge:l}=(e=>{let t,i,n,r,s=e.fva??null,a=e.sts??null;if(2===e.v){if(e.o){t=e.o?.id,n=e.o?.slg,e.o?.rol&&(i=`org:${e.o?.rol}`);let{org:s}=ni(e.fea),{permissions:a,featurePermissionMap:o}=(({per:e,fpm:t})=>{if(!e||!t)return{permissions:[],featurePermissionMap:[]};let i=e.split(",").map(e=>e.trim());return{permissions:i,featurePermissionMap:t.split(",").map(e=>Number.parseInt(e.trim(),10)).map(e=>e.toString(2).padStart(i.length,"0").split("").map(e=>Number.parseInt(e,10)).reverse()).filter(Boolean)}})({per:e.o?.per,fpm:e.o?.fpm});r=function({features:e,permissions:t,featurePermissionMap:i}){if(!e||!t||!i)return[];let n=[];for(let r=0;r<e.length;r++){let s=e[r];if(r>=i.length)continue;let a=i[r];if(a)for(let e=0;e<a.length;e++)1===a[e]&&n.push(`org:${s}:${t[e]}`)}return n}({features:s,featurePermissionMap:o,permissions:a})}}else t=e.org_id,i=e.org_role,n=e.org_slug,r=e.org_permissions;return{sessionClaims:e,sessionId:e.sid,sessionStatus:a,actor:e.act,userId:e.sub,orgId:t,orgRole:i,orgSlug:n,orgPermissions:r,factorVerificationAge:s}})(t.jwt.claims),c={object:"client",last_active_session_id:i,id:"client_init",sessions:[{object:"session",id:i,status:"active",last_active_organization_id:r||null,last_active_token:{id:void 0,object:"token",jwt:e},factor_verification_age:l||null,public_user_data:{user_id:n},user:{object:"user",id:n,updated_at:1,organization_memberships:r&&o&&s?[{object:"organization_membership",id:r,role:s,permissions:a||[],organization:{object:"organization",id:r,name:o,slug:o,members_count:1,max_allowed_memberships:1}}]:[]}}]};return t4.getOrCreateInstance(c)}class ri{async getBaseFapiProxyOptions(){let e=await tL.clerk.session?.getToken();if(!e)throw new I("No valid session token available",{code:"no_session_token"});return{pathPrefix:"",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},credentials:"same-origin"}}async getAll(e){return tL._fetch({...await this.getBaseFapiProxyOptions(),method:"GET",path:"/api_keys",search:t5({...e,subject:e?.subject??tL.clerk.organization?.id??tL.clerk.user?.id??"",query:e?.query??""})}).then(e=>{let{data:t,total_count:i}=e;return{total_count:i,data:t.map(e=>new nR(e))}})}async create(e){return new nR(await tL._fetch({...await this.getBaseFapiProxyOptions(),path:"/api_keys",method:"POST",body:JSON.stringify({type:"api_key",name:e.name,subject:e.subject??tL.clerk.organization?.id??tL.clerk.user?.id??"",description:e.description,seconds_until_expiration:e.secondsUntilExpiration})}))}async revoke(e){return new nR(await tL._fetch({...await this.getBaseFapiProxyOptions(),method:"POST",path:`/api_keys/${e.apiKeyID}/revoke`,body:JSON.stringify({revocation_reason:e.revocationReason})}))}}let rn=(()=>{let e=new Map;return{cache:e,listeners:new Map,pendingOperations:new Map,safeGet:(e,t)=>(t.has(e)||t.set(e,new Set),t.get(e)),safeGetOperations(e){return this.pendingOperations.has(e)||this.pendingOperations.set(e,new Map),this.pendingOperations.get(e)}}})(),rr="completed";function rs(e){let t=e.isStarting||e.isConfirming?"fetching":e.error?"error":"idle",i=e.checkout?.status===rr?rr:e.checkout?"needs_confirmation":"needs_initialization";return{...e,fetchStatus:t,status:i}}let ra=Object.freeze(rs({isStarting:!1,isConfirming:!1,error:null,checkout:null})),ro="__clerk_protect_pid",rl=/^v\d+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/,rc="abcdefghijklmnopqrstuvwxyz234567",rd=/^[a-z2-7]{26}$/,rh=/\{(cid|pid|rid|sdkver)\}/g,ru=/\{(?:cid|pid|rid|sdkver)\}/,rp=/\{(?:cid|pid|rid)\}/,rf=/\{cid\}/;function rm(e,t){return e.replace(rh,(e,i)=>t[i]??e)}function r_(){let e="undefined"!=typeof crypto?crypto:void 0;if("function"!=typeof e?.getRandomValues)return null;try{return function(e){let t="",i=0,n=0;for(let r=0;r<e.length;r++)for(i=i<<8|e[r],n+=8;n>=5;)t+=rc[i>>>n-5&31],n-=5;return n>0&&(t+=rc[i<<5-n&31]),t}(e.getRandomValues(new Uint8Array(16)))}catch{return null}}let rg=new Map;function ry(){try{return globalThis.localStorage??null}catch{return null}}function rb(e){try{let t=ry()?.getItem(e);if("string"==typeof t)return t}catch{}return rg.get(e)??null}function rw(e,t){try{let i=ry();if(i){i.setItem(e,t),rg.delete(e);return}}catch{}rg.set(e,t)}function rv(e,t,i){let n,r=rb(e);if(!r)return null;try{n=JSON.parse(r)}catch{return null}if(!n||"object"!=typeof n)return null;let{token:s,exp:a,rid:o,at:l,floor:c}=n;if("string"!=typeof o||!rd.test(o)||!function(e){if("number"!=typeof e||!Number.isFinite(e))return!1;let t=Date.now()-e;return t>=0&&t<864e5}(l)||rk(c)<i)return null;let d=rS(s,a,t);return d?{...d,rid:o,at:l,floor:rk(c)}:null}function rk(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:0}function rS(e,t,i){if("string"!=typeof e||e.length>4096||!rl.test(e)||"number"!=typeof t||!Number.isFinite(t))return null;let n=1e3*t;return n-i<=Date.now()||n>Date.now()+864e5?null:{token:e,exp:t}}function rC(e,t,i){rw(e,JSON.stringify({...t,at:Date.now(),floor:i}))}let rA=Symbol("deadline");async function rU(e,t,i){let n=globalThis.__clerk_specter;if(!n||"object"!=typeof n)return"no_token";let{cid:r,ready:s}=n;if(r!==e||!(s&&("object"==typeof s||"function"==typeof s)&&"function"==typeof s.then))return"no_token";let a=await new Promise(e=>{let t=setTimeout(()=>e(rA),Math.max(0,i-Date.now())),n=i=>{clearTimeout(t),e(i)};s.then(n,()=>n(null))});if(a===rA)return"timeout";if(!a||"object"!=typeof a)return"no_token";let{token:o,exp:l}=a,c=rS(o,l,0);return c?{...c,rid:t}:"no_token"}function rI(e){return e>=100&&e<=599?`http_${e}`:"fetch_error"}function rP(e){let t=[];for(let i of("string"==typeof e.token_url&&t.push(e.token_url),"string"==typeof e.text_content&&t.push(e.text_content),Object.values(e.attributes??{})))"string"==typeof i&&t.push(i);return t}function rT(e){return rP(e).some(e=>ru.test(e))}function rO(e){return rP(e).some(e=>rp.test(e))}function rE(e){return rP(e).some(e=>rf.test(e))}class rx{#K;#B;#V;#q;#H;#G;#Z;#Y;#Q=0;#X;#ee;#et;#ei=!1;#en=0;#er=0;static create(e,t,i){let n=e.filter(rT);if(0!==n.length)return new rx(n,t,i)}constructor(e,t,i){var n,r;this.#Y=t,this.#Q=rk(i);let s=e.some(rO);this.#K=s?function(){let e=rb(ro);if(e&&rd.test(e))return e;let t=r_();return t&&rw(ro,t),t}():null,this.#B=this.#K?r_():null,this.#V=this.#K&&this.#B?(n=this.#K,r=this.#B,`1-${n}-${r}`):null,this.#q={...this.#V?{cid:this.#V}:{},...this.#K?{pid:this.#K}:{},...this.#B?{rid:this.#B}:{},sdkver:"5.128.0"};let a=e.find(rE);this.#H=a,this.#G=a?function(e,t){if("string"!=typeof e.token_url||!e.token_url)return;let i="undefined"!=typeof document?document.baseURI:void 0;try{return new URL(rm(e.token_url,t),i).href}catch{return}}(a,this.#q):void 0,this.#Z=function(e){return"number"!=typeof e||!Number.isFinite(e)||e<=0?5e3:Math.min(e,1e4)}(a?.token_timeout_ms),this.#X="__clerk_protect_st",this.#ee=n5("clerk.lock.protectSessionToken")}placeholders(){return this.#q}isTokenLoader(e){return this.#H===e}start(){this.#H&&!this.#et&&this.#es()}
vendor: 9,226 bytes, line 16
16async getRequestParams(){var e,t,i,n;if(!this.#H)return;if(!this.#V||!this.#K)return{__clerk_protect_status:"unsupported"};this.#ea();let r=this.#et?await (e=this.#et,t=this.#Z,new Promise(i=>{let n=setTimeout(()=>i("timeout"),t),r=e=>{clearTimeout(n),i(e)};e.then(r,()=>r("timeout"))})):"timeout",s=rv(this.#X,5e3,this.#Q);return s?{__clerk_protect_token:s.token,__clerk_protect_status:"ok",__clerk_protect_cid:(i=this.#K,n=s.rid,`1-${i}-${n}`)}:{__clerk_protect_status:"ok"===r?"timeout":r,__clerk_protect_cid:this.#V}}hasFreshToken(){return!!this.#H&&null!==this.#eo()}#eo(){return rv(this.#X,6e4,this.#Q)}#ea(){if(!this.#et)return void this.#es();!(!this.#ei||rv(this.#X,5e3,this.#Q))&&(Date.now()-this.#en<this.#el()||this.#es())}#el(){return this.#er<=1?3e4:Math.min(3e4*2**(this.#er-1),9e5)}#es(){this.#en=Date.now(),this.#ei=!1;let e=e=>(this.#ei=!0,this.#er=rv(this.#X,5e3,this.#Q)?0:this.#er+1,e);this.#et=this.#ec().then(e,()=>e("timeout"))}async #ec(){if(!this.#V)return"unsupported";if(this.#eo())return"ok";let e=await this.#ee.acquireLockAndRun(async()=>this.#eo()?"ok":await this.#ed());return"string"==typeof e?e:this.#eo()?"ok":"timeout"}async #ed(){let e=Date.now()+this.#Z,t=await this.#eh(e);if("error"===t)return"script_error";if("timeout"===t)return"timeout";if(this.#G)return await this.#eu(e);let i=await rU(this.#V,this.#B,e);return"string"==typeof i?i:(rC(this.#X,i,this.#Q),"ok")}#eh(e){var t;let i,n=this.#H;if(!n)return Promise.resolve("error");try{i=this.#Y(n,this.#q)}catch{return Promise.resolve("error")}return i?(t=i).getAttribute("src")||t.getAttribute("href")||"SCRIPT"===t.tagName&&t.getAttribute("type")?.toLowerCase()==="module"?new Promise(t=>{let n=setTimeout(()=>t("timeout"),Math.max(0,e-Date.now())),r=e=>()=>{clearTimeout(n),t(e)};i.addEventListener("load",r("loaded"),{once:!0}),i.addEventListener("error",r("error"),{once:!0})}):Promise.resolve("loaded"):Promise.resolve("error")}async #eu(e){let t=this.#G,i=new AbortController,n=setTimeout(()=>i.abort(),Math.max(0,e-Date.now()));try{for(;;){var r;let n;if(Date.now()>=e)return"timeout";try{n=await fetch(t,{credentials:"omit",signal:i.signal})}catch{return i.signal.aborted?"timeout":"fetch_error"}if(200===n.status){let e=await rR(n,this.#B);if(!e)return"fetch_error";return rC(this.#X,e,this.#Q),"ok"}let s=202===n.status;if(!s&&(r=n.status,408!==r&&429!==r&&!(r>=500)))return rI(n.status);let a=s?await rM(n):200;if(Date.now()+a>=e)return s?"timeout":rI(n.status);await function(e,t){return new Promise(i=>{let n=setTimeout(i,e);t.addEventListener("abort",()=>{clearTimeout(n),i()},{once:!0})})}(a,i.signal)}}finally{clearTimeout(n)}}}async function rR(e,t){let i;try{i=await e.json()}catch{return null}if(!i||"object"!=typeof i)return null;let{token:n,exp:r}=i,s=rS(n,r,0);return s?{...s,rid:t}:null}async function rM(e){try{let t=await e.json(),i=t?.retry_in_ms;if("number"==typeof i&&Number.isFinite(i))return Math.min(Math.max(i,50),1e3)}catch{}return 100}class rz{#v=!1;#ep;load(e){let t=e?.protectConfig;if(t?.loaders&&Array.isArray(t.loaders)&&0!==t.loaders.length&&!this.#v){if(a()){this.#v=!0;try{this.#ef(t.loaders,t.tokens_invalid_before)}catch(e){K(`[protect] failed to load: ${e}`)}}}}#ef(e,t){let i=e.filter(e=>{var t;return(!!(t=e)&&"object"==typeof t||(K(`[protect] loader entry is not an object: ${t}`),!1))&&function(e){if(void 0===e.rollout)return!0;let t=e.rollout;return"number"!=typeof t||t<0?(K(`[protect] loader rollout value is invalid: ${t}`),!1):0!==t&&Math.random()<=t}(e)}),n=(e,t)=>this.applyLoader(e,t);for(let e of(this.#ep=rx.create(i,n,t),i))if(!this.#ep?.isTokenLoader(e))try{this.applyLoader(e,this.#ep?.placeholders())}catch(e){K(`[protect] failed to apply loader: ${e}`)}this.#ep?.start()}getRequestParams(){try{return(this.#ep?.getRequestParams()??Promise.resolve(void 0)).catch(()=>void 0)}catch{return Promise.resolve(void 0)}}applyLoader(e,t){let i=e.type||"script",n=e.target||"body",r=document.createElement(i);if(e.attributes)for(let[i,n]of Object.entries(e.attributes))switch(typeof n){case"string":r.setAttribute(i,t?rm(n,t):n);break;case"number":case"boolean":r.setAttribute(i,String(n));break;default:K(`[protect] loader attribute is invalid type: ${i}=${n}`)}switch(e.text_content&&"string"==typeof e.text_content&&(r.textContent=t?rm(e.text_content,t):e.text_content),n){case"head":return document.head.appendChild(r),r;case"body":return document.body.appendChild(r),r;default:if(n?.startsWith("#")){let e=document.getElementById(n.substring(1));if(!e)return void K(`[protect] loader target element not found: ${n}`);return e.appendChild(r),r}K(`[protect] loader target is invalid: ${n}`);return}}}let rN={"choose-organization":"choose-organization","reset-password":"reset-password","setup-mfa":"setup-mfa"},rF=e=>`/tasks/${rN[e.key]}`;function rD(e,{navigate:t,baseUrl:i}){let n=e.currentTask;if(n)return t(function(e,t){let i=eR();return eH({base:t.base,hashPath:rF(e),searchParams:i},{stringify:!0})}(n,{base:i}))}(y=b||(b={}))[y.None=0]="None",y[y.Mutable=1]="Mutable",y[y.Watching=2]="Watching",y[y.RecursedCheck=4]="RecursedCheck",y[y.Recursed=8]="Recursed",y[y.Dirty=16]="Dirty",y[y.Pending=32]="Pending";let rW=[],{link:rL,unlink:r$,propagate:rj,checkDirty:rJ,endTracking:rK,startTracking:rB,shallowPropagate:rV}=function({update:e,notify:t,unwatched:i}){let n=0;return{link:function(e,t){let i,r=t.depsTail;if(void 0!==r&&r.dep===e)return;if(4&t.flags&&void 0!==(i=void 0!==r?r.nextDep:t.deps)&&i.dep===e){i.version=n,t.depsTail=i;return}let s=e.subsTail;if(void 0!==s&&s.version===n&&s.sub===t)return;let a=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:s,nextSub:void 0};void 0!==i&&(i.prevDep=a),void 0!==r?r.nextDep=a:t.deps=a,void 0!==s?s.nextSub=a:e.subs=a},unlink:r,propagate:function(e){let i,n=e.nextSub;e:for(;;){let r=e.sub,s=r.flags;if(3&s&&(60&s?12&s?4&s?!(48&s)&&function(e,t){let i=t.depsTail;if(void 0!==i){let n=t.deps;do{if(n===e)return!0;if(n===i)break;n=n.nextDep}while(void 0!==n)}return!1}(e,r)?(r.flags=40|s,s&=1):s=0:r.flags=-9&s|32:s=0:r.flags=32|s,2&s&&t(r),1&s)){let t=r.subs;if(void 0!==t){e=t,void 0!==t.nextSub&&(i={value:n,prev:i},n=e.nextSub);continue}}if(void 0!==(e=n)){n=e.nextSub;continue}for(;void 0!==i;)if(e=i.value,i=i.prev,void 0!==e){n=e.nextSub;continue e}break}},checkDirty:function(t,i){let n,r=0;e:for(;;){let a=t.dep,o=a.flags,l=!1;if(16&i.flags)l=!0;else if((17&o)==17){if(e(a)){let e=a.subs;void 0!==e.nextSub&&s(e),l=!0}}else if((33&o)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(n={value:t,prev:n}),t=a.deps,i=a,++r;continue}if(!l&&void 0!==t.nextDep){t=t.nextDep;continue}for(;r;){--r;let a=i.subs,o=void 0!==a.nextSub;if(o?(t=n.value,n=n.prev):t=a,l){if(e(i)){o&&s(a),i=t.sub;continue}}else i.flags&=-33;if(i=t.sub,void 0!==t.nextDep){t=t.nextDep;continue e}l=!1}return l}},endTracking:function(e){let t=e.depsTail,i=void 0!==t?t.nextDep:e.deps;for(;void 0!==i;)i=r(i,e);e.flags&=-5},startTracking:function(e){++n,e.depsTail=void 0,e.flags=-57&e.flags|4},shallowPropagate:s};function r(e,t=e.sub){let n=e.dep,s=e.prevDep,a=e.nextDep,o=e.nextSub,l=e.prevSub;return void 0!==a?a.prevDep=s:t.depsTail=s,void 0!==s?s.nextDep=a:t.deps=a,void 0!==o?o.prevSub=l:n.subsTail=l,void 0!==l?l.nextSub=o:void 0===(n.subs=o)&&i(n),a}function s(e){do{let i=e.sub,n=e.nextSub,r=i.flags;(48&r)==32&&(i.flags=16|r,2&r&&t(i)),e=n}while(void 0!==e)}}({update:e=>"getter"in e?rX(e):r0(e,e.value),notify:function e(t){let i=t.flags;if(!(64&i)){t.flags=64|i;let n=t.subs;void 0!==n?e(n.sub):rW[rH++]=t}},unwatched(e){if("getter"in e){let t=e.deps;if(void 0!==t){e.flags=17;do t=r$(t,e);while(void 0!==t)}}else"previousValue"in e||r2.call(e)}}),rq=0,rH=0;function rG(e){let t=r;return r=e,t}function rZ(e){return r3.bind({previousValue:e,value:e,subs:void 0,subsTail:void 0,flags:1})}function rY(e){return r1.bind({value:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:17,getter:e})}function rQ(e){let t={fn:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:2};void 0!==r?rL(t,r):void 0!==s&&rL(t,s);let i=rG(t);try{t.fn()}finally{rG(i)}return r2.bind(t)}function rX(e){let t=rG(e);rB(e);try{let t=e.value;return t!==(e.value=e.getter(t))}finally{rG(t),rK(e)}}function r0(e,t){return e.flags=1,e.previousValue!==(e.previousValue=t)}function r1(){let e=this.flags;if(16&e||32&e&&rJ(this.deps,this)){if(rX(this)){let e=this.subs;void 0!==e&&rV(e)}}else 32&e&&(this.flags=-33&e);return void 0!==r?rL(this,r):void 0!==s&&rL(this,s),this.value}function r3(...e){if(e.length){let t=e[0];if(this.value!==(this.value=t)){this.flags=17;let e=this.subs;void 0!==e&&(rj(e),function(){for(;rq<rH;){let e=rW[rq];rW[rq++]=void 0,function e(t,i){if(16&i||32&i&&rJ(t.deps,t)){let e=rG(t);rB(t);try{t.fn()}finally{rG(e),rK(t)}return}32&i&&(t.flags=-33&i);let n=t.deps;for(;void 0!==n;){let t=n.dep,i=t.flags;64&i&&e(t,t.flags=-65&i),n=n.nextDep}}(e,e.flags&=-65)}rq=0,rH=0}())}}else{let e=this.value;if(16&this.flags&&r0(this,e)){let e=this.subs;void 0!==e&&rV(e)}return void 0!==r&&rL(this,r),e}}function r2(){let e=this.deps;for(;void 0!==e;)e=r$(e,this);let t=this.subs;void 0!==t&&r$(t),this.flags=0}let r4=rZ({resource:null}),r5=rZ({error:null}),r6=rZ({status:"idle"}),r8=rY(()=>
16{let e=r4().resource,t=r5().error,i=r6().status;return{errors:si(t,{identifier:null,password:null,code:null}),fetchStatus:i,signIn:e?e.__internal_future:null}}),r9=rZ({resource:null}),r7=rZ({error:null}),se=rZ({status:"idle"}),st=rY(()=>{let e=r9().resource,t=r7().error,i=se().status;return{errors:si(t,{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null}),fetchStatus:i,signUp:e?e.__internal_future:null}});function si(e,t){let i={fields:{...t},raw:null,global:null};return e&&(S(e)?e.errors.some(e=>"meta"in e&&e.meta&&"paramName"in e.meta)?e.errors.forEach(e=>{if(i.raw?i.raw.push(e):i.raw=[e],"meta"in e&&e.meta&&"paramName"in e.meta){let t=H(e.meta.paramName);t in i.fields&&(i.fields[t]=e)}}):(i.raw=[e],i.global=[x(e)]):(i.raw=[e],i.global=[x(e)])),i}class sn{signInResourceSignal=r4;signInErrorSignal=r5;signInFetchSignal=r6;signInSignal=r8;signUpResourceSignal=r9;signUpErrorSignal=r7;signUpFetchSignal=se;signUpSignal=st;__internal_effect=rQ;__internal_computed=rY;constructor(){iU.on("resource:update",this.onResourceUpdated),iU.on("resource:error",this.onResourceError),iU.on("resource:fetch",this.onResourceFetch)}onResourceError=e=>{e.resource instanceof ny&&this.signInErrorSignal({error:e.error}),e.resource instanceof nk&&this.signUpErrorSignal({error:e.error})};onResourceUpdated=e=>{e.resource instanceof ny&&this.signInResourceSignal({resource:e.resource}),e.resource instanceof nk&&this.signUpResourceSignal({resource:e.resource})};onResourceFetch=e=>{e.resource instanceof ny&&this.signInFetchSignal({status:e.status}),e.resource instanceof nk&&this.signUpFetchSignal({status:e.status})}}let sr=e=>`\u{1F512} Clerk:
17${e.trim()}
18(This notice only appears in development)`,ss={cannotRenderComponentWhenSessionExists:"The <SignUp/> and <SignIn/> components cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the Home URL instead.",cannotRenderSignUpComponentWhenSessionExists:"The <SignUp/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the value set in `afterSignUp` URL instead.",cannotRenderSignUpComponentWhenTaskExists:"The <SignUp/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenTaskDoesNotExist:"<TaskChooseOrganization/> cannot render unless a session task is pending. Clerk is redirecting to the value set in `redirectUrlComplete` instead.",cannotRenderSignInComponentWhenSessionExists:"The <SignIn/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `afterSignIn` URL instead.",cannotRenderSignInComponentWhenTaskExists:"The <SignIn/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenUserDoesNotExist:"<UserProfile/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotRenderComponentWhenOrgDoesNotExist:"<OrganizationProfile/> cannot render unless an organization is active. Since no organization is currently active, this is no-op.",cannotRenderAnyOrganizationComponent:e=>sr(`The <${e}/> cannot be rendered when the feature is turned off. Visit 'dashboard.clerk.com' to enable the feature. Since the feature is turned off, this is no-op.`),cannotRenderAnyBillingComponent:e=>sr(`The <${e}/> component cannot be rendered when billing is disabled. Visit 'https://dashboard.clerk.com/last-active?path=billing/settings' to follow the necessary steps to enable billing. Since billing is disabled, this is no-op.`),cannotOpenUserProfile:"The UserProfile modal cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenCheckout:"The Checkout drawer cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenSignInOrSignUp:"The SignIn or SignUp modals do not render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a 
18single session, this is no-op.",cannotRenderAPIKeysComponent:"The <APIKeys/> component cannot be rendered when API keys are disabled. Since API keys are disabled, this is no-op.",cannotRenderAPIKeysComponentForUserWhenDisabled:"The <APIKeys/> component cannot be rendered when user API keys are disabled. Since user API keys are disabled, this is no-op.",cannotRenderAPIKeysComponentForOrgWhenDisabled:"The <APIKeys/> component cannot be rendered when organization API keys are disabled. Since organization API keys are disabled, this is no-op."};for(let e of Object.keys(ss)){let t=ss[e];"function"!=typeof t&&(ss[e]=sr(t))}let sa="cannot_render_billing_disabled",so="cannot_render_user_missing",sl="cannot_render_organizations_disabled",sc="cannot_render_organization_missing",sd="cannot_render_single_session_enabled",sh={polling:!0,standardBrowser:!0,touchSession:!0,isSatellite:!1,signInUrl:void 0,signUpUrl:void 0,afterSignOutUrl:void 0,signInFallbackRedirectUrl:void 0,signUpFallbackRedirectUrl:void 0,signInForceRedirectUrl:void 0,signUpForceRedirectUrl:void 0,newSubscriptionRedirectUrl:void 0};class su{static mountComponentRenderer;static version="5.128.0";static sdkMetadata={name:"@clerk/clerk-js",version:"5.128.0"};static _billing;static _apiKeys;_checkout;client;session;organization;user;__internal_country;telemetry;__internal_state=new sn;internal_last_error=null;environment;#em;#e_="";#eg;#ey;#eb;#ew;#ev;#ek=null;#eS;#eC;#eA;#eU="loading";#eI=[];#eP=[];#eT={};#eO=null;#eE=0;#ex=f();get __internal_queryClient(){return this.#em||Promise.all([i.e("298"),i.e("901")]).then(i.bind(i,4586)).then(e=>e.QueryClient).then(e=>{this.#em||(this.#em=new e,this.#ex.emit("queryClientStatus","ready"))}),this.#em?{__tag:"clerk-rq-client",client:this.#em}:void 0}__internal_getCachedResources;__internal_createPublicCredentials;__internal_getPublicCredentials;__internal_isWebAuthnSupported;__internal_isWebAuthnAutofillSupported;__internal_isWebAuthnPlatformAuthenticatorSupported;__internal_setActiveInProgress=!1;get publishableKey(){return this.#e_}get version(){return su.version}set sdkMetadata(e){su.sdkMetadata=e}get sdkMetadata(){return su.sdkMetadata}get loaded(){return"degraded"===this.status||"ready"===this.status}get status(){return this.#eU}get isSatellite(){return!!e4()&&(0,eu.YZ)(this.#eT.isSatellite,new URL(window.location.href),!1)}get domain(){if(e4()){let e=function(e=""){return(e||"").replace(/^.+:\/\//,"")}((0,eu.YZ)(this.#eg,new URL(window.location.href)));if("production"===this.#eA){let t;if(!e)return"";if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}return e}return""}get proxyUrl(){if(e4()){let e=(0,eu.YZ)(this.#ey,new URL(window.location.href));return!e||V(e)||q(e)||eW.throwInvalidProxyUrl({url:e}),e?q(e)?new URL(e,window.location.origin).toString():e:""}return""}get frontendApi(){let e=W(this.publishableKey);return e?e.frontendApi:eW.throwInvalidPublishableKeyError({key:this.publishableKey})}get instanceType(){return this.#eA}get isStandardBrowser(){return this.#eT.standardBrowser||!1}get billing(){return su._billing||(su._billing=new t6),su._billing}get apiKeys(){return su._apiKeys||(su._apiKeys=new ri),su._apiKeys}__experimental_checkout(e){return this._checkout||(this._checkout=e=>(function(e,t){let{for:i,planId:n,planPeriod:r}=t;if(!e.isSignedIn||!e.user)throw Error("Clerk: User is not authenticated");if("organization"===i&&!e.organization)throw Error("Clerk: Use `setActive` to set the organization");let s=function(e){let t=rn.safeGet(e,rn.listeners),i=rn.safeGetOperations(e),n=()=>rn.cache.get(e)||ra,r=i=>{let r=rs({...n(),...i});rn.cache.set(e,Object.freeze(r)),t.forEach(e=>e(n()))};return{subscribe:e=>(t.add(e),()=>{t.delete(e)}),getCacheState:n,async executeOperation(t,n){let s=`${e}-${t}`,a="start"===t?"isStarting":"isConfirming",o=i.get(s);if(o)return await o;let l=(async()=>{let e=null,o=null;try{r({[a]:!0,error:null,..."start"===t?{checkout:null}:{}});let i=await n();r({[a]:!1,error:null,checkout:i}),e=i}catch(e){o=e,r({[a]:!1,error:e})}finally{i.delete(s)}return{data:e,error:o}})();return i.set(s,l),l},clearCheckout(){0===i.size&&r(ra)}}}(function(e){let{userId:t,orgId:i,planId:n,planPeriod:r}=e;return`${t}-${i||"user"}-${n}-${r}`}({userId:e.user.id,orgId:"organization"===i?e.organization?.id:void 0,planId:n,planPeriod:r}));return{start:async()=>s.executeOperation("start",async()=>await e.billing?.startCheckout({..."organization"===i?{orgId:e.organization?.id}:{},planId:n,planPeriod:r})),confirm:async e=>
vendor: 4,091 bytes, line 18
18s.executeOperation("confirm",async()=>{let t=s.getCacheState().checkout;if(!t)throw Error("Clerk: Call `start` before `confirm`");return t.confirm(e)}),finalize:t=>{let{navigate:i}=t||{};return e.setActive({session:e.session?.id,navigate:i})},clear:()=>s.clearCheckout(),subscribe:e=>s.subscribe(e),getState:s.getCacheState}})(this,e)),this._checkout(e)}__internal_getOption(e){return this.#eT[e]}get isSignedIn(){return this?.session?.status!=="pending"&&!!this.session}constructor(e,t){if(!(e=(e||"").trim()))return eW.throwMissingPublishableKeyError();let i=W(e);if(!i)return eW.throwInvalidPublishableKeyError({key:e});this.#eg=t?.domain,this.#ey=t?.proxyUrl,this.environment=iT.getInstance(),this.#eA=i.instanceType,this.#e_=e,this.#eC=function(e){let t=[],i=[];async function n(e){for await(let i of["undefined"!=typeof window&&window.__unstable__onBeforeRequest,...t].filter(e=>e))if(await i(e)===!1)return!1;return!0}async function r(e,t){for await(let n of["undefined"!=typeof window&&window.__unstable__onAfterResponse,...i].filter(e=>e))if(await n(e,t)===!1)return!1;return!0}function s({method:t,path:i,sessionId:n,search:r,rotatingTokenNonce:s}){let a=new URLSearchParams(r);return a.append("__clerk_api_version","2025-11-10"),a.append("_clerk_js_version","5.128.0"),s&&a.append("rotating_token_nonce",s),e.domain&&"development"===e.instanceType&&e.isSatellite&&a.append("__domain",e.domain),t&&"GET"!==t&&"POST"!==t&&a.append("_method",t),i&&!n7.some(e=>i.startsWith(e))&&n&&a.append("_clerk_session_id",n),ej([...a.entries()].reduce((e,[t,i])=>(e[t]=i.includes(",")?i.split(","):i,e),{}))}function a(t){let{path:i,pathPrefix:n="v1"}=t;if(e.proxyUrl){let r=new URL(e.proxyUrl),a=r.pathname.slice(1);return a.endsWith("/")&&(a=a.slice(0,-1)),eH({base:r.origin,pathname:`${a}/${n}${i}`,search:s(t)},{stringify:!1})}let r="production"===e.instanceType?e.domain:"";return eH({base:`https://${r||e.frontendApi}`,pathname:`${n}${i}`,search:s(t)},{stringify:!1})}async function o(t,i){let s,o={...t},{method:l="GET"}=o,{body:d}=o;if(e.getProtectParams&&(m=o.path,"GET"!==l&&m&&re.some(e=>m===e||m.startsWith(`${e}/`)))&&function(e){if(void 0===e)return!0;if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(d)){let t=await e.getProtectParams().catch(()=>void 0);t&&(o.body=d={...d??{},...t})}!d||"object"!=typeof d||d instanceof FormData||(o.body=function(e){if(!e||"object"!=typeof e||Object.getPrototypeOf(e)!==Object.prototype)return e;let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}(d)),o.url=a({...o,sessionId:e.getSessionId()}),o.headers=new Headers(o.headers),"GET"===l||d instanceof FormData||o.headers.has("content-type")||o.headers.set("content-type","application/x-www-form-urlencoded"),"application/x-www-form-urlencoded"===o.headers.get("content-type")&&(o.body=d?ej(d,{keyEncoder:G}):d);let h=await n(o),u="GET"===l?"GET":"POST",p=o.url,f={...o,method:u,credentials:o.credentials||"include"};try{if(h){let e=i?.fetchMaxTries??(c()?4:11);s=await tP(()=>fetch(p,f),{retryImmediately:!0,initialDelay:700,maxDelayBetweenRetries:5e3,shouldRetry:(t,i)=>"GET"===u&&i<e&&!f.signal?.aborted,onBeforeRetry:e=>{p.searchParams.set("_clerk_retry_attempt",e.toString())}})}else s=new Response("{}",o)}catch(t){var m;let e=p.toString();throw eb.error("network error",{error:t,url:e,method:l},"fapiClient"),Error(`${t_} Network error at "${e}" - ${t}. Please try again.`)}let _=204!==s.status?await s.json():null,g=Object.assign(s,{payload:_});return s.ok||eb.error("request failed",{method:l,path:o.path,status:s.status},"fapiClient"),await r(o,g),g}return{buildEmailAddress:function(t){return function({localPart:e,frontendApi:t}){let i=t?t.replace("clerk.",""):"clerk.com";return`${e}@${i}`}({localPart:t,frontendApi:e.frontendApi})},buildUrl:a,onAfterResponse:function(e){i.push(e)},onBeforeRequest:function(e){t.push(e)},request:o}}({domain:this.domain,frontendApi:this.frontendApi,instanceType:this.instanceType,isSatellite:this.isSatellite,getSessionId:()=>this.session?.id,getProtectParams:()=>
18this.#ew?.getRequestParams()??Promise.resolve(void 0),proxyUrl:this.proxyUrl}),this.#ex.emit(m,"loading"),this.#ex.prioritizedOn(m,e=>this.#eU=e),tL.clerk=this,this.#ew=new rz}getFapiClient=()=>this.#eC;load=async e=>{if(eb.info("load() start",{},"clerk"),!this.loaded){if("development"===this.#eA&&K("Clerk: Clerk has been loaded with development keys. Development instances have strict usage limits and should not be used when deploying your application to production. Learn more: https://clerk.com/docs/deployments/overview"),this.#eT=this.#eR(e),"development"===this.#eA&&(this.#eT.routerPush||this.#eT.routerReplace)&&(!this.#eT.routerPush||!this.#eT.routerReplace)){let e=this.#eT.routerPush?"routerReplace":"routerPush";K(`Clerk: Both \`routerPush\` and \`routerReplace\` need to be defined, but \`${e}\` is not defined. This may cause issues with navigation in your application.`)}iU.on(iA,()=>{this.#eM(this.session),this.#ez()}),th(this.#eT),this.#eT.sdkMetadata&&(su.sdkMetadata=this.#eT.sdkMetadata),!1!==this.#eT.telemetry&&(this.telemetry=new er({clerkVersion:su.version,samplingRate:1,perEventSampling:!this.#eT.__internal_keyless_claimKeylessApplicationUrl&&void 0,publishableKey:this.publishableKey,...this.#eT.telemetry}),this.#eT.appearance&&this.telemetry.record({event:"THEME_USAGE",eventSamplingRate:1,payload:function(e){let t;if(!e||"object"!=typeof e)return{};let i=e.theme||e.baseTheme;if(!i)return{};if(Array.isArray(i))for(let e of i){let i=ed(e);if(i){t=i;break}}else t=ed(i);return{themeName:t}}(this.#eT.appearance)}));try{this.#eT.standardBrowser?await this.#eN():await this.#eF();let e=this.#eT.telemetry,t=!1!==e&&!e?.disabled,i=!!this.#eT.__internal_keyless_claimKeylessApplicationUrl,n=!!this.environment?.clientDebugMode,r=this.environment?.isProduction?.()??!1,s=n||i&&!r,a=i&&!n?"error":void 0;s&&function(e={}){if(em)return;let{enabled:t=!1,...i}=e;t&&(ep=!0,em=!0,ey(i))}({enabled:!0,...a?{logLevel:a}:{},...t&&this.telemetry?{telemetryCollector:this.telemetry}:{}}),this.#ew?.load(this.environment),eb.info("load() complete",{},"clerk")}catch(e){throw this.#ex.emit(m,"error"),eb.error("load() failed",{error:e},"clerk"),e}}};#eD(){let e;return!!(!this.#eT.signUpUrl&&this.#eT.signInUrl&&(e=this.#eT.signInUrl,!eh.test(e)))}signOut=async(e,t)=>{if(!this.client||0===this.client.sessions.length)return;let i="undefined"!=typeof window&&"function"==typeof window.__unstable__onBeforeSetActive?window.__unstable__onBeforeSetActive:eu.ZT,n="undefined"!=typeof window&&"function"==typeof window.__unstable__onAfterSetActive?window.__unstable__onAfterSetActive:eu.ZT,r=e&&"object"==typeof e?e:t||{},s=r?.redirectUrl||this.buildAfterSignOutUrl();eb.debug("signOut() start",{hasClient:!!this.client,multiSessionCount:this.client?.signedInSessions.length??0,redirectUrl:s,sessionTarget:r?.sessionId??null},"clerk");let a="function"==typeof e?e:void 0,o=async()=>{let e=eS(this.#eT.standardBrowser);iU.emit(iS,null),this.#eW(),await e.track(async()=>{a?await a():await this.navigate(s)}),e.isUnloading()||(this.#eM(),this.#ez(),await n())};if(await i(),!r.sessionId||1===this.client.signedInSessions.length){this.#eT.experimental?.persistClient??!0?await this.client.removeSessions():await this.client.destroy(),await o(),eb.info("signOut() complete",{redirectUrl:eG(s)},"clerk");return}let l=this.client.signedInSessions.find(e=>e.id===r.sessionId),c=l?.id&&this.session?.id===l.id;await l?.remove(),c&&(await o(),eb.info("signOut() complete",{redirectUrl:eG(s)},"clerk"))};openGoogleOneTap=e=>{let t="GoogleOneTap";this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:t}).then(t=>t.openModal("googleOneTap",e||{})),this.telemetry?.record(ec(t,e))};closeGoogleOneTap=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("googleOneTap"))};openSignIn=e=>{if(this.assertComponentsReady(this.#eS),eM(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotOpenSignInOrSignUp,{code:sd});return}let t="SignIn";this.#eS.ensureMounted({preloadHint:t}).then(t=>t.openModal("signIn",e||{}));let i={withSignUp:e?.withSignUp??this.#eD()};this.telemetry?.record(ec(t,e,i))};closeSignIn=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("signIn"))};__internal_openCheckout=e=>{if(this.assertComponentsReady(this.#eS),ez(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAnyBillingComponent("Checkout"),{code:sa});return}if(!this.user){if("development"===this.#eA)throw new I(ss.cannotOpenCheckout,{code:so});return}this.#eS.ensureMounted({preloadHint:"Checkout"}).then(t=>t.openDrawer("checkout",e||{}))};__internal_closeCheckout=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeDrawer("checkout"))};__internal_openPlanDetails=e=>{if(this.assertComponentsReady(this.#eS),ez(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAnyBillingComponent("PlanDetails"),{code:sa});return}let t="PlanDetails";this.#eS.ensureMounted({preloadHint:t}).then(t=>t.openDrawer("planDetails",e||{})),this.telemetry?.record(ec(t,e))};__internal_closePlanDetails=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeDrawer("planDetails"))};
18__internal_openSubscriptionDetails=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"SubscriptionDetails"}).then(t=>t.openDrawer("subscriptionDetails",e||{}))};__internal_closeSubscriptionDetails=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeDrawer("subscriptionDetails"))};__internal_openReverification=e=>{if(this.assertComponentsReady(this.#eS),!this.user){if("development"===this.#eA)throw new I(ss.cannotOpenUserProfile,{code:so});return}this.#eS.ensureMounted({preloadHint:"UserVerification"}).then(t=>t.openModal("userVerification",e||{})),this.telemetry?.record(ec("UserVerification",e))};__internal_closeReverification=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("userVerification"))};__internal_attemptToEnableEnvironmentSetting=e=>{let{for:t,caller:i}=e;if(this.user||"development"!==this.#eA||K(`Clerk: "${i}" requires an active user session. Ensure a user is signed in before executing ${i}.`),"organizations"===t){let t;return(t=this.environment,t?.organizationSettings.enabled||this.session?.currentTask?.key==="choose-organization")?{isEnabled:!0}:("development"===this.#eA&&this.__internal_openEnableOrganizationsPrompt({caller:i,onSuccess:()=>window.location.reload(),onClose:e.onClose}),{isEnabled:!1})}throw Error(`Attempted to enable an unknown or unsupported setting "${t}".`)};__internal_openEnableOrganizationsPrompt=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"EnableOrganizationsPrompt"}).then(t=>t.openModal("enableOrganizationsPrompt",e||{})),this.telemetry?.record(el("EnableOrganizationsPrompt",e))};__internal_closeEnableOrganizationsPrompt=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("enableOrganizationsPrompt"))};__internal_openBlankCaptchaModal=()=>(this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"BlankCaptchaModal"}).then(e=>e.openModal("blankCaptcha",{})));__internal_closeBlankCaptchaModal=()=>(this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"BlankCaptchaModal"}).then(e=>e.closeModal("blankCaptcha")));__internal_loadStripeJs=async()=>{let{loadStripe:e}=await i.e("832").then(i.bind(i,8823));return e};openSignUp=e=>{if(this.assertComponentsReady(this.#eS),eM(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotOpenSignInOrSignUp,{code:sd});return}this.#eS.ensureMounted({preloadHint:"SignUp"}).then(t=>t.openModal("signUp",e||{})),this.telemetry?.record(ec("SignUp",e))};closeSignUp=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("signUp"))};openUserProfile=e=>{if(this.assertComponentsReady(this.#eS),!this.user){if("development"===this.#eA)throw new I(ss.cannotOpenUserProfile,{code:so});return}this.#eS.ensureMounted({preloadHint:"UserProfile"}).then(t=>t.openModal("userProfile",e||{}));let t=(e?.customPages?.length||0)>0?{customPages:!0}:void 0;this.telemetry?.record(ec("UserProfile",e,t))};closeUserProfile=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("userProfile"))};openOrganizationProfile=e=>{this.assertComponentsReady(this.#eS);let{isEnabled:t}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationProfile",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:sl})}});if(t){if(!this.organization){if("development"===this.#eA)throw new I(ss.cannotRenderComponentWhenOrgDoesNotExist,{code:sc});return}this.#eS.ensureMounted({preloadHint:"OrganizationProfile"}).then(t=>t.openModal("organizationProfile",e||{})),this.telemetry?.record(ec("OrganizationProfile",e))}};closeOrganizationProfile=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("organizationProfile"))};openCreateOrganization=e=>{this.assertComponentsReady(this.#eS);let{isEnabled:t}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"CreateOrganization",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:sl})}});t&&(this.#eS.ensureMounted({preloadHint:"CreateOrganization"}).then(t=>t.openModal("createOrganization",e||{})),this.telemetry?.record(ec("CreateOrganization",e)))};closeCreateOrganization=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("createOrganization"))};openWaitlist=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"Waitlist"}).then(t=>t.openModal("waitlist",e||{})),this.telemetry?.record(ec("Waitlist",e))};closeWaitlist=()=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(e=>e.closeModal("waitlist"))};
18mountSignIn=(e,t)=>{this.assertComponentsReady(this.#eS);let i="SignIn";this.#eS.ensureMounted({preloadHint:i}).then(n=>n.mountComponent({name:i,appearanceKey:"signIn",node:e,props:t}));let n={withSignUp:t?.withSignUp??this.#eD()};this.telemetry?.record(el(i,t,n))};unmountSignIn=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountUserAvatar=(e,t)=>{this.assertComponentsReady(this.#eS);let i="UserAvatar";this.#eS.ensureMounted({preloadHint:i}).then(n=>n.mountComponent({name:i,appearanceKey:"userAvatar",node:e,props:t})),this.telemetry?.record(el(i,t))};unmountUserAvatar=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountSignUp=(e,t)=>{this.assertComponentsReady(this.#eS);let i="SignUp";this.#eS.ensureMounted({preloadHint:i}).then(n=>n.mountComponent({name:i,appearanceKey:"signUp",node:e,props:t})),this.telemetry?.record(el(i,t))};unmountSignUp=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountUserProfile=(e,t)=>{if(this.assertComponentsReady(this.#eS),!this.user){if("development"===this.#eA)throw new I(ss.cannotRenderComponentWhenUserDoesNotExist,{code:so});return}let i="UserProfile";this.#eS.ensureMounted({preloadHint:i}).then(n=>n.mountComponent({name:i,appearanceKey:"userProfile",node:e,props:t}));let n=(t?.customPages?.length||0)>0?{customPages:!0}:void 0;this.telemetry?.record(el(i,t,n))};unmountUserProfile=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountOrganizationProfile=(e,t)=>{this.assertComponentsReady(this.#eS);let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationProfile",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:sl})}});if(!i)return;let n=!!this.user;if(!this.organization&&n){if("development"===this.#eA)throw new I(ss.cannotRenderComponentWhenOrgDoesNotExist,{code:sc});return}this.#eS.ensureMounted({preloadHint:"OrganizationProfile"}).then(i=>i.mountComponent({name:"OrganizationProfile",appearanceKey:"userProfile",node:e,props:t})),this.telemetry?.record(el("OrganizationProfile",t))};unmountOrganizationProfile=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountCreateOrganization=(e,t)=>{this.assertComponentsReady(this.#eS);let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"CreateOrganization",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:sl})}});i&&(this.#eS?.ensureMounted({preloadHint:"CreateOrganization"}).then(i=>i.mountComponent({name:"CreateOrganization",appearanceKey:"createOrganization",node:e,props:t})),this.telemetry?.record(el("CreateOrganization",t)))};unmountCreateOrganization=e=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountOrganizationSwitcher=(e,t)=>{this.assertComponentsReady(this.#eS);let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationSwitcher",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("OrganizationSwitcher"),{code:sl})}});i&&(this.#eS?.ensureMounted({preloadHint:"OrganizationSwitcher"}).then(i=>i.mountComponent({name:"OrganizationSwitcher",appearanceKey:"organizationSwitcher",node:e,props:t})),this.telemetry?.record(el("OrganizationSwitcher",{...t,forceOrganizationSelection:this.environment?.organizationSettings.forceOrganizationSelection})))};unmountOrganizationSwitcher=e=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted().then(t=>t.unmountComponent({node:e}))};__experimental_prefetchOrganizationSwitcher=()=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted({preloadHint:"OrganizationSwitcher"}).then(e=>e.prefetch("organizationSwitcher"))};mountOrganizationList=(e,t)=>{this.assertComponentsReady(this.#eS);let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationList",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("OrganizationList"),{code:sl})}});i&&(this.#eS?.ensureMounted({preloadHint:"OrganizationList"}).then(i=>i.mountComponent({name:"OrganizationList",appearanceKey:"organizationList",node:e,props:t})),this.telemetry?.record(el("OrganizationList",{...t,forceOrganizationSelection:this.environment?.organizationSettings.forceOrganizationSelection})))};unmountOrganizationList=e=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountUserButton=(e,t)=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted({preloadHint:"UserButton"}).then(i=>i.mountComponent({name:"UserButton",appearanceKey:"userButton",node:e,props:t}));let i={...t?.customMenuItems?.length||0?{customItems:!0}:void 0,...t?.__experimental_asStandalone?{standalone:!0}:void 0};this.telemetry?.record(el("UserButton",t,i))};
18unmountUserButton=e=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountWaitlist=(e,t)=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted({preloadHint:"Waitlist"}).then(i=>i.mountComponent({name:"Waitlist",appearanceKey:"waitlist",node:e,props:t})),this.telemetry?.record(el("Waitlist",t))};unmountWaitlist=e=>{this.assertComponentsReady(this.#eS),this.#eS?.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountPricingTable=(e,t)=>{if(this.assertComponentsReady(this.#eS),ez(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAnyBillingComponent("PricingTable"),{code:sa});return}let i={...t};void 0!==t?.forOrganizations&&K('Clerk: [IMPORTANT] <PricingTable /> prop `forOrganizations` is deprecated and will be removed in the coming minors. Use `for="organization"` instead.'),this.#eS.ensureMounted({preloadHint:"PricingTable"}).then(t=>t.mountComponent({name:"PricingTable",appearanceKey:"pricingTable",node:e,props:i})),this.telemetry?.record(el("PricingTable",i))};unmountPricingTable=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};__internal_mountOAuthConsent=(e,t)=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"OAuthConsent"}).then(i=>i.mountComponent({name:"OAuthConsent",appearanceKey:"__internal_oauthConsent",node:e,props:t}))};__internal_unmountOAuthConsent=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountAPIKeys=(e,t)=>{if(this.assertComponentsReady(this.#eS),K("Clerk: <APIKeys /> component is in early access and not yet recommended for production use."),((e,t)=>eN(e,t)&&eF(e,t))(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAPIKeysComponent,{code:"cannot_render_api_keys_disabled"});return}if(this.organization&&eF(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAPIKeysComponentForOrgWhenDisabled,{code:"cannot_render_api_keys_org_disabled"});return}if(eN(this,this.environment)){if("development"===this.#eA)throw new I(ss.cannotRenderAPIKeysComponentForUserWhenDisabled,{code:"cannot_render_api_keys_user_disabled"});return}this.#eS.ensureMounted({preloadHint:"APIKeys"}).then(i=>i.mountComponent({name:"APIKeys",appearanceKey:"apiKeys",node:e,props:t})),this.telemetry?.record(el("APIKeys",t))};unmountAPIKeys=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountTaskChooseOrganization=(e,t)=>{this.assertComponentsReady(this.#eS);let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"TaskChooseOrganization",onClose:()=>{throw new I(ss.cannotRenderAnyOrganizationComponent("TaskChooseOrganization"),{code:sl})}});i&&(this.#eS.ensureMounted({preloadHint:"TaskChooseOrganization"}).then(i=>i.mountComponent({name:"TaskChooseOrganization",appearanceKey:"taskChooseOrganization",node:e,props:t})),this.telemetry?.record(el("TaskChooseOrganization",t)))};unmountTaskChooseOrganization=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountTaskResetPassword=(e,t)=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"TaskResetPassword"}).then(i=>i.mountComponent({name:"TaskResetPassword",appearanceKey:"taskResetPassword",node:e,props:t})),this.telemetry?.record(el("TaskResetPassword",t))};unmountTaskResetPassword=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};mountTaskSetupMFA=(e,t)=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted({preloadHint:"TaskSetupMFA"}).then(i=>i.mountComponent({name:"TaskSetupMFA",appearanceKey:"taskSetupMfa",node:e,props:t})),this.telemetry?.record(el("TaskSetupMFA",t))};unmountTaskSetupMFA=e=>{this.assertComponentsReady(this.#eS),this.#eS.ensureMounted().then(t=>t.unmountComponent({node:e}))};setActive=async e=>{let{organization:t,beforeEmit:i,redirectUrl:n,navigate:r}=e,{session:s}=e;this.__internal_setActiveInProgress=!0,eb.debug("setActive() start",{hasClient:!!this.client,sessionTarget:"string"==typeof s?s:s?.id??s??null,organizationTarget:"string"==typeof t?t:t?.id??t??null,redirectUrl:n??null},"clerk");try{if(!this.client)throw eb.warn("Clerk setActive called before client is loaded",{},"clerk"),Error("setActive is being called before the client is loaded. Wait for init.");if(void 0===s&&!this.session)throw eb.warn("Clerk setActive precondition not met: no target session and no active session",{},"clerk"),Error("setActive should either be called with a session param or there should be already an active session.");"string"==typeof s&&(s=this.client.sessions.find(e=>e.id===s)||null);let a="undefined"!=typeof window&&"function"==typeof window.__unstable__onBeforeSetActive?window.__unstable__onBeforeSetActive:eu.ZT,o="undefined"!=typeof window&&"function"==typeof window.__unstable__onAfterSetActive?window.__unstable__onAfterSetActive:eu.ZT,l=void 0===s?this.session:s;l?.status==="pending"&&function(e){let t=["taskUrls","navigate"];Object.keys(e).some(e=>t.includes(e))||K('Clerk: Session has pending tasks but no handling is configured. To handle pending tasks, provide either "taskUrls" for navigation to custom URLs or "navigate" for programmatic navigation. Without these options, users may get stuck on incomplete flows.')}({...this.#eT,...e});let c=void 0!==t;if(l&&c){let e="string"==typeof t?t:t?.id;if(function(e){return"string"==typeof e&&e.startsWith("org_")}(e))l.lastActiveOrganizationId=e||null;else{let t=l.user.organizationMemberships.find(t=>t.organization.slug===e),i=t?.organization.id||null,n=null===i;if(this.environment?.organizationSettings?.forceOrganizationSelection&&n)return;l.lastActiveOrganizationId=i}}l?.status!=="pending"&&await a(null===l?"sign-out":void 0),(e4()&&globalThis.document.hasFocus()||!this.#eT.standardBrowser)&&(await this.#eL(l,c?"select_org":"select_session"),l=this.#e$(l?.id)),await l?.getToken()||(d()||eb.warn("Token is null when setting active session (offline)",{sessionId:l?.id},"clerk"),iU.emit(ik,{token:null}));let h=eS(this.#eT.standardBrowser);
18i&&(((e,t,i)=>{let n=(()=>{try{return!0}catch{}return!1})(),r=i??e;_.has(r)||n||(_.add(r),console.warn(`Clerk - DEPRECATION WARNING: "${e}" is deprecated and will be removed in the next major release.
19${t}`))})("Clerk.setActive({beforeEmit})",'Use the `redirectUrl` property instead. Example `Clerk.setActive({redirectUrl:"/"})`'),await h.track(async()=>{this.#eW(),await i(l)}));let u=l?.status==="pending"&&l?.currentTask&&this.#eT.taskUrls?.[l?.currentTask.key];if(!i&&(n||u||r)&&await h.track(async()=>{if(this.client){if(l?.status!=="pending"&&this.#eW(),u){let e=n?eH({base:u,hashSearchParams:{redirectUrl:n}},{stringify:!0}):u;await this.navigate(e)}else if(r&&l)await r({session:l});else if(n){if(this.client.isEligibleForTouch()){let e=new URL(n,window.location.href),t=this.buildUrlWithAuth(this.client.buildTouchUrl({redirectUrl:e}));await this.navigate(t)}await this.navigate(n)}}}),h.isUnloading())return;this.#eM(l),this.#ez(),l?.status!=="pending"&&await o()}finally{this.__internal_setActiveInProgress=!1}};addListener=e=>(e=function(e){let t;return i=>{var n;t||={...i},e(t={...{client:nz((n=t).client,i.client),session:nz(n.session,i.session),user:nz(n.user,i.user),organization:nz(n.organization,i.organization)}})}}(e),this.#eI.push(e),this.client&&e({client:this.client,session:this.session,user:this.user,organization:this.organization}),()=>{this.#eI=this.#eI.filter(t=>t!==e)});on=(...e)=>{this.#ex.on(...e)};off=(...e)=>{this.#ex.off(...e)};__internal_addNavigationListener=e=>(this.#eP.push(e),()=>{this.#eP=this.#eP.filter(t=>t!==e)});navigate=async(e,t)=>{if(!e||!e4())return;if(void 0===window.location){let i=t?.replace&&this.#eT.routerReplace?this.#eT.routerReplace:this.#eT.routerPush;return i?(eb.info(`Clerk is navigating to: ${e}`),await i(e,{windowNavigate:ek})):void 0}setTimeout(()=>{this.#ej()},0);let i=new URL(e,window.location.href);this.#eJ.includes(i.protocol)||(console.warn(`Clerk: "${i.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`),i=new URL("/",window.location.href));let n=t?.replace&&this.#eT.routerReplace?this.#eT.routerReplace:this.#eT.routerPush;if(eb.info(`Clerk is navigating to: ${i}`),this.#eT.routerDebug&&console.log(`Clerk is navigating to: ${i}`),"null"!==i.origin&&i.origin!==window.location.origin||!n)return void ek(i);let r={...t?.metadata?{__internal_metadata:t?.metadata}:{},windowNavigate:ek};return await n(eG(i),r)};buildUrlWithAuth(e){if("production"===this.#eA)return e;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin&&this.#eb?this.#eb.decorateUrlWithDevBrowserToken(t).href:t.href}buildSignInUrl(e){return this.#eK("signInUrl",{...e,redirectUrl:e?.redirectUrl||window.location.href},e?.initialValues)}buildSignUpUrl(e){return this.#eK("signUpUrl",{...e,redirectUrl:e?.redirectUrl||window.location.href},e?.initialValues)}buildUserProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.userProfileUrl):""}buildHomeUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.homeUrl):""}buildAfterSignInUrl({params:e}={}){return this.buildUrlWithAuth(new nD(this.#eT,{},e).getAfterSignInUrl())}buildAfterSignUpUrl({params:e}={}){return this.buildUrlWithAuth(new nD(this.#eT,{},e).getAfterSignUpUrl())}buildAfterSignOutUrl(){return this.#eT.afterSignOutUrl?this.buildUrlWithAuth(this.#eT.afterSignOutUrl):"/"}buildNewSubscriptionRedirectUrl(){return this.#eT.newSubscriptionRedirectUrl?this.#eT.newSubscriptionRedirectUrl:this.buildAfterSignInUrl()}buildWaitlistUrl(e){return this.environment&&this.environment.displayConfig?eH({base:this.#eT.waitlistUrl||this.environment.displayConfig.waitlistUrl,hashSearchParams:[new URLSearchParams(e?.initialValues||{})]},{stringify:!0}):""}buildAfterMultiSessionSingleSignOutUrl(){return this.environment?this.#eT.afterMultiSessionSingleSignOutUrl?this.buildUrlWithAuth(this.#eT.afterMultiSessionSingleSignOutUrl):this.#eT.signInUrl?this.buildUrlWithAuth(eH({base:this.#eT.signInUrl,hashPath:"choose"},{stringify:!0})):this.buildUrlWithAuth(this.environment.displayConfig.afterSignOutOneUrl):""}buildCreateOrganizationUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.createOrganizationUrl):""}buildOrganizationProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.organizationProfileUrl):""}buildTasksUrl(e){let t=this.session?.currentTask;if(!t)return"";let i=this.#eT.taskUrls?.[t.key];return i||eH({base:this.buildSignInUrl(e),hashPath:rF(t)},{stringify:!0})}#eB=async()=>
vendor: 3,035 bytes, line 19
19{if(!e4())return;let e=new URLSearchParams({[eT]:"true"}),t=eE(eI);t&&V(t)||function(){throw Error(`${t_} Invalid redirect_url. A valid http or https url should be used for the redirection.`)}();let i=eH({base:eE(eI),searchParams:e},{stringify:!0});return this.navigate(this.buildUrlWithAuth(i))};redirectWithAuth=async e=>{if(e4())return this.navigate(this.buildUrlWithAuth(e))};redirectToSignIn=async e=>{if(e4())return this.navigate(this.buildSignInUrl(e))};redirectToSignUp=async e=>{if(e4())return this.navigate(this.buildSignUpUrl(e))};redirectToUserProfile=async()=>{if(e4())return this.navigate(this.buildUserProfileUrl())};redirectToCreateOrganization=async()=>{if(e4())return this.navigate(this.buildCreateOrganizationUrl())};redirectToOrganizationProfile=async()=>{if(e4())return this.navigate(this.buildOrganizationProfileUrl())};redirectToAfterSignIn=async()=>{if(e4())return this.navigate(this.buildAfterSignInUrl())};redirectToAfterSignUp=async()=>{if(e4())return this.navigate(this.buildAfterSignUpUrl())};redirectToAfterSignOut=async()=>{if(e4())return this.navigate(this.buildAfterSignOutUrl())};redirectToWaitlist=async()=>{if(e4())return this.navigate(this.buildWaitlistUrl())};redirectToTasks=async e=>{if(e4())return this.navigate(this.buildTasksUrl(e))};handleEmailLinkVerification=async(e,t)=>{if(!this.client)return;let i=eE("__clerk_status");if("expired"===i)throw new U("expired");if("client_mismatch"===i)throw new U("client_mismatch");if("verified"!==i)throw new U("failed");let n=eE("__clerk_created_session"),{signIn:r,signUp:s,sessions:a}=this.client,o=a.some(e=>e.id===n),l="needs_second_factor"===r.status||"missing_requirements"===s.status,c=e=>t&&"function"==typeof t?t(e):this.navigate(e),d=e.redirectUrl?()=>c(e.redirectUrl):eu.ZT;return o?this.setActive({session:n,redirectUrl:e.redirectUrlComplete}):l?d():("function"==typeof e.onVerifiedOnOtherDevice&&e.onVerifiedOnOtherDevice(),null)};handleGoogleOneTapCallback=async(e,t,i)=>{if(!this.loaded||!this.environment||!this.client)return;let{signIn:n,signUp:r}=this.client,s="identifier"in(e||{})?e:n,a="missingFields"in(e||{})?e:r,o=e=>i&&"function"==typeof i?i(this.buildUrlWithAuth(e)):this.navigate(this.buildUrlWithAuth(e));return this._handleRedirectCallback(t,{signUp:a,signIn:s,navigate:o})};_handleRedirectCallback=async(e,{signIn:t,signUp:i,navigate:n})=>{if(!this.loaded||!this.environment||!this.client)return;if(!window.opener&&e.reloadResource)try{"signIn"===e.reloadResource?await t.reload():"signUp"===e.reloadResource&&await i.reload()}catch{}let{displayConfig:r}=this.environment,{firstFactorVerification:s}=t,{externalAccount:a}=i.verifications,o={status:i.status,missingFields:i.missingFields,externalAccountStatus:a.status,externalAccountErrorCode:a.error?.code,externalAccountSessionId:a.error?.meta?.sessionId,sessionId:i.createdSessionId},l={status:t.status,firstFactorVerificationStatus:s.status,firstFactorVerificationErrorCode:s.error?.code,firstFactorVerificationSessionId:s.error?.meta?.sessionId,sessionId:t.createdSe
19ssionId},c=e=>()=>n(e),d=c(e.signInUrl||r.signInUrl),h=c(e.signUpUrl||r.signUpUrl),u=c(e.firstFactorUrl||eH({base:r.signInUrl,hashPath:"/factor-one"},{stringify:!0})),p=c(e.secondFactorUrl||eH({base:r.signInUrl,hashPath:"/factor-two"},{stringify:!0})),f=c(e.resetPasswordUrl||eH({base:r.signInUrl,hashPath:"/reset-password"},{stringify:!0})),m=new nD(this.#eT,e),_=c(e.continueSignUpUrl||eH({base:r.signUpUrl,hashPath:"/continue"},{stringify:!0})),g=({missingFields:t})=>t.length?_():(({signUp:e,verifyEmailPath:t,verifyPhonePath:i,continuePath:n,navigate:r,handleComplete:s,redirectUrl:a="",redirectUrlComplete:o="",oidcPrompt:l})=>{if("complete"===e.status)return s&&s();if("missing_requirements"===e.status){if(e.missingFields.some(e=>"saml"===e||"enterprise_sso"===e))return e.authenticateWithRedirect({strategy:"enterprise_sso",redirectUrl:a,redirectUrlComplete:o,continueSignUp:!0,oidcPrompt:l});let s=eR();if(e.unverifiedFields?.includes("email_address")&&t)return r(t,{searchParams:s});if(e.unverifiedFields?.includes("phone_number")&&i)return r(i,{searchParams:s});if(n)return r(n,{searchParams:s})}})({signUp:i,verifyEmailPath:e.verifyEmailAddressUrl||eH({base:r.signUpUrl,hashPath:"/verify-email-address"},{stringify:!0}),verifyPhonePath:e.verifyPhoneNumberUrl||eH({base:r.signUpUrl,hashPath:"/verify-phone-number"},{stringify:!0}),navigate:n}),y=e.signInUrl||r.signInUrl,b=e.signUpUrl||r.signUpUrl,w=async({session:e,baseUrl:t,redirectUrl:i})=>{if(!e.currentTask)return void await this.navigate(i);await rD(e,{baseUrl:t,navigate:this.navigate})};if("complete"===l.status)return this.setActive({session:l.sessionId,navigate:async({session:e})=>{await w({session:e,baseUrl:y,redirectUrl:m.getAfterSignInUrl()})}});if("transferable"===o.externalAccountStatus&&"external_account_exists"===o.externalAccountErrorCode){let e=await t.create({transfer:!0});switch(e.status){case"complete":return this.setActive({session:e.createdSessionId,navigate:async({session:e})=>{await w({session:e,baseUrl:b,redirectUrl:m.getAfterSignInUrl()})}});case"needs_first_factor":return u();case"needs_second_factor":return p();case"needs_new_password":return f();default:ty("sign in")}}let v="user_locked"===o.externalAccountErrorCode,k="user_locked"===l.firstFactorVerificationErrorCode;if(v)return h();if(k)return d();if("needs_first_factor"===l.status&&!t.supportedFirstFactors?.every(e=>"enterprise_sso"===e.strategy))return u();if("needs_new_password"===l.status)return f();if("transferable"===l.firstFactorVerificationStatus){if(!1===e.transferable)return d();let t=await i.create({transfer:!0,unsafeMetadata:e.unsafeMetadata});switch(t.status){case"complete":return this.setActive({session:t.createdSe
19ssionId,navigate:async({session:e})=>{await w({session:e,baseUrl:b,redirectUrl:m.getAfterSignUpUrl()})}});case"missing_requirements":return g({missingFields:t.missingFields});default:ty("sign in")}}if("complete"===o.status)return this.setActive({session:o.sessionId,navigate:async({session:e})=>{await w({session:e,baseUrl:b,redirectUrl:m.getAfterSignUpUrl()})}});if("needs_second_factor"===l.status)return p();let S=("failed"===o.externalAccountStatus||"unverified"===o.externalAccountStatus)&&"identifier_already_signed_in"===o.externalAccountErrorCode&&o.externalAccountSessionId,C="failed"===l.firstFactorVerificationStatus&&"identifier_already_signed_in"===l.firstFactorVerificationErrorCode&&l.firstFactorVerificationSessionId;if(S||C){let e=l.firstFactorVerificationSessionId||o.externalAccountSessionId;if(e)return this.setActive({session:e,navigate:async({session:e})=>{await w({session:e,baseUrl:S?b:y,redirectUrl:m.getAfterSignInUrl()})}})}return(e=>{let{externalAccount:t}=e.verifications;return!!t.error})(i)?h():"verified"===o.externalAccountStatus&&"missing_requirements"===o.status?g({missingFields:i.missingFields}):this.session?.currentTask?void await this.redirectToTasks({redirectUrl:this.buildAfterSignInUrl()}):d()};handleRedirectCallback=async(e={},t)=>{if(!this.loaded||!this.environment||!this.client)return;let{signIn:i,signUp:n}=this.client,r=e=>t&&"function"==typeof t?t(e):this.navigate(e);return this._handleRedirectCallback(e,{signUp:n,signIn:i,navigate:r})};handleUnauthenticated=async(e={broadcast:!0})=>{if(this.client&&this.session){eb.warn("handleUnauthenticated triggered",{activeSessionId:this.session.id,hasActor:!!this.session.actor,totalSessions:this.client.sessions?.length??0},"clerk");try{let t=await t4.getOrCreateInstance().fetch();if(this.updateClient(t),this.session)return;return e.broadcast&&iU.emit(iS,null),this.setActive({session:null})}catch(e){if(S(e)&&[403,500].includes(e.status))return this.setActive({session:null});throw e}}};authenticateWithGoogleOneTap=async e=>this.client?.signIn.create({strategy:"google_one_tap",token:e.token}).catch(t=>{if(S(t)&&"external_account_not_found"===t.errors[0].code)return this.client?.signUp.create({strategy:"google_one_tap",token:e.token,legalAccepted:e.legalAccepted});throw t});authenticateWithMetamask=async(e={})=>{await this.authenticateWithWeb3({...e,strategy:"web3_metamask_signature"})};authenticateWithCoinbaseWallet=async(e={})=>{await this.authenticateWithWeb3({...e,strategy:"web3_coinbase_wallet_signature"})};authenticateWithBase=async(e={})=>{await this.authenticateWithWeb3({...e,strategy:"web3_base_signature"})};authenticateWithOKXWallet=async(e={})=>{await this.authenticateWithWeb3({...e,strategy:"web3_okx_wallet_signature"})};authenticateWithSolana=async e=>{await this.authenticateWithWeb3({...e,strategy:"web3_solana_signature"})};authenticateWithWeb3=async({redirectUrl:e,signUpContinueUrl:t,customNavigate:i,unsafeMetadata:n,strategy:r,legalAccepted:s,secondFactorUrl:a,walletName:o})=>{let l,c;if(!this.client||!this.environment)return;let{displayConfig:d}=this.environment,h=r.replace("web3_","").replace("_signature",""),u=await e9({provider:h,walletName:o});switch(h){case"metamask":l=ts;break;case"base":l=tl;break;case"coinbase_wallet":l=ta;break;case"solana":if(!o)throw new I("Wallet name is required for Solana authentication.",{code:"web3_solana_wallet_name_required"});l=e=>tc({...e,walletName:o});break;default:l=to}let p=e=>()=>i&&"function"==typeof i?i(e):this.navigate(e),f=p(a||eH({base:d.signInUrl,hashPath:"/factor-two"},{stringify:!0})),m=p(t||eH({base:d.signUpUrl,hashPath:"/continue"},{stringify:!0}));try{c=await this.client.signIn.authenticateWithWeb3({identifier:u,generateSignature:l,strategy:r,walletName:o})}catch(e){if(eD(e,"form_identifier_not_found"))c=await this.client.signUp.authenticateWithWeb3({identifier:u,generateSignature:l,unsafeMetadata:n,strategy:r,legalAccepted:s,walletName:o}),t&&"missing_requirements"===c.status&&"verified"===c.verifications.web3Wallet.status&&await m();else throw e}let _=async({session:e,redirectUrl:t})=>{if(!e.currentTask)return void await this.navigate(t);
19await rD(e,{baseUrl:d.signInUrl,navigate:this.navigate})};switch(c.status){case"needs_second_factor":await f();break;case"complete":c.createdSessionId&&await this.setActive({session:c.createdSessionId,navigate:async({session:t})=>{await _({session:t,redirectUrl:e??this.buildAfterSignInUrl()})}});break;default:return}};createOrganization=async({name:e,slug:t})=>i0.create({name:e,slug:t});getOrganization=async e=>i0.get(e);joinWaitlist=async({emailAddress:e})=>nx.join({emailAddress:e});updateEnvironment(e){this.environment=e}__internal_setCountry=e=>{this.__internal_country||(this.__internal_country=e)};get __internal_last_error(){let e=this.internal_last_error;return this.internal_last_error=null,e}set __internal_last_error(e){this.internal_last_error=e}updateClient=e=>{if(!this.client){let t=this.#eT.selectInitialSession?this.#eT.selectInitialSession(e):this.#eV(e);this.#eM(t)}if(this.client=e,this.session){let e=this.#e$(this.session.id);"active"===this.session.status&&e?.status==="pending"&&("undefined"!=typeof window&&"function"==typeof window.__unstable__onAfterSetActive?window.__unstable__onAfterSetActive:eu.ZT)(),this.#eM(e),this.session?.lastActiveToken||d()||eb.warn("No last active token when updating client (offline)",{sessionId:this.session?.id},"clerk"),iU.emit(ik,{token:this.session?.lastActiveToken})}this.#ez()};get __unstable__environment(){return this.environment}__unstable__setEnvironment=async e=>{this.environment=new iT(e),su.mountComponentRenderer&&(this.#eS=su.mountComponentRenderer(this,this.environment,this.#eT))};__unstable__onBeforeRequest=e=>{this.#eC.onBeforeRequest(e)};__unstable__onAfterResponse=e=>{this.#eC.onAfterResponse(e)};__unstable__updateProps=e=>{let t={...e,options:this.#eR({...this.#eT,...e.options})};return this.#eS?.ensureMounted().then(e=>e.updateProps(t))};__internal_navigateWithError(e,t){return this.__internal_last_error=t,this.navigate(e)}#eq=()=>{let e=new URLSearchParams({[eI]:window.location.href});return eH({base:this.#eT.signInUrl,searchParams:e},{stringify:!0})};#eH=()=>{let e;if(this.proxyUrl){let t=new URL(this.proxyUrl);e=new URL(`${t.pathname}/v1/client/sync`,t.origin)}else this.domain&&(e=new URL("/v1/client/sync",`https://${this.domain}`));return e?.searchParams.append("redirect_url",window.location.href),e?.toString()||""};#eG=()=>"true"!==eE(eT)&&!!this.isSatellite&&!!this.#eb?.isSignedOut();#eZ=()=>"production"!==this.#eA&&!this.isSatellite&&!!eE(eI);#eY=async()=>{"development"===this.instanceType?await this.navigate(this.#eq()):"production"===this.instanceType&&await this.navigate(this.#eH())};#eQ=(e,t)=>{let i;try{i=new URL(e)}catch{throw Error(`${t_} The signInUrl needs to have a absolute url format.`)}i.origin===t&&function(){throw Error(`${t_} The signInUrl needs to be on a different origin than your satellite application.`)}()};#eX=()=>{this.isSatellite&&("development"!==this.#eA||this.#eT.signInUrl||function(){throw Error(`${t_} Missing signInUrl. A satellite application needs to specify the signInUrl for development instances.`)}(),this.proxyUrl||this.domain||function(){throw Error(`${t_} Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl.`)}(),this.#eT.signInUrl&&this.#eQ(this.#eT.signInUrl,window.location.origin))};#eN=async()=>{if(this.#eb=await n8.create(this,this.#eC,this.#eA,this.#ex),this.#eX(),this.#eG())return void await this.#eY();if(this.#eZ())return void await this.#eB();this.#eO=(()=>{if(!a())return{onPageFocus:eu.ZT};let e=[];return window.addEventListener("focus",()=>{"visible"===document.visibilityState&&e.forEach(e=>e())}),{onPageFocus:t=>{e.push(t)}}})(),"undefined"!=typeof BroadcastChannel&&(this.#ek=new BroadcastChannel("clerk")),this.#e0();let e=function(e=window.location.hostname){if(!e)return!1;let t=eV.get(e);void 0===t&&(t=R.some(t=>e.startsWith("accounts.")&&e.endsWith(t))||M.some(t=>e.endsWith(t)&&!e.endsWith(".clerk"+t)),eV.set(e,t));return t}(window?.location.hostname),t="development"===this.#eA&&!e,i=0,n=0;for(;n<2;){n++;try{let e=iT.getInstance().fetch({touch:t}).then(e=>this.updateEnvironment(e)).catch(()=>{++i;let e=tm.getItem(tu,null);e&&this.updateEnvironment(new iT(e))}),n=async()=>{let e=new AbortController;return(0,eu.AW)(t4.getOrCreateInstance().fetch({abortSignal:e.signal}),7e3,e).then(e=>this.updateClient(e)).catch(async e=>{if(E(e))throw e;++i,this.#eb?.stopPollingForToken();try{let e=this.#eV(rt(this.#eb?.getSessionCookie()));e?.clearCache();let t=e?await (0,eu.AW)(e.getToken(),7e3).catch(()=>(e.clearCache(),this.#eb?.getSessionCookie())):this.#eb?.getSessionCookie();this.updateClient(rt(t))}finally{this.#eb?.startPollingForToken()}return t4.getOrCreateInstance().fetch().then(e=>this.updateClient(e)).catch(eu.ZT),null})},r=()=>{su.mountComponentRenderer&&!this.#eS&&(this.#eS=su.mountComponentRenderer(this,this.environment,this.#eT))},[,s]=await (0,eu.Lu)([e,n()]);if("rejected"===s.status){let e=s.reason;if(eD(e,"requires_captcha"))r(),await n();else throw e}if(this.#eb?.setClientUatCookieForDevelopmentInstances(),await this.#e1())return;r();break}catch(e){if(eD(e,"dev_browser_unauthenticated"))await this.#eb.handleUnauthenticatedDevBrowser();else if(!d())return void console.warn(e);else throw e}n>=2&&function(){throw Error(`${t_} Something went wrong initializing Clerk.`)}()}this.#ev=new n9(this),this.#ev.start(),this.#e3(),this.#e2(),this.#e4(),this.#ex.emit(m,i>0?"degraded":"ready")};shouldFallbackToCachedResources=()=>!!this.__internal_getCachedResources;#eF=async()=>{let e,t,i=this.shouldFallbackToCachedResources()?1:void 0,n=0;try{[e,t]=await Promise.all([iT.getInstance().fetch({touch:!1,fetchMaxTries:i}
19),t4.getOrCreateInstance().fetch({fetchMaxTries:i})])}catch(i){if(P(i)&&"network_error"===i.code&&this.shouldFallbackToCachedResources()){let i=await this.__internal_getCachedResources?.();e=new iT(i?.environment),t4.clearInstance(),t=t4.getOrCreateInstance(i?.client),++n}else throw i}this.updateClient(t),this.updateEnvironment(e),su.mountComponentRenderer&&(this.#eS=su.mountComponentRenderer(this,this.environment,this.#eT)),this.#ex.emit(m,n>0?"degraded":"ready")};__internal_reloadInitialResources=async()=>{let[e,t]=await Promise.all([iT.getInstance().fetch({touch:!1,fetchMaxTries:1}),t4.getOrCreateInstance().fetch({fetchMaxTries:1})]);this.updateClient(t),this.updateEnvironment(e),this.#ez()};#eV=e=>{if(e.lastActiveSessionId){let t=e.signedInSessions.find(t=>t.id===e.lastActiveSessionId);if(t)return t}return e.signedInSessions[0]||null};#e0=()=>{a()&&(this.#eO?.onPageFocus(()=>{this.session&&!(!(this.environment&&!this.environment.authConfig.singleSessionMode)&&this.#eE>Date.now())&&(this.#eE=Date.now()+5e3,this.#eT.touchSession&&this.#eL(this.session,"focus"))}),this.#ek?.addEventListener("message",e=>{e.data?.type==="signout"&&this.handleUnauthenticated({broadcast:!1})}),iU.on(iS,()=>{this.#ek?.postMessage({type:"signout"})}),iU.on(iC,()=>{tm.setItem(tu,this.environment?.__internal_toSnapshot(),864e5)}))};#eL=async(e,t="focus")=>{if(!e)return Promise.resolve();await e.touch({intent:t}).catch(e=>{E(e)&&this.handleUnauthenticated()})};#ez=()=>{if(this.client)for(let e of this.#eI)e({client:this.client,session:this.session,user:this.user,organization:this.organization})};#ej=()=>{for(let e of this.#eP)e()};#eW=()=>{this.session=void 0,this.organization=void 0,this.user=void 0,this.#ez()};#e5=()=>(this.session?.user.organizationMemberships||[]).map(e=>e.organization).find(e=>e.id===this.session?.lastActiveOrganizationId)||null;#eM=e=>{this.session=e||null,this.organization=this.#e5(),this.user=this.session?this.session.user:null};#e$=e=>this.client?.signedInSessions.find(t=>t.id===e)||null;#e2=()=>{this.addListener(({session:e})=>{e?.actor&&this.#eS?.ensureMounted().then(e=>e.mountImpersonationFab())})};#e4=()=>{this.#eT.__internal_keyless_claimKeylessApplicationUrl&&this.#eS?.ensureMounted().then(e=>{e.updateProps({options:{__internal_keyless_claimKeylessApplicationUrl:this.#eT.__internal_keyless_claimKeylessApplicationUrl,__internal_keyless_copyInstanceKeysUrl:this.#eT.__internal_keyless_copyInstanceKeysUrl,__internal_keyless_dismissPrompt:this.#eT.__internal_keyless_dismissPrompt}})})};#eK=(e,t,i)=>{if(!e||!this.loaded||!this.environment||!this.environment.displayConfig)return"";let n=this.#eT[e]||this.environment.displayConfig[e];this.#eD()&&(n=this.#eT.signInUrl);let r=new nD(this.#eT,t).toSearchParams(),s=new URLSearchParams(i||{}),a=eH({base:n,hashPath:this.#eD()&&"signUpUrl"===e?"/create":"",hashSearchParams:[s,r]},{stringify:!0});return this.buildUrlWithAuth(a)};assertComponentsReady(e){if(!su.mountComponentRenderer)throw Error("ClerkJS was loaded without UI components.");if(!e)throw Error("ClerkJS components are not ready yet.")}#e1=async()=>{let e=new URLSearchParams(window.location.search).get("redirect_url"),t="production"===this.instanceType,i=null!==e&&function(e,t){let i=new URL(t,eJ),n=i.pathname,r=eX.includes(n)||e0.includes(n);return e===i.host&&r}(this.frontendApi,e);if(t||!i)return!1;let n=this.session,r=this.#eT.signInUrl||this.environment?.displayConfig.signInUrl,s=r&&window.location.href.startsWith(r),a=this.#eT.signUpUrl||this.environment?.displayConfig.signUpUrl,o=a&&window.location.href.startsWith(a);return(!function(e){let t=new URL(e,eJ);return eX.includes(t.pathname)}(e)||!!n||!s&&!o)&&(await this.navigate(this.buildUrlWithAuth(e)),!0)};#eR=e=>{let t=e?{...e}:{};return t.appearance&&(t.appearance=function(e){let t;if(!e||"object"!=typeof e)return e;let i=void 0!==e.theme?e.theme:e.baseTheme,n=void 0!==e.theme;if(!i)return e;if(Array.isArray(i)){i.forEach(e=>{!t&&"object"==typeof e&&e.cssLayerName&&(t=e.cssLayerName)});let r=i.map(e=>{if("string"==typeof e)return e;let{cssLayerName:t,...i}=e;return i}),s=e.cssLayerName||t,a={...e,[n?"theme":"baseTheme"]:r};return s&&(a.cssLayerName=s),a}{let t;"object"==typeof i&&i.cssLayerName&&(t=i.cssLayerName);let r="string"==typeof i?i:(()=>{let{cssLayerName:e,...t}=i;return t})(),s=e.cssLayerName||t,a={...e,[n?"theme":"baseTheme"]:r};return s&&(a.cssLayerName=s),a}}
vendor: 6,538 bytes, line 19
19(t.appearance)),{...sh,...t,allowedRedirectOrigins:function(e,t,i){if(Array.isArray(e)&&e.length)return e;let n=[];return"undefined"!=typeof window&&window.location&&n.push(window.location.origin),n.push(`https://${eq(t)}`),n.push(`https://*.${eq(t)}`),"development"===i&&n.push(`https://${t}`),n}(e?.allowedRedirectOrigins,this.frontendApi,this.instanceType)}};#e3=()=>{try{ex(eT),ex(B),ex(eP),ex("__clerk_handshake"),ex("__clerk_handshake_nonce"),ex("__clerk_help")}catch{}};get #eJ(){let e=ev;return this.#eT.allowedRedirectProtocols&&(e=e.concat(this.#eT.allowedRedirectProtocols)),e}}e=i.hmd(e);let sp=document.querySelector("script[data-clerk-publishable-key]")?.getAttribute("data-clerk-publishable-key")||window.__clerk_publishable_key||"",sf=document.querySelector("script[data-clerk-proxy-url]")?.getAttribute("data-clerk-proxy-url")||window.__clerk_proxy_url||"",sm=document.querySelector("script[data-clerk-domain]")?.getAttribute("data-clerk-domain")||window.__clerk_domain||"";window.Clerk||(window.Clerk=new su(sp,{proxyUrl:sf,domain:sm})),e.hot&&e.hot.accept()},2788:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,o)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){var l=[s,o];if(i)throw TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&l[0]?n.return:l[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,l[1])).done)return r;switch(n=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){a.label=l[1];break}if(6===l[0]&&a.label<r[1]){a.label=r[1],r=l;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(l);break}r[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{i=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}},s=this;Object.defineProperty(t,"__esModule",{value:!0});var a=i(6119),o="browser-tabs-lock-key",l={key:function(e){return n(s,void 0,void 0,function(){return r(this,function(e){throw Error("Unsupported")})})},getItem:function(e){return n(s,void 0,void 0,function(){return r(this,function(e){throw Error("Unsupported")})})},clear:function(){return n(s,void 0,void 0,function(){return r(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return n(s,void 0,void 0,function(){return r(this,function(e){throw Error("Unsupported")})})},setItem:function(e,t){return n(s,void 0,void 0,function(){return r(this,function(e){throw Error("Unsupported")})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function c(e){return new Promise(function(t){return setTimeout(t,e)})}function d(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",i="",n=0;n<e;n++){var r=Math.floor(Math.random()*t.length);i+=t[r]}return i}t.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+d(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,i){return void 0===i&&(i=5e3),n(this,void 0,void 0,function(){var n,s,a,h,u,p,f;return r(this,function(r){switch(r.label){case 0:n=Date.now()+d(4),s=Date.now()+i,a=o+"-"+t,h=void 0===this.storageHandler?l:this.storageHandler,r.label=1;case 1:if(!(Date.now()<s))return[3,8];return[4,c(30)];case 2:if(r.sent(),null!==h.getItemSync(a))return[3,5];return u=this.id+"-"+t+"-"+n,[4,c(Math.floor(25*Math.random()))];case 3:return r.sent(),h.setItemSync(a,JSON.stringify({id:this.id,iat:n,timeoutKey:u,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:if(r.sent(),null!==(p=h.getItemSync(a))&&(f=JSON.parse(p)).id===this.id&&f.iat===n)return this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(a,n),[2,!0];return[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?l:this.storageHandler),[4,this.waitForSomethingToChange(s)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+d(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return n(this,void 0,void 0,function(){var i=this;return r(this,function(s){return setTimeout(function(){return n(i,void 0,void 0,function(){var i,n,s;return r(this,function(r){switch(r.label){case 0:return[4,a.default().lock(t)];case 1:if(r.sent(),!this.acquiredIatSet.has(t)||null===(n=(i=void 0===this.storageHandler?l:this.storageHandler).getItemSync(e)))return a.default().unlock(t),[2];return(s=JSON.parse(n)).timeRefreshed=Date.now(),i.setItemSync(e,JSON.stringify(s)),a.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2]}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return n(this,void 0,void 0,function(){return r(this,function(i){switch(i.label){case 0:return[4,new Promise(function(i){var n=!1,r=Date.now(),s=!1;function a(){if(s||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(o),s=!0),!n){n=!0;var t=50-(Date.now()-r);t>0?setTimeout(i,t):i(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var o=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return i.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEac
19h(function(e){return e()})},e.prototype.releaseLock=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return n(this,void 0,void 0,function(){var i,n,s,c;return r(this,function(r){switch(r.label){case 0:if(i=void 0===this.storageHandler?l:this.storageHandler,n=o+"-"+t,null===(s=i.getItemSync(n)))return[2];if((c=JSON.parse(s)).id!==this.id)return[3,2];return[4,a.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),i.removeItemSync(n),a.default().unlock(c.iat),e.notifyWaiters(),r.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var i=Date.now()-5e3,n=[],r=0;;){var s=t.keySync(r);if(null===s)break;n.push(s),r++}for(var a=!1,l=0;l<n.length;l++){var c=n[l];if(c.includes(o)){var d=t.getItemSync(c);if(null!==d){var h=JSON.parse(d);(void 0===h.timeRefreshed&&h.timeAcquired<i||void 0!==h.timeRefreshed&&h.timeRefreshed<i)&&(t.removeItemSync(c),a=!0)}}}a&&e.notifyWaiters()},e.waiters=void 0,e}()},6119:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,i){var n=e.locked.get(t);void 0===n?void 0===i?e.locked.set(t,[]):e.locked.set(t,[i]):void 0!==i&&(n.unshift(i),e.locked.set(t,n))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(i,n){e.isLocked(t)?e.addToLocked(t,i):(e.addToLocked(t),i())})},this.unlock=function(t){var i=e.locked.get(t);if(void 0===i||0===i.length)return void e.locked.delete(t);var n=i.pop();e.locked.set(t,i),void 0!==n&&setTimeout(n,0)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();t.default=function(){return i.getInstance()}},4763:function(e){e.exports=function(e,t){if("string"!=typeof e)throw TypeError("Expected a string");for(var i,n=String(e),r="",s=!!t&&!!t.extended,a=!!t&&!!t.globstar,o=!1,l=t&&"string"==typeof t.flags?t.flags:"",c=0,d=n.length;c<d;c++)switch(i=n[c]){case"/":case"$":case"^":case"+":case".":case"(":case")":case"=":case"!":case"|":r+="\\"+i;break;case"?":if(s){r+=".";break}case"[":case"]":if(s){r+=i;break}case"{":if(s){o=!0,r+="(";break}case"}":if(s){o=!1,r+=")";break}case",":if(o){r+="|";break}r+="\\"+i;break;case"*":for(var h=n[c-1],u=1;"*"===n[c+1];)u++,c++;var p=n[c+1];a?u>1&&("/"===h||void 0===h)&&("/"===p||void 0===p)?(r+="((?:[^/]*(?:/|$))*)",c++):r+="([^/]*)":r+=".*";break;default:r+=i}return l&&~l.indexOf("g")||(r="^"+r+"$"),new RegExp(r,l)}},4096:function(e){var t=function(e){"use strict";var t,i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(e,t,i){e[t]=i.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,i){return e[t]=i}}function d(e,i,n,s){var a,o,l,c,d=Object.create((i&&i.prototype instanceof _?i:_).prototype);return r(d,"_invoke",{value:(a=e,o=n,l=new I(s||[]),c=u,function(e,i){if(c===p)throw Error("Generator is already running");if(c===f){if("throw"===e)throw i;return{value:t,done:!0}}for(l.method=e,l.arg=i;;){var n=l.delegate;if(n){var r=function e(i,n){var r=n.method,s=i.iterator[r];if(t===s)return(n.delegate=null,"throw"===r&&i.iterator.return&&(n.method="return",n.arg=t,e(i,n),"throw"===n.method))?m:("return"!==r&&(n.method="throw",n.arg=TypeError("The iterator does not provide a '"+r+"' method")),m);var a=h(s,i.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,m;var o=a.arg;return o?o.done?(n[i.resultName]=o.value,n.next=i.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):o:(n.method="throw",n.arg=TypeError("iterator result is not an object"),n.delegate=null,m)}(n,l);if(r){if(r===m)continue;return r}}if("next"===l.method)l.sent=l._sent=l.arg;else if("throw"===l.method){if(c===u)throw c=f,l.arg;l.dispatchException(l.arg)}else"return"===l.method&&l.abrupt("return",l.arg);c=p;var s=h(a,o,l);if("normal"===s.type){if(c=l.done?f:"suspendedYield",s.arg===m)continue;return{value:s.arg,done:l.done}}"throw"===s.type&&(c=f,l.method="throw",l.arg=s.arg)}})}),d}function h(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var u="suspendedStart",p="executing",f="completed",m={};function _(){}function g(){}function y(){}var b={};c(b,a,function(){return this});var w=Object.getPrototypeOf,v=w&&w(w(P([])));v&&v!==i&&n.call(v,a)&&(b=v);var k=y.prototype=_.prototype=Object.create(b);function S(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function C(e,t){var i;r(this,"_invoke",{value:function(r,s){function a(){return new t(function(i,a){!function i(r,s,a,o){var l=h(e[r],e,s);if("throw"===l.type)o(l.arg);else{var c=l.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then(function(e){i("next",e,a,o)},function(e){i("throw",e,a,o)}):t.resolve(d).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,o)})}}(r,s,i,a)})}return i=i?i.then(a,a):a()}})}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function U(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function P(e){if(null!=e){var i=e[a];if(i)return i.call(e);
19if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw TypeError(typeof e+" is not iterable")}return g.prototype=y,r(k,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:g,configurable:!0}),g.displayName=c(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},S(C.prototype),c(C.prototype,o,function(){return this}),e.AsyncIterator=C,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var a=new C(d(t,i,n,r),s);return e.isGeneratorFunction(i)?a:a.next().then(function(e){return e.done?e.value:a.next()})},S(k),c(k,l,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),i=[];for(var n in t)i.push(n);return i.reverse(),function e(){for(;i.length;){var n=i.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=P,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return o.type="throw",o.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);else if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else if(c){if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else throw Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return(a.type=e,a.arg=t,s)?(this.method="next",this.next=s.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),U(i),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var r=n.arg;U(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:P(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},5851:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(...e)=>{}},2823:function(e,t,i){"use strict";function n(e,t,i){return"function"==typeof e?e(t):void 0!==e?e:void 0!==i?i:void 0}i.d(t,{ZT:()=>r.Z,Lu:()=>s,YZ:()=>n,AW:()=>a});var r=i(5851);function s(e){return Promise.all(Array.from(e).map(e=>e.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}function a(e,t,i){let n,r=new Promise((e,r)=>{n=setTimeout(()=>{let e=Error(`Timed out after ${t}ms`);i?.abort(),r(e)},t),n.unref?.()});return Promise.race([Promise.resolve(e),r]).finally(()=>{clearTimeout(n)})}}},t={};function i(n){var r=t[n];
19if(void 0!==r)return r.exports;var s=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}return i.m=e,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;i.t=function(n,r){if(1&r&&(n=this(n)),8&r||"object"==typeof n&&n&&(4&r&&n.__esModule||16&r&&"function"==typeof n.then))return n;var s=Object.create(null);i.r(s);var a={};e=e||[null,t({}),t([]),t(t)];for(var o=2&r&&n;"object"==typeof o&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(e=>{a[e]=()=>n[e]});return a.default=()=>n,i.d(s,a),s}})(),i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),i.u=e=>""+(({192:"vendors",199:"cookieSuffix",298:"query-core-vendors",325:"zxcvbn-common",514:"base-account-sdk",708:"zxcvbn-ts-core",832:"stripe-vendors",956:"coinbase-wallet-sdk"})[e]||e)+"_clerk.headless.browser_"+i.h().slice(0,6)+"_5.128.0.js",i.h=()=>"b916325c7aebc699",i.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={},t="@clerk/clerk-js:";i.l=function(n,r,s,a){if(e[n])return void e[n].push(r);if(void 0!==s)for(var o,l,c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var h=c[d];if(h.getAttribute("src")==n||h.getAttribute("data-webpack")==t+s){o=h;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,i.nc&&o.setAttribute("nonce",i.nc),o.setAttribute("data-webpack",t+s),o.src=n),e[n]=[r];var u=function(t,i){o.onerror=o.onload=null,clearTimeout(p);var r=e[n];if(delete e[n],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(i)}),t)return t(i)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),l&&document.head.appendChild(o)}})(),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{i.g.importScripts&&(e=i.g.location+"");var e,t=i.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw Error("Automatic publicPath is not supported in this browser");i.p=e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")})(),(()=>{var e={567:0};i.f.j=function(t,n){var r=i.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var s=new Promise((i,n)=>r=e[t]=[i,n]);n.push(r[2]=s);var a=i.p+i.u(t),o=Error();i.l(a,function(n){if(i.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+s+": "+a+")",o.name="ChunkLoadError",o.type=s,o.request=a,r[1](o)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,s,[a,o,l]=n,c=0;if(a.some(t=>0!==e[t])){for(r in o)i.o(o,r)&&(i.m[r]=o[r]);l&&l(i)}for(t&&t(n);c<a.length;c++)s=a[c],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0},n=globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),i(5056)})());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.