module.exports=[76304,a=>{"use strict";function b(a){return function(b){let c=b??this;if(!c)throw TypeError(`${a.kind||a.name} type guard requires an error object`);return!!a.kind&&"object"==typeof c&&null!==c&&"constructor"in c&&c.constructor?.kind===a.kind||c instanceof a}}var c=class a extends Error{static kind="ClerkError";clerkError=!0;code;longMessage;docsUrl;cause;get name(){return this.constructor.name}constructor(b){super(new.target.formatMessage(new.target.kind,b.message,b.code,b.docsUrl),{cause:b.cause}),Object.setPrototypeOf(this,a.prototype),this.code=b.code,this.docsUrl=b.docsUrl,this.longMessage=b.longMessage,this.cause=b.cause}toString(){return`[${this.name}]
Message:${this.message}`}static formatMessage(a,b,c,d){let e="Clerk:",f=RegExp(e.replace(" ","\\s*"),"i");return b=b.replace(f,""),b=`${e} ${b.trim()}

(code="${c}")

`,d&&(b+=`

Docs: ${d}`),b}},d=class a extends c{static kind="ClerkRuntimeError";clerkRuntimeError=!0;constructor(b,c){super({...c,message:b}),Object.setPrototypeOf(this,a.prototype)}};let e=b(d);a.s(["a",0,b,"i",0,function(a){return b(c)(a)||!!a&&"object"==typeof a&&"clerkError"in a&&!0===a.clerkError},"n",0,e,"r",0,c,"t",0,d])},76816,22555,55759,3891,29400,76909,43979,74011,5556,59241,a=>{"use strict";var b=a.i(59134);let c=new Set;a.s(["deprecated",0,(a,d,e)=>{let f=(0,b.r)()||(0,b.n)(),g=e??a;c.has(g)||f||(c.add(g),console.warn(`Clerk - DEPRECATION WARNING: "${a}" is deprecated and will be removed in the next major release.
${d}`))}],76816);let d=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"];a.s(["a",0,"https://api.lclclerk.com","c",0,"https://api.clerk.com","d",0,[".accountsstage.dev"],"i",0,[".lcl.dev",".lclstage.dev",".lclclerk.com"],"o",0,[".lcl.dev","lclstage.dev",".lclclerk.com",".accounts.lclclerk.com"],"r",0,d,"t",0,[".accounts.dev",".accountsstage.dev",".accounts.lclclerk.com"],"u",0,"https://api.clerkstage.dev"],22555);let e=a=>"u">typeof atob&&"function"==typeof atob?atob(a):void 0!==globalThis.Buffer?globalThis.Buffer.from(a,"base64").toString():a;a.s(["t",0,e],55759);let f="pk_live_";function g(a){if(!a.endsWith("$"))return!1;let b=a.slice(0,-1);return!b.includes("$")&&b.includes(".")}function h(a,b={}){let c;if(!(a=a||"")||!i(a)){if(b.fatal&&!a)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(b.fatal&&!i(a))throw Error("Publishable key not valid.");return null}let d=a.startsWith(f)?"production":"development";try{c=e(a.split("_")[2])}catch{if(b.fatal)throw Error("Publishable key not valid: Failed to decode key.");return null}if(!g(c)){if(b.fatal)throw Error("Publishable key not valid: Decoded key has invalid format.");return null}let j=c.slice(0,-1);return b.proxyUrl?j=b.proxyUrl:"development"!==d&&b.domain&&b.isSatellite&&(j=`clerk.${b.domain}`),{instanceType:d,frontendApi:j}}function i(a=""){try{if(!(a.startsWith(f)||a.startsWith("pk_test_")))return!1;let b=a.split("_");if(3!==b.length)return!1;let c=b[2];if(!c)return!1;return g(e(c))}catch{return!1}}function j(a){return a.startsWith("test_")||a.startsWith("sk_test_")}async function k(a,b=globalThis.crypto.subtle){var c;let d=new TextEncoder().encode(a);return(c=String.fromCharCode(...new Uint8Array(await b.digest("sha-1",d))),"u">typeof btoa&&"function"==typeof btoa?btoa(c):void 0!==globalThis.Buffer?globalThis.Buffer.from(c).toString("base64"):c).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}let l=(a,b)=>`${a}_${b}`;a.s(["i",0,l,"n",0,function(){let a=new Map;return{isDevOrStagingUrl:b=>{if(!b)return!1;let c="string"==typeof b?b:b.hostname,e=a.get(c);return void 0===e&&(e=d.some(a=>c.endsWith(a)),a.set(c,e)),e}}},"o",0,j,"r",0,k,"u",0,h],3891),a.s(["getCookieSuffix",0,k],29400),a.s(["getSuffixedCookieName",0,l],76909),a.s(["isDevelopmentFromSecretKey",0,j],43979),a.s(["parsePublishableKey",0,h],74011);let m={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(a,b)=>b<5,retryImmediately:!1,jitter:!0},n=async a=>new Promise(b=>setTimeout(b,a)),o=(a,b)=>b?a*(1+Math.random()):a,p=async(a,b={})=>{var c;let d,e=0,{shouldRetry:f,initialDelay:g,maxDelayBetweenRetries:h,factor:i,retryImmediately:j,jitter:k,onBeforeRetry:l}={...m,...b},p=(c={initialDelay:g,maxDelayBetweenRetries:h,factor:i,jitter:k},d=0,async()=>{let a;await n((a=o(a=c.initialDelay*Math.pow(c.factor,d),c.jitter),Math.min(c.maxDelayBetweenRetries||a,a))),d++});for(;;)try{return await a()}catch(a){if(!f(a,++e))throw a;l&&await l(e),j&&1===e?await n(o(100,k)):await p()}};a.s(["t",0,p],5556),a.s(["retry",0,p],59241)},25427,54753,46882,a=>{"use strict";var b=a.i(76304),c=class{static kind="ClerkAPIError";code;message;longMessage;meta;constructor(a){const b={code:a.code,message:a.message,longMessage:a.long_message,meta:{paramName:a.meta?.param_name,sessionId:a.meta?.session_id,emailAddresses:a.meta?.email_addresses,identifiers:a.meta?.identifiers,zxcvbn:a.meta?.zxcvbn,plan:a.meta?.plan,isPlanUpgradePossible:a.meta?.is_plan_upgrade_possible}};this.code=b.code,this.message=b.message,this.longMessage=b.longMessage,this.meta=b.meta}};let d=(0,b.a)(c);var e=class a extends b.r{static kind="ClerkAPIResponseError";status;clerkTraceId;retryAfter;errors;constructor(b,d){const{data:e,status:f,clerkTraceId:g,retryAfter:h}=d;super({...d,message:b,code:"api_response_error"}),Object.setPrototypeOf(this,a.prototype),this.status=f,this.clerkTraceId=g,this.retryAfter=h,this.errors=(e||[]).map(a=>new c(a))}toString(){let a=`[${this.name}]
Message:${this.message}
Status:${this.status}
Serialized errors: ${this.errors.map(a=>JSON.stringify(a))}`;return this.clerkTraceId&&(a+=`
Clerk Trace ID: ${this.clerkTraceId}`),a}static formatMessage(a,b,c,d){return b}};let f=(0,b.a)(e);var g=class a extends e{static kind="MissingExpiredTokenError";static ERROR_CODE="missing_expired_token";static STATUS=422;static is(b){return f(b)&&b.status===a.STATUS&&b.errors.length>0&&b.errors[0].code===a.ERROR_CODE}},h=class a extends b.t{static kind="ClerkOfflineError";static ERROR_CODE="clerk_offline";constructor(b){super(b,{code:a.ERROR_CODE}),Object.setPrototypeOf(this,a.prototype)}static is(c){return null!=c&&(c instanceof a||(0,b.n)(c)&&c.code===a.ERROR_CODE)}};let i=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. 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"});function j({packageName:a,customMessages:b}){let c=a;function d(a,b){if(!b)return`${c}: ${a}`;let d=a;for(let c of a.matchAll(/{{([a-zA-Z0-9-_]+)}}/g)){let a=(b[c[1]]||"").toString();d=d.replace(`{{${c[1]}}}`,a)}return`${c}: ${d}`}let e={...i,...b};return{setPackageName({packageName:a}){return"string"==typeof a&&(c=a),this},setMessages({customMessages:a}){return Object.assign(e,a||{}),this},throwInvalidPublishableKeyError(a){throw Error(d(e.InvalidPublishableKeyErrorMessage,a))},throwInvalidProxyUrl(a){throw Error(d(e.InvalidProxyUrlErrorMessage,a))},throwMissingPublishableKeyError(){throw Error(d(e.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw Error(d(e.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(a){throw Error(d(e.MissingClerkProvider,a))},throw(a){throw Error(d(a))}}}var k=class a extends Error{code;constructor(b){super(b),this.code=b,this.name="EmailLinkError",Object.setPrototypeOf(this,a.prototype)}},l=class extends b.t{code;constructor(a,{code:b}){super(a,{code:b}),this.code=b}};function m(a){return"code"in a&&[4001,32602,32603].includes(a.code)&&"message"in a}a.s(["C",0,f,"D",0,c,"E",0,function(a=[]){return a.length>0?a.map(a=>new c(a)):[]},"O",0,d,"S",0,e,"T",0,function(a){return new c(a)},"_",0,{Expired:"expired",Failed:"failed",ClientMismatch:"client_mismatch"},"a",0,function(a){return"EmailLinkError"===a.name},"b",0,h,"c",0,function(a){return(`${a.message}${a.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")},"d",0,function(a){return(0,b.n)(a)&&"reverification_cancelled"===a.code},"f",0,function(a){let b=a?.status;return 401===b||422===b},"g",0,k,"h",0,l,"i",0,function(a){return["captcha_invalid","captcha_not_enabled","captcha_missing_token"].includes(a.errors[0].code)},"l",0,function(a){return f(a)&&a.errors?.[0]?.code==="form_password_compromised"},"m",0,function(a){return f(a)&&a.errors?.[0]?.code==="user_locked"},"n",0,function(a){return a?.status===429},"o",0,function(a){return f(a)||m(a)||(0,b.n)(a)},"p",0,function(a){let b=a?.status;return a?.errors?.[0]?.code==="authentication_invalid"&&401===b},"r",0,function(a){let b=a?.status;return!!b&&b>=400&&b<500},"s",0,m,"t",0,function(a){for(let[c,d]of Object.entries({isClerkAPIResponseError:f,isClerkRuntimeError:b.n}))Object.assign(a,{[c]:d});return a},"u",0,function(a){return f(a)&&a.errors?.[0]?.code==="form_password_pwned"},"v",0,{Expired:"expired",Failed:"failed",ClientMismatch:"client_mismatch"},"w",0,function(a){return{code:a?.code||"",message:a?.message||"",long_message:a?.longMessage,meta:{param_name:a?.meta?.paramName,session_id:a?.meta?.sessionId,email_addresses:a?.meta?.emailAddresses,identifiers:a?.meta?.identifiers,zxcvbn:a?.meta?.zxcvbn,plan:a?.meta?.plan,is_plan_upgrade_possible:a?.meta?.isPlanUpgradePossible}}},"x",0,g,"y",0,j],54753),a.s([],25427),a.s(["buildErrorThrower",0,j],46882)},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},47072,79378,61675,11910,26725,73030,89044,a=>{"use strict";let b,c,d,e;var f,g,h,i,j=a.i(76816),k=a.i(29400),l=a.i(76909),m=a.i(43979),n=a.i(74011),o=a.i(59241);a.i(25427);var p=a.i(46882),q=a.i(3891),q=q,r=(0,p.buildErrorThrower)({packageName:"@clerk/backend"}),{isDevOrStagingUrl:s}=(0,q.n)();a.s(["errorThrower",0,r],79378);var t=a.i(76304),t=t,u={InvalidSecretKey:"clerk_key_invalid"},v={TokenExpired:"token-expired",TokenInvalid:"token-invalid",TokenInvalidAlgorithm:"token-invalid-algorithm",TokenInvalidAuthorizedParties:"token-invalid-authorized-parties",TokenInvalidSignature:"token-invalid-signature",TokenNotActiveYet:"token-not-active-yet",TokenIatInTheFuture:"token-iat-in-the-future",TokenVerificationFailed:"token-verification-failed",InvalidSecretKey:"secret-key-invalid",LocalJWKMissing:"jwk-local-missing",RemoteJWKFailedToLoad:"jwk-remote-failed-to-load",RemoteJWKInvalid:"jwk-remote-invalid",RemoteJWKMissing:"jwk-remote-missing",JWKFailedToResolve:"jwk-failed-to-resolve",JWKKidMismatch:"jwk-kid-mismatch"},w={ContactSupport:"Contact support@clerk.com",EnsureClerkJWT:"Make sure that this is a valid Clerk-generated JWT.",SetClerkJWTKey:"Set the CLERK_JWT_KEY environment variable.",SetClerkSecretKey:"Set the CLERK_SECRET_KEY environment variable.",EnsureClockSync:"Make sure your system clock is in sync (e.g. turn off and on automatic time synchronization)."},x=class a extends Error{constructor({action:b,message:c,reason:d}){super(c),Object.setPrototypeOf(this,a.prototype),this.reason=d,this.message=c,this.action=b}getFullMessage(){return`${[this.message,this.action].filter(a=>a).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`}},y={TokenInvalid:"token-invalid",InvalidSecretKey:"secret-key-invalid",UnexpectedError:"unexpected-error",TokenVerificationFailed:"token-verification-failed"},z=class a extends t.r{constructor({message:b,code:c,status:d,action:e}){super({message:b,code:c}),Object.setPrototypeOf(this,a.prototype),this.status=d,this.action=e}static formatMessage(a,b,c,d){return b}getFullMessage(){return`${this.message} (code=${this.code}, status=${this.status||"n/a"})`}};z.kind="MachineTokenVerificationError",a.s(["MachineTokenVerificationError",0,z,"MachineTokenVerificationErrorCode",0,y,"SignJWTError",0,class extends Error{},"TokenVerificationError",0,x,"TokenVerificationErrorAction",0,w,"TokenVerificationErrorCode",0,u,"TokenVerificationErrorReason",0,v],61675);var A=a.i(66680),B=a.i(55759),B=B,C=fetch.bind(globalThis),D={crypto:A.webcrypto,get fetch(){return C},AbortController:globalThis.AbortController,Blob:globalThis.Blob,FormData:globalThis.FormData,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response},E={parse:(a,b)=>(function(a,b,c={}){if(!b.codes){b.codes={};for(let a=0;a<b.chars.length;++a)b.codes[b.chars[a]]=a}if(!c.loose&&a.length*b.bits&7)throw SyntaxError("Invalid padding");let d=a.length;for(;"="===a[d-1];)if(--d,!c.loose&&!((a.length-d)*b.bits&7))throw SyntaxError("Invalid padding");let e=new(c.out??Uint8Array)(d*b.bits/8|0),f=0,g=0,h=0;for(let c=0;c<d;++c){let d=b.codes[a[c]];if(void 0===d)throw SyntaxError("Invalid character "+a[c]);g=g<<b.bits|d,(f+=b.bits)>=8&&(f-=8,e[h++]=255&g>>f)}if(f>=b.bits||255&g<<8-f)throw SyntaxError("Unexpected end of data");return e})(a,F,b),stringify:(a,b)=>(function(a,b,c={}){let{pad:d=!0}=c,e=(1<<b.bits)-1,f="",g=0,h=0;for(let c=0;c<a.length;++c)for(h=h<<8|255&a[c],g+=8;g>b.bits;)g-=b.bits,f+=b.chars[e&h>>g];if(g&&(f+=b.chars[e&h<<b.bits-g]),d)for(;f.length*b.bits&7;)f+="=";return f})(a,F,b)},F={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},G={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},H="RSASSA-PKCS1-v1_5",I={RS256:H,RS384:H,RS512:H},J=Object.keys(G);function K(a){let b=G[a],c=I[a];if(!b||!c)throw Error(`Unsupported algorithm ${a}, expected one of ${J.join(",")}.`);return{hash:{name:G[a]},name:I[a]}}var L=(a,b="JWT")=>{if(void 0===a)return;let c=Array.isArray(b)?b:[b];if(!c.includes(a))throw new x({action:w.EnsureClerkJWT,reason:v.TokenInvalid,message:`Invalid JWT type ${JSON.stringify(a)}. Expected "${c.join(", ")}".`})},M=a=>{if(!J.includes(a))throw new x({action:w.EnsureClerkJWT,reason:v.TokenInvalidAlgorithm,message:`Invalid JWT algorithm ${JSON.stringify(a)}. Supported: ${J}.`})};function N(a,b,c){if("object"==typeof a)return D.crypto.subtle.importKey("jwk",a,b,!1,[c]);let d=function(a){let b=a.replace(/-----BEGIN.*?-----/g,"").replace(/-----END.*?-----/g,"").replace(/\s/g,""),c=(0,B.t)(b),d=new Uint8Array(new ArrayBuffer(c.length));for(let a=0,b=c.length;a<b;a++)d[a]=c.charCodeAt(a);return d}(a),e="sign"===c?"pkcs8":"spki";return D.crypto.subtle.importKey(e,d,b,!1,[c])}async function O(a,b){let{header:c,signature:d,raw:e}=a,f=new TextEncoder().encode([e.header,e.payload].join(".")),g=K(c.alg);try{let a=await N(b,g,"verify");return{data:await D.crypto.subtle.verify(g.name,a,d,f)}}catch(a){return{errors:[new x({reason:v.TokenInvalidSignature,message:a?.message})]}}}function P(a){let b=(a||"").toString().split(".");if(3!==b.length)return{errors:[new x({reason:v.TokenInvalid,message:"Invalid JWT form. A JWT consists of three parts separated by dots."})]};let[c,d,e]=b,f=new TextDecoder,g=JSON.parse(f.decode(E.parse(c,{loose:!0}))),h=JSON.parse(f.decode(E.parse(d,{loose:!0})));return{data:{header:g,payload:h,signature:E.parse(e,{loose:!0}),raw:{header:c,payload:d,signature:e,text:a}}}}async function Q(a,b){let{audience:c,authorizedParties:d,clockSkewInMs:e,key:f,headerType:g}=b,h=e||5e3,{data:i,errors:j}=P(a);if(j)return{errors:j};let{header:k,payload:l}=i;try{let{typ:a,alg:b}=k;L(a,g),M(b);let{azp:e,sub:f,aud:i,iat:j,exp:m,nbf:n}=l;if("string"!=typeof f)throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Subject claim (sub) is required and must be a string. Received ${JSON.stringify(f)}.`});((a,b)=>{let c=[b].flat().filter(a=>!!a),d=[a].flat().filter(a=>!!a);if(c.length>0&&d.length>0){if("string"==typeof a){if(!c.includes(a))throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Invalid JWT audience claim (aud) ${JSON.stringify(a)}. Is not included in "${JSON.stringify(c)}".`})}else if(Array.isArray(a)&&a.length>0&&a.every(a=>"string"==typeof a)&&!a.some(a=>c.includes(a)))throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Invalid JWT audience claim array (aud) ${JSON.stringify(a)}. Is not included in "${JSON.stringify(c)}".`})}})([i],[c]);if(e&&d&&0!==d.length&&!d.includes(e))throw new x({reason:v.TokenInvalidAuthorizedParties,message:`Invalid JWT Authorized party claim (azp) ${JSON.stringify(e)}. Expected "${d}".`});if("number"!=typeof m)throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Invalid JWT expiry date claim (exp) ${JSON.stringify(m)}. Expected number.`});let o=new Date(Date.now()),p=new Date(0);if(p.setUTCSeconds(m),p.getTime()<=o.getTime()-h)throw new x({reason:v.TokenExpired,message:`JWT is expired. Expiry date: ${p.toUTCString()}, Current date: ${o.toUTCString()}.`});((a,b)=>{if(void 0===a)return;if("number"!=typeof a)throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Invalid JWT not before date claim (nbf) ${JSON.stringify(a)}. Expected number.`});let c=new Date(Date.now()),d=new Date(0);if(d.setUTCSeconds(a),d.getTime()>c.getTime()+b)throw new x({reason:v.TokenNotActiveYet,message:`JWT cannot be used prior to not before date claim (nbf). Not before date: ${d.toUTCString()}; Current date: ${c.toUTCString()};`})})(n,h),((a,b)=>{if(void 0===a)return;if("number"!=typeof a)throw new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Invalid JWT issued at date claim (iat) ${JSON.stringify(a)}. Expected number.`});let c=new Date(Date.now()),d=new Date(0);if(d.setUTCSeconds(a),d.getTime()>c.getTime()+b)throw new x({reason:v.TokenIatInTheFuture,message:`JWT issued at date claim (iat) is in the future. Issued at date: ${d.toUTCString()}; Current date: ${c.toUTCString()};`})})(j,h)}catch(a){return{errors:[a]}}let{data:m,errors:n}=await O(i,f);return n?{errors:[new x({action:w.EnsureClerkJWT,reason:v.TokenVerificationFailed,message:`Error verifying JWT signature. ${n[0]}`})]}:m?{data:l}:{errors:[new x({reason:v.TokenInvalidSignature,message:"JWT signature is invalid."})]}}a.s(["assertHeaderAlgorithm",0,M,"assertHeaderType",0,L,"base64url",0,E,"decodeJwt",0,P,"getCryptoAlgorithm",0,K,"hasValidSignature",0,O,"importKey",0,N,"runtime",0,D,"verifyJwt",0,Q],11910);var R=Object.create,S=Object.defineProperty,T=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,V=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty,X=a=>{throw TypeError(a)},Y=(a,b,c)=>b.has(a)||X("Cannot "+c),Z=(a,b,c)=>b.has(a)?X("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),$=(a,b,c)=>(Y(a,b,"access private method"),c);function _(a){return a?`https://${a.replace(/clerk\.accountsstage\./,"accountsstage.").replace(/clerk\.accounts\.|clerk\./,"accounts.")}`:""}var aa=a.i(22555);function ab(a){return aa.i.some(b=>a.startsWith("accounts.")&&a.endsWith(b))}function ac(a){return aa.t.some(b=>a.endsWith(b)&&!a.endsWith(".clerk"+b))}a.s(["c",0,ac,"l",0,ab,"t",0,function(a){let b;if(!a)return"";if(a.match(/^(clerk\.)+\w*$/))b=/(clerk\.)*(?=clerk\.)/;else{if(a.match(/\.clerk.accounts/))return a;b=/^(clerk\.)*/gi}return`clerk.${a.replace(b,"")}`}],26725);let ad={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"}},ae=new Set(["first_factor","second_factor","multi_factor"]),af=new Set(["strict_mfa","strict","moderate","lax"]),ag=new Set(["o","org","organization"]),ah=new Set(["u","user"]),ai=(a,b)=>{let{org:c,user:d}=aj(a),[e,f]=b.split(":"),g=void 0!==f,h=f||e;if(g&&!ag.has(e)&&!ah.has(e))throw Error(`Invalid scope: ${e}`);if(g){if(ag.has(e))return c.includes(h);if(ah.has(e))return d.includes(h)}return[...c,...d].includes(h)},aj=a=>{let b=[],c=[];if(!a)return{org:b,user:c};let d=a.split(",");for(let a=0;a<d.length;a++){let e=d[a].trim(),f=e.indexOf(":");if(-1===f)throw Error(`Invalid claim element (missing colon): ${e}`);let g=e.slice(0,f),h=e.slice(f+1);"o"===g?b.push(h):"u"===g?c.push(h):("ou"===g||"uo"===g)&&(b.push(h),c.push(h))}return{org:b,user:c}};var ak=a.i(54753),ak=ak,al=ak,am=ak;function an(a){return a.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function ao(a){return a&&a.sensitive?"":"i"}let ap=a=>({clerk_error:{type:"forbidden",reason:"reverification-error",metadata:{reverification:a}}});a.s(["reverificationError",0,ap],73030),a.s(["reverificationErrorResponse",0,(...a)=>new Response(JSON.stringify(ap(...a)),{status:403})],89044);var aq=(b={"../../node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(a){let b;Object.defineProperty(a,"__esModule",{value:!0}),a.parse=function(a,b){let c=new h,d=a.length;if(d<2)return c;let e=b?.decode||k,f=0;do{let b=a.indexOf("=",f);if(-1===b)break;let g=a.indexOf(";",f),h=-1===g?d:g;if(b>h){f=a.lastIndexOf(";",b-1)+1;continue}let k=i(a,f,b),l=j(a,b,k),m=a.slice(k,l);if(void 0===c[m]){let d=i(a,b+1,h),f=j(a,h,d),g=e(a.slice(d,f));c[m]=g}f=h+1}while(f<d)return c},a.serialize=function(a,b,h){let i=h?.encode||encodeURIComponent;if(!c.test(a))throw TypeError(`argument name is invalid: ${a}`);let j=i(b);if(!d.test(j))throw TypeError(`argument val is invalid: ${b}`);let k=a+"="+j;if(!h)return k;if(void 0!==h.maxAge){if(!Number.isInteger(h.maxAge))throw TypeError(`option maxAge is invalid: ${h.maxAge}`);k+="; Max-Age="+h.maxAge}if(h.domain){if(!e.test(h.domain))throw TypeError(`option domain is invalid: ${h.domain}`);k+="; Domain="+h.domain}if(h.path){if(!f.test(h.path))throw TypeError(`option path is invalid: ${h.path}`);k+="; Path="+h.path}if(h.expires){var l;if(l=h.expires,"[object Date]"!==g.call(l)||!Number.isFinite(h.expires.valueOf()))throw TypeError(`option expires is invalid: ${h.expires}`);k+="; Expires="+h.expires.toUTCString()}if(h.httpOnly&&(k+="; HttpOnly"),h.secure&&(k+="; Secure"),h.partitioned&&(k+="; Partitioned"),h.priority)switch("string"==typeof h.priority?h.priority.toLowerCase():void 0){case"low":k+="; Priority=Low";break;case"medium":k+="; Priority=Medium";break;case"high":k+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${h.priority}`)}if(h.sameSite)switch("string"==typeof h.sameSite?h.sameSite.toLowerCase():h.sameSite){case!0:case"strict":k+="; SameSite=Strict";break;case"lax":k+="; SameSite=Lax";break;case"none":k+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${h.sameSite}`)}return k};var c=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,d=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,f=/^[\u0020-\u003A\u003D-\u007E]*$/,g=Object.prototype.toString,h=((b=function(){}).prototype=Object.create(null),b);function i(a,b,c){do{let c=a.charCodeAt(b);if(32!==c&&9!==c)return b}while(++b<c)return c}function j(a,b,c){for(;b>c;){let c=a.charCodeAt(--b);if(32!==c&&9!==c)return b+1}return c}function k(a){if(-1===a.indexOf("%"))return a;try{return decodeURIComponent(a)}catch(b){return a}}}},function(){return c||(0,b[U(b)[0]])((c={exports:{}}).exports,c),c.exports}),ar="https://api.clerk.com",as="@clerk/backend@3.2.1",at="2025-11-10",au={Session:"__session",Refresh:"__refresh",ClientUat:"__client_uat",Handshake:"__clerk_handshake",DevBrowser:"__clerk_db_jwt",RedirectCount:"__clerk_redirect_count",HandshakeNonce:"__clerk_handshake_nonce"},av={ClerkSynced:"__clerk_synced",SuffixedCookies:"suffixed_cookies",ClerkRedirectUrl:"__clerk_redirect_url",DevBrowser:au.DevBrowser,Handshake:au.Handshake,HandshakeHelp:"__clerk_help",LegacyDevBrowser:"__dev_session",HandshakeReason:"__clerk_hs_reason",HandshakeNonce:au.HandshakeNonce,HandshakeFormat:"format",Session:"__session"},aw={NeedsSync:"false",Completed:"true"},ax={Attributes:{AuthToken:"__clerkAuthToken",AuthSignature:"__clerkAuthSignature",AuthStatus:"__clerkAuthStatus",AuthReason:"__clerkAuthReason",AuthMessage:"__clerkAuthMessage",ClerkUrl:"__clerkUrl"},Cookies:au,Headers:{Accept:"accept",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",AuthReason:"x-clerk-auth-reason",AuthSignature:"x-clerk-auth-signature",AuthStatus:"x-clerk-auth-status",AuthToken:"x-clerk-auth-token",CacheControl:"cache-control",ClerkRedirectTo:"x-clerk-redirect-to",ClerkRequestData:"x-clerk-request-data",ClerkUrl:"x-clerk-clerk-url",CloudFrontForwardedProto:"cloudfront-forwarded-proto",ContentType:"content-type",ContentSecurityPolicy:"content-security-policy",ContentSecurityPolicyReportOnly:"content-security-policy-report-only",EnableDebug:"x-clerk-debug",ForwardedHost:"x-forwarded-host",ForwardedPort:"x-forwarded-port",ForwardedProto:"x-forwarded-proto",Host:"host",Location:"location",Nonce:"x-nonce",Origin:"origin",Referrer:"referer",SecFetchDest:"sec-fetch-dest",SecFetchSite:"sec-fetch-site",UserAgent:"user-agent",ReportingEndpoints:"reporting-endpoints"},ContentTypes:{Json:"application/json"},QueryParameters:av,ClerkSyncStatus:aw},ay=(a,b,c,d,e)=>{if(""===a)return az(b.toString(),c?.toString());let f=new URL(a),g=c?new URL(c,f):void 0,h=new URL(b,f),i=`${f.hostname}:${f.port}`!=`${h.hostname}:${h.port}`;return g&&(i&&e&&g.searchParams.set(ax.QueryParameters.ClerkSynced,aw.NeedsSync),h.searchParams.set("redirect_url",g.toString())),i&&d&&h.searchParams.set(ax.QueryParameters.DevBrowser,d),h.toString()},az=(a,b)=>{let c;if(a.startsWith("http"))c=new URL(a);else{if(!b||!b.startsWith("http"))throw Error("destination url or return back url should be an absolute path url!");let d=new URL(b);c=new URL(a,d.origin)}return b&&c.searchParams.set("redirect_url",b),c.toString()};function aA(a,b){return Object.keys(a).reduce((a,c)=>({...a,[c]:b[c]||a[c]}),{...a})}function aB(a){if(!a||"string"!=typeof a)throw Error("Missing Clerk Secret Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var aC={SessionToken:"session_token",ApiKey:"api_key",M2MToken:"m2m_token",OAuthToken:"oauth_token"},aD=class{constructor(a,b,c){this.cookieSuffix=a,this.clerkRequest=b,this.originalFrontendApi="",c.acceptsToken===aC.M2MToken||c.acceptsToken===aC.ApiKey?this.initHeaderValues():(this.initPublishableKeyValues(c),this.initHeaderValues(),this.initCookieValues(),this.initHandshakeValues()),Object.assign(this,c),this.clerkUrl=this.clerkRequest.clerkUrl,this.proxyUrl?.startsWith("/")&&(this.proxyUrl=`${this.clerkUrl.origin}${this.proxyUrl}`)}get sessionToken(){return this.sessionTokenInCookie||this.tokenInHeader}usesSuffixedCookies(){let a=this.getSuffixedCookie(ax.Cookies.ClientUat),b=this.getCookie(ax.Cookies.ClientUat),c=this.getSuffixedCookie(ax.Cookies.Session)||"",d=this.getCookie(ax.Cookies.Session)||"";if(d&&!this.tokenHasIssuer(d))return!1;if(d&&!this.tokenBelongsToInstance(d))return!0;if(!a&&!c)return!1;let{data:e}=P(d),f=e?.payload.iat||0,{data:g}=P(c),h=g?.payload.iat||0;if("0"!==a&&"0"!==b&&f>h||"0"===a&&"0"!==b)return!1;if("production"!==this.instanceType){let c=this.sessionExpired(g);if("0"!==a&&"0"===b&&c)return!1}return!!a||!c}isCrossOriginReferrer(){if(!this.referrer||!this.clerkUrl.origin)return!1;try{return new URL(this.referrer).origin!==this.clerkUrl.origin}catch{return!1}}isKnownClerkReferrer(){if(!this.referrer)return!1;try{let a=new URL(this.referrer),b=a.hostname;if(this.frontendApi){let a=this.frontendApi.startsWith("http")?new URL(this.frontendApi).hostname:this.frontendApi;if(b===a)return!0}if(ab(b)||ac(b))return!0;let c=_(this.frontendApi);if(c){let b=new URL(c).origin;if(a.origin===b)return!0}if(b.startsWith("accounts."))return!0;return!1}catch{return!1}}initPublishableKeyValues(a){var b;b=a.publishableKey,(0,n.parsePublishableKey)(b,{fatal:!0}),this.publishableKey=a.publishableKey;let c=a.proxyUrl;c?.startsWith("/")&&(c=`${this.clerkRequest.clerkUrl.origin}${c}`);let d=(0,n.parsePublishableKey)(this.publishableKey,{fatal:!0,domain:a.domain,isSatellite:a.isSatellite});this.originalFrontendApi=d.frontendApi;let e=(0,n.parsePublishableKey)(this.publishableKey,{fatal:!0,proxyUrl:c,domain:a.domain,isSatellite:a.isSatellite});this.instanceType=e.instanceType,this.frontendApi=e.frontendApi}initHeaderValues(){this.tokenInHeader=this.parseAuthorizationHeader(this.getHeader(ax.Headers.Authorization)),this.origin=this.getHeader(ax.Headers.Origin),this.host=this.getHeader(ax.Headers.Host),this.forwardedHost=this.getHeader(ax.Headers.ForwardedHost),this.forwardedProto=this.getHeader(ax.Headers.CloudFrontForwardedProto)||this.getHeader(ax.Headers.ForwardedProto),this.referrer=this.getHeader(ax.Headers.Referrer),this.userAgent=this.getHeader(ax.Headers.UserAgent),this.secFetchDest=this.getHeader(ax.Headers.SecFetchDest),this.accept=this.getHeader(ax.Headers.Accept)}initCookieValues(){this.sessionTokenInCookie=this.getSuffixedOrUnSuffixedCookie(ax.Cookies.Session),this.refreshTokenInCookie=this.getSuffixedCookie(ax.Cookies.Refresh),this.clientUat=Number.parseInt(this.getSuffixedOrUnSuffixedCookie(ax.Cookies.ClientUat)||"")||0}initHandshakeValues(){this.devBrowserToken=this.getQueryParam(ax.QueryParameters.DevBrowser)||this.getSuffixedOrUnSuffixedCookie(ax.Cookies.DevBrowser),this.handshakeToken=this.getQueryParam(ax.QueryParameters.Handshake)||this.getCookie(ax.Cookies.Handshake),this.handshakeRedirectLoopCounter=Number(this.getCookie(ax.Cookies.RedirectCount))||0,this.handshakeNonce=this.getQueryParam(ax.QueryParameters.HandshakeNonce)||this.getCookie(ax.Cookies.HandshakeNonce)}getQueryParam(a){return this.clerkRequest.clerkUrl.searchParams.get(a)}getHeader(a){return this.clerkRequest.headers.get(a)||void 0}getCookie(a){return this.clerkRequest.cookies.get(a)||void 0}getSuffixedCookie(a){return this.getCookie((0,l.getSuffixedCookieName)(a,this.cookieSuffix))||void 0}getSuffixedOrUnSuffixedCookie(a){return this.usesSuffixedCookies()?this.getSuffixedCookie(a):this.getCookie(a)}parseAuthorizationHeader(a){if(!a)return;let[b,c]=a.split(" ",2);return c?"Bearer"===b?c:void 0:b}tokenHasIssuer(a){let{data:b,errors:c}=P(a);return!c&&!!b.payload.iss}tokenBelongsToInstance(a){if(!a)return!1;let{data:b,errors:c}=P(a);if(c)return!1;let d=b.payload.iss.replace(/https?:\/\//gi,"");return this.originalFrontendApi===d}sessionExpired(a){return!!a&&a?.payload.exp<=(Date.now()/1e3|0)}},aE=async(a,b)=>new aD(b.publishableKey?await (0,k.getCookieSuffix)(b.publishableKey,D.crypto.subtle):"",a,b),aF=RegExp("(?<!:)/{1,}","g");function aG(...a){return a.filter(a=>a).join("/").replace(aF,"/")}var aH=class{constructor(a){this.request=a}requireId(a){if(!a)throw Error("A valid resource ID is required.")}},aI="/actor_tokens",aJ=class extends aH{async create(a){return this.request({method:"POST",path:aI,bodyParams:a})}async revoke(a){return this.requireId(a),this.request({method:"POST",path:aG(aI,a,"revoke")})}},aK="/agents/tasks",aL=class extends aH{async create(a){return this.request({method:"POST",path:aK,bodyParams:a,options:{deepSnakecaseBodyParamKeys:!0}})}async revoke(a){return this.requireId(a),this.request({method:"POST",path:aG(aK,a,"revoke")})}},aM="/accountless_applications",aN=class extends aH{async createAccountlessApplication(a){let b=a?.requestHeaders?Object.fromEntries(a.requestHeaders.entries()):void 0;return this.request({method:"POST",path:aM,headerParams:b})}async completeAccountlessApplicationOnboarding(a){let b=a?.requestHeaders?Object.fromEntries(a.requestHeaders.entries()):void 0;return this.request({method:"POST",path:aG(aM,"complete"),headerParams:b})}},aO="/allowlist_identifiers",aP=class extends aH{async getAllowlistIdentifierList(a={}){return this.request({method:"GET",path:aO,queryParams:{...a,paginated:!0}})}async createAllowlistIdentifier(a){return this.request({method:"POST",path:aO,bodyParams:a})}async deleteAllowlistIdentifier(a){return this.requireId(a),this.request({method:"DELETE",path:aG(aO,a)})}},aQ="/api_keys",aR=class extends aH{async list(a){return this.request({method:"GET",path:aQ,queryParams:a})}async create(a){return this.request({method:"POST",path:aQ,bodyParams:a})}async get(a){return this.requireId(a),this.request({method:"GET",path:aG(aQ,a)})}async update(a){let{apiKeyId:b,...c}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(aQ,b),bodyParams:c})}async delete(a){return this.requireId(a),this.request({method:"DELETE",path:aG(aQ,a)})}async revoke(a){let{apiKeyId:b,revocationReason:c=null}=a;return this.requireId(b),this.request({method:"POST",path:aG(aQ,b,"revoke"),bodyParams:{revocationReason:c}})}async getSecret(a){return this.requireId(a),this.request({method:"GET",path:aG(aQ,a,"secret")})}async verify(a){return this.request({method:"POST",path:aG(aQ,"verify"),bodyParams:{secret:a}})}},aS=class extends aH{async changeDomain(a){return this.request({method:"POST",path:aG("/beta_features","change_domain"),bodyParams:a})}},aT="/blocklist_identifiers",aU=class extends aH{async getBlocklistIdentifierList(a={}){return this.request({method:"GET",path:aT,queryParams:a})}async createBlocklistIdentifier(a){return this.request({method:"POST",path:aT,bodyParams:a})}async deleteBlocklistIdentifier(a){return this.requireId(a),this.request({method:"DELETE",path:aG(aT,a)})}},aV="/clients",aW=class extends aH{async getClientList(a={}){return this.request({method:"GET",path:aV,queryParams:{...a,paginated:!0}})}async getClient(a){return this.requireId(a),this.request({method:"GET",path:aG(aV,a)})}verifyClient(a){return this.request({method:"POST",path:aG(aV,"verify"),bodyParams:{token:a}})}async getHandshakePayload(a){return this.request({method:"GET",path:aG(aV,"handshake_payload"),queryParams:a})}},aX="/domains",aY=class extends aH{async list(){return this.request({method:"GET",path:aX})}async add(a){return this.request({method:"POST",path:aX,bodyParams:a})}async update(a){let{domainId:b,...c}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(aX,b),bodyParams:c})}async delete(a){return this.deleteDomain(a)}async deleteDomain(a){return this.requireId(a),this.request({method:"DELETE",path:aG(aX,a)})}},aZ="/email_addresses",a$=class extends aH{async getEmailAddress(a){return this.requireId(a),this.request({method:"GET",path:aG(aZ,a)})}async createEmailAddress(a){return this.request({method:"POST",path:aZ,bodyParams:a})}async updateEmailAddress(a,b={}){return this.requireId(a),this.request({method:"PATCH",path:aG(aZ,a),bodyParams:b})}async deleteEmailAddress(a){return this.requireId(a),this.request({method:"DELETE",path:aG(aZ,a)})}},a_="/enterprise_connections",a0=class extends aH{async createEnterpriseConnection(a){return this.request({method:"POST",path:a_,bodyParams:a,options:{deepSnakecaseBodyParamKeys:!0}})}async updateEnterpriseConnection(a,b){return this.requireId(a),this.request({method:"PATCH",path:aG(a_,a),bodyParams:b,options:{deepSnakecaseBodyParamKeys:!0}})}async getEnterpriseConnectionList(a={}){return this.request({method:"GET",path:a_,queryParams:a})}async getEnterpriseConnection(a){return this.requireId(a),this.request({method:"GET",path:aG(a_,a)})}async deleteEnterpriseConnection(a){return this.requireId(a),this.request({method:"DELETE",path:aG(a_,a)})}},a1=class extends aH{async verify(a){return this.request({method:"POST",path:aG("/oauth_applications/access_tokens","verify"),bodyParams:{access_token:a}})}},a2="/instance",a3=class extends aH{async get(){return this.request({method:"GET",path:a2})}async update(a){return this.request({method:"PATCH",path:a2,bodyParams:a})}async updateRestrictions(a){return this.request({method:"PATCH",path:aG(a2,"restrictions"),bodyParams:a})}async updateOrganizationSettings(a){return this.request({method:"PATCH",path:aG(a2,"organization_settings"),bodyParams:a})}},a4="/invitations",a5=class extends aH{async getInvitationList(a={}){return this.request({method:"GET",path:a4,queryParams:{...a,paginated:!0}})}async createInvitation(a){return this.request({method:"POST",path:a4,bodyParams:a})}async createInvitationBulk(a){return this.request({method:"POST",path:aG(a4,"bulk"),bodyParams:a})}async revokeInvitation(a){return this.requireId(a),this.request({method:"POST",path:aG(a4,a,"revoke")})}},a6="/machines",a7=class extends aH{async get(a){return this.requireId(a),this.request({method:"GET",path:aG(a6,a)})}async list(a={}){return this.request({method:"GET",path:a6,queryParams:a})}async create(a){return this.request({method:"POST",path:a6,bodyParams:a})}async update(a){let{machineId:b,...c}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(a6,b),bodyParams:c})}async delete(a){return this.requireId(a),this.request({method:"DELETE",path:aG(a6,a)})}async getSecretKey(a){return this.requireId(a),this.request({method:"GET",path:aG(a6,a,"secret_key")})}async rotateSecretKey(a){let{machineId:b,previousTokenTtl:c}=a;return this.requireId(b),this.request({method:"POST",path:aG(a6,b,"secret_key","rotate"),bodyParams:{previousTokenTtl:c}})}async createScope(a,b){return this.requireId(a),this.request({method:"POST",path:aG(a6,a,"scopes"),bodyParams:{toMachineId:b}})}async deleteScope(a,b){return this.requireId(a),this.request({method:"DELETE",path:aG(a6,a,"scopes",b)})}},a8=class a{constructor(a,b,c,d,e,f,g,h,i,j,k){this.id=a,this.clientId=b,this.type=c,this.subject=d,this.scopes=e,this.revoked=f,this.revocationReason=g,this.expired=h,this.expiration=i,this.createdAt=j,this.updatedAt=k}static fromJSON(b){return new a(b.id,b.client_id,b.type,b.subject,b.scopes,b.revoked,b.revocation_reason,b.expired,b.expiration,b.created_at,b.updated_at)}static fromJwtPayload(b,c=5e3){return new a(b.jti??"",b.client_id??"","oauth_token",b.sub,b.scp??b.scope?.split(" ")??[],!1,null,1e3*b.exp<=Date.now()-c,b.exp,b.iat,b.iat)}},a9=class a{constructor(a,b,c,d,e,f,g,h,i,j,k){this.id=a,this.subject=b,this.scopes=c,this.claims=d,this.revoked=e,this.revocationReason=f,this.expired=g,this.expiration=h,this.createdAt=i,this.updatedAt=j,this.token=k}static fromJSON(b){return new a(b.id,b.subject,b.scopes,b.claims,b.revoked,b.revocation_reason,b.expired,b.expiration,b.created_at,b.updated_at,b.token)}static fromJwtPayload(b,c=5e3){return new a(b.jti??"",b.sub,b.scopes?.split(" ")??b.aud??[],null,!1,null,1e3*b.exp<=Date.now()-c,1e3*b.exp,1e3*b.iat,1e3*b.iat)}},ba={},bb=0;function bc(a,b,c=!0){ba[a]=b,bb=c?Date.now():-1}function bd(a){let{kid:b,pem:c}=a,d=`local-${b}`,e=ba[d];if(e)return e;if(!c)throw new x({action:w.SetClerkJWTKey,message:"Missing local JWK.",reason:v.LocalJWKMissing});let f={kid:d,kty:"RSA",alg:"RS256",n:c.replace(/\r\n|\n|\r/g,"").replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").replace("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA","").replace("IDAQAB","").replace(/\+/g,"-").replace(/\//g,"_"),e:"AQAB"};return bc(d,f,!1),f}async function be(a){let{secretKey:b,apiUrl:c=ar,apiVersion:d="v1",kid:e,skipJwksCache:f}=a;if(f||function(){if(-1===bb)return!1;let a=Date.now()-bb>=3e5;return a&&(ba={}),a}()||!ba[e]){if(!b)throw new x({action:w.ContactSupport,message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:v.RemoteJWKFailedToLoad});let{keys:a}=await (0,o.retry)(()=>bf(c,b,d));if(!a||!a.length)throw new x({action:w.ContactSupport,message:"The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.",reason:v.RemoteJWKFailedToLoad});a.forEach(a=>bc(a.kid,a))}let g=ba[e];if(!g){let a=Object.values(ba).map(a=>a.kid).sort().join(", ");throw new x({action:`Go to your Dashboard and validate your secret and public keys are correct. ${w.ContactSupport} if the issue persists.`,message:`Unable to find a signing key in JWKS that matches the kid='${e}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid is available: ${a}`,reason:v.JWKKidMismatch})}return g}async function bf(a,b,c){if(!b)throw new x({action:w.SetClerkSecretKey,message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:v.RemoteJWKFailedToLoad});let d=new URL(a);d.pathname=aG(d.pathname,c,"/jwks");let e=await D.fetch(d.href,{headers:{Authorization:`Bearer ${b}`,"Clerk-API-Version":at,"Content-Type":"application/json","User-Agent":as}});if(!e.ok){let a=await e.json(),b=bg(a?.errors,u.InvalidSecretKey);if(b){let a=v.InvalidSecretKey;throw new x({action:w.ContactSupport,message:b.message,reason:a})}throw new x({action:w.ContactSupport,message:`Error loading Clerk JWKS from ${d.href} with code=${e.status}`,reason:v.RemoteJWKFailedToLoad})}return e.json()}var bg=(a,b)=>a?a.find(a=>a.code===b):null,bh="mch_",bi="oat_",bj=["mt_",bi,"ak_"],bk=/^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/;function bl(a){return bk.test(a)}var bm=["at+jwt","application/at+jwt"];function bn(a){if(!bl(a))return!1;try{let{data:b,errors:c}=P(a);return!c&&!!b&&bm.includes(b.header.typ)}catch{return!1}}function bo(a){if(!bl(a))return!1;try{let{data:b,errors:c}=P(a);return!c&&!!b&&"string"==typeof b.payload.sub&&b.payload.sub.startsWith(bh)}catch{return!1}}function bp(a){return bj.some(b=>a.startsWith(b))}function bq(a){return bp(a)||bn(a)||bo(a)}function br(a){if(a.startsWith("mt_")||bo(a))return aC.M2MToken;if(a.startsWith(bi)||bn(a))return aC.OAuthToken;if(a.startsWith("ak_"))return aC.ApiKey;throw Error("Unknown machine token type")}var bs=(a,b)=>!!a&&("any"===b||(Array.isArray(b)?b:[b]).includes(a)),bt=new Set([aC.ApiKey,aC.M2MToken,aC.OAuthToken]);async function bu(a,b,c,d){try{let e;if(c.jwtKey)e=bd({kid:b,pem:c.jwtKey});else{if(!c.secretKey)return{error:new z({action:w.SetClerkJWTKey,message:"Failed to resolve JWK during verification.",code:y.TokenVerificationFailed})};e=await be({...c,kid:b})}let{data:f,errors:g}=await Q(a,{...c,key:e,...d?{headerType:d}:{}});if(g)return{error:new z({code:y.TokenVerificationFailed,message:g[0].message})};return{payload:f}}catch(a){return{error:new z({code:y.TokenVerificationFailed,message:a.message})}}}async function bv(a,b,c){let d=await bu(a,b.header.kid,c);return"error"in d?{data:void 0,tokenType:aC.M2MToken,errors:[d.error]}:{data:a9.fromJwtPayload(d.payload,c.clockSkewInMs),tokenType:aC.M2MToken,errors:void 0}}async function bw(a,b,c){let d=await bu(a,b.header.kid,c,bm);return"error"in d?{data:void 0,tokenType:aC.OAuthToken,errors:[d.error]}:{data:a8.fromJwtPayload(d.payload,c.clockSkewInMs),tokenType:aC.OAuthToken,errors:void 0}}var bx="/m2m_tokens",by=class extends aH{constructor(a,b={}){super(a),Z(this,g),Z(this,f),((a,b,c)=>(Y(a,b,"write to private field"),b.set(a,c)))(this,f,b)}async list(a){let{machineSecretKey:b,...c}=a,d=$(this,g,h).call(this,{method:"GET",path:bx,queryParams:c},b);return this.request(d)}async createToken(a){let{claims:b=null,machineSecretKey:c,secondsUntilExpiration:d=null,tokenFormat:e="opaque"}=a||{},f=$(this,g,h).call(this,{method:"POST",path:bx,bodyParams:{secondsUntilExpiration:d,claims:b,tokenFormat:e}},c);return this.request(f)}async revokeToken(a){let{m2mTokenId:b,revocationReason:c=null,machineSecretKey:d}=a;this.requireId(b);let e=$(this,g,h).call(this,{method:"POST",path:aG(bx,b,"revoke"),bodyParams:{revocationReason:c}},d);return this.request(e)}async verify(a){let{token:b,machineSecretKey:c}=a;if(bo(b))return $(this,g,i).call(this,b);let d=$(this,g,h).call(this,{method:"POST",path:aG(bx,"verify"),bodyParams:{token:b}},c);return this.request(d)}};f=new WeakMap,g=new WeakSet,h=function(a,b){return b?{...a,headerParams:{...a.headerParams,Authorization:`Bearer ${b}`}}:a},i=async function(a){let b,c;try{let{data:c,errors:d}=P(a);if(d)throw d[0];b=c}catch(a){throw new z({code:y.TokenInvalid,message:a.message})}let d=await bv(a,b,(Y(this,c=f,"read from private field"),c.get(this)));if(d.errors)throw d.errors[0];return d.data};var bz=class extends aH{async getJwks(){return this.request({method:"GET",path:"/jwks"})}},bA="/jwt_templates",bB=class extends aH{async list(a={}){return this.request({method:"GET",path:bA,queryParams:{...a,paginated:!0}})}async get(a){return this.requireId(a),this.request({method:"GET",path:aG(bA,a)})}async create(a){return this.request({method:"POST",path:bA,bodyParams:a})}async update(a){let{templateId:b,...c}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(bA,b),bodyParams:c})}async delete(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bA,a)})}},bC="/organizations",bD=class extends aH{async getOrganizationList(a){return this.request({method:"GET",path:bC,queryParams:a})}async createOrganization(a){return this.request({method:"POST",path:bC,bodyParams:a})}async getOrganization(a){let{includeMembersCount:b}=a,c="organizationId"in a?a.organizationId:a.slug;return this.requireId(c),this.request({method:"GET",path:aG(bC,c),queryParams:{includeMembersCount:b}})}async updateOrganization(a,b){return this.requireId(a),this.request({method:"PATCH",path:aG(bC,a),bodyParams:b})}async updateOrganizationLogo(a,b){this.requireId(a);let c=new D.FormData;return c.append("file",b?.file),b?.uploaderUserId&&c.append("uploader_user_id",b?.uploaderUserId),this.request({method:"PUT",path:aG(bC,a,"logo"),formData:c})}async deleteOrganizationLogo(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bC,a,"logo")})}async updateOrganizationMetadata(a,b){return this.requireId(a),this.request({method:"PATCH",path:aG(bC,a,"metadata"),bodyParams:b})}async deleteOrganization(a){return this.request({method:"DELETE",path:aG(bC,a)})}async getOrganizationMembershipList(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"GET",path:aG(bC,b,"memberships"),queryParams:c})}async getInstanceOrganizationMembershipList(a){return this.request({method:"GET",path:"/organization_memberships",queryParams:a})}async createOrganizationMembership(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"POST",path:aG(bC,b,"memberships"),bodyParams:c})}async updateOrganizationMembership(a){let{organizationId:b,userId:c,...d}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(bC,b,"memberships",c),bodyParams:d})}async updateOrganizationMembershipMetadata(a){let{organizationId:b,userId:c,...d}=a;return this.request({method:"PATCH",path:aG(bC,b,"memberships",c,"metadata"),bodyParams:d})}async deleteOrganizationMembership(a){let{organizationId:b,userId:c}=a;return this.requireId(b),this.request({method:"DELETE",path:aG(bC,b,"memberships",c)})}async getOrganizationInvitationList(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"GET",path:aG(bC,b,"invitations"),queryParams:c})}async createOrganizationInvitation(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"POST",path:aG(bC,b,"invitations"),bodyParams:c})}async createOrganizationInvitationBulk(a,b){return this.requireId(a),this.request({method:"POST",path:aG(bC,a,"invitations","bulk"),bodyParams:b})}async getOrganizationInvitation(a){let{organizationId:b,invitationId:c}=a;return this.requireId(b),this.requireId(c),this.request({method:"GET",path:aG(bC,b,"invitations",c)})}async revokeOrganizationInvitation(a){let{organizationId:b,invitationId:c,...d}=a;return this.requireId(b),this.request({method:"POST",path:aG(bC,b,"invitations",c,"revoke"),bodyParams:d})}async getOrganizationDomainList(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"GET",path:aG(bC,b,"domains"),queryParams:c})}async createOrganizationDomain(a){let{organizationId:b,...c}=a;return this.requireId(b),this.request({method:"POST",path:aG(bC,b,"domains"),bodyParams:{...c,verified:c.verified??!0}})}async updateOrganizationDomain(a){let{organizationId:b,domainId:c,...d}=a;return this.requireId(b),this.requireId(c),this.request({method:"PATCH",path:aG(bC,b,"domains",c),bodyParams:d})}async deleteOrganizationDomain(a){let{organizationId:b,domainId:c}=a;return this.requireId(b),this.requireId(c),this.request({method:"DELETE",path:aG(bC,b,"domains",c)})}},bE="/oauth_applications",bF=class extends aH{async list(a={}){return this.request({method:"GET",path:bE,queryParams:a})}async get(a){return this.requireId(a),this.request({method:"GET",path:aG(bE,a)})}async create(a){return this.request({method:"POST",path:bE,bodyParams:a})}async update(a){let{oauthApplicationId:b,...c}=a;return this.requireId(b),this.request({method:"PATCH",path:aG(bE,b),bodyParams:c})}async delete(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bE,a)})}async rotateSecret(a){return this.requireId(a),this.request({method:"POST",path:aG(bE,a,"rotate_secret")})}},bG="/phone_numbers",bH=class extends aH{async getPhoneNumber(a){return this.requireId(a),this.request({method:"GET",path:aG(bG,a)})}async createPhoneNumber(a){return this.request({method:"POST",path:bG,bodyParams:a})}async updatePhoneNumber(a,b={}){return this.requireId(a),this.request({method:"PATCH",path:aG(bG,a),bodyParams:b})}async deletePhoneNumber(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bG,a)})}},bI=class extends aH{async verify(a){return this.request({method:"POST",path:"/proxy_checks",bodyParams:a})}},bJ="/redirect_urls",bK=class extends aH{async getRedirectUrlList(){return this.request({method:"GET",path:bJ,queryParams:{paginated:!0}})}async getRedirectUrl(a){return this.requireId(a),this.request({method:"GET",path:aG(bJ,a)})}async createRedirectUrl(a){return this.request({method:"POST",path:bJ,bodyParams:a})}async deleteRedirectUrl(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bJ,a)})}},bL="/saml_connections",bM=class extends aH{async getSamlConnectionList(a={}){return this.request({method:"GET",path:bL,queryParams:a})}async createSamlConnection(a){return this.request({method:"POST",path:bL,bodyParams:a,options:{deepSnakecaseBodyParamKeys:!0}})}async getSamlConnection(a){return this.requireId(a),this.request({method:"GET",path:aG(bL,a)})}async updateSamlConnection(a,b={}){return this.requireId(a),this.request({method:"PATCH",path:aG(bL,a),bodyParams:b,options:{deepSnakecaseBodyParamKeys:!0}})}async deleteSamlConnection(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bL,a)})}},bN="/sessions",bO=class extends aH{async getSessionList(a={}){return this.request({method:"GET",path:bN,queryParams:{...a,paginated:!0}})}async getSession(a){return this.requireId(a),this.request({method:"GET",path:aG(bN,a)})}async createSession(a){return this.request({method:"POST",path:bN,bodyParams:a})}async revokeSession(a){return this.requireId(a),this.request({method:"POST",path:aG(bN,a,"revoke")})}async verifySession(a,b){return this.requireId(a),this.request({method:"POST",path:aG(bN,a,"verify"),bodyParams:{token:b}})}async getToken(a,b,c){this.requireId(a);let d={method:"POST",path:b?aG(bN,a,"tokens",b):aG(bN,a,"tokens")};return void 0!==c&&(d.bodyParams={expires_in_seconds:c}),this.request(d)}async refreshSession(a,b){this.requireId(a);let{suffixed_cookies:c,...d}=b;return this.request({method:"POST",path:aG(bN,a,"refresh"),bodyParams:d,queryParams:{suffixed_cookies:c}})}},bP="/sign_in_tokens",bQ=class extends aH{async createSignInToken(a){return this.request({method:"POST",path:bP,bodyParams:a})}async revokeSignInToken(a){return this.requireId(a),this.request({method:"POST",path:aG(bP,a,"revoke")})}},bR="/sign_ups",bS=class extends aH{async get(a){return this.requireId(a),this.request({method:"GET",path:aG(bR,a)})}async update(a){let{signUpAttemptId:b,...c}=a;return this.request({method:"PATCH",path:aG(bR,b),bodyParams:c})}},bT=class extends aH{async createTestingToken(){return this.request({method:"POST",path:"/testing_tokens"})}},bU="/users",bV=class extends aH{async getUserList(a={}){let{limit:b,offset:c,orderBy:d,...e}=a,[f,g]=await Promise.all([this.request({method:"GET",path:bU,queryParams:a}),this.getCount(e)]);return{data:f,totalCount:g}}async getUser(a){return this.requireId(a),this.request({method:"GET",path:aG(bU,a)})}async createUser(a){return this.request({method:"POST",path:bU,bodyParams:a})}async updateUser(a,b={}){return this.requireId(a),this.request({method:"PATCH",path:aG(bU,a),bodyParams:b})}async updateUserProfileImage(a,b){this.requireId(a);let c=new D.FormData;return c.append("file",b?.file),this.request({method:"POST",path:aG(bU,a,"profile_image"),formData:c})}async updateUserMetadata(a,b){return this.requireId(a),this.request({method:"PATCH",path:aG(bU,a,"metadata"),bodyParams:b})}async deleteUser(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bU,a)})}async getCount(a={}){return this.request({method:"GET",path:aG(bU,"count"),queryParams:a})}async getUserOauthAccessToken(a,b){this.requireId(a);let c=b.startsWith("oauth_"),d=c?b:`oauth_${b}`;return c&&(0,j.deprecated)("getUserOauthAccessToken(userId, provider)","Remove the `oauth_` prefix from the `provider` argument."),this.request({method:"GET",path:aG(bU,a,"oauth_access_tokens",d),queryParams:{paginated:!0}})}async disableUserMFA(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bU,a,"mfa")})}async getOrganizationMembershipList(a){let{userId:b,limit:c,offset:d}=a;return this.requireId(b),this.request({method:"GET",path:aG(bU,b,"organization_memberships"),queryParams:{limit:c,offset:d}})}async getOrganizationInvitationList(a){let{userId:b,...c}=a;return this.requireId(b),this.request({method:"GET",path:aG(bU,b,"organization_invitations"),queryParams:c})}async verifyPassword(a){let{userId:b,password:c}=a;return this.requireId(b),this.request({method:"POST",path:aG(bU,b,"verify_password"),bodyParams:{password:c}})}async verifyTOTP(a){let{userId:b,code:c}=a;return this.requireId(b),this.request({method:"POST",path:aG(bU,b,"verify_totp"),bodyParams:{code:c}})}async banUser(a){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"ban")})}async unbanUser(a){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"unban")})}async lockUser(a){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"lock")})}async unlockUser(a){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"unlock")})}async deleteUserProfileImage(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bU,a,"profile_image")})}async deleteUserPasskey(a){return this.requireId(a.userId),this.requireId(a.passkeyIdentificationId),this.request({method:"DELETE",path:aG(bU,a.userId,"passkeys",a.passkeyIdentificationId)})}async deleteUserWeb3Wallet(a){return this.requireId(a.userId),this.requireId(a.web3WalletIdentificationId),this.request({method:"DELETE",path:aG(bU,a.userId,"web3_wallets",a.web3WalletIdentificationId)})}async deleteUserExternalAccount(a){return this.requireId(a.userId),this.requireId(a.externalAccountId),this.request({method:"DELETE",path:aG(bU,a.userId,"external_accounts",a.externalAccountId)})}async deleteUserBackupCodes(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bU,a,"backup_code")})}async deleteUserTOTP(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bU,a,"totp")})}async setPasswordCompromised(a,b={revokeAllSessions:!1}){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"password","set_compromised"),bodyParams:b})}async unsetPasswordCompromised(a){return this.requireId(a),this.request({method:"POST",path:aG(bU,a,"password","unset_compromised")})}},bW="/waitlist_entries",bX=class extends aH{async list(a={}){return this.request({method:"GET",path:bW,queryParams:a})}async create(a){return this.request({method:"POST",path:bW,bodyParams:a})}async createBulk(a){return this.request({method:"POST",path:aG(bW,"bulk"),bodyParams:a})}async invite(a,b={}){return this.requireId(a),this.request({method:"POST",path:aG(bW,a,"invite"),bodyParams:b})}async reject(a){return this.requireId(a),this.request({method:"POST",path:aG(bW,a,"reject")})}async delete(a){return this.requireId(a),this.request({method:"DELETE",path:aG(bW,a)})}},bY="/webhooks",bZ=class extends aH{async createSvixApp(){return this.request({method:"POST",path:aG(bY,"svix")})}async generateSvixAuthURL(){return this.request({method:"POST",path:aG(bY,"svix_url")})}async deleteSvixApp(){return this.request({method:"DELETE",path:aG(bY,"svix")})}},b$="/billing",b_=class extends aH{async getPlanList(a){return this.request({method:"GET",path:aG(b$,"plans"),queryParams:a})}async cancelSubscriptionItem(a,b){return this.requireId(a),this.request({method:"DELETE",path:aG(b$,"subscription_items",a),queryParams:b})}async extendSubscriptionItemFreeTrial(a,b){return this.requireId(a),this.request({method:"POST",path:aG("/billing","subscription_items",a,"extend_free_trial"),bodyParams:b})}async getOrganizationBillingSubscription(a){return this.requireId(a),this.request({method:"GET",path:aG("/organizations",a,"billing","subscription")})}async getUserBillingSubscription(a){return this.requireId(a),this.request({method:"GET",path:aG("/users",a,"billing","subscription")})}},b0=a=>"object"==typeof a&&null!==a,b1=a=>b0(a)&&!(a instanceof RegExp)&&!(a instanceof Error)&&!(a instanceof Date)&&!(globalThis.Blob&&a instanceof globalThis.Blob),b2=Symbol("mapObjectSkip"),b3=(a,b,c,d=new WeakMap)=>{if(c={deep:!1,target:{},...c},d.has(a))return d.get(a);d.set(a,c.target);let{target:e}=c;delete c.target;let f=a=>a.map(a=>b1(a)?b3(a,b,c,d):a);if(Array.isArray(a))return f(a);for(let[g,h]of Object.entries(a)){let i=b(g,h,a);if(i===b2)continue;let[j,k,{shouldRecurse:l=!0}={}]=i;"__proto__"!==j&&(c.deep&&l&&b1(k)&&(k=Array.isArray(k)?f(k):b3(k,b,c,d)),e[j]=k)}return e};function b4(a,b,c){if(!b0(a))throw TypeError(`Expected an object, got \`${a}\` (${typeof a})`);if(Array.isArray(a))throw TypeError("Expected an object, got an array");return b3(a,b,c)}var b5=/([\p{Ll}\d])(\p{Lu})/gu,b6=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,b7=/(\d)\p{Ll}|(\p{L})\d/u,b8=/[^\p{L}\d]+/giu,b9="$1\0$2";function ca(a){let b=a.trim();b=(b=b.replace(b5,b9).replace(b6,b9)).replace(b8,"\0");let c=0,d=b.length;for(;"\0"===b.charAt(c);)c++;if(c===d)return[];for(;"\0"===b.charAt(d-1);)d--;return b.slice(c,d).split(/\0/g)}function cb(a){let b=ca(a);for(let a=0;a<b.length;a++){let c=b[a],d=b7.exec(c);if(d){let e=d.index+(d[1]??d[2]).length;b.splice(a,1,c.slice(0,e),c.slice(e))}}return b}function cc(a,b){return function(a,b){var c;let[d,e,f]=function(a,b={}){let c=b.split??(b.separateNumbers?cb:ca),d=b.prefixCharacters??"",e=b.suffixCharacters??"",f=0,g=a.length;for(;f<a.length;){let b=a.charAt(f);if(!d.includes(b))break;f++}for(;g>f;){let b=g-1,c=a.charAt(b);if(!e.includes(c))break;g=b}return[a.slice(0,f),c(a.slice(f,g)),a.slice(g)]}(a,b);return d+e.map(!1===(c=b?.locale)?a=>a.toLowerCase():a=>a.toLocaleLowerCase(c)).join(b?.delimiter??" ")+f}(a,{delimiter:"_",...b})}var cd={}.constructor;function ce(a,b){return a.some(a=>"string"==typeof a?a===b:a.test(b))}function cf(a,b,c){return c.shouldRecurse?{shouldRecurse:c.shouldRecurse(a,b)}:void 0}var cg=function(a,b){if(Array.isArray(a)){if(a.some(a=>a.constructor!==cd))throw Error("obj must be array of plain objects");let c=(b={deep:!0,exclude:[],parsingOptions:{},...b}).snakeCase||(a=>cc(a,b.parsingOptions));return a.map(a=>b4(a,(a,d)=>[ce(b.exclude,a)?a:c(a),d,cf(a,d,b)],b))}if(a.constructor!==cd)throw Error("obj must be an plain object");let c=(b={deep:!0,exclude:[],parsingOptions:{},...b}).snakeCase||(a=>cc(a,b.parsingOptions));return b4(a,(a,d)=>[ce(b.exclude,a)?a:c(a),d,cf(a,d,b)],b)},ch=class a{constructor(a,b,c,d){this.publishableKey=a,this.secretKey=b,this.claimUrl=c,this.apiKeysUrl=d}static fromJSON(b){return new a(b.publishable_key,b.secret_key,b.claim_url,b.api_keys_url)}},ci=class a{constructor(a,b,c){this.agentId=a,this.taskId=b,this.url=c}static fromJSON(b){return new a(b.agent_id,b.task_id,b.url)}},cj=class a{constructor(a,b,c,d,e,f,g,h){this.id=a,this.status=b,this.userId=c,this.actor=d,this.token=e,this.url=f,this.createdAt=g,this.updatedAt=h}static fromJSON(b){return new a(b.id,b.status,b.user_id,b.actor,b.token,b.url,b.created_at,b.updated_at)}},ck=class a{constructor(a,b,c,d,e,f,g){this.id=a,this.identifier=b,this.identifierType=c,this.createdAt=d,this.updatedAt=e,this.instanceId=f,this.invitationId=g}static fromJSON(b){return new a(b.id,b.identifier,b.identifier_type,b.created_at,b.updated_at,b.instance_id,b.invitation_id)}},cl=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){this.id=a,this.type=b,this.name=c,this.subject=d,this.scopes=e,this.claims=f,this.revoked=g,this.revocationReason=h,this.expired=i,this.expiration=j,this.createdBy=k,this.description=l,this.lastUsedAt=m,this.createdAt=n,this.updatedAt=o,this.secret=p}static fromJSON(b){return new a(b.id,b.type,b.name,b.subject,b.scopes,b.claims,b.revoked,b.revocation_reason,b.expired,b.expiration,b.created_by,b.description,b.last_used_at,b.created_at,b.updated_at,b.secret)}},cm=class a{constructor(a,b,c,d,e,f){this.id=a,this.identifier=b,this.identifierType=c,this.createdAt=d,this.updatedAt=e,this.instanceId=f}static fromJSON(b){return new a(b.id,b.identifier,b.identifier_type,b.created_at,b.updated_at,b.instance_id)}},cn=class a{constructor(a,b,c,d,e,f,g,h){this.id=a,this.isMobile=b,this.ipAddress=c,this.city=d,this.country=e,this.browserVersion=f,this.browserName=g,this.deviceType=h}static fromJSON(b){return new a(b.id,b.is_mobile,b.ip_address,b.city,b.country,b.browser_version,b.browser_name,b.device_type)}},co=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l=null){this.id=a,this.clientId=b,this.userId=c,this.status=d,this.lastActiveAt=e,this.expireAt=f,this.abandonAt=g,this.createdAt=h,this.updatedAt=i,this.lastActiveOrganizationId=j,this.latestActivity=k,this.actor=l}static fromJSON(b){return new a(b.id,b.client_id,b.user_id,b.status,b.last_active_at,b.expire_at,b.abandon_at,b.created_at,b.updated_at,b.last_active_organization_id,b.latest_activity&&cn.fromJSON(b.latest_activity),b.actor)}},cp=class a{constructor(a,b,c,d,e,f,g,h,i){this.id=a,this.sessionIds=b,this.sessions=c,this.signInId=d,this.signUpId=e,this.lastActiveSessionId=f,this.lastAuthenticationStrategy=g,this.createdAt=h,this.updatedAt=i}static fromJSON(b){return new a(b.id,b.session_ids,b.sessions.map(a=>co.fromJSON(a)),b.sign_in_id,b.sign_up_id,b.last_active_session_id,b.last_authentication_strategy,b.created_at,b.updated_at)}},cq=class a{constructor(a,b,c){this.host=a,this.value=b,this.required=c}static fromJSON(b){return new a(b.host,b.value,b.required)}},cr=class a{constructor(a){this.cookies=a}static fromJSON(b){return new a(b.cookies)}},cs=class a{constructor(a,b,c,d){this.object=a,this.id=b,this.slug=c,this.deleted=d}static fromJSON(b){return new a(b.object,b.id||null,b.slug||null,b.deleted)}},ct=class a{constructor(a,b,c,d,e,f,g,h){this.id=a,this.name=b,this.isSatellite=c,this.frontendApiUrl=d,this.developmentOrigin=e,this.cnameTargets=f,this.accountsPortalUrl=g,this.proxyUrl=h}static fromJSON(b){return new a(b.id,b.name,b.is_satellite,b.frontend_api_url,b.development_origin,b.cname_targets&&b.cname_targets.map(a=>cq.fromJSON(a)),b.accounts_portal_url,b.proxy_url)}},cu=class a{constructor(a,b,c,d,e,f,g,h,i,j,k){this.id=a,this.fromEmailName=b,this.emailAddressId=c,this.toEmailAddress=d,this.subject=e,this.body=f,this.bodyPlain=g,this.status=h,this.slug=i,this.data=j,this.deliveredByClerk=k}static fromJSON(b){return new a(b.id,b.from_email_name,b.email_address_id,b.to_email_address,b.subject,b.body,b.body_plain,b.status,b.slug,b.data,b.delivered_by_clerk)}},cv=class a{constructor(a,b){this.id=a,this.type=b}static fromJSON(b){return new a(b.id,b.type)}},cw=class a{constructor(a,b,c=null,d=null,e=null,f=null,g=null){this.status=a,this.strategy=b,this.externalVerificationRedirectURL=c,this.attempts=d,this.expireAt=e,this.nonce=f,this.message=g}static fromJSON(b){return new a(b.status,b.strategy,b.external_verification_redirect_url?new URL(b.external_verification_redirect_url):null,b.attempts,b.expire_at,b.nonce)}},cx=class a{constructor(a,b,c,d){this.id=a,this.emailAddress=b,this.verification=c,this.linkedTo=d}static fromJSON(b){return new a(b.id,b.email_address,b.verification&&cw.fromJSON(b.verification),b.linked_to.map(a=>cv.fromJSON(a)))}},cy=class a{constructor(a,b,c,d,e){this.id=a,this.name=b,this.description=c,this.slug=d,this.avatarUrl=e}static fromJSON(b){return new a(b.id,b.name,b.description??null,b.slug,b.avatar_url??null)}},cz=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){this.id=a,this.name=b,this.slug=c,this.description=d,this.isDefault=e,this.isRecurring=f,this.hasBaseFee=g,this.publiclyVisible=h,this.fee=i,this.annualFee=j,this.annualMonthlyFee=k,this.forPayerType=l,this.features=m,this.avatarUrl=n,this.freeTrialDays=o,this.freeTrialEnabled=p}static fromJSON(b){let c=a=>a?{amount:a.amount,amountFormatted:a.amount_formatted,currency:a.currency,currencySymbol:a.currency_symbol}:null;return new a(b.id,b.name,b.slug,b.description??null,b.is_default,b.is_recurring,b.has_base_fee,b.publicly_visible,c(b.fee),c(b.annual_fee),c(b.annual_monthly_fee),b.for_payer_type,(b.features??[]).map(a=>cy.fromJSON(a)),b.avatar_url,b.free_trial_days,b.free_trial_enabled)}},cA=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){this.id=a,this.status=b,this.planPeriod=c,this.periodStart=d,this.nextPayment=e,this.amount=f,this.plan=g,this.planId=h,this.createdAt=i,this.updatedAt=j,this.periodEnd=k,this.canceledAt=l,this.pastDueAt=m,this.endedAt=n,this.payerId=o,this.isFreeTrial=p,this.lifetimePaid=q}static fromJSON(b){function c(a){return a?{amount:a.amount,amountFormatted:a.amount_formatted,currency:a.currency,currencySymbol:a.currency_symbol}:a}return new a(b.id,b.status,b.plan_period,b.period_start,b.next_payment,c(b.amount)??void 0,b.plan?cz.fromJSON(b.plan):null,b.plan_id??null,b.created_at,b.updated_at,b.period_end,b.canceled_at,b.past_due_at,b.ended_at,b.payer_id,b.is_free_trial,c(b.lifetime_paid)??void 0)}},cB=class a{constructor(a,b,c,d,e,f,g,h,i,j){this.id=a,this.status=b,this.payerId=c,this.createdAt=d,this.updatedAt=e,this.activeAt=f,this.pastDueAt=g,this.subscriptionItems=h,this.nextPayment=i,this.eligibleForFreeTrial=j}static fromJSON(b){let c=b.next_payment?{date:b.next_payment.date,amount:{amount:b.next_payment.amount.amount,amountFormatted:b.next_payment.amount.amount_formatted,currency:b.next_payment.amount.currency,currencySymbol:b.next_payment.amount.currency_symbol}}:null;return new a(b.id,b.status,b.payer_id,b.created_at,b.updated_at,b.active_at??null,b.past_due_at??null,(b.subscription_items??[]).map(a=>cA.fromJSON(a)),c,b.eligible_for_free_trial??!1)}},cC=class a{constructor(a,b,c,d,e,f,g,h,i,j){this.id=a,this.name=b,this.domains=c,this.organizationId=d,this.active=e,this.syncUserAttributes=f,this.allowSubdomains=g,this.disableAdditionalIdentifications=h,this.createdAt=i,this.updatedAt=j}static fromJSON(b){return new a(b.id,b.name,b.domains,b.organization_id,b.active,b.sync_user_attributes,b.allow_subdomains,b.disable_additional_identifications,b.created_at,b.updated_at)}},cD=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m={},n,o){this.id=a,this.provider=b,this.providerUserId=c,this.identificationId=d,this.externalId=e,this.approvedScopes=f,this.emailAddress=g,this.firstName=h,this.lastName=i,this.imageUrl=j,this.username=k,this.phoneNumber=l,this.publicMetadata=m,this.label=n,this.verification=o}static fromJSON(b){return new a(b.id,b.provider,b.provider_user_id,b.identification_id,b.provider_user_id,b.approved_scopes,b.email_address,b.first_name,b.last_name,b.image_url||"",b.username,b.phone_number,b.public_metadata,b.label,b.verification&&cw.fromJSON(b.verification))}},cE=class a{constructor(a,b,c){this.id=a,this.environmentType=b,this.allowedOrigins=c}static fromJSON(b){return new a(b.id,b.environment_type,b.allowed_origins)}},cF=class a{constructor(a,b,c,d,e){this.allowlist=a,this.blocklist=b,this.blockEmailSubaddresses=c,this.blockDisposableEmailDomains=d,this.ignoreDotsForGmailAddresses=e}static fromJSON(b){return new a(b.allowlist,b.blocklist,b.block_email_subaddresses,b.block_disposable_email_domains,b.ignore_dots_for_gmail_addresses)}},cG=class a{constructor(a,b,c,d,e){this.id=a,this.restrictedToAllowlist=b,this.fromEmailAddress=c,this.progressiveSignUp=d,this.enhancedEmailDeliverability=e}static fromJSON(b){return new a(b.id,b.restricted_to_allowlist,b.from_email_address,b.progressive_sign_up,b.enhanced_email_deliverability)}},cH=class a{constructor(a,b,c,d,e,f,g,h){this.id=a,this.emailAddress=b,this.publicMetadata=c,this.createdAt=d,this.updatedAt=e,this.status=f,this.url=g,this.revoked=h,this._raw=null}get raw(){return this._raw}static fromJSON(b){let c=new a(b.id,b.email_address,b.public_metadata,b.created_at,b.updated_at,b.status,b.url,b.revoked);return c._raw=b,c}},cI=class a{constructor(a,b,c,d,e,f,g,h,i){this.id=a,this.name=b,this.claims=c,this.lifetime=d,this.allowedClockSkew=e,this.customSigningKey=f,this.signingAlgorithm=g,this.createdAt=h,this.updatedAt=i}static fromJSON(b){return new a(b.id,b.name,b.claims,b.lifetime,b.allowed_clock_skew,b.custom_signing_key,b.signing_algorithm,b.created_at,b.updated_at)}},cJ=class a{constructor(a,b,c,d,e,f,g,h){this.id=a,this.name=b,this.instanceId=c,this.createdAt=d,this.updatedAt=e,this.scopedMachines=f,this.defaultTokenTtl=g,this.secretKey=h}static fromJSON(b){return new a(b.id,b.name,b.instance_id,b.created_at,b.updated_at,b.scoped_machines.map(b=>new a(b.id,b.name,b.instance_id,b.created_at,b.updated_at,[],b.default_token_ttl)),b.default_token_ttl,b.secret_key)}},cK=class a{constructor(a,b,c,d){this.fromMachineId=a,this.toMachineId=b,this.createdAt=c,this.deleted=d}static fromJSON(b){return new a(b.from_machine_id,b.to_machine_id,b.created_at,b.deleted)}},cL=class a{constructor(a){this.secret=a}static fromJSON(b){return new a(b.secret)}},cM=class a{constructor(a,b,c,d={},e,f,g,h,i){this.externalAccountId=a,this.provider=b,this.token=c,this.publicMetadata=d,this.label=e,this.scopes=f,this.tokenSecret=g,this.expiresAt=h,this.idToken=i}static fromJSON(b){return new a(b.external_account_id,b.provider,b.token,b.public_metadata,b.label||"",b.scopes,b.token_secret,b.expires_at,b.id_token)}},cN=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){this.id=a,this.instanceId=b,this.name=c,this.clientId=d,this.clientUri=e,this.clientImageUrl=f,this.dynamicallyRegistered=g,this.consentScreenEnabled=h,this.pkceRequired=i,this.isPublic=j,this.scopes=k,this.redirectUris=l,this.authorizeUrl=m,this.tokenFetchUrl=n,this.userInfoUrl=o,this.discoveryUrl=p,this.tokenIntrospectionUrl=q,this.createdAt=r,this.updatedAt=s,this.clientSecret=t}static fromJSON(b){return new a(b.id,b.instance_id,b.name,b.client_id,b.client_uri,b.client_image_url,b.dynamically_registered,b.consent_screen_enabled,b.pkce_required,b.public,b.scopes,b.redirect_uris,b.authorize_url,b.token_fetch_url,b.user_info_url,b.discovery_url,b.token_introspection_url,b.created_at,b.updated_at,b.client_secret)}},cO=class a{constructor(a,b,c,d,e,f,g,h={},i={},j,k,l,m){this.id=a,this.name=b,this.slug=c,this.imageUrl=d,this.hasImage=e,this.createdAt=f,this.updatedAt=g,this.publicMetadata=h,this.privateMetadata=i,this.maxAllowedMemberships=j,this.adminDeleteEnabled=k,this.membersCount=l,this.createdBy=m,this._raw=null}get raw(){return this._raw}static fromJSON(b){let c=new a(b.id,b.name,b.slug,b.image_url||"",b.has_image,b.created_at,b.updated_at,b.public_metadata,b.private_metadata,b.max_allowed_memberships,b.admin_delete_enabled,b.members_count,b.created_by);return c._raw=b,c}},cP=class a{constructor(a,b,c,d,e,f,g,h,i,j,k={},l={},m){this.id=a,this.emailAddress=b,this.role=c,this.roleName=d,this.organizationId=e,this.createdAt=f,this.updatedAt=g,this.expiresAt=h,this.url=i,this.status=j,this.publicMetadata=k,this.privateMetadata=l,this.publicOrganizationData=m,this._raw=null}get raw(){return this._raw}static fromJSON(b){let c=new a(b.id,b.email_address,b.role,b.role_name,b.organization_id,b.created_at,b.updated_at,b.expires_at,b.url,b.status,b.public_metadata,b.private_metadata,b.public_organization_data);return c._raw=b,c}},cQ=class a{constructor(a,b,c,d={},e={},f,g,h,i){this.id=a,this.role=b,this.permissions=c,this.publicMetadata=d,this.privateMetadata=e,this.createdAt=f,this.updatedAt=g,this.organization=h,this.publicUserData=i,this._raw=null}get raw(){return this._raw}static fromJSON(b){let c=new a(b.id,b.role,b.permissions,b.public_metadata,b.private_metadata,b.created_at,b.updated_at,cO.fromJSON(b.organization),cR.fromJSON(b.public_user_data));return c._raw=b,c}},cR=class a{constructor(a,b,c,d,e,f){this.identifier=a,this.firstName=b,this.lastName=c,this.imageUrl=d,this.hasImage=e,this.userId=f}static fromJSON(b){return new a(b.identifier,b.first_name,b.last_name,b.image_url,b.has_image,b.user_id)}},cS=class a{constructor(a,b,c,d,e,f,g,h,i,j){this.enabled=a,this.maxAllowedMemberships=b,this.maxAllowedRoles=c,this.maxAllowedPermissions=d,this.creatorRole=e,this.adminDeleteEnabled=f,this.domainsEnabled=g,this.slugDisabled=h,this.domainsEnrollmentModes=i,this.domainsDefaultRole=j}static fromJSON(b){return new a(b.enabled,b.max_allowed_memberships,b.max_allowed_roles,b.max_allowed_permissions,b.creator_role,b.admin_delete_enabled,b.domains_enabled,b.slug_disabled,b.domains_enrollment_modes,b.domains_default_role)}},cT=class a{constructor(a,b,c,d,e,f){this.id=a,this.phoneNumber=b,this.reservedForSecondFactor=c,this.defaultSecondFactor=d,this.verification=e,this.linkedTo=f}static fromJSON(b){return new a(b.id,b.phone_number,b.reserved_for_second_factor,b.default_second_factor,b.verification&&cw.fromJSON(b.verification),b.linked_to.map(a=>cv.fromJSON(a)))}},cU=class a{constructor(a,b,c,d,e,f,g){this.id=a,this.domainId=b,this.lastRunAt=c,this.proxyUrl=d,this.successful=e,this.createdAt=f,this.updatedAt=g}static fromJSON(b){return new a(b.id,b.domain_id,b.last_run_at,b.proxy_url,b.successful,b.created_at,b.updated_at)}},cV=class a{constructor(a,b,c,d){this.id=a,this.url=b,this.createdAt=c,this.updatedAt=d}static fromJSON(b){return new a(b.id,b.url,b.created_at,b.updated_at)}},cW=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){this.id=a,this.name=b,this.domain=c,this.organizationId=d,this.idpEntityId=e,this.idpSsoUrl=f,this.idpCertificate=g,this.idpMetadataUrl=h,this.idpMetadata=i,this.acsUrl=j,this.spEntityId=k,this.spMetadataUrl=l,this.active=m,this.provider=n,this.userCount=o,this.syncUserAttributes=p,this.allowSubdomains=q,this.allowIdpInitiated=r,this.createdAt=s,this.updatedAt=t,this.attributeMapping=u}static fromJSON(b){return new a(b.id,b.name,b.domain,b.organization_id,b.idp_entity_id,b.idp_sso_url,b.idp_certificate,b.idp_metadata_url,b.idp_metadata,b.acs_url,b.sp_entity_id,b.sp_metadata_url,b.active,b.provider,b.user_count,b.sync_user_attributes,b.allow_subdomains,b.allow_idp_initiated,b.created_at,b.updated_at,b.attribute_mapping&&cX.fromJSON(b.attribute_mapping))}},cX=class a{constructor(a,b,c,d){this.userId=a,this.emailAddress=b,this.firstName=c,this.lastName=d}static fromJSON(b){return new a(b.user_id,b.email_address,b.first_name,b.last_name)}},cY=class a{constructor(a,b,c,d,e,f,g){this.id=a,this.userId=b,this.token=c,this.status=d,this.url=e,this.createdAt=f,this.updatedAt=g}static fromJSON(b){return new a(b.id,b.user_id,b.token,b.status,b.url,b.created_at,b.updated_at)}},cZ=class a{constructor(a,b){this.nextAction=a,this.supportedStrategies=b}static fromJSON(b){return new a(b.next_action,b.supported_strategies)}},c$=class a{constructor(a,b,c,d){this.emailAddress=a,this.phoneNumber=b,this.web3Wallet=c,this.externalAccount=d}static fromJSON(b){return new a(b.email_address&&cZ.fromJSON(b.email_address),b.phone_number&&cZ.fromJSON(b.phone_number),b.web3_wallet&&cZ.fromJSON(b.web3_wallet),b.external_account)}},c_=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){this.id=a,this.status=b,this.requiredFields=c,this.optionalFields=d,this.missingFields=e,this.unverifiedFields=f,this.verifications=g,this.username=h,this.emailAddress=i,this.phoneNumber=j,this.web3Wallet=k,this.passwordEnabled=l,this.firstName=m,this.lastName=n,this.customAction=o,this.externalId=p,this.createdSessionId=q,this.createdUserId=r,this.abandonAt=s,this.legalAcceptedAt=t,this.publicMetadata=u,this.unsafeMetadata=v}static fromJSON(b){return new a(b.id,b.status,b.required_fields,b.optional_fields,b.missing_fields,b.unverified_fields,b.verifications?c$.fromJSON(b.verifications):null,b.username,b.email_address,b.phone_number,b.web3_wallet,b.password_enabled,b.first_name,b.last_name,b.custom_action,b.external_id,b.created_session_id,b.created_user_id,b.abandon_at,b.legal_accepted_at,b.public_metadata,b.unsafe_metadata)}},c0=class a{constructor(a,b,c,d,e,f,g){this.id=a,this.fromPhoneNumber=b,this.toPhoneNumber=c,this.message=d,this.status=e,this.phoneNumberId=f,this.data=g}static fromJSON(b){return new a(b.id,b.from_phone_number,b.to_phone_number,b.message,b.status,b.phone_number_id,b.data)}},c1=class a{constructor(a){this.jwt=a}static fromJSON(b){return new a(b.jwt)}},c2=class a{constructor(a,b,c){this.id=a,this.web3Wallet=b,this.verification=c}static fromJSON(b){return new a(b.id,b.web3_wallet,b.verification&&cw.fromJSON(b.verification))}},c3=class a{constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t={},u={},v={},w=[],x=[],y=[],z=[],A,B,C=null,D,E,F){this.id=a,this.passwordEnabled=b,this.totpEnabled=c,this.backupCodeEnabled=d,this.twoFactorEnabled=e,this.banned=f,this.locked=g,this.createdAt=h,this.updatedAt=i,this.imageUrl=j,this.hasImage=k,this.primaryEmailAddressId=l,this.primaryPhoneNumberId=m,this.primaryWeb3WalletId=n,this.lastSignInAt=o,this.externalId=p,this.username=q,this.firstName=r,this.lastName=s,this.publicMetadata=t,this.privateMetadata=u,this.unsafeMetadata=v,this.emailAddresses=w,this.phoneNumbers=x,this.web3Wallets=y,this.externalAccounts=z,this.lastActiveAt=A,this.createOrganizationEnabled=B,this.createOrganizationsLimit=C,this.deleteSelfEnabled=D,this.legalAcceptedAt=E,this.locale=F,this._raw=null}get raw(){return this._raw}static fromJSON(b){let c=new a(b.id,b.password_enabled,b.totp_enabled,b.backup_code_enabled,b.two_factor_enabled,b.banned,b.locked,b.created_at,b.updated_at,b.image_url,b.has_image,b.primary_email_address_id,b.primary_phone_number_id,b.primary_web3_wallet_id,b.last_sign_in_at,b.external_id,b.username,b.first_name,b.last_name,b.public_metadata,b.private_metadata,b.unsafe_metadata,(b.email_addresses||[]).map(a=>cx.fromJSON(a)),(b.phone_numbers||[]).map(a=>cT.fromJSON(a)),(b.web3_wallets||[]).map(a=>c2.fromJSON(a)),(b.external_accounts||[]).map(a=>cD.fromJSON(a)),b.last_active_at,b.create_organization_enabled,b.create_organizations_limit,b.delete_self_enabled,b.legal_accepted_at,b.locale);return c._raw=b,c}get primaryEmailAddress(){return this.emailAddresses.find(({id:a})=>a===this.primaryEmailAddressId)??null}get primaryPhoneNumber(){return this.phoneNumbers.find(({id:a})=>a===this.primaryPhoneNumberId)??null}get primaryWeb3Wallet(){return this.web3Wallets.find(({id:a})=>a===this.primaryWeb3WalletId)??null}get fullName(){return[this.firstName,this.lastName].join(" ").trim()||null}},c4=class a{constructor(a,b,c,d,e,f,g){this.id=a,this.emailAddress=b,this.status=c,this.invitation=d,this.createdAt=e,this.updatedAt=f,this.isLocked=g}static fromJSON(b){return new a(b.id,b.email_address,b.status,b.invitation&&cH.fromJSON(b.invitation),b.created_at,b.updated_at,b.is_locked)}};function c5(a){if("string"!=typeof a&&"object"in a&&"deleted"in a)return cs.fromJSON(a);switch(a.object){case"accountless_application":return ch.fromJSON(a);case"actor_token":return cj.fromJSON(a);case"allowlist_identifier":return ck.fromJSON(a);case"api_key":return cl.fromJSON(a);case"blocklist_identifier":return cm.fromJSON(a);case"client":return cp.fromJSON(a);case"cookies":return cr.fromJSON(a);case"domain":return ct.fromJSON(a);case"email_address":return cx.fromJSON(a);case"email":return cu.fromJSON(a);case"clerk_idp_oauth_access_token":return a8.fromJSON(a);case"instance":return cE.fromJSON(a);case"instance_restrictions":return cF.fromJSON(a);case"instance_settings":return cG.fromJSON(a);case"invitation":return cH.fromJSON(a);case"jwt_template":return cI.fromJSON(a);case"machine":return cJ.fromJSON(a);case"machine_scope":return cK.fromJSON(a);case"machine_secret_key":return cL.fromJSON(a);case"machine_to_machine_token":return a9.fromJSON(a);case"oauth_access_token":return cM.fromJSON(a);case"oauth_application":return cN.fromJSON(a);case"organization":return cO.fromJSON(a);case"organization_invitation":return cP.fromJSON(a);case"organization_membership":return cQ.fromJSON(a);case"organization_settings":return cS.fromJSON(a);case"phone_number":return cT.fromJSON(a);case"proxy_check":return cU.fromJSON(a);case"redirect_url":return cV.fromJSON(a);case"enterprise_connection":return cC.fromJSON(a);case"saml_connection":return cW.fromJSON(a);case"sign_in_token":return cY.fromJSON(a);case"agent_task":return ci.fromJSON(a);case"sign_up_attempt":return c_.fromJSON(a);case"session":return co.fromJSON(a);case"sms_message":return c0.fromJSON(a);case"token":return c1.fromJSON(a);case"total_count":return a.total_count;case"user":return c3.fromJSON(a);case"waitlist_entry":return c4.fromJSON(a);case"commerce_plan":return cz.fromJSON(a);case"commerce_subscription":return cB.fromJSON(a);case"commerce_subscription_item":return cA.fromJSON(a);case"feature":return cy.fromJSON(a);default:return a}}function c6(a){var b;return b=async b=>{let c,{secretKey:d,machineSecretKey:e,useMachineSecretKey:f=!1,requireSecretKey:g=!0,apiUrl:h=ar,apiVersion:i="v1",userAgent:j=as,skipApiVersionInUrl:k=!1}=a,{path:l,method:m,queryParams:n,headerParams:o,bodyParams:p,formData:q,options:r}=b,{deepSnakecaseBodyParamKeys:s=!1}=r||{};g&&aB(d);let t=new URL(k?aG(h,l):aG(h,i,l));if(n)for(let[a,b]of Object.entries(cg({...n})))b&&[b].flat().forEach(b=>t.searchParams.append(a,b));let u=new Headers({"Clerk-API-Version":at,[ax.Headers.UserAgent]:j,...o}),v=ax.Headers.Authorization;!u.has(v)&&(f&&e?u.set(v,`Bearer ${e}`):d&&u.set(v,`Bearer ${d}`));try{q?c=await D.fetch(t.href,{method:m,headers:u,body:q}):(u.set("Content-Type","application/json"),c=await D.fetch(t.href,{method:m,headers:u,...(()=>{if(!("GET"!==m&&p&&Object.keys(p).length>0))return null;let a=a=>cg(a,{deep:s});return{body:JSON.stringify(Array.isArray(p)?p.map(a):a(p))}})()}));let a=c?.headers&&c.headers?.get(ax.Headers.ContentType)===ax.ContentTypes.Json,b=await (a?c.json():c.text());if(!c.ok)return{data:null,errors:c9(b),status:c?.status,statusText:c?.statusText,clerkTraceId:c7(b,c?.headers),retryAfter:c8(c?.headers)};return{...function(a){var b,c;let d;if(Array.isArray(a))return{data:a.map(a=>c5(a))};if((b=a)&&"object"==typeof b&&"m2m_tokens"in b&&Array.isArray(b.m2m_tokens))return{data:d=a.m2m_tokens.map(a=>c5(a)),totalCount:a.total_count};return(c=a)&&"object"==typeof c&&"data"in c&&Array.isArray(c.data)&&void 0!==c.data?{data:d=a.data.map(a=>c5(a)),totalCount:a.total_count}:{data:c5(a)}}(b),errors:null}}catch(a){if(a instanceof Error)return{data:null,errors:[{code:"unexpected_error",message:a.message||"Unexpected error"}],clerkTraceId:c7(a,c?.headers)};return{data:null,errors:c9(a),status:c?.status,statusText:c?.statusText,clerkTraceId:c7(a,c?.headers),retryAfter:c8(c?.headers)}}},async(...a)=>{let{data:c,errors:d,totalCount:e,status:f,statusText:g,clerkTraceId:h,retryAfter:i}=await b(...a);if(d){let a=new ak.S(g||"",{data:[],status:f,clerkTraceId:h,retryAfter:i});throw a.errors=d,a}return void 0!==e?{data:c,totalCount:e}:c}}function c7(a,b){return a&&"object"==typeof a&&"clerk_trace_id"in a&&"string"==typeof a.clerk_trace_id?a.clerk_trace_id:b?.get("cf-ray")||""}function c8(a){let b=a?.get("Retry-After");if(!b)return;let c=parseInt(b,10);if(!isNaN(c))return c}function c9(a){if(a&&"object"==typeof a&&"errors"in a){let b=a.errors;return b.length>0?b.map(al.T):[]}return[]}function da(a){let b=c6(a);return{__experimental_accountlessApplications:new aN(c6({...a,requireSecretKey:!1})),actorTokens:new aJ(b),agentTasks:new aL(b),allowlistIdentifiers:new aP(b),apiKeys:new aR(c6({...a,skipApiVersionInUrl:!0})),betaFeatures:new aS(b),blocklistIdentifiers:new aU(b),billing:new b_(b),clients:new aW(b),domains:new aY(b),emailAddresses:new a$(b),enterpriseConnections:new a0(b),idPOAuthAccessToken:new a1(c6({...a,skipApiVersionInUrl:!0})),instance:new a3(b),invitations:new a5(b),jwks:new bz(b),jwtTemplates:new bB(b),machines:new a7(b),m2m:new by(c6({...a,skipApiVersionInUrl:!0,requireSecretKey:!1,useMachineSecretKey:!0}),{secretKey:a.secretKey,apiUrl:a.apiUrl,jwtKey:a.jwtKey}),oauthApplications:new bF(b),organizations:new bD(b),phoneNumbers:new bH(b),proxyChecks:new bI(b),redirectUrls:new bK(b),sessions:new bO(b),signInTokens:new bQ(b),signUps:new bS(b),testingTokens:new bT(b),users:new bV(b),waitlistEntries:new bX(b),webhooks:new bZ(b),samlConnections:new bM(b)}}var db=a=>()=>{let b={...a};return b.secretKey=(b.secretKey||"").substring(0,7),b.jwtKey=(b.jwtKey||"").substring(0,7),{...b}};function dc(a,b,c){let d,{actor:e,sessionId:f,sessionStatus:g,userId:h,orgId:i,orgRole:j,orgSlug:k,orgPermissions:l,factorVerificationAge:m}=(a=>{let b,c,d,e,f=a.fva??null,g=a.sts??null;if(2===a.v){if(a.o){b=a.o?.id,d=a.o?.slg,a.o?.rol&&(c=`org:${a.o?.rol}`);let{org:f}=aj(a.fea),{permissions:g,featurePermissionMap:h}=(({per:a,fpm:b})=>{if(!a||!b)return{permissions:[],featurePermissionMap:[]};let c=a.split(",").map(a=>a.trim());return{permissions:c,featurePermissionMap:b.split(",").map(a=>Number.parseInt(a.trim(),10)).map(a=>a.toString(2).padStart(c.length,"0").split("").map(a=>Number.parseInt(a,10)).reverse()).filter(Boolean)}})({per:a.o?.per,fpm:a.o?.fpm});e=function({features:a,permissions:b,featurePermissionMap:c}){if(!a||!b||!c)return[];let d=[];for(let e=0;e<a.length;e++){let f=a[e];if(e>=c.length)continue;let g=c[e];if(g)for(let a=0;a<g.length;a++)1===g[a]&&d.push(`org:${f}:${b[a]}`)}return d}({features:f,featurePermissionMap:h,permissions:g})}}else b=a.org_id,c=a.org_role,d=a.org_slug,e=a.org_permissions;return{sessionClaims:a,sessionId:a.sid,sessionStatus:g,actor:a.act,userId:a.sub,orgId:b,orgRole:c,orgSlug:d,orgPermissions:e,factorVerificationAge:f}})(c),n=da(a),o=dh({sessionId:f,sessionToken:b,fetcher:async(a,b,c)=>(await n.sessions.getToken(a,b||"",c)).jwt});return{tokenType:aC.SessionToken,actor:e,sessionClaims:c,sessionId:f,sessionStatus:g,userId:h,orgId:i,orgRole:j,orgSlug:k,orgPermissions:l,factorVerificationAge:m,getToken:o,has:(d={orgId:i,orgRole:j,orgPermissions:l,userId:h,factorVerificationAge:m,features:c.fea||"",plans:c.pla||""},a=>{if(!d.userId)return!1;let b=((a,b)=>{let{features:c,plans:d}=b;return a.feature&&c?ai(c,a.feature):a.plan&&d?ai(d,a.plan):null})(a,d),c=((a,b)=>{let{orgId:c,orgRole:d,orgPermissions:e}=b;return(a.role||a.permission)&&c&&d&&e?a.permission?e.includes(a.permission.replace(/^(org:)*/,"org:")):a.role?d.replace(/^(org:)*/,"org:")===a.role.replace(/^(org:)*/,"org:"):null:null})(a,d),e=((a,{factorVerificationAge:b})=>{if(!a.reverification||!b)return null;let c=(a=>{let b,c;if(!a)return!1;let d="string"==typeof a&&af.has(a),e="object"==typeof a&&(b=a.level,ae.has(b))&&"number"==typeof(c=a.afterMinutes)&&c>0;return(!!d||!!e)&&(a=>"string"==typeof a?ad[a]:a).bind(null,a)})(a.reverification);if(!c)return null;let{level:d,afterMinutes:e}=c(),[f,g]=b,h=-1!==f?e>f:null,i=-1!==g?e>g:null;switch(d){case"first_factor":return h;case"second_factor":return -1!==g?i:h;case"multi_factor":return -1===g?h:h&&i}})(a,d);return[b||c,e].some(a=>null===a)?[b||c,e].some(a=>!0===a):[b||c,e].every(a=>!0===a)}),debug:db({...a,sessionToken:b}),isAuthenticated:!0}}function dd(a,b){return{tokenType:aC.SessionToken,sessionClaims:null,sessionId:null,sessionStatus:b??null,userId:null,actor:null,orgId:null,orgRole:null,orgSlug:null,orgPermissions:null,factorVerificationAge:null,getToken:()=>Promise.resolve(null),has:()=>!1,debug:db(a),isAuthenticated:!1}}function de(a,b,c,d){let e={id:c.id,subject:c.subject,getToken:()=>Promise.resolve(b),has:()=>!1,debug:db(d),isAuthenticated:!0};switch(a){case aC.ApiKey:return{...e,tokenType:a,name:c.name,claims:c.claims,scopes:c.scopes,userId:c.subject.startsWith("user_")?c.subject:null,orgId:c.subject.startsWith("org_")?c.subject:null};case aC.M2MToken:return{...e,tokenType:a,claims:c.claims,scopes:c.scopes,machineId:c.subject};case aC.OAuthToken:return{...e,tokenType:a,scopes:c.scopes,userId:c.subject,clientId:c.clientId};default:throw Error(`Invalid token type: ${a}`)}}function df(a,b){let c={id:null,subject:null,scopes:null,has:()=>!1,getToken:()=>Promise.resolve(null),debug:db(b),isAuthenticated:!1};switch(a){case aC.ApiKey:return{...c,tokenType:a,name:null,claims:null,scopes:null,userId:null,orgId:null};case aC.M2MToken:return{...c,tokenType:a,claims:null,scopes:null,machineId:null};case aC.OAuthToken:return{...c,tokenType:a,scopes:null,userId:null,clientId:null};default:throw Error(`Invalid token type: ${a}`)}}function dg(){return{isAuthenticated:!1,tokenType:null,getToken:()=>Promise.resolve(null),has:()=>!1,debug:()=>({})}}var dh=a=>{let{fetcher:b,sessionToken:c,sessionId:d}=a||{};return async(a={})=>d?a.template||void 0!==a.expiresInSeconds?b(d,a.template,a.expiresInSeconds):c:null},di={SignedIn:"signed-in",SignedOut:"signed-out",Handshake:"handshake"},dj="satellite-needs-syncing",dk="session-token-and-uat-missing",dl="token-type-mismatch",dm="unexpected-error";function dn(a){let{authenticateContext:b,headers:c=new Headers,token:d}=a;return{status:di.SignedIn,reason:null,message:null,proxyUrl:b.proxyUrl||"",publishableKey:b.publishableKey||"",isSatellite:b.isSatellite||!1,domain:b.domain||"",signInUrl:b.signInUrl||"",signUpUrl:b.signUpUrl||"",afterSignInUrl:b.afterSignInUrl||"",afterSignUpUrl:b.afterSignUpUrl||"",isSignedIn:!0,isAuthenticated:!0,tokenType:a.tokenType,toAuth:({treatPendingAsSignedOut:c=!0}={})=>{if(a.tokenType===aC.SessionToken){let{sessionClaims:e}=a,f=dc(b,d,e);return c&&"pending"===f.sessionStatus?dd(void 0,f.sessionStatus):f}let{machineData:e}=a;return de(a.tokenType,d,e,b)},headers:c,token:d}}function dp(a){let{authenticateContext:b,headers:c=new Headers,reason:d,message:e="",tokenType:f}=a;return dq({status:di.SignedOut,reason:d,message:e,proxyUrl:b.proxyUrl||"",publishableKey:b.publishableKey||"",isSatellite:b.isSatellite||!1,domain:b.domain||"",signInUrl:b.signInUrl||"",signUpUrl:b.signUpUrl||"",afterSignInUrl:b.afterSignInUrl||"",afterSignUpUrl:b.afterSignUpUrl||"",isSignedIn:!1,isAuthenticated:!1,tokenType:f,toAuth:()=>f===aC.SessionToken?dd({...b,status:di.SignedOut,reason:d,message:e}):df(f,{reason:d,message:e,headers:c}),headers:c,token:null})}var dq=a=>{let b=new Headers(a.headers||{});if(a.message)try{b.set(ax.Headers.AuthMessage,a.message)}catch{}if(a.reason)try{b.set(ax.Headers.AuthReason,a.reason)}catch{}if(a.status)try{b.set(ax.Headers.AuthStatus,a.status)}catch{}return a.headers=b,a},dr=(e=null!=(d=aq())?R(V(d)):{},((a,b,c)=>{if(b&&"object"==typeof b||"function"==typeof b)for(let d of U(b))W.call(a,d)||void 0===d||S(a,d,{get:()=>b[d],enumerable:!(c=T(b,d))||c.enumerable});return a})(d&&d.__esModule?e:S(e,"default",{value:d,enumerable:!0}),d)),ds=class extends URL{isCrossOrigin(a){return this.origin!==new URL(a.toString()).origin}},dt=(...a)=>new ds(...a),du=class extends Request{constructor(a,b){super("string"!=typeof a&&"url"in a?a.url:String(a),b||"string"==typeof a?void 0:a),this.clerkUrl=this.deriveUrlFromHeaders(this),this.cookies=this.parseCookies(this)}toJSON(){return{url:this.clerkUrl.href,method:this.method,headers:JSON.stringify(Object.fromEntries(this.headers)),clerkUrl:this.clerkUrl.toString(),cookies:JSON.stringify(Object.fromEntries(this.cookies))}}deriveUrlFromHeaders(a){let b=new URL(a.url),c=a.headers.get(ax.Headers.ForwardedProto),d=a.headers.get(ax.Headers.ForwardedHost),e=a.headers.get(ax.Headers.Host),f=b.protocol,g=this.getFirstValueFromHeader(d)??e,h=this.getFirstValueFromHeader(c)??f?.replace(/[:/]/,""),i=g&&h?`${h}://${g}`:b.origin;if(i===b.origin)return dt(b);try{return dt(b.pathname+b.search,i)}catch{return dt(b)}}getFirstValueFromHeader(a){return a?.split(",")[0]}parseCookies(a){return new Map(Object.entries((0,dr.parse)(this.decodeCookieValue(a.headers.get("cookie")||""))))}decodeCookieValue(a){return a?a.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent):a}},dv=(...a)=>a[0]&&"object"==typeof a[0]&&"clerkUrl"in a[0]&&"cookies"in a[0]?a[0]:new du(...a),dw=a=>a.split(";")[0]?.split("=")[0],dx=a=>a.split(";")[0]?.split("=")[1];async function dy(a,b){let{data:c,errors:d}=P(a);if(d)return{errors:d};let{header:e}=c,{kid:f}=e;try{let c;if(b.jwtKey)c=bd({kid:f,pem:b.jwtKey});else{if(!b.secretKey)return{errors:[new x({action:w.SetClerkJWTKey,message:"Failed to resolve JWK during verification.",reason:v.JWKFailedToResolve})]};c=await be({...b,kid:f})}return await Q(a,{...b,key:c})}catch(a){return{errors:[a]}}}function dz(a,b,c){if((0,am.C)(b)){let d,e;switch(b.status){case 401:d=y.InvalidSecretKey,e=b.errors[0]?.message||"Invalid secret key";break;case 404:d=y.TokenInvalid,e=c;break;default:d=y.UnexpectedError,e="Unexpected error"}return{data:void 0,tokenType:a,errors:[new z({message:e,code:d,status:b.status})]}}return{data:void 0,tokenType:a,errors:[new z({message:"Unexpected error",code:y.UnexpectedError,status:b.status})]}}async function dA(a,b){try{let c=da(b);return{data:await c.m2m.verify({token:a}),tokenType:aC.M2MToken,errors:void 0}}catch(a){return dz(aC.M2MToken,a,"Machine token not found")}}async function dB(a,b){try{let c=da(b);return{data:await c.idPOAuthAccessToken.verify(a),tokenType:aC.OAuthToken,errors:void 0}}catch(a){return dz(aC.OAuthToken,a,"OAuth token not found")}}async function dC(a,b){try{let c=da(b);return{data:await c.apiKeys.verify(a),tokenType:aC.ApiKey,errors:void 0}}catch(a){return dz(aC.ApiKey,a,"API key not found")}}async function dD(a,b){if(bl(a)){let c;try{let{data:b,errors:d}=P(a);if(d)throw d[0];c=b}catch(a){return{data:void 0,tokenType:aC.M2MToken,errors:[new z({code:y.TokenInvalid,message:a.message})]}}return c.payload.sub.startsWith(bh)?bv(a,c,b):bm.includes(c.header.typ)?bw(a,c,b):{data:void 0,tokenType:aC.OAuthToken,errors:[new z({code:y.TokenVerificationFailed,message:`Invalid JWT type: ${c.header.typ??"missing"}. Expected one of: ${bm.join(", ")} for OAuth, or sub starting with 'mch_' for M2M`})]}}if(a.startsWith("mt_"))return dA(a,b);if(a.startsWith(bi))return dB(a,b);if(a.startsWith("ak_"))return dC(a,b);throw Error("Unknown machine token type")}async function dE(a,{key:b}){let{data:c,errors:d}=P(a);if(d)throw d[0];let{header:e,payload:f}=c,{typ:g,alg:h}=e;L(g),M(h);let{data:i,errors:j}=await O(c,b);if(j)throw new x({reason:v.TokenVerificationFailed,message:`Error verifying handshake token. ${j[0]}`});if(!i)throw new x({reason:v.TokenInvalidSignature,message:"Handshake signature is invalid."});return f}async function dF(a,b){let c,{secretKey:d,apiUrl:e,apiVersion:f,jwksCacheTtlInMs:g,jwtKey:h,skipJwksCache:i}=b,{data:j,errors:k}=P(a);if(k)throw k[0];let{kid:l}=j.header;if(h)c=bd({kid:l,pem:h});else if(d)c=await be({secretKey:d,apiUrl:e,apiVersion:f,kid:l,jwksCacheTtlInMs:g,skipJwksCache:i});else throw new x({action:w.SetClerkJWTKey,message:"Failed to resolve JWK during handshake verification.",reason:v.JWKFailedToResolve});return dE(a,{key:c})}var dG=class{constructor(a,b,c){this.authenticateContext=a,this.options=b,this.organizationMatcher=c}isRequestEligibleForHandshake(){let{accept:a,secFetchDest:b}=this.authenticateContext;return!!("document"===b||"iframe"===b||!b&&a?.startsWith("text/html"))}buildRedirectToHandshake(a){if(!this.authenticateContext?.clerkUrl)throw Error("Missing clerkUrl in authenticateContext");let b=this.removeDevBrowserFromURL(this.authenticateContext.clerkUrl),c=this.authenticateContext.frontendApi.startsWith("http")?this.authenticateContext.frontendApi:`https://${this.authenticateContext.frontendApi}`,d=new URL("v1/client/handshake",c=c.replace(/\/+$/,"")+"/");d.searchParams.append("redirect_url",b?.href||""),d.searchParams.append("__clerk_api_version",at),d.searchParams.append(ax.QueryParameters.SuffixedCookies,this.authenticateContext.usesSuffixedCookies().toString()),d.searchParams.append(ax.QueryParameters.HandshakeReason,a),d.searchParams.append(ax.QueryParameters.HandshakeFormat,"nonce"),this.authenticateContext.sessionToken&&d.searchParams.append(ax.QueryParameters.Session,this.authenticateContext.sessionToken),"development"===this.authenticateContext.instanceType&&this.authenticateContext.devBrowserToken&&d.searchParams.append(ax.QueryParameters.DevBrowser,this.authenticateContext.devBrowserToken);let e=this.getOrganizationSyncTarget(this.authenticateContext.clerkUrl,this.organizationMatcher);return e&&this.getOrganizationSyncQueryParams(e).forEach((a,b)=>{d.searchParams.append(b,a)}),new Headers({[ax.Headers.Location]:d.href})}async getCookiesFromHandshake(){let a=[];if(this.authenticateContext.handshakeNonce)try{let b=await this.authenticateContext.apiClient?.clients.getHandshakePayload({nonce:this.authenticateContext.handshakeNonce});b&&a.push(...b.directives)}catch(a){console.error("Clerk: HandshakeService: error getting handshake payload:",a)}else if(this.authenticateContext.handshakeToken){let b=await dF(this.authenticateContext.handshakeToken,this.authenticateContext);b&&Array.isArray(b.handshake)&&a.push(...b.handshake)}return a}async resolveHandshake(){let a=new Headers({"Access-Control-Allow-Origin":"null","Access-Control-Allow-Credentials":"true"}),b=await this.getCookiesFromHandshake(),c="";if(b.forEach(b=>{a.append("Set-Cookie",b),dw(b).startsWith(ax.Cookies.Session)&&(c=dx(b))}),"development"===this.authenticateContext.instanceType){let b=new URL(this.authenticateContext.clerkUrl);b.searchParams.delete(ax.QueryParameters.Handshake),b.searchParams.delete(ax.QueryParameters.HandshakeHelp),b.searchParams.delete(ax.QueryParameters.DevBrowser),b.searchParams.delete(ax.QueryParameters.HandshakeNonce),a.append(ax.Headers.Location,b.toString()),a.set(ax.Headers.CacheControl,"no-store")}if(""===c)return dp({tokenType:aC.SessionToken,authenticateContext:this.authenticateContext,reason:"session-token-missing",message:"",headers:a});let{data:d,errors:[e]=[]}=await dy(c,this.authenticateContext);if(d)return dn({tokenType:aC.SessionToken,authenticateContext:this.authenticateContext,sessionClaims:d,headers:a,token:c});if("development"===this.authenticateContext.instanceType&&(e?.reason===v.TokenExpired||e?.reason===v.TokenNotActiveYet||e?.reason===v.TokenIatInTheFuture)){let b=new x({action:e.action,message:e.message,reason:e.reason});b.tokenCarrier="cookie",console.error(`Clerk: Clock skew detected. This usually means that your system clock is inaccurate. Clerk will attempt to account for the clock skew in development.

To resolve this issue, make sure your system's clock is set to the correct time (e.g. turn off and on automatic time synchronization).

---

${b.getFullMessage()}`);let{data:d,errors:[f]=[]}=await dy(c,{...this.authenticateContext,clockSkewInMs:864e5});if(d)return dn({tokenType:aC.SessionToken,authenticateContext:this.authenticateContext,sessionClaims:d,headers:a,token:c});throw Error(f?.message||"Clerk: Handshake retry failed.")}throw Error(e?.message||"Clerk: Handshake failed.")}handleTokenVerificationErrorInDevelopment(a){if(a.reason===v.TokenInvalidSignature)throw Error("Clerk: Handshake token verification failed due to an invalid signature. If you have switched Clerk keys locally, clear your cookies and try again.");throw Error(`Clerk: Handshake token verification failed: ${a.getFullMessage()}.`)}checkAndTrackRedirectLoop(a){if(3===this.authenticateContext.handshakeRedirectLoopCounter)return!0;let b=this.authenticateContext.handshakeRedirectLoopCounter+1,c=ax.Cookies.RedirectCount;return a.append("Set-Cookie",`${c}=${b}; SameSite=Lax; HttpOnly; Max-Age=2`),!1}removeDevBrowserFromURL(a){let b=new URL(a);return b.searchParams.delete(ax.QueryParameters.DevBrowser),b.searchParams.delete(ax.QueryParameters.LegacyDevBrowser),b}getOrganizationSyncTarget(a,b){return b.findTarget(a)}getOrganizationSyncQueryParams(a){let b=new Map;return"personalAccount"===a.type&&b.set("organization_id",""),"organization"===a.type&&(a.organizationId&&b.set("organization_id",a.organizationId),a.organizationSlug&&b.set("organization_id",a.organizationSlug)),b}},dH=class{constructor(a){this.organizationPattern=this.createMatcher(a?.organizationPatterns),this.personalAccountPattern=this.createMatcher(a?.personalAccountPatterns)}createMatcher(a){if(!a)return null;try{var b,c,d,e,f,g,h;try{return b=void 0,c=[],d=function a(b,c,d){var e;return b instanceof RegExp?function(a,b){if(!b)return a;for(var c=/\((?:\?<(.*?)>)?(?!\?)/g,d=0,e=c.exec(a.source);e;)b.push({name:e[1]||d++,prefix:"",suffix:"",modifier:"",pattern:""}),e=c.exec(a.source);return a}(b,c):Array.isArray(b)?(e=b.map(function(b){return a(b,c,d).source}),new RegExp("(?:".concat(e.join("|"),")"),ao(d))):function(a,b,c){void 0===c&&(c={});for(var d=c.strict,e=void 0!==d&&d,f=c.start,g=c.end,h=c.encode,i=void 0===h?function(a){return a}:h,j=c.delimiter,k=c.endsWith,l="[".concat(an(void 0===k?"":k),"]|$"),m="[".concat(an(void 0===j?"/#?":j),"]"),n=void 0===f||f?"^":"",o=0;o<a.length;o++){var p=a[o];if("string"==typeof p)n+=an(i(p));else{var q=an(i(p.prefix)),r=an(i(p.suffix));if(p.pattern)if(b&&b.push(p),q||r)if("+"===p.modifier||"*"===p.modifier){var s="*"===p.modifier?"?":"";n+="(?:".concat(q,"((?:").concat(p.pattern,")(?:").concat(r).concat(q,"(?:").concat(p.pattern,"))*)").concat(r,")").concat(s)}else n+="(?:".concat(q,"(").concat(p.pattern,")").concat(r,")").concat(p.modifier);else{if("+"===p.modifier||"*"===p.modifier)throw TypeError('Can not repeat "'.concat(p.name,'" without a prefix and suffix'));n+="(".concat(p.pattern,")").concat(p.modifier)}else n+="(?:".concat(q).concat(r,")").concat(p.modifier)}}if(void 0===g||g)e||(n+="".concat(m,"?")),n+=c.endsWith?"(?=".concat(l,")"):"$";else{var t=a[a.length-1],u="string"==typeof t?m.indexOf(t[t.length-1])>-1:void 0===t;e||(n+="(?:".concat(m,"(?=").concat(l,"))?")),u||(n+="(?=".concat(m,"|").concat(l,")"))}return new RegExp(n,ao(c))}(function(a,b){void 0===b&&(b={});for(var c=function(a){for(var b=[],c=0;c<a.length;){var d=a[c];if("*"===d||"+"===d||"?"===d){b.push({type:"MODIFIER",index:c,value:a[c++]});continue}if("\\"===d){b.push({type:"ESCAPED_CHAR",index:c++,value:a[c++]});continue}if("{"===d){b.push({type:"OPEN",index:c,value:a[c++]});continue}if("}"===d){b.push({type:"CLOSE",index:c,value:a[c++]});continue}if(":"===d){for(var e="",f=c+1;f<a.length;){var g=a.charCodeAt(f);if(g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||95===g){e+=a[f++];continue}break}if(!e)throw TypeError("Missing parameter name at ".concat(c));b.push({type:"NAME",index:c,value:e}),c=f;continue}if("("===d){var h=1,i="",f=c+1;if("?"===a[f])throw TypeError('Pattern cannot start with "?" at '.concat(f));for(;f<a.length;){if("\\"===a[f]){i+=a[f++]+a[f++];continue}if(")"===a[f]){if(0==--h){f++;break}}else if("("===a[f]&&(h++,"?"!==a[f+1]))throw TypeError("Capturing groups are not allowed at ".concat(f));i+=a[f++]}if(h)throw TypeError("Unbalanced pattern at ".concat(c));if(!i)throw TypeError("Missing pattern at ".concat(c));b.push({type:"PATTERN",index:c,value:i}),c=f;continue}b.push({type:"CHAR",index:c,value:a[c++]})}return b.push({type:"END",index:c,value:""}),b}(a),d=b.prefixes,e=void 0===d?"./":d,f=b.delimiter,g=void 0===f?"/#?":f,h=[],i=0,j=0,k="",l=function(a){if(j<c.length&&c[j].type===a)return c[j++].value},m=function(a){var b=l(a);if(void 0!==b)return b;var d=c[j],e=d.type,f=d.index;throw TypeError("Unexpected ".concat(e," at ").concat(f,", expected ").concat(a))},n=function(){for(var a,b="";a=l("CHAR")||l("ESCAPED_CHAR");)b+=a;return b},o=function(a){for(var b=0;b<g.length;b++){var c=g[b];if(a.indexOf(c)>-1)return!0}return!1},p=function(a){var b=h[h.length-1],c=a||(b&&"string"==typeof b?b:"");if(b&&!c)throw TypeError('Must have text between two parameters, missing text after "'.concat(b.name,'"'));return!c||o(c)?"[^".concat(an(g),"]+?"):"(?:(?!".concat(an(c),")[^").concat(an(g),"])+?")};j<c.length;){var q=l("CHAR"),r=l("NAME"),s=l("PATTERN");if(r||s){var t=q||"";-1===e.indexOf(t)&&(k+=t,t=""),k&&(h.push(k),k=""),h.push({name:r||i++,prefix:t,suffix:"",pattern:s||p(t),modifier:l("MODIFIER")||""});continue}var u=q||l("ESCAPED_CHAR");if(u){k+=u;continue}if(k&&(h.push(k),k=""),l("OPEN")){var t=n(),v=l("NAME")||"",w=l("PATTERN")||"",x=n();m("CLOSE"),h.push({name:v||(w?i++:""),pattern:v&&!w?p(t):w,prefix:t,suffix:x,modifier:l("MODIFIER")||""});continue}m("END")}return h}(b,d),c,d)}(a,c,b),e=c,f=b,void 0===f&&(f={}),g=f.decode,h=void 0===g?function(a){return a}:g,function(a){var b=d.exec(a);if(!b)return!1;for(var c=b[0],f=b.index,g=Object.create(null),i=1;i<b.length;i++)!function(a){if(void 0!==b[a]){var c=e[a-1];"*"===c.modifier||"+"===c.modifier?g[c.name]=b[a].split(c.prefix+c.suffix).map(function(a){return h(a,c)}):g[c.name]=h(b[a],c)}}(i);return{path:c,index:f,params:g}}}catch(a){throw Error(`Invalid path and options: Consult the documentation of path-to-regexp here: https://github.com/pillarjs/path-to-regexp/tree/6.x
${a.message}`)}}catch(b){throw Error(`Invalid pattern "${a}": ${b}`)}}findTarget(a){let b=this.findOrganizationTarget(a);return b||this.findPersonalAccountTarget(a)}findOrganizationTarget(a){if(!this.organizationPattern)return null;try{let b=this.organizationPattern(a.pathname);if(!b||!("params"in b))return null;let c=b.params;if(c.id)return{type:"organization",organizationId:c.id};if(c.slug)return{type:"organization",organizationSlug:c.slug};return null}catch(a){return console.error("Failed to match organization pattern:",a),null}}findPersonalAccountTarget(a){if(!this.personalAccountPattern)return null;try{return this.personalAccountPattern(a.pathname)?{type:"personalAccount"}:null}catch(a){return console.error("Failed to match personal account pattern:",a),null}}};function dI(a,b,c){return bs(a,b)?null:dp({tokenType:"string"==typeof b?b:a,authenticateContext:c,reason:dl})}var dJ=async(a,b)=>{let c=await aE(dv(a),b),d=b.acceptsToken??aC.SessionToken;if(d!==aC.M2MToken&&(aB(c.secretKey),c.isSatellite)){var e=c.signInUrl,f=c.secretKey;if(!e&&(0,m.isDevelopmentFromSecretKey)(f))throw Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite");if(c.signInUrl&&c.origin&&function(a,b){let c;try{c=new URL(a)}catch{throw Error("The signInUrl needs to have a absolute url format.")}if(c.origin===b)throw Error("The signInUrl needs to be on a different origin than your satellite application.")}(c.signInUrl,c.origin),!(c.proxyUrl||c.domain))throw Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}d===aC.M2MToken&&function(a){if(!a.machineSecretKey&&!a.secretKey)throw Error("Machine token authentication requires either a Machine secret key or a Clerk secret key. Ensure a Clerk secret key or Machine secret key is set.")}(c);let g=new dH(b.organizationSyncOptions),h=new dG(c,{organizationSyncOptions:b.organizationSyncOptions},g);async function i(c){if(!b.apiClient)return{data:null,error:{message:"An apiClient is needed to perform token refresh.",cause:{reason:"missing-api-client"}}};let{sessionToken:d,refreshTokenInCookie:e}=c;if(!d)return{data:null,error:{message:"Session token must be provided.",cause:{reason:"missing-session-token"}}};if(!e)return{data:null,error:{message:"Refresh token must be provided.",cause:{reason:"missing-refresh-token"}}};let{data:f,errors:g}=P(d);if(!f||g)return{data:null,error:{message:"Unable to decode the expired session token.",cause:{reason:"expired-session-token-decode-failed",errors:g}}};if(!f?.payload?.sid)return{data:null,error:{message:"Expired session token is missing the `sid` claim.",cause:{reason:"expired-session-token-missing-sid-claim"}}};try{return{data:(await b.apiClient.sessions.refreshSession(f.payload.sid,{format:"cookie",suffixed_cookies:c.usesSuffixedCookies(),expired_token:d||"",refresh_token:e||"",request_origin:c.clerkUrl.origin,request_headers:Object.fromEntries(Array.from(a.headers.entries()).map(([a,b])=>[a,[b]]))})).cookies,error:null}}catch(a){if(!a?.errors?.length)return{data:null,error:{message:"Unexpected Server/BAPI error",cause:{reason:"unexpected-bapi-error",errors:[a]}}};if("unexpected_error"===a.errors[0].code)return{data:null,error:{message:"Fetch unexpected error",cause:{reason:"fetch-error",errors:a.errors}}};return{data:null,error:{message:a.errors[0].code,cause:{reason:a.errors[0].code,errors:a.errors}}}}}async function j(a){let{data:b,error:c}=await i(a);if(!b||0===b.length)return{data:null,error:c};let d=new Headers,e="";b.forEach(a=>{d.append("Set-Cookie",a),dw(a).startsWith(ax.Cookies.Session)&&(e=dx(a))});let{data:f,errors:g}=await dy(e,a);return g?{data:null,error:{message:"Clerk: unable to verify refreshed session token.",cause:{reason:"invalid-session-token",errors:g}}}:{data:{jwtPayload:f,sessionToken:e,headers:d},error:null}}function k(a,b,c,d){if(!h.isRequestEligibleForHandshake())return dp({tokenType:aC.SessionToken,authenticateContext:a,reason:b,message:c});let e=d??h.buildRedirectToHandshake(b);return(e.get(ax.Headers.Location)&&e.set(ax.Headers.CacheControl,"no-store"),h.checkAndTrackRedirectLoop(e))?(console.log("Clerk: Refreshing the session token resulted in an infinite redirect loop. This usually means that your Clerk instance keys do not match - make sure to copy the correct publishable and secret keys from the Clerk dashboard."),dp({tokenType:aC.SessionToken,authenticateContext:a,reason:b,message:c})):function(a,b,c="",d){return dq({status:di.Handshake,reason:b,message:c,publishableKey:a.publishableKey||"",isSatellite:a.isSatellite||!1,domain:a.domain||"",proxyUrl:a.proxyUrl||"",signInUrl:a.signInUrl||"",signUpUrl:a.signUpUrl||"",afterSignInUrl:a.afterSignInUrl||"",afterSignUpUrl:a.afterSignUpUrl||"",isSignedIn:!1,isAuthenticated:!1,tokenType:aC.SessionToken,toAuth:()=>null,headers:d,token:null})}(a,b,c,e)}async function l(){let{tokenInHeader:a}=c;if(bn(a)||bo(a))return dp({tokenType:aC.SessionToken,authenticateContext:c,reason:dl,message:""});try{let{data:b,errors:d}=await dy(a,c);if(d)throw d[0];return dn({tokenType:aC.SessionToken,authenticateContext:c,sessionClaims:b,headers:new Headers,token:a})}catch(a){return o(a,"header")}}async function n(){let a=c.clientUat,b=!!c.sessionTokenInCookie,d=!!c.devBrowserToken;if(c.handshakeNonce||c.handshakeToken)try{return await h.resolveHandshake()}catch(a){a instanceof x&&"development"===c.instanceType?h.handleTokenVerificationErrorInDevelopment(a):console.error("Clerk: unable to resolve handshake:",a)}let e=c.isSatellite&&"document"===c.secFetchDest,f=c.clerkUrl.searchParams.get(ax.QueryParameters.ClerkSynced),i=f===ax.ClerkSyncStatus.NeedsSync,j=f===ax.ClerkSyncStatus.Completed,l=b||a,m=!1===c.satelliteAutoSync&&!l&&!i;if("production"===c.instanceType&&e&&!j){if(m)return dp({tokenType:aC.SessionToken,authenticateContext:c,reason:dk});if(!l||i)return k(c,dj,"")}if("development"===c.instanceType&&e&&!j){if(m)return dp({tokenType:aC.SessionToken,authenticateContext:c,reason:dk});if(!l||i){let a=new URL(c.signInUrl);return a.searchParams.append(ax.QueryParameters.ClerkRedirectUrl,c.clerkUrl.toString()),k(c,dj,"",new Headers({[ax.Headers.Location]:a.toString()}))}}let n=new URL(c.clerkUrl).searchParams.get(ax.QueryParameters.ClerkRedirectUrl);if("development"===c.instanceType&&!c.isSatellite&&n){let a=new URL(n);return c.devBrowserToken&&a.searchParams.append(ax.QueryParameters.DevBrowser,c.devBrowserToken),a.searchParams.set(ax.QueryParameters.ClerkSynced,ax.ClerkSyncStatus.Completed),k(c,"primary-responds-to-syncing","",new Headers({[ax.Headers.Location]:a.toString()}))}if("development"===c.instanceType&&c.clerkUrl.searchParams.has(ax.QueryParameters.DevBrowser))return k(c,"dev-browser-sync","");if("development"===c.instanceType&&!d)return k(c,"dev-browser-missing","");if(!a&&!b)return dp({tokenType:aC.SessionToken,authenticateContext:c,reason:dk});if(!a&&b)return k(c,"session-token-but-no-client-uat","");if(a&&!b)return k(c,"client-uat-but-no-session-token","");let{data:p,errors:q}=P(c.sessionTokenInCookie);if(q)return o(q[0],"cookie");if(p.payload.iat<c.clientUat)return k(c,"session-token-iat-before-client-uat","");try{let{data:a,errors:b}=await dy(c.sessionTokenInCookie,c);if(b)throw b[0];a.azp||console.warn("Clerk: Session token from cookie is missing the azp claim. In a future version of Clerk, this token will be considered invalid. Please contact Clerk support if you see this warning.");let d=dn({tokenType:aC.SessionToken,authenticateContext:c,sessionClaims:a,headers:new Headers,token:c.sessionTokenInCookie});if(!c.isSatellite&&"document"===c.secFetchDest&&c.isCrossOriginReferrer()&&!c.isKnownClerkReferrer()&&0===c.handshakeRedirectLoopCounter)return k(c,"primary-domain-cross-origin-sync","Cross-origin request from satellite domain requires handshake");let e=d.toAuth();if(e.userId){let a=function(a,b){let c=g.findTarget(a.clerkUrl);if(!c)return null;let d=!1;if("organization"===c.type&&(c.organizationSlug&&c.organizationSlug!==b.orgSlug&&(d=!0),c.organizationId&&c.organizationId!==b.orgId&&(d=!0)),"personalAccount"===c.type&&b.orgId&&(d=!0),!d)return null;if(a.handshakeRedirectLoopCounter>=3)return console.warn("Clerk: Organization activation handshake loop detected. This is likely due to an invalid organization ID or slug. Skipping organization activation."),null;let e=k(a,"active-organization-mismatch","");return"handshake"!==e.status?null:e}(c,e);if(a)return a}return d}catch(a){return o(a,"cookie")}}async function o(b,d){let e;if(!(b instanceof x))return dp({tokenType:aC.SessionToken,authenticateContext:c,reason:dm});if(b.reason===v.TokenExpired&&c.refreshTokenInCookie&&"GET"===a.method){let{data:a,error:b}=await j(c);if(a)return dn({tokenType:aC.SessionToken,authenticateContext:c,sessionClaims:a.jwtPayload,headers:a.headers,token:a.sessionToken});e=b?.cause?.reason?b.cause.reason:"unexpected-sdk-error"}else e="GET"!==a.method?"non-eligible-non-get":c.refreshTokenInCookie?null:"non-eligible-no-refresh-cookie";return(b.tokenCarrier=d,[v.TokenExpired,v.TokenNotActiveYet,v.TokenIatInTheFuture].includes(b.reason))?k(c,dL({tokenError:b.reason,refreshError:e}),b.getFullMessage()):dp({tokenType:aC.SessionToken,authenticateContext:c,reason:b.reason,message:b.getFullMessage()})}function p(a,b){return b instanceof z?dp({tokenType:a,authenticateContext:c,reason:b.code,message:b.getFullMessage()}):dp({tokenType:a,authenticateContext:c,reason:dm})}async function q(){let{tokenInHeader:a}=c;if(!a)return o(Error("Missing token in header"),"header");if(!bq(a))return dp({tokenType:d,authenticateContext:c,reason:dl,message:""});let b=dI(br(a),d,c);if(b)return b;let{data:e,tokenType:f,errors:g}=await dD(a,c);return g?p(f,g[0]):dn({tokenType:f,authenticateContext:c,machineData:e,token:a})}async function r(){let{tokenInHeader:a}=c;if(!a)return o(Error("Missing token in header"),"header");if(bq(a)){let b=dI(br(a),d,c);if(b)return b;let{data:e,tokenType:f,errors:g}=await dD(a,c);return g?p(f,g[0]):dn({tokenType:f,authenticateContext:c,machineData:e,token:a})}let{data:b,errors:e}=await dy(a,c);return e?o(e[0],"header"):dn({tokenType:aC.SessionToken,authenticateContext:c,sessionClaims:b,token:a})}if(Array.isArray(d)&&!function(a,b){let c=null,{tokenInHeader:d}=b;return d&&(c=bq(d)?br(d):aC.SessionToken),bs(c??aC.SessionToken,a)}(d,c)){let a;return a=dg(),dq({status:di.SignedOut,reason:dl,message:"",proxyUrl:"",publishableKey:"",isSatellite:!1,domain:"",signInUrl:"",signUpUrl:"",afterSignInUrl:"",afterSignUpUrl:"",isSignedIn:!1,isAuthenticated:!1,tokenType:null,toAuth:()=>a,headers:new Headers,token:null})}return c.tokenInHeader?"any"===d||Array.isArray(d)?r():d===aC.SessionToken?l():q():d===aC.OAuthToken||d===aC.ApiKey||d===aC.M2MToken?dp({tokenType:d,authenticateContext:c,reason:"No token in header"}):n()},dK=a=>{let{isSignedIn:b,isAuthenticated:c,proxyUrl:d,reason:e,message:f,publishableKey:g,isSatellite:h,domain:i}=a;return{isSignedIn:b,isAuthenticated:c,proxyUrl:d,reason:e,message:f,publishableKey:g,isSatellite:h,domain:i}},dL=({tokenError:a,refreshError:b})=>{switch(a){case v.TokenExpired:return`session-token-expired-refresh-${b}`;case v.TokenNotActiveYet:return"session-token-nbf";case v.TokenIatInTheFuture:return"session-token-iat-in-the-future";default:return dm}},dM={secretKey:"",machineSecretKey:"",jwtKey:"",apiUrl:void 0,apiVersion:void 0,proxyUrl:"",publishableKey:"",isSatellite:!1,domain:"",audience:""},dN=async(a,b,c)=>{let{loadSession:d,loadUser:e,loadOrganization:f}=c||{},{userId:g,sessionId:h,orgId:i}=b,{sessions:j,users:k,organizations:l}=da({...c}),[m,n,o]=await Promise.all([d&&h?j.getSession(h):Promise.resolve(void 0),e&&g?k.getUser(g):Promise.resolve(void 0),f&&i?l.getOrganization({organizationId:i}):Promise.resolve(void 0)]);return Object.assign(a,dO({session:m,user:n,organization:o}))};function dO(a){let b=a.user?{...a.user}:a.user,c=a.organization?{...a.organization}:a.organization;return dP(b),dP(c),{...a,user:b,organization:c}}function dP(a){return a&&("privateMetadata"in a&&delete a.privateMetadata,"private_metadata"in a&&delete a.private_metadata),a}a.s(["AuthStatus",0,di,"TokenType",0,aC,"authenticatedMachineObject",0,de,"constants",0,ax,"createAuthenticateRequest",0,function(a){let b=aA(dM,a.options),c=a.apiClient;return{authenticateRequest:(a,d={})=>{let{apiUrl:e,apiVersion:f}=b,g=aA(b,d);return dJ(a,{...d,...g,apiUrl:e,apiVersion:f,apiClient:c})},debugRequestState:dK}},"createBackendApiClient",0,da,"createClerkRequest",0,dv,"createRedirect",0,a=>{let{publishableKey:b,redirectAdapter:c,signInUrl:d,signUpUrl:e,baseUrl:f,sessionStatus:g,isSatellite:h}=a,i=(0,n.parsePublishableKey)(b),j=i?.frontendApi,k=i?.instanceType==="development",l=_(j),m="pending"===g,o=(b,{returnBackUrl:d})=>c(ay(f,`${b}/tasks`,d,k?a.devBrowserToken:null,h));return{redirectToSignUp:({returnBackUrl:b}={})=>{e||l||r.throwMissingPublishableKeyError();let g=`${l}/sign-up`,i=e||function(a){if(!a)return;let b=new URL(a,f);return b.pathname=`${b.pathname}/create`,b.toString()}(d)||g;return m?o(i,{returnBackUrl:b}):c(ay(f,i,b,k?a.devBrowserToken:null,h))},redirectToSignIn:({returnBackUrl:b}={})=>{d||l||r.throwMissingPublishableKeyError();let e=`${l}/sign-in`,g=d||e;return m?o(g,{returnBackUrl:b}):c(ay(f,g,b,k?a.devBrowserToken:null,h))}}},"debugRequestState",0,dK,"decorateObjectWithResources",0,dN,"getAuthObjectForAcceptedToken",0,({authObject:a,acceptsToken:b=aC.SessionToken})=>{if("any"===b)return a;if(Array.isArray(b))return bs(a.tokenType,b)?a:dg();if(!bs(a.tokenType,b))return bt.has(b)?df(b,a.debug):dd(a.debug);return a},"getAuthObjectFromJwt",0,(a,{treatPendingAsSignedOut:b=!0,...c})=>{let d=dc(c,a.raw.text,a.payload);return b&&"pending"===d.sessionStatus?dd(c,d.sessionStatus):d},"invalidTokenAuthObject",0,dg,"isMachineToken",0,bq,"isMachineTokenByPrefix",0,bp,"isTokenTypeAccepted",0,bs,"makeAuthObjectSerializable",0,a=>{let{debug:b,getToken:c,has:d,...e}=a;return e},"signedInAuthObject",0,dc,"signedOutAuthObject",0,dd,"stripPrivateDataFromObject",0,dO,"unauthenticatedMachineObject",0,df,"verifyMachineAuthToken",0,dD,"verifyToken",0,dy],47072)},57110,a=>{"use strict";a.s(["withLegacyReturn",0,function(a){return async(...b)=>{let{data:c,errors:d}=await a(...b);if(d)throw d[0];return c}},"withLegacySyncReturn",0,function(a){return(...b)=>{let{data:c,errors:d}=a(...b);if(d)throw d[0];return c}}])},47966,a=>{"use strict";var b=a.i(22555),c=a.i(3891);a.s(["apiUrlFromPublishableKey",0,a=>{let d=(0,c.u)(a)?.frontendApi;return d?.startsWith("clerk.")&&b.i.some(a=>d?.endsWith(a))?b.c:b.o.some(a=>d?.endsWith(a))?b.a:b.d.some(a=>d?.endsWith(a))?b.u:b.c}])},39899,a=>{"use strict";let b=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;function c(a){return a?a.replace(/([-_][a-z])/g,a=>a.toUpperCase().replace(/-|_/,"")):""}function d(a){return a?a.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`):""}let e=a=>{let b=c=>{if(!c)return c;if(Array.isArray(c))return c.map(a=>"object"==typeof a||Array.isArray(a)?b(a):a);let d={...c};for(let c of Object.keys(d)){let e=a(c.toString());e!==c&&(d[e]=d[c],delete d[c]),"object"==typeof d[e]&&(d[e]=b(d[e]))}return d};return b},f=e(d),g=e(c);a.s(["a",0,function(a){return b.test(a||"")},"c",0,function(a){let b=a||"";return b.charAt(0).toUpperCase()+b.slice(1)},"i",0,function(a){return Object.entries(a).reduce((a,[b,c])=>(void 0!==c&&(a[b]=c),a),{})},"l",0,a=>{if(0==a.length)return"";if(1==a.length)return a[0];let b=a.slice(0,-1).join(", ");return b+`, or ${a.slice(-1)}`},"n",0,f,"o",0,function(a){if("boolean"==typeof a)return a;if(null==a)return!1;if("string"==typeof a){if("true"===a.toLowerCase())return!0;if("false"===a.toLowerCase())return!1}let b=parseInt(a,10);return!isNaN(b)&&b>0},"r",0,g,"s",0,c,"t",0,d])},82849,36401,11286,a=>{"use strict";var b=a.i(47966),c=a.i(39899);a.s([],36401);var d=c;a.s(["isTruthy",()=>d.o],11286);var d=c;process.env.NEXT_PUBLIC_CLERK_JS_VERSION,process.env.NEXT_PUBLIC_CLERK_JS_URL,process.env.NEXT_PUBLIC_CLERK_UI_URL,process.env.NEXT_PUBLIC_CLERK_UI_VERSION;let e=process.env.CLERK_API_VERSION||"v1",f=process.env.CLERK_SECRET_KEY||"",g=process.env.CLERK_MACHINE_SECRET_KEY||"",h="pk_live_Y2xlcmsuYWl5YXJkLm5ldCQ",i=process.env.CLERK_ENCRYPTION_KEY||"",j=process.env.CLERK_API_URL||(0,b.apiUrlFromPublishableKey)(h),k=process.env.NEXT_PUBLIC_CLERK_DOMAIN||"",l=process.env.NEXT_PUBLIC_CLERK_PROXY_URL||"",m=(0,d.o)(process.env.NEXT_PUBLIC_CLERK_IS_SATELLITE)||!1,n=process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL||"",o=process.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL||"",p=(0,d.o)(process.env.NEXT_PUBLIC_CLERK_TELEMETRY_DISABLED),q=(0,d.o)(process.env.NEXT_PUBLIC_CLERK_TELEMETRY_DEBUG),r=(0,d.o)(process.env.NEXT_PUBLIC_CLERK_KEYLESS_DISABLED)||!1;a.s(["API_URL",0,j,"API_VERSION",0,e,"DOMAIN",0,k,"ENCRYPTION_KEY",0,i,"IS_SATELLITE",0,m,"KEYLESS_DISABLED",0,r,"MACHINE_SECRET_KEY",0,g,"PROXY_URL",0,l,"PUBLISHABLE_KEY",0,h,"SDK_METADATA",0,{name:"@clerk/nextjs",version:"7.0.5",environment:"production"},"SECRET_KEY",0,f,"SIGN_IN_URL",0,n,"SIGN_UP_URL",0,o,"TELEMETRY_DEBUG",0,q,"TELEMETRY_DISABLED",0,p],82849)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0nt9x7p._.js.map