module.exports=[59134,a=>{"use strict";a.s(["n",0,()=>{try{return!0}catch{}return!1},"r",0,()=>!1,"t",0,()=>!1])},95430,a=>{"use strict";var b=a.i(59134);function c(){if((0,b.t)())return globalThis.__clerk_internal_keyless_logger||(globalThis.__clerk_internal_keyless_logger={__cache:new Map,log:function({cacheKey:a,msg:b}){this.__cache.has(a)&&Date.now()<(this.__cache.get(a)?.expiresAt||0)||(console.log(b),this.__cache.set(a,{expiresAt:Date.now()+6e5}))},run:async function(a,{cacheKey:b,onSuccessStale:c=6e5,onErrorStale:d=6e5}){if(this.__cache.has(b)&&Date.now()<(this.__cache.get(b)?.expiresAt||0))return this.__cache.get(b)?.data;try{let d=await a();return this.__cache.set(b,{expiresAt:Date.now()+c,data:d}),d}catch(a){throw this.__cache.set(b,{expiresAt:Date.now()+d}),a}}}),globalThis.__clerk_internal_keyless_logger}function d(a){return`
\x1b[35m
[Clerk]:\x1b[0m You are running in keyless mode.
You can \x1b[35mclaim your keys\x1b[0m by visiting ${a.claimUrl}
`}function e(){return`
\x1b[35m
[Clerk]:\x1b[0m Your application is running with your claimed keys.
You can safely remove the \x1b[35m.clerk/\x1b[0m from your project.
`}let f=c(),g=".clerk";function h(a,b){let c=new Headers;return a&&c.set("Clerk-Framework",a),b&&c.set("Clerk-Framework-Version",b),c}a.s(["clerkDevelopmentCache",0,f,"createClerkDevCache",0,c,"createConfirmationMessage",0,e,"createKeylessModeMessage",0,d,"createKeylessService",0,function(a){let{storage:b,api:c,framework:g,frameworkVersion:i}=a,j=!1,k=()=>{try{let a=b.read();if(!a)return;return JSON.parse(a)}catch{return}};return{async getOrCreateKeys(){let a=k();if(a?.publishableKey&&a?.secretKey)return a;let d=h(g,i),e=await c.createAccountlessApplication(d);return e&&b.write(JSON.stringify(e)),e},readKeys:()=>k(),removeKeys(){b.remove()},async completeOnboarding(){let a=h(g,i);return c.completeOnboarding(a)},logKeylessMessage(a){j||(j=!0,console.log(`[Clerk]: Running in keyless mode. Claim your keys at: ${a}`))},async resolveKeysWithKeylessFallback(a,b){let c,g,h=a,i=b;try{let b=k();if(a&&a===b?.publishableKey&&b){try{await f?.run(()=>this.completeOnboarding(),{cacheKey:`${b.publishableKey}_complete`,onSuccessStale:864e5})}catch{}return f?.log({cacheKey:`${b.publishableKey}_claimed`,msg:e()}),{publishableKey:h,secretKey:i,claimUrl:c,apiKeysUrl:g}}if(!h&&!i){let a=await this.getOrCreateKeys();a&&(h=a.publishableKey,i=a.secretKey,c=a.claimUrl,g=a.apiKeysUrl,f?.log({cacheKey:a.publishableKey,msg:d(a)}))}}catch{}return{publishableKey:h,secretKey:i,claimUrl:c,apiKeysUrl:g}}}},"createNodeFileStorage",0,function(a,b,c={}){let{cwd:d=()=>process.cwd(),frameworkPackageName:e="@clerk/shared"}=c,f=!1,h=()=>b.join(d(),g),i=()=>b.join(h(),".tmp"),j=()=>b.join(i(),"keyless.json"),k=()=>b.join(d(),"clerk.lock"),l=()=>{if(f||a.existsSync(k()))return!1;f=!0;try{return a.writeFileSync(k(),"This file can be deleted if your app is stuck.",{encoding:"utf8",mode:420}),!0}catch{return f=!1,!1}},m=()=>{f=!1;try{a.existsSync(k())&&a.rmSync(k(),{force:!0})}catch{}};return{read(){try{if(!a.existsSync(j()))return"";return a.readFileSync(j(),{encoding:"utf-8"})}catch{return""}},write(c){if(l())try{let f,h,k,l;f=i(),a.existsSync(f)||a.mkdirSync(f,{recursive:!0}),h=b.join(d(),".gitignore"),k=`/${g}/`,a.existsSync(h)||a.writeFileSync(h,"",{encoding:"utf8",mode:420}),a.readFileSync(h,{encoding:"utf-8"}).includes(k)||a.appendFileSync(h,`
# clerk configuration (can include secrets)
${k}
`),l=`## DO NOT COMMIT
This directory is auto-generated from \`${e}\` because you are running in Keyless mode.
Avoid committing the \`.clerk/\` directory as it includes the secret key of the unclaimed instance.
`,a.writeFileSync(b.join(i(),"README.md"),l,{encoding:"utf8",mode:384}),a.writeFileSync(j(),c,{encoding:"utf8",mode:384})}finally{m()}},remove(){if(l())try{a.existsSync(h())&&a.rmSync(h(),{recursive:!0,force:!0})}finally{m()}}}}])},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},82943,a=>{"use strict";let b,c;var d=Object.getOwnPropertyNames;let e=(b={"src/runtime/node/safe-node-apis.js"(b,c){let{existsSync:d,writeFileSync:e,readFileSync:f,appendFileSync:g,mkdirSync:h,rmSync:i}=a.r(2157);c.exports={fs:{existsSync:d,writeFileSync:e,readFileSync:f,appendFileSync:g,mkdirSync:h,rmSync:i},path:a.r(50227),cwd:()=>process.cwd()}}},function(){return c||(0,b[d(b)[0]])((c={exports:{}}).exports,c),c.exports})();function f(a,b){if(!a)throw Error(`Clerk: ${b} is missing. This is an internal error. Please contact Clerk's support.`)}a.s(["nodeCwdOrThrow",0,()=>(f(e.cwd,"cwd"),e.cwd),"nodeFsOrThrow",0,()=>(f(e.fs,"fs"),e.fs),"nodePathOrThrow",0,()=>(f(e.path,"path"),e.path)],82943)},488,a=>{"use strict";var b=a.i(95430),c=a.i(47072);a.i(79378);var d=a.i(57110);a.i(11910),a.i(61675);var e=a.i(39899),f=a.i(3891),g=class{#a;#b=864e5;constructor(a){this.#a=a}isEventThrottled(a){let b=Date.now(),c=this.#c(a),d=this.#a.getItem(c);return!!d&&!(b-d>this.#b)||(this.#a.setItem(c,b),!1)}#c(a){let{sk:b,pk:c,payload:d,...e}=a,f={...d,...e};return JSON.stringify(Object.keys({...d,...e}).sort().map(a=>f[a]))}},h=class{#d="clerk_telemetry_throttler";getItem(a){return this.#e()[a]}setItem(a,b){try{let c=this.#e();c[a]=b,localStorage.setItem(this.#d,JSON.stringify(c))}catch(a){a instanceof DOMException&&("QuotaExceededError"===a.name||"NS_ERROR_DOM_QUOTA_REACHED"===a.name)&&localStorage.length>0&&localStorage.removeItem(this.#d)}}removeItem(a){try{let b=this.#e();delete b[a],localStorage.setItem(this.#d,JSON.stringify(b))}catch{}}#e(){try{let a=localStorage.getItem(this.#d);if(!a)return{};return JSON.parse(a)}catch{return{}}}static isSupported(){return!1}},i=class{#a=new Map;#f=1e4;getItem(a){return this.#a.size>this.#f?void this.#a.clear():this.#a.get(a)}setItem(a,b){this.#a.set(a,b)}removeItem(a){this.#a.delete(a)}};let j=new Set(["error","warn","info","debug","trace"]);var k=class{#g;#h;#i={};#j=[];#k=null;constructor(a){this.#g={maxBufferSize:a.maxBufferSize??5,samplingRate:a.samplingRate??1,perEventSampling:a.perEventSampling??!0,disabled:a.disabled??!1,debug:a.debug??!1,endpoint:"https://clerk-telemetry.com"},a.clerkVersion?this.#i.clerkVersion=a.clerkVersion??"":this.#i.clerkVersion="",this.#i.sdk=a.sdk,this.#i.sdkVersion=a.sdkVersion,this.#i.publishableKey=a.publishableKey??"";const b=(0,f.u)(a.publishableKey);b&&(this.#i.instanceType=b.instanceType),a.secretKey&&(this.#i.secretKey=a.secretKey.substring(0,16)),this.#h=new g(h.isSupported()?new h:new i)}get isEnabled(){return!("development"!==this.#i.instanceType||this.#g.disabled||"u">typeof process&&process.env&&(0,e.o)(process.env.CLERK_TELEMETRY_DISABLED))}get isDebug(){return this.#g.debug||"u">typeof process&&process.env&&(0,e.o)(process.env.CLERK_TELEMETRY_DEBUG)}record(a){try{let b=this.#l(a.event,a.payload);if(this.#m(b.event,b),!this.#n(b,a.eventSamplingRate))return;this.#j.push({kind:"event",value:b}),this.#o()}catch(a){console.error("[clerk/telemetry] Error recording telemetry event",a)}}recordLog(a){try{if(!this.#p(a))return;let b="string"==typeof a?.level&&j.has(a.level),c="string"==typeof a?.message&&a.message.trim().length>0,d=null,e=a?.timestamp;if("number"==typeof e||"string"==typeof e){let a=new Date(e);Number.isNaN(a.getTime())||(d=a)}if(!b||!c||null===d){this.isDebug&&"u">typeof console&&console.warn("[clerk/telemetry] Dropping invalid telemetry log entry",{levelIsValid:b,messageIsValid:c,timestampIsValid:null!==d});return}let f=this.#q(),g={sdk:f.name,sdkv:f.version,cv:this.#i.clerkVersion??"",lvl:a.level,msg:a.message,ts:d.toISOString(),pk:this.#i.publishableKey||null,payload:this.#r(a.context)};this.#j.push({kind:"log",value:g}),this.#o()}catch(a){console.error("[clerk/telemetry] Error recording telemetry log entry",a)}}#n(a,b){return this.isEnabled&&!this.isDebug&&this.#s(a,b)}#p(a){return!0}#s(a,b){let c=Math.random();return!!(c<=this.#g.samplingRate&&(!1===this.#g.perEventSampling||void 0===b||c<=b))&&!this.#h.isEventThrottled(a)}#o(){this.#t()}#t(){let a=[...this.#j];if(this.#j=[],this.#k=null,0===a.length)return;let b=a.filter(a=>"event"===a.kind).map(a=>a.value),c=a.filter(a=>"log"===a.kind).map(a=>a.value);b.length>0&&fetch(new URL("/v1/event",this.#g.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({events:b})}).catch(()=>void 0),c.length>0&&fetch(new URL("/v1/logs",this.#g.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({logs:c})}).catch(()=>void 0)}#m(a,b){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",a),console.log(b),console.groupEnd()):console.log("[clerk/telemetry]",a,b))}#q(){return{name:this.#i.sdk,version:this.#i.sdkVersion}}#l(a,b){let c=this.#q();return{event:a,cv:this.#i.clerkVersion??"",it:this.#i.instanceType??"",sdk:c.name,sdkv:c.version,...this.#i.publishableKey?{pk:this.#i.publishableKey}:{},...this.#i.secretKey?{sk:this.#i.secretKey}:{},payload:b}}#r(a){if(null==a||"object"!=typeof a)return null;try{let b=JSON.parse(JSON.stringify(a));if(b&&"object"==typeof b&&!Array.isArray(b))return b;return null}catch{return null}}};(0,d.withLegacyReturn)(c.verifyToken);var l=a.i(82849);let m={secretKey:l.SECRET_KEY,publishableKey:l.PUBLISHABLE_KEY,apiUrl:l.API_URL,apiVersion:l.API_VERSION,userAgent:"@clerk/nextjs@7.0.5",proxyUrl:l.PROXY_URL,domain:l.DOMAIN,isSatellite:l.IS_SATELLITE,machineSecretKey:l.MACHINE_SECRET_KEY,sdkMetadata:l.SDK_METADATA,telemetry:{disabled:l.TELEMETRY_DISABLED,debug:l.TELEMETRY_DEBUG}};var n=a.i(82943);let o=null;a.s(["keyless",0,function(){if(!o){var a;let d,e,f,g,h,i,j,l=(a={},d={...m,...a},e=(0,c.createBackendApiClient)(d),f=(0,c.createAuthenticateRequest)({options:d,apiClient:e}),g=new k({publishableKey:d.publishableKey,secretKey:d.secretKey,samplingRate:.1,...d.sdkMetadata?{sdk:d.sdkMetadata.name,sdkVersion:d.sdkMetadata.version}:{},...d.telemetry||{}}),{...e,...f,telemetry:g});o=(0,b.createKeylessService)({storage:(h=(0,n.nodeFsOrThrow)(),i=(0,n.nodePathOrThrow)(),j=(0,n.nodeCwdOrThrow)(),(0,b.createNodeFileStorage)(h,i,{cwd:j,frameworkPackageName:"@clerk/nextjs"})),api:{async createAccountlessApplication(a){try{return await l.__experimental_accountlessApplications.createAccountlessApplication({requestHeaders:a})}catch{return null}},async completeOnboarding(a){try{return await l.__experimental_accountlessApplications.completeAccountlessApplicationOnboarding({requestHeaders:a})}catch{return null}}},framework:"nextjs"})}return o}],488)}];

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