@madarco/agentbox 0.27.1 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/{_cloud-attach-WDGM6FL5.js → _cloud-attach-FVD5YJCE.js} +6 -4
- package/dist/{chunk-NEF6MDJO.js → chunk-2PCU4OF5.js} +4 -4
- package/dist/{chunk-JE6UI5YR.js → chunk-47BVC7FN.js} +7 -59
- package/dist/chunk-47BVC7FN.js.map +1 -0
- package/dist/chunk-5ZK5MQA2.js +64 -0
- package/dist/chunk-5ZK5MQA2.js.map +1 -0
- package/dist/{chunk-26IKZRTT.js → chunk-A4OVGMVL.js} +23 -16
- package/dist/chunk-A4OVGMVL.js.map +1 -0
- package/dist/{chunk-KWOEUFVA.js → chunk-EZWPCTUO.js} +2 -2
- package/dist/{chunk-IDH5A4RR.js → chunk-F6NQZ4DC.js} +2 -2
- package/dist/chunk-IMN62QY5.js +285 -0
- package/dist/chunk-IMN62QY5.js.map +1 -0
- package/dist/{chunk-V5XXJH63.js → chunk-JNFUWQ4N.js} +2 -2
- package/dist/{chunk-UJEH2NJT.js → chunk-JRXNVEV3.js} +2 -271
- package/dist/chunk-JRXNVEV3.js.map +1 -0
- package/dist/{chunk-LL7NCMUU.js → chunk-QAJQXZ3N.js} +3 -3
- package/dist/{chunk-SJ75AIA2.js → chunk-QJT2XOKH.js} +8 -6
- package/dist/{chunk-SJ75AIA2.js.map → chunk-QJT2XOKH.js.map} +1 -1
- package/dist/{chunk-HR7NHH5J.js → chunk-RK2CEABS.js} +205 -5
- package/dist/{chunk-HR7NHH5J.js.map → chunk-RK2CEABS.js.map} +1 -1
- package/dist/cloud-backends.js +28 -0
- package/dist/cloud-backends.js.map +1 -0
- package/dist/{dist-O3LKOIE7.js → dist-2SXD3ITR.js} +6 -5
- package/dist/{dist-O3LKOIE7.js.map → dist-2SXD3ITR.js.map} +1 -1
- package/dist/{dist-FTKS2GI4.js → dist-4KTWNGU6.js} +6 -5
- package/dist/{dist-WVYAURMF.js → dist-6ZOCQZIP.js} +6 -5
- package/dist/{dist-OO52HARR.js → dist-7VCYREHM.js} +22 -20
- package/dist/{dist-KQTMCVME.js → dist-TL4YW7KZ.js} +6 -5
- package/dist/{dist-KQTMCVME.js.map → dist-TL4YW7KZ.js.map} +1 -1
- package/dist/{dist-TSFVB7AI.js → dist-UUOX4DBX.js} +6 -5
- package/dist/{dist-TSFVB7AI.js.map → dist-UUOX4DBX.js.map} +1 -1
- package/dist/dist-XSEK7LX3.js +156 -0
- package/dist/{dist-Z6L5MM5D.js → dist-YGXQMN2K.js} +6 -5
- package/dist/index.js +58 -54
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-75DIZ55S-TNJXWMXV.js → prepared-state-75DIZ55S-B33TDOJZ.js} +3 -2
- package/dist/prepared-state-75DIZ55S-B33TDOJZ.js.map +1 -0
- package/package.json +1 -1
- package/runtime/_shared/ctl.cjs +186 -172
- package/runtime/digitalocean/ctl.cjs +186 -172
- package/runtime/docker/packages/ctl/dist/bin.cjs +186 -172
- package/runtime/e2b/ctl.cjs +186 -172
- package/runtime/hetzner/ctl.cjs +186 -172
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/prerender-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/server-reference-manifest.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +12 -12
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +11 -11
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +8 -8
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/151__@better-auth_core_dist_0ecdp_3._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04h15ml._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04jgk9x._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07ednlo._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0a7djvw._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ig1bot._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0szd4sh._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t7o5ed._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1e4z_-v._.js → [root-of-the-server]__11izd5j._.js} +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13ioh5z._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13jwk_k._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16_uteg._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16p2m-g._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1_gu2yk._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ai-945._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bu2zio._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ctczev._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f2sueq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f9zctr._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1md9kdw._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1mttufy._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1pp5oib._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qwhzmi._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1xeczo7._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__20503l7._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/packages_relay_dist_control-plane_03a-9aj.js +3 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_03s-ah2._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0kpdmm-._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r4px38._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_18w2zeh._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_approvals_page_actions_1mi0bpn.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/packages_relay_dist_control-plane_0ve-wz4.js +1 -1
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +18 -18
- package/runtime/hub/apps/hub/.next/static/chunks/{30de2x24ntwkg.js → 1-maeq_pl3z29.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{2gfw8-qyx5xi_.js → 1f-pwhlfklk8h.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{3tqnniym2yvpb.js → 1g922r_mc5ciw.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{070w7h5rh5ja6.js → 2k1tvmngrtdgs.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{3e5n630psqst8.js → 2omimeqtc8qnp.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/{2awpm9w8crker.js → 3urpddxa8b_je.js} +1 -1
- package/runtime/hub/apps/hub/{chunk-YJ5MJOXK.js → chunk-5ARPIPV4.js} +194 -171
- package/runtime/hub/apps/hub/{chunk-EHBJKZCL.js → chunk-AEIOQFZ4.js} +245 -2
- package/runtime/hub/apps/hub/dist-2EOAT3PC.js +155 -0
- package/runtime/hub/apps/hub/{dist-LYDHYTP2.js → dist-DQIL673Y.js} +2 -2
- package/runtime/hub/apps/hub/{dist-GTVVXCBP.js → dist-EURE7AUA.js} +2 -2
- package/runtime/hub/apps/hub/{dist-JG45OFT2.js → dist-EYHD64SR.js} +16 -16
- package/runtime/hub/apps/hub/{dist-G6TXUSPZ.js → dist-GFXXCXLS.js} +2 -2
- package/runtime/hub/apps/hub/{dist-DX6IYMAH.js → dist-IVA2PC7N.js} +2 -2
- package/runtime/hub/apps/hub/{dist-6FPPUSWZ.js → dist-MMTT7VYJ.js} +1 -1
- package/runtime/hub/apps/hub/{dist-3I7KUI6W.js → dist-TAWVTJGU.js} +2 -2
- package/runtime/hub/apps/hub/server.js +28 -15
- package/runtime/relay/bin.cjs +37 -3
- package/runtime/vercel/ctl.cjs +186 -172
- package/dist/chunk-26IKZRTT.js.map +0 -1
- package/dist/chunk-JE6UI5YR.js.map +0 -1
- package/dist/chunk-UJEH2NJT.js.map +0 -1
- /package/dist/{_cloud-attach-WDGM6FL5.js.map → _cloud-attach-FVD5YJCE.js.map} +0 -0
- /package/dist/{chunk-NEF6MDJO.js.map → chunk-2PCU4OF5.js.map} +0 -0
- /package/dist/{chunk-KWOEUFVA.js.map → chunk-EZWPCTUO.js.map} +0 -0
- /package/dist/{chunk-IDH5A4RR.js.map → chunk-F6NQZ4DC.js.map} +0 -0
- /package/dist/{chunk-V5XXJH63.js.map → chunk-JNFUWQ4N.js.map} +0 -0
- /package/dist/{chunk-LL7NCMUU.js.map → chunk-QAJQXZ3N.js.map} +0 -0
- /package/dist/{dist-FTKS2GI4.js.map → dist-4KTWNGU6.js.map} +0 -0
- /package/dist/{dist-OO52HARR.js.map → dist-6ZOCQZIP.js.map} +0 -0
- /package/dist/{dist-WVYAURMF.js.map → dist-7VCYREHM.js.map} +0 -0
- /package/dist/{dist-Z6L5MM5D.js.map → dist-XSEK7LX3.js.map} +0 -0
- /package/dist/{prepared-state-75DIZ55S-TNJXWMXV.js.map → dist-YGXQMN2K.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → Wddru2A-5szSWhZWYoMwi}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → Wddru2A-5szSWhZWYoMwi}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{PWF2iHQOg9-rRyfqVDLrh → Wddru2A-5szSWhZWYoMwi}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[10469,69772,e=>{"use strict";let t=Symbol.for("better-auth:global"),r=null,n={},a="1.6.23";function i(){return globalThis[t]||(globalThis[t]={version:a,epoch:1,context:n},r=globalThis[t]),(r=globalThis[t]).version!==a&&(r.version=a,r.epoch++),globalThis[t]}e.s(["__getBetterAuthGlobal",0,i,"getBetterAuthVersion",0,function(){return i().version}],10469);let o=import("node:async_hooks").then(e=>e.AsyncLocalStorage).catch(e=>{if("AsyncLocalStorage"in globalThis)return globalThis.AsyncLocalStorage;throw console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected."),console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler"),console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag"),e});async function s(){let e=await o;if(null!==e)return e;throw Error("getAsyncLocalStorage is only available in server code")}e.s(["getAsyncLocalStorage",0,s],69772)},36004,33763,58461,43651,56958,76422,80527,e=>{"use strict";let t=Object.fromEntries(Object.entries({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CHANGE_EMAIL_DISABLED:"Change email is disabled",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"}).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]));function r(e){let t=e.split("\n at ");return t.length<=1?e:(t.splice(1,1),t.join("\n at "))}function n(e,t){class n extends e{#e;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){const t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);const t=Error().stack;t&&(this.#e=r(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0}),n}e.s(["BASE_ERROR_CODES",0,t],33763);let a={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};var i=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:a[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}},o=class extends i{constructor(e,t){super(400,{message:e,code:"VALIDATION_ERROR"}),this.message=e,this.issues=t,this.issues=t}},s=class extends Error{constructor(e){super(e),this.name="BetterCallError"}};let d=Symbol.for("better-call:api-error-headers"),l=n(i,Error);e.s(["APIError",0,l,"BetterCallError",0,s,"ValidationError",0,o,"hideInternalStackFrames",0,r,"kAPIErrorHeaderSymbol",0,d,"makeErrorForHideStackFrame",0,n,"statusCodes",0,a],58461);var u=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}},c=class e extends l{constructor(...e){super(...e)}static fromStatus(t,r){return new e(t,r)}static from(t,r){return new e(t,{message:r.message,code:r.code})}};e.s(["APIError",0,c,"BetterAuthError",0,u],36004),e.s(["getAuthTables",0,e=>{let t=(e.plugins??[]).reduce((e,t)=>{let r=t.schema;if(!r)return e;for(let[t,n]of Object.entries(r))e[t]={fields:{...e[t]?.fields,...n.fields},modelName:n.modelName||t,disableMigrations:n.disableMigration??e[t]?.disableMigrations};return e},{}),r=e.rateLimit?.storage==="database",n={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",unique:!0,required:!0,fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",required:!0,fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",bigint:!0,required:!0,fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest",defaultValue:()=>Date.now()}}}},{user:a,session:i,account:o,verification:s,...d}=t,l={verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier",index:!0},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!0,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,defaultValue:()=>new Date,onUpdate:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"},...s?.fields,...e.verification?.additionalFields},order:4}},u={session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,index:!0},...i?.fields,...e.session?.additionalFields},order:2}};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name",sortable:!0},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email",sortable:!0},emailVerified:{type:"boolean",defaultValue:!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified",input:!1},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,onUpdate:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...a?.fields,...e.user?.additionalFields},order:1},...!e.secondaryStorage||e.session?.storeSessionInDatabase?u:{},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId",index:!0},accessToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.refreshTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},...o?.fields,...e.account?.additionalFields},order:3},...!e.secondaryStorage||e.verification?.storeInDatabase?l:{},...d,...r?n:{}}}],43651);let f=Object.create(null),m=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?f:globalThis),p=new Proxy(f,{get:(e,t)=>m()[t]??f[t],has:(e,t)=>t in m()||t in f,set:(e,t,r)=>(m(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=m(!0);return delete r[t],!0},ownKeys:()=>Object.keys(m(!0))}),E=p.NODE_ENV??"";function O(e,t){return"u">typeof process&&process.env?process.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}let T=Object.freeze({get BETTER_AUTH_SECRET(){return O("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return O("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return O("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return O("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return O("NODE_ENV","development")},get PACKAGE_VERSION(){return O("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return O("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});e.s(["ENV",0,T,"env",0,p,"getBooleanEnvVar",0,function(e,t=!0){let r=O(e);return r?"0"!==r&&"false"!==r.toLowerCase()&&""!==r:t},"getEnvVar",0,O,"isDevelopment",0,()=>"dev"===E||"development"===E,"isProduction",0,"production"===E,"isTest",0,()=>{var e;return"test"===E||!!(e=p.TEST)&&"false"!==e}],56958);let A={eterm:4,cons25:4,console:4,cygwin:4,dtterm:4,gnome:4,hurd:4,jfbterm:4,konsole:4,kterm:4,mlterm:4,mosh:24,putty:4,st:4,"rxvt-unicode-24bit":24,terminator:24,"xterm-kitty":24},g=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),y=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function b(){if(void 0!==O("FORCE_COLOR"))switch(O("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==O("NODE_DISABLE_COLORS")&&""!==O("NODE_DISABLE_COLORS")||void 0!==O("NO_COLOR")&&""!==O("NO_COLOR")||"dumb"===O("TERM"))return 1;if(O("TMUX"))return 24;if("TF_BUILD"in p&&"AGENT_NAME"in p)return 4;if("CI"in p){for(let{0:e,1:t}of g)if(e in p)return t;return"codeship"===O("CI_NAME")?8:1}if("TEAMCITY_VERSION"in p)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(O("TEAMCITY_VERSION"))?4:1;switch(O("TERM_PROGRAM")){case"iTerm.app":if(!O("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(O("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===O("COLORTERM")||"24bit"===O("COLORTERM"))return 24;if(O("TERM")){if(null!==/truecolor/.exec(O("TERM")))return 24;if(null!==/^xterm-256/.exec(O("TERM")))return 8;let e=O("TERM").toLowerCase();if(A[e])return A[e];if(y.some(t=>null!==t.exec(e)))return 4}return O("COLORTERM")?4:1}e.s(["getColorDepth",0,b],76422);let h={reset:"\x1b[0m",bright:"\x1b[1m",dim:"\x1b[2m",undim:"\x1b[22m",underscore:"\x1b[4m",blink:"\x1b[5m",reverse:"\x1b[7m",hidden:"\x1b[8m",fg:{black:"\x1b[30m",red:"\x1b[31m",green:"\x1b[32m",yellow:"\x1b[33m",blue:"\x1b[34m",magenta:"\x1b[35m",cyan:"\x1b[36m",white:"\x1b[37m"},bg:{black:"\x1b[40m",red:"\x1b[41m",green:"\x1b[42m",yellow:"\x1b[43m",blue:"\x1b[44m",magenta:"\x1b[45m",cyan:"\x1b[46m",white:"\x1b[47m"}},_=["debug","info","success","warn","error"];function N(e,t){return _.indexOf(t)>=_.indexOf(e)}let I={info:h.fg.blue,success:h.fg.green,warn:h.fg.yellow,error:h.fg.red,debug:h.fg.magenta},R=e=>{let t=e?.disabled!==!0,r=e?.level??"warn",n=e?.disableColors!==void 0?!e.disableColors:1!==b();return{...Object.fromEntries(_.map(a=>[a,(...[i,...o])=>((a,i,o=[])=>{let s;if(!t||!N(r,a))return;let d=(s=new Date().toISOString(),n?`${h.dim}${s}${h.reset} ${I[a]}${a.toUpperCase()}${h.reset} ${h.bright}[Better Auth]:${h.reset} ${i}`:`${s} ${a.toUpperCase()} [Better Auth]: ${i}`);e&&"function"==typeof e.log?e.log("success"===a?"info":a,i,...o):"error"===a?console.error(d,...o):"warn"===a?console.warn(d,...o):console.log(d,...o)})(a,i,o)])),get level(){return r}}},S=R();e.s(["TTY_COLORS",0,h,"createLogger",0,R,"logger",0,S,"shouldPublishLog",0,N],80527)},4055,e=>{"use strict";var t=e.i(10469),r=e.i(69772);let n=async()=>{let e=(0,t.__getBetterAuthGlobal)();if(!e.context.adapterAsyncStorage){let t=await (0,r.getAsyncLocalStorage)();e.context.adapterAsyncStorage=new t}return e.context.adapterAsyncStorage},a=async e=>n().then(t=>t.getStore()?.adapter||e).catch(()=>e),i=async(e,t)=>{let r=!1;return n().then(async n=>{let a,i;r=!0;let o=[],s=!1;try{a=await n.run({adapter:e,pendingHooks:o,isTransactionActive:!1},t)}catch(e){i=e,s=!0}for(let e of o)await e();if(s)throw i;return a}).catch(e=>{if(!r)return t();throw e})},o=async(e,t)=>{let r=!1;return n().then(async n=>{let a,i;if(r=!0,n.getStore()?.isTransactionActive)return t();let o=[],s=!1;try{a=await e.transaction(async e=>n.run({adapter:e,pendingHooks:o,isTransactionActive:!0},t))}catch(e){s=!0,i=e}for(let e of o)await e();if(s)throw i;return a}).catch(e=>{if(!r)return t();throw e})},s=async e=>n().then(t=>{let r=t.getStore();if(!r)return e();r.pendingHooks.push(e)}).catch(()=>e());e.s(["getCurrentAdapter",0,a,"queueAfterTransactionHook",0,s,"runWithAdapter",0,i,"runWithTransaction",0,o])},70901,12680,53082,37015,15272,97495,97454,47171,e=>{"use strict";let t,r,n,a;var i,o=e.i(4055),s=e.i(36004),d=e.i(43651),l=e.i(76422),u=e.i(80527);let c=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;function f(e){if("string"==typeof e&&c.test(e)){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}function m(e){try{if("string"!=typeof e){if(null==e)return null;return function e(t){if(null==t)return t;if("string"==typeof t)return f(t);if(t instanceof Date)return t;if(Array.isArray(t))return t.map(e);if("object"==typeof t){let r={};for(let n of Object.keys(t))r[n]=e(t[n]);return r}return t}(e)}return JSON.parse(e,(e,t)=>f(t))}catch(e){return u.logger.error("Error parsing JSON",{error:e}),null}}e.s(["safeJSONParse",0,m],12680);let p=({usePlural:e,schema:t})=>r=>{if(e&&"s"===r.charAt(r.length-1)){let e=r.slice(0,-1),n=t[e]?e:void 0;if(n||(n=Object.entries(t).find(([t,r])=>r.modelName===e)?.[0]),n)return n}let n=t[r]?r:void 0;if(n||(n=Object.entries(t).find(([e,t])=>t.modelName===r)?.[0]),!n)throw new s.BetterAuthError(`Model "${r}" not found in schema`);return n},E=({schema:e,usePlural:t})=>{let r=p({schema:e,usePlural:t});return({field:t,model:n})=>{if("id"===t||"_id"===t)return"id";let a=r(n),i=e[a]?.fields[t];if(!i){let r=Object.entries(e[a].fields).find(([e,r])=>r.fieldName===t);r&&(i=r[1],t=r[0])}if(!i)throw new s.BetterAuthError(`Field ${t} not found in model ${a}`);return t}};function O(e){switch(e){case"a-z":return"abcdefghijklmnopqrstuvwxyz";case"A-Z":return"ABCDEFGHIJKLMNOPQRSTUVWXYZ";case"0-9":return"0123456789";case"-_":return"-_";default:throw Error(`Unsupported alphabet: ${e}`)}}function T(...e){let t=e.map(O).join("");if(0===t.length)throw Error("No valid characters provided for random string generation.");let r=t.length;return(e,...n)=>{let a;if(e<=0)throw Error("Length must be a positive integer.");let i=t,o=r;n.length>0&&(o=(i=n.map(O).join("")).length);let s=Math.floor(256/o)*o,d=new Uint8Array(2*e),l=d.length,u="",c=l;for(;u.length<e;)c>=l&&(crypto.getRandomValues(d),c=0),(a=d[c++])<s&&(u+=i[a%o]);return u}}e.s(["createRandomStringGenerator",0,T],53082);let A=e=>T("a-z","A-Z","0-9")(e||32);e.s(["generateId",0,A],37015);let g=({usePlural:e,schema:t,disableIdGeneration:r,options:n,customIdGenerator:a,supportsUUIDs:i})=>{let o=p({usePlural:e,schema:t});return({customModelName:e,forceAllowId:t})=>{let s=n.advanced?.database?.generateId==="serial",d=n.advanced?.database?.generateId==="uuid",l=!r&&(!s||!!t)&&(!d||!i),c=o(e??"id");return{type:s?"number":"string",required:!!l,...l?{defaultValue(){if(r)return;let e=n.advanced?.database?.generateId;if(!1!==e&&"serial"!==e)return"function"==typeof e?e({model:c}):"uuid"===e?crypto.randomUUID():a?a({model:c}):A()}}:{},transform:{input:e=>{if(e){if(s){let t=Number(e);if(isNaN(t))return;return t}if(d){if(l&&!t)return e;if(r)return;if(t&&"string"==typeof e)if(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e))return e;else{let e=Error().stack?.split("\n").filter((e,t)=>1!==t).join("\n").replace("Error:","");u.logger.warn("[Adapter Factory] - Invalid UUID value for field `id` provided when `forceAllowId` is true. Generating a new UUID.",e)}return i||"string"==typeof e||i?void 0:crypto.randomUUID()}return e}},output:e=>{if(e)return String(e)}}}}},y=({schema:e,usePlural:t})=>{let r=p({schema:e,usePlural:t}),n=E({schema:e,usePlural:t});return function({model:t,field:a}){let i=r(t),o=n({model:i,field:a});return e[i]?.fields[o]?.fieldName||o}};e.s(["initGetFieldName",0,y],15272);let b=({usePlural:e,schema:t})=>{let r=p({schema:t,usePlural:e});return n=>{let a=r(n);return t&&t[a]&&t[a].modelName!==n?e?`${t[a].modelName}s`:t[a].modelName:e?`${n}s`:n}};e.s(["initGetModelName",0,b],97495);let h="db.collection.name",_="db.operation.name",N="http.response.status_code";e.s(["ATTR_DB_COLLECTION_NAME",0,h,"ATTR_DB_OPERATION_NAME",0,_,"ATTR_HTTP_RESPONSE_STATUS_CODE",0,N,"ATTR_HTTP_ROUTE",0,"http.route"],97454);let I={SpanStatusCode:{UNSET:0,OK:1,ERROR:2},trace:(i=n={end(){},setAttribute(e,t){},setStatus(e){},recordException(e){},updateName:e=>n},a={startActiveSpan:function(e,...t){return(0,t[t.length-1])(i)}},{getTracer:(e,t)=>a,getActiveSpan(){}})};function R(){return t||(t=e.A(46358).then(e=>{r=e}).catch(()=>void 0)),r??I}function S(e,t){let{SpanStatusCode:r}=R();!function(e){if(null!=e&&"object"==typeof e&&"name"in e&&"APIError"===e.name&&"statusCode"in e){let t=e.statusCode;return t>=300&&t<400}return!1}(t)?(e.recordException(t),e.setStatus({code:r.ERROR,message:String(t?.message??t)})):(e.setAttribute(N,t.statusCode),e.setStatus({code:r.OK})),e.end()}function L(e,t,r){let{trace:n}=R();return n.getTracer("better-auth","1.6.23").startActiveSpan(e,{attributes:t},e=>{try{let t=r();if(t instanceof Promise)return t.then(t=>(e.end(),t)).catch(t=>{throw S(e,t),t});return e.end(),t}catch(t){throw S(e,t),t}})}e.s(["withSpan",0,L],47171);let D=[],w=-1;function $(e){return 8>(0,l.getColorDepth)()?`#${e}`:`${u.TTY_COLORS.fg.magenta}#${e}${u.TTY_COLORS.reset}`}function v(e,t){return`${u.TTY_COLORS.bg.black}${u.TTY_COLORS.fg.yellow}[${e}/${t}]${u.TTY_COLORS.reset}`}function C(e){return`${u.TTY_COLORS.bright}${e}${u.TTY_COLORS.reset}`}function U(e){return`${u.TTY_COLORS.dim}(${e})${u.TTY_COLORS.reset}`}e.s(["createAdapterFactory",0,({adapter:e,config:t})=>r=>{let n=Math.random().toString(36).substring(2,15),a={...t,supportsBooleans:t.supportsBooleans??!0,supportsDates:t.supportsDates??!0,supportsJSON:t.supportsJSON??!1,adapterName:t.adapterName??t.adapterId,supportsNumericIds:t.supportsNumericIds??!0,supportsUUIDs:t.supportsUUIDs??!1,supportsArrays:t.supportsArrays??!1,transaction:t.transaction??!1,disableTransformInput:t.disableTransformInput??!1,disableTransformOutput:t.disableTransformOutput??!1,disableTransformJoin:t.disableTransformJoin??!1};if(r.advanced?.database?.generateId==="serial"&&!1===a.supportsNumericIds)throw new s.BetterAuthError(`[${a.adapterName}] Your database or database adapter does not support numeric ids. Please disable "useNumberId" in your config.`);let i=(0,d.getAuthTables)(r),l=(...e)=>{if(!0===a.debugLogs||"object"==typeof a.debugLogs){let t=(0,u.createLogger)({level:"info"});if("object"==typeof a.debugLogs&&"isRunningAdapterTests"in a.debugLogs){a.debugLogs.isRunningAdapterTests&&(e.shift(),D.push({instance:n,args:e}));return}if("object"!=typeof a.debugLogs||!a.debugLogs.logCondition||a.debugLogs.logCondition?.())if("object"==typeof e[0]&&"method"in e[0]){let r=e.shift().method;if("object"==typeof a.debugLogs){if("create"===r&&!a.debugLogs.create)return;else if("update"===r&&!a.debugLogs.update)return;else if("updateMany"===r&&!a.debugLogs.updateMany)return;else if("findOne"===r&&!a.debugLogs.findOne)return;else if("findMany"===r&&!a.debugLogs.findMany)return;else if("delete"===r&&!a.debugLogs.delete)return;else if("deleteMany"===r&&!a.debugLogs.deleteMany)return;else if("consumeOne"===r&&!a.debugLogs.consumeOne)return;else if("incrementOne"===r&&!a.debugLogs.incrementOne)return;else if("count"===r&&!a.debugLogs.count)return}t.info(`[${a.adapterName}]`,...e)}else t.info(`[${a.adapterName}]`,...e)}},c=(0,u.createLogger)(r.logger),f=p({usePlural:a.usePlural,schema:i}),O=E({usePlural:a.usePlural,schema:i}),T=b({usePlural:a.usePlural,schema:i}),A=y({schema:i,usePlural:a.usePlural}),N=g({schema:i,options:r,usePlural:a.usePlural,disableIdGeneration:a.disableIdGeneration,customIdGenerator:a.customIdGenerator,supportsUUIDs:a.supportsUUIDs}),I=(({usePlural:e,schema:t,options:r,customIdGenerator:n,disableIdGeneration:a})=>{let i=p({usePlural:e,schema:t}),o=E({usePlural:e,schema:t}),d=g({usePlural:e,schema:t,options:r,customIdGenerator:n,disableIdGeneration:a});return({model:e,field:r})=>{let n=i(e),a=o({field:r,model:n}),l=t[n].fields;l.id=d({customModelName:n});let u=l[a];if(!u)throw new s.BetterAuthError(`Field ${r} not found in model ${e}`);return u}})({schema:i,options:r,usePlural:a.usePlural,disableIdGeneration:a.disableIdGeneration,customIdGenerator:a.customIdGenerator}),R=async(e,t,n,o)=>{let s={},d=i[t].fields,l=a.mapKeysTransformInput??{},u=r.advanced?.database?.generateId==="serial";for(let f in d.id=N({customModelName:t,forceAllowId:o&&"id"in e}),d){let o=e[f],m=d[f],p=l[f]||d[f].fieldName||f;if(void 0===o&&(void 0===m.defaultValue&&!m.transform?.input&&!("update"===n&&m.onUpdate)||"update"===n&&!m.onUpdate))continue;if(m&&"date"===m.type&&!(o instanceof Date)&&"string"==typeof o)try{o=new Date(o)}catch{c.error("[Adapter Factory] Failed to convert string to date",{value:o,field:f})}let E=function(e,t,r){if("update"===r)return void 0===e&&void 0!==t.onUpdate?"function"==typeof t.onUpdate?t.onUpdate():t.onUpdate:e;return"create"===r&&(void 0===e||!0===t.required&&null===e)&&void 0!==t.defaultValue?"function"==typeof t.defaultValue?t.defaultValue():t.defaultValue:e}(o,m,n);m.transform?.input&&(E=await m.transform.input(E)),m.references?.field==="id"&&u?E=Array.isArray(E)?E.map(e=>null!==e?Number(e):null):null!==E?Number(E):null:!1===a.supportsJSON&&"object"==typeof E&&"json"===m.type||!1===a.supportsArrays&&Array.isArray(E)&&("string[]"===m.type||"number[]"===m.type)?E=JSON.stringify(E):!1===a.supportsDates&&E instanceof Date&&"date"===m.type?E=E.toISOString():!1===a.supportsBooleans&&"boolean"==typeof E&&(E=+!!E),a.customTransformInput&&(E=a.customTransformInput({data:E,action:n,field:p,fieldAttributes:m,model:T(t),schema:i,options:r})),void 0!==E&&(s[p]=E)}return s},S=async(e,t,n=[],o)=>{let s=async(e,t,n=[])=>{if(!e)return null;let o=a.mapKeysTransformOutput??{},s={},d=i[f(t)].fields;for(let l in d[Object.entries(o).find(([e,t])=>"id"===t)?.[0]??"id"]={type:r.advanced?.database?.generateId==="serial"?"number":"string"},d){if(n.length&&!n.includes(l))continue;let u=d[l];if(u){let d=u.fieldName||l,c=e[Object.entries(o).find(([e,t])=>t===d)?.[0]||d];u.transform?.output&&(c=await u.transform.output(c));let f=o[l]||l;"id"===d||u.references?.field==="id"?null!=c&&(c=String(c)):!1===a.supportsJSON&&"string"==typeof c&&"json"===u.type||!1===a.supportsArrays&&"string"==typeof c&&("string[]"===u.type||"number[]"===u.type)?c=m(c):!1===a.supportsDates&&"string"==typeof c&&"date"===u.type?c=new Date(c):!1===a.supportsBooleans&&"number"==typeof c&&"boolean"===u.type&&(c=1===c),a.customTransformOutput&&(c=a.customTransformOutput({data:c,field:f,fieldAttributes:u,select:n,model:T(t),schema:i,options:r})),s[f]=c}}return s};if(!o||0===Object.keys(o).length)return await s(e,t,n);t=f(t);let d=await s(e,t,n),l=Object.entries(o).map(([e,t])=>({modelName:T(e),defaultModelName:f(e),joinConfig:t}));if(!e)return null;for(let{modelName:n,defaultModelName:a,joinConfig:i}of l){let o=await (async()=>r.experimental?.joins?e[n]:await k({baseModel:t,baseData:d,joinModel:n,specificJoinConfig:i}))();null==o&&(o="one-to-one"===i.relation?null:[]),"one-to-many"!==i.relation||Array.isArray(o)||(o=[o]);let l=[];if(Array.isArray(o))for(let e of o){let t=await s(e,n,[]);l.push(t)}else{let e=await s(o,n,[]);l.push(e)}d[a]=("one-to-one"===i.relation?l[0]:l)??null}return d},M=({model:e,where:t,action:n})=>{if(!t)return;let o=a.mapKeysTransformInput??{};return t.map(t=>{let{field:d,value:l,operator:u="eq",connector:c="AND",mode:m="sensitive"}=t;if("in"===u&&!Array.isArray(l))throw new s.BetterAuthError("Value must be an array");let p=l,E=f(e),g=O({field:d,model:e}),y=o[g]||A({field:g,model:E}),b=I({field:g,model:E}),h=r.advanced?.database?.generateId==="serial";if(("id"===g||b.references?.field==="id")&&h&&(p=Array.isArray(l)?l.map(Number):Number(l)),"date"===b.type&&l instanceof Date&&!a.supportsDates&&(p=l.toISOString()),"boolean"===b.type&&"string"==typeof p&&(p="true"===p),"number"===b.type){if("string"==typeof p&&""!==p.trim()){let e=Number(p);Number.isNaN(e)||(p=e)}else if(Array.isArray(p)){let e=p.map(e=>"string"==typeof e&&""!==e.trim()?Number(e):NaN);e.every(e=>!Number.isNaN(e))&&(p=e)}}if("boolean"!==b.type||"boolean"!=typeof p||a.supportsBooleans||(p=+!!p),"json"===b.type&&"object"==typeof l&&!a.supportsJSON)try{p=JSON.stringify(l)}catch(e){throw Error(`Failed to stringify JSON value for field ${y}`,{cause:e})}return a.customTransformInput&&(p=a.customTransformInput({data:p,fieldAttributes:b,field:y,model:T(e),schema:i,options:r,action:n})),{operator:u,connector:c,field:y,value:p,mode:m}})},P=(e,t,n)=>{if(!t||0===Object.keys(t).length)return;let a={};for(let[o,d]of Object.entries(t)){let t,l,u;if(!d)continue;let c=f(o),m=f(e),p=Object.entries(i[c].fields).filter(([e,t])=>t.references&&f(t.references.model)===m),E=!0;if(p.length||(p=Object.entries(i[m].fields).filter(([e,t])=>t.references&&f(t.references.model)===c),E=!1),p.length){if(p.length>1)throw new s.BetterAuthError(`Multiple foreign keys found for model ${o} and base model ${e} while performing join operation. Only one foreign key is supported.`)}else throw new s.BetterAuthError(`No foreign key found for model ${o} and base model ${e} while performing join operation.`);let[O,g]=p[0];if(!g.references)throw new s.BetterAuthError(`No references found for foreign key ${O} on model ${o} while performing join operation.`);E?(t=A({model:e,field:u=g.references.field}),l=A({model:o,field:O})):(t=A({model:e,field:u=O}),l=A({model:o,field:g.references.field})),n&&!n.includes(u)&&n.push(u);let y="id"===l||(g.unique??!1),b=r.advanced?.database?.defaultFindManyLimit??100;y?b=1:"object"==typeof d&&"number"==typeof d.limit&&(b=d.limit),a[T(o)]={on:{from:t,to:l},limit:b,relation:y?"one-to-one":"one-to-many"}}return{join:a,select:n}},k=async({baseModel:e,baseData:t,joinModel:n,specificJoinConfig:a})=>{let i;if(!t)return t;let o=T(n),s=a.on.to,d=t[O({field:a.on.from,model:e})];if(null==d)return"one-to-one"===a.relation?null:[];let l=M({model:o,where:[{field:s,value:d,operator:"eq",connector:"AND"}],action:"findOne"});try{if("one-to-one"===a.relation)i=await L(`db findOne ${o}`,{[_]:"findOne",[h]:o},()=>x.findOne({model:o,where:l}));else{let e=a.limit??r.advanced?.database?.defaultFindManyLimit??100;i=await L(`db findMany ${o}`,{[_]:"findMany",[h]:o},()=>x.findMany({model:o,where:l,limit:e}))}}catch(e){throw c.error(`Failed to query fallback join for model ${o}:`,{where:l,limit:a.limit}),console.error(e),e}return i},x=e({options:r,schema:i,debugLog:l,getFieldName:A,getModelName:T,getDefaultModelName:f,getDefaultFieldName:O,getFieldAttributes:I,transformInput:R,transformOutput:S,transformWhereClause:M}),B=null,j={transaction:async e=>{if(!B)if(a.transaction)c.debug(`[${a.adapterName}] - Using provided transaction implementation.`),B=a.transaction;else B=e=>e(j);return B(e)},create:async({data:e,model:t,select:r,forceAllowId:n=!1})=>{let i=++w,o=T(t);t=f(t),"id"in e&&void 0!==e.id&&!n&&(c.warn(`[${a.adapterName}] - You are trying to create a record with an id. This is not allowed as we handle id generation for you, unless you pass in the \`forceAllowId\` parameter. The id will be ignored.`),console.log(Error().stack?.split("\n").filter((e,t)=>1!==t).join("\n").replace("Error:","Create method with `id` being called at:")),e.id=void 0),l({method:"create"},`${$(i)} ${v(1,4)}`,`${C("create")} ${U("Unsafe Input")}:`,{model:o,data:e});let s=e;a.disableTransformInput||(s=await R(e,t,"create",n)),l({method:"create"},`${$(i)} ${v(2,4)}`,`${C("create")} ${U("Parsed Input")}:`,{model:o,data:s});let d=await L(`db create ${o}`,{[_]:"create",[h]:o},()=>x.create({data:s,model:o}));l({method:"create"},`${$(i)} ${v(3,4)}`,`${C("create")} ${U("DB Result")}:`,{model:o,res:d});let u=d;return a.disableTransformOutput||(u=await S(d,t,r,void 0)),l({method:"create"},`${$(i)} ${v(4,4)}`,`${C("create")} ${U("Parsed Result")}:`,{model:o,data:u}),u},update:async({model:e,where:t,update:r})=>{let n=++w,i=T(e=f(e)),o=M({model:e,where:t,action:"update"});if(0===o.length)return null;l({method:"update"},`${$(n)} ${v(1,4)}`,`${C("update")} ${U("Unsafe Input")}:`,{model:i,data:r});let s=r;a.disableTransformInput||(s=await R(r,e,"update")),l({method:"update"},`${$(n)} ${v(2,4)}`,`${C("update")} ${U("Parsed Input")}:`,{model:i,data:s});let d=await L(`db update ${i}`,{[_]:"update",[h]:i},()=>x.update({model:i,where:o,update:s}));l({method:"update"},`${$(n)} ${v(3,4)}`,`${C("update")} ${U("DB Result")}:`,{model:i,data:d});let u=d;return a.disableTransformOutput||(u=await S(d,e,void 0,void 0)),l({method:"update"},`${$(n)} ${v(4,4)}`,`${C("update")} ${U("Parsed Result")}:`,{model:i,data:u}),u},updateMany:async({model:e,where:t,update:r})=>{let n=++w,i=T(e),o=M({model:e,where:t,action:"updateMany"});e=f(e),l({method:"updateMany"},`${$(n)} ${v(1,4)}`,`${C("updateMany")} ${U("Unsafe Input")}:`,{model:i,data:r});let s=r;a.disableTransformInput||(s=await R(r,e,"update")),l({method:"updateMany"},`${$(n)} ${v(2,4)}`,`${C("updateMany")} ${U("Parsed Input")}:`,{model:i,data:s});let d=await L(`db updateMany ${i}`,{[_]:"updateMany",[h]:i},()=>x.updateMany({model:i,where:o,update:s}));return l({method:"updateMany"},`${$(n)} ${v(3,4)}`,`${C("updateMany")} ${U("DB Result")}:`,{model:i,data:d}),l({method:"updateMany"},`${$(n)} ${v(4,4)}`,`${C("updateMany")} ${U("Parsed Result")}:`,{model:i,data:d}),d},findOne:async({model:e,where:t,select:n,join:i})=>{let o,s=++w,d=T(e),u=M({model:e,where:t,action:"findOne"});e=f(e);let c=!0;if(a.disableTransformJoin)o=i;else{let t=P(e,i,n);t&&(o=t.join,n=t.select),!r.experimental?.joins&&o&&Object.keys(o).length>0&&(c=!1)}l({method:"findOne"},`${$(s)} ${v(1,3)}`,`${C("findOne")}:`,{model:d,where:u,select:n,join:o});let m=await L(`db findOne ${d}`,{[_]:"findOne",[h]:d},()=>x.findOne({model:d,where:u,select:n,join:c?o:void 0}));l({method:"findOne"},`${$(s)} ${v(2,3)}`,`${C("findOne")} ${U("DB Result")}:`,{model:d,data:m});let p=m;return a.disableTransformOutput||(p=await S(m,e,n,o)),l({method:"findOne"},`${$(s)} ${v(3,3)}`,`${C("findOne")} ${U("Parsed Result")}:`,{model:d,data:p}),p},findMany:async({model:e,where:t,limit:n,select:i,sortBy:o,offset:s,join:d})=>{let u,c=++w,m=n??r.advanced?.database?.defaultFindManyLimit??100,p=T(e),E=M({model:e,where:t,action:"findMany"});e=f(e);let O=!0;if(a.disableTransformJoin)u=d;else{let t=P(e,d,i);t&&(u=t.join,i=t.select),!r.experimental?.joins&&u&&Object.keys(u).length>0&&(O=!1)}l({method:"findMany"},`${$(c)} ${v(1,3)}`,`${C("findMany")}:`,{model:p,where:E,limit:m,sortBy:o,offset:s,join:u});let A=await L(`db findMany ${p}`,{[_]:"findMany",[h]:p},()=>x.findMany({model:p,where:E,limit:m,select:i,sortBy:o,offset:s,join:O?u:void 0}));l({method:"findMany"},`${$(c)} ${v(2,3)}`,`${C("findMany")} ${U("DB Result")}:`,{model:p,data:A});let g=A;return a.disableTransformOutput||(g=await Promise.all(A.map(async t=>await S(t,e,void 0,u)))),l({method:"findMany"},`${$(c)} ${v(3,3)}`,`${C("findMany")} ${U("Parsed Result")}:`,{model:p,data:g}),g},delete:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"delete"});e=f(e),l({method:"delete"},`${$(r)} ${v(1,2)}`,`${C("delete")}:`,{model:n,where:a}),await L(`db delete ${n}`,{[_]:"delete",[h]:n},()=>x.delete({model:n,where:a})),l({method:"delete"},`${$(r)} ${v(2,2)}`,`${C("delete")} ${U("DB Result")}:`,{model:n})},deleteMany:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"deleteMany"});e=f(e),l({method:"deleteMany"},`${$(r)} ${v(1,2)}`,`${C("deleteMany")} ${U("DeleteMany")}:`,{model:n,where:a});let i=await L(`db deleteMany ${n}`,{[_]:"deleteMany",[h]:n},()=>x.deleteMany({model:n,where:a}));return l({method:"deleteMany"},`${$(r)} ${v(2,2)}`,`${C("deleteMany")} ${U("DB Result")}:`,{model:n,data:i}),i},consumeOne:async({model:e,where:t})=>{let r,n=++w,i=T(e),d=M({model:e,where:t,action:"consumeOne"});e=f(e),l({method:"consumeOne"},`${$(n)} ${v(1,3)}`,`${C("consumeOne")} ${U("ConsumeOne")}:`,{model:i,where:d});let u=!0;x.consumeOne?r=await L(`db consumeOne ${i}`,{[_]:"consumeOne",[h]:i},()=>x.consumeOne({model:i,where:d})):(r=await L(`db consumeOne ${i}`,{[_]:"consumeOne",[h]:i},()=>(0,o.runWithTransaction)(j,async()=>{let r=await (0,o.getCurrentAdapter)(j),n=(await r.findMany({model:e,where:t,limit:1}))[0];if(!n)return null;let i=await r.deleteMany({model:e,where:[...t,{field:"id",value:n.id,operator:"eq",connector:"AND",mode:"sensitive"}]});if("number"!=typeof i)throw new s.BetterAuthError(`Adapter "${a.adapterId}" returned a non-numeric value from deleteMany during the consumeOne fallback. Return the number of deleted rows, or implement a native consumeOne for atomic single-use consumption.`);return i>0?n:null})),u=!1),l({method:"consumeOne"},`${$(n)} ${v(2,3)}`,`${C("consumeOne")} ${U("DB Result")}:`,{model:i,data:r});let c=r;return!a.disableTransformOutput&&u&&r&&(c=await S(r,e,void 0,void 0)),l({method:"consumeOne"},`${$(n)} ${v(3,3)}`,`${C("consumeOne")} ${U("Parsed Result")}:`,{model:i,data:c}),c},incrementOne:async({model:e,where:t,increment:r,set:n})=>{let i,d=Object.keys(r).length>0,u=!!n&&Object.keys(n).length>0;if(!d&&!u)throw new s.BetterAuthError("incrementOne requires a non-empty `increment` or `set`; both were empty.");let c=++w,m=T(e),p=M({model:e,where:t,action:"incrementOne"});e=f(e),l({method:"incrementOne"},`${$(c)} ${v(1,3)}`,`${C("incrementOne")} ${U("IncrementOne")}:`,{model:m,where:p,increment:r,set:n});let E=!0;if(x.incrementOne){let t,o=a.mapKeysTransformInput??{},d={};for(let[t,n]of Object.entries(r))d[o[t]||A({model:e,field:t})]=n;if(t=n&&!a.disableTransformInput?await R(n,e,"update"):n,0===Object.keys(d).length&&(!t||0===Object.keys(t).length))throw new s.BetterAuthError("incrementOne resolved to an empty update: every increment/set field was unknown to the schema or transformed away.");i=await L(`db incrementOne ${m}`,{[_]:"incrementOne",[h]:m},()=>x.incrementOne({model:m,where:p,increment:d,set:t}))}else i=await L(`db incrementOne ${m}`,{[_]:"incrementOne",[h]:m},()=>(0,o.runWithTransaction)(j,async()=>{let i=await (0,o.getCurrentAdapter)(j),d=(await i.findMany({model:e,where:t,limit:1}))[0];if(!d)return null;let l={...n??{}};for(let[e,t]of Object.entries(r))l[e]=("number"==typeof d[e]?d[e]:0)+t;let u=await i.updateMany({model:e,where:[...t,{field:"id",value:d.id,operator:"eq",connector:"AND",mode:"sensitive"}],update:l});if("number"!=typeof u)throw new s.BetterAuthError(`Adapter "${a.adapterId}" returned a non-numeric value from updateMany during the incrementOne fallback. Return the number of updated rows, or implement a native incrementOne for atomic guarded counter updates.`);return u>0?{...d,...l}:null})),E=!1;l({method:"incrementOne"},`${$(c)} ${v(2,3)}`,`${C("incrementOne")} ${U("DB Result")}:`,{model:m,data:i});let O=i;return!a.disableTransformOutput&&E&&i&&(O=await S(i,e,void 0,void 0)),l({method:"incrementOne"},`${$(c)} ${v(3,3)}`,`${C("incrementOne")} ${U("Parsed Result")}:`,{model:m,data:O}),O},count:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"count"});e=f(e),l({method:"count"},`${$(r)} ${v(1,2)}`,`${C("count")}:`,{model:n,where:a});let i=await L(`db count ${n}`,{[_]:"count",[h]:n},()=>x.count({model:n,where:a}));return l({method:"count"},`${$(r)} ${v(2,2)}`,`${C("count")}:`,{model:n,data:i}),i},createSchema:x.createSchema?async(e,t)=>{let n=(0,d.getAuthTables)(r);return r.secondaryStorage&&!r.session?.storeSessionInDatabase&&delete n.session,x.createSchema({file:t,tables:n})}:void 0,options:{adapterConfig:a,...x.options??{}},id:a.adapterId,...a.debugLogs?.isRunningAdapterTests?{adapterTestDebugLogs:{resetDebugLogs(){D=D.filter(e=>e.instance!==n)},printDebugLogs(){let e="─".repeat(80),t=D.filter(e=>e.instance===n);0===t.length||console.log(...t.reverse().map(e=>(e.args[0]=`
|
|
1
|
+
module.exports=[10469,15705,e=>{"use strict";let t=Symbol.for("better-auth:global"),r=null,n={},a="1.6.23";function i(){return globalThis[t]||(globalThis[t]={version:a,epoch:1,context:n},r=globalThis[t]),(r=globalThis[t]).version!==a&&(r.version=a,r.epoch++),globalThis[t]}e.s(["__getBetterAuthGlobal",0,i,"getBetterAuthVersion",0,function(){return i().version}],10469);let o=import("node:async_hooks").then(e=>e.AsyncLocalStorage).catch(e=>{if("AsyncLocalStorage"in globalThis)return globalThis.AsyncLocalStorage;throw console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected."),console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler"),console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag"),e});async function s(){let e=await o;if(null!==e)return e;throw Error("getAsyncLocalStorage is only available in server code")}e.s(["getAsyncLocalStorage",0,s],15705)},36004,33763,58461,43651,56958,76422,80527,e=>{"use strict";let t=Object.fromEntries(Object.entries({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CHANGE_EMAIL_DISABLED:"Change email is disabled",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"}).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]));function r(e){let t=e.split("\n at ");return t.length<=1?e:(t.splice(1,1),t.join("\n at "))}function n(e,t){class n extends e{#e;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){const t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);const t=Error().stack;t&&(this.#e=r(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0}),n}e.s(["BASE_ERROR_CODES",0,t],33763);let a={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};var i=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:a[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}},o=class extends i{constructor(e,t){super(400,{message:e,code:"VALIDATION_ERROR"}),this.message=e,this.issues=t,this.issues=t}},s=class extends Error{constructor(e){super(e),this.name="BetterCallError"}};let d=Symbol.for("better-call:api-error-headers"),l=n(i,Error);e.s(["APIError",0,l,"BetterCallError",0,s,"ValidationError",0,o,"hideInternalStackFrames",0,r,"kAPIErrorHeaderSymbol",0,d,"makeErrorForHideStackFrame",0,n,"statusCodes",0,a],58461);var u=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}},c=class e extends l{constructor(...e){super(...e)}static fromStatus(t,r){return new e(t,r)}static from(t,r){return new e(t,{message:r.message,code:r.code})}};e.s(["APIError",0,c,"BetterAuthError",0,u],36004),e.s(["getAuthTables",0,e=>{let t=(e.plugins??[]).reduce((e,t)=>{let r=t.schema;if(!r)return e;for(let[t,n]of Object.entries(r))e[t]={fields:{...e[t]?.fields,...n.fields},modelName:n.modelName||t,disableMigrations:n.disableMigration??e[t]?.disableMigrations};return e},{}),r=e.rateLimit?.storage==="database",n={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",unique:!0,required:!0,fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",required:!0,fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",bigint:!0,required:!0,fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest",defaultValue:()=>Date.now()}}}},{user:a,session:i,account:o,verification:s,...d}=t,l={verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier",index:!0},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!0,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,defaultValue:()=>new Date,onUpdate:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"},...s?.fields,...e.verification?.additionalFields},order:4}},u={session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,index:!0},...i?.fields,...e.session?.additionalFields},order:2}};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name",sortable:!0},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email",sortable:!0},emailVerified:{type:"boolean",defaultValue:!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified",input:!1},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,onUpdate:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...a?.fields,...e.user?.additionalFields},order:1},...!e.secondaryStorage||e.session?.storeSessionInDatabase?u:{},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId",index:!0},accessToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.refreshTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},...o?.fields,...e.account?.additionalFields},order:3},...!e.secondaryStorage||e.verification?.storeInDatabase?l:{},...d,...r?n:{}}}],43651);let f=Object.create(null),m=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?f:globalThis),p=new Proxy(f,{get:(e,t)=>m()[t]??f[t],has:(e,t)=>t in m()||t in f,set:(e,t,r)=>(m(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=m(!0);return delete r[t],!0},ownKeys:()=>Object.keys(m(!0))}),E=p.NODE_ENV??"";function O(e,t){return"u">typeof process&&process.env?process.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}let T=Object.freeze({get BETTER_AUTH_SECRET(){return O("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return O("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return O("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return O("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return O("NODE_ENV","development")},get PACKAGE_VERSION(){return O("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return O("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});e.s(["ENV",0,T,"env",0,p,"getBooleanEnvVar",0,function(e,t=!0){let r=O(e);return r?"0"!==r&&"false"!==r.toLowerCase()&&""!==r:t},"getEnvVar",0,O,"isDevelopment",0,()=>"dev"===E||"development"===E,"isProduction",0,"production"===E,"isTest",0,()=>{var e;return"test"===E||!!(e=p.TEST)&&"false"!==e}],56958);let A={eterm:4,cons25:4,console:4,cygwin:4,dtterm:4,gnome:4,hurd:4,jfbterm:4,konsole:4,kterm:4,mlterm:4,mosh:24,putty:4,st:4,"rxvt-unicode-24bit":24,terminator:24,"xterm-kitty":24},g=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),y=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function b(){if(void 0!==O("FORCE_COLOR"))switch(O("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==O("NODE_DISABLE_COLORS")&&""!==O("NODE_DISABLE_COLORS")||void 0!==O("NO_COLOR")&&""!==O("NO_COLOR")||"dumb"===O("TERM"))return 1;if(O("TMUX"))return 24;if("TF_BUILD"in p&&"AGENT_NAME"in p)return 4;if("CI"in p){for(let{0:e,1:t}of g)if(e in p)return t;return"codeship"===O("CI_NAME")?8:1}if("TEAMCITY_VERSION"in p)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(O("TEAMCITY_VERSION"))?4:1;switch(O("TERM_PROGRAM")){case"iTerm.app":if(!O("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(O("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===O("COLORTERM")||"24bit"===O("COLORTERM"))return 24;if(O("TERM")){if(null!==/truecolor/.exec(O("TERM")))return 24;if(null!==/^xterm-256/.exec(O("TERM")))return 8;let e=O("TERM").toLowerCase();if(A[e])return A[e];if(y.some(t=>null!==t.exec(e)))return 4}return O("COLORTERM")?4:1}e.s(["getColorDepth",0,b],76422);let h={reset:"\x1b[0m",bright:"\x1b[1m",dim:"\x1b[2m",undim:"\x1b[22m",underscore:"\x1b[4m",blink:"\x1b[5m",reverse:"\x1b[7m",hidden:"\x1b[8m",fg:{black:"\x1b[30m",red:"\x1b[31m",green:"\x1b[32m",yellow:"\x1b[33m",blue:"\x1b[34m",magenta:"\x1b[35m",cyan:"\x1b[36m",white:"\x1b[37m"},bg:{black:"\x1b[40m",red:"\x1b[41m",green:"\x1b[42m",yellow:"\x1b[43m",blue:"\x1b[44m",magenta:"\x1b[45m",cyan:"\x1b[46m",white:"\x1b[47m"}},_=["debug","info","success","warn","error"];function N(e,t){return _.indexOf(t)>=_.indexOf(e)}let I={info:h.fg.blue,success:h.fg.green,warn:h.fg.yellow,error:h.fg.red,debug:h.fg.magenta},R=e=>{let t=e?.disabled!==!0,r=e?.level??"warn",n=e?.disableColors!==void 0?!e.disableColors:1!==b();return{...Object.fromEntries(_.map(a=>[a,(...[i,...o])=>((a,i,o=[])=>{let s;if(!t||!N(r,a))return;let d=(s=new Date().toISOString(),n?`${h.dim}${s}${h.reset} ${I[a]}${a.toUpperCase()}${h.reset} ${h.bright}[Better Auth]:${h.reset} ${i}`:`${s} ${a.toUpperCase()} [Better Auth]: ${i}`);e&&"function"==typeof e.log?e.log("success"===a?"info":a,i,...o):"error"===a?console.error(d,...o):"warn"===a?console.warn(d,...o):console.log(d,...o)})(a,i,o)])),get level(){return r}}},S=R();e.s(["TTY_COLORS",0,h,"createLogger",0,R,"logger",0,S,"shouldPublishLog",0,N],80527)},4055,e=>{"use strict";var t=e.i(10469),r=e.i(15705);let n=async()=>{let e=(0,t.__getBetterAuthGlobal)();if(!e.context.adapterAsyncStorage){let t=await (0,r.getAsyncLocalStorage)();e.context.adapterAsyncStorage=new t}return e.context.adapterAsyncStorage},a=async e=>n().then(t=>t.getStore()?.adapter||e).catch(()=>e),i=async(e,t)=>{let r=!1;return n().then(async n=>{let a,i;r=!0;let o=[],s=!1;try{a=await n.run({adapter:e,pendingHooks:o,isTransactionActive:!1},t)}catch(e){i=e,s=!0}for(let e of o)await e();if(s)throw i;return a}).catch(e=>{if(!r)return t();throw e})},o=async(e,t)=>{let r=!1;return n().then(async n=>{let a,i;if(r=!0,n.getStore()?.isTransactionActive)return t();let o=[],s=!1;try{a=await e.transaction(async e=>n.run({adapter:e,pendingHooks:o,isTransactionActive:!0},t))}catch(e){s=!0,i=e}for(let e of o)await e();if(s)throw i;return a}).catch(e=>{if(!r)return t();throw e})},s=async e=>n().then(t=>{let r=t.getStore();if(!r)return e();r.pendingHooks.push(e)}).catch(()=>e());e.s(["getCurrentAdapter",0,a,"queueAfterTransactionHook",0,s,"runWithAdapter",0,i,"runWithTransaction",0,o])},70901,12680,53082,37015,15272,97495,97454,47171,e=>{"use strict";let t,r,n,a;var i,o=e.i(4055),s=e.i(36004),d=e.i(43651),l=e.i(76422),u=e.i(80527);let c=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;function f(e){if("string"==typeof e&&c.test(e)){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}function m(e){try{if("string"!=typeof e){if(null==e)return null;return function e(t){if(null==t)return t;if("string"==typeof t)return f(t);if(t instanceof Date)return t;if(Array.isArray(t))return t.map(e);if("object"==typeof t){let r={};for(let n of Object.keys(t))r[n]=e(t[n]);return r}return t}(e)}return JSON.parse(e,(e,t)=>f(t))}catch(e){return u.logger.error("Error parsing JSON",{error:e}),null}}e.s(["safeJSONParse",0,m],12680);let p=({usePlural:e,schema:t})=>r=>{if(e&&"s"===r.charAt(r.length-1)){let e=r.slice(0,-1),n=t[e]?e:void 0;if(n||(n=Object.entries(t).find(([t,r])=>r.modelName===e)?.[0]),n)return n}let n=t[r]?r:void 0;if(n||(n=Object.entries(t).find(([e,t])=>t.modelName===r)?.[0]),!n)throw new s.BetterAuthError(`Model "${r}" not found in schema`);return n},E=({schema:e,usePlural:t})=>{let r=p({schema:e,usePlural:t});return({field:t,model:n})=>{if("id"===t||"_id"===t)return"id";let a=r(n),i=e[a]?.fields[t];if(!i){let r=Object.entries(e[a].fields).find(([e,r])=>r.fieldName===t);r&&(i=r[1],t=r[0])}if(!i)throw new s.BetterAuthError(`Field ${t} not found in model ${a}`);return t}};function O(e){switch(e){case"a-z":return"abcdefghijklmnopqrstuvwxyz";case"A-Z":return"ABCDEFGHIJKLMNOPQRSTUVWXYZ";case"0-9":return"0123456789";case"-_":return"-_";default:throw Error(`Unsupported alphabet: ${e}`)}}function T(...e){let t=e.map(O).join("");if(0===t.length)throw Error("No valid characters provided for random string generation.");let r=t.length;return(e,...n)=>{let a;if(e<=0)throw Error("Length must be a positive integer.");let i=t,o=r;n.length>0&&(o=(i=n.map(O).join("")).length);let s=Math.floor(256/o)*o,d=new Uint8Array(2*e),l=d.length,u="",c=l;for(;u.length<e;)c>=l&&(crypto.getRandomValues(d),c=0),(a=d[c++])<s&&(u+=i[a%o]);return u}}e.s(["createRandomStringGenerator",0,T],53082);let A=e=>T("a-z","A-Z","0-9")(e||32);e.s(["generateId",0,A],37015);let g=({usePlural:e,schema:t,disableIdGeneration:r,options:n,customIdGenerator:a,supportsUUIDs:i})=>{let o=p({usePlural:e,schema:t});return({customModelName:e,forceAllowId:t})=>{let s=n.advanced?.database?.generateId==="serial",d=n.advanced?.database?.generateId==="uuid",l=!r&&(!s||!!t)&&(!d||!i),c=o(e??"id");return{type:s?"number":"string",required:!!l,...l?{defaultValue(){if(r)return;let e=n.advanced?.database?.generateId;if(!1!==e&&"serial"!==e)return"function"==typeof e?e({model:c}):"uuid"===e?crypto.randomUUID():a?a({model:c}):A()}}:{},transform:{input:e=>{if(e){if(s){let t=Number(e);if(isNaN(t))return;return t}if(d){if(l&&!t)return e;if(r)return;if(t&&"string"==typeof e)if(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e))return e;else{let e=Error().stack?.split("\n").filter((e,t)=>1!==t).join("\n").replace("Error:","");u.logger.warn("[Adapter Factory] - Invalid UUID value for field `id` provided when `forceAllowId` is true. Generating a new UUID.",e)}return i||"string"==typeof e||i?void 0:crypto.randomUUID()}return e}},output:e=>{if(e)return String(e)}}}}},y=({schema:e,usePlural:t})=>{let r=p({schema:e,usePlural:t}),n=E({schema:e,usePlural:t});return function({model:t,field:a}){let i=r(t),o=n({model:i,field:a});return e[i]?.fields[o]?.fieldName||o}};e.s(["initGetFieldName",0,y],15272);let b=({usePlural:e,schema:t})=>{let r=p({schema:t,usePlural:e});return n=>{let a=r(n);return t&&t[a]&&t[a].modelName!==n?e?`${t[a].modelName}s`:t[a].modelName:e?`${n}s`:n}};e.s(["initGetModelName",0,b],97495);let h="db.collection.name",_="db.operation.name",N="http.response.status_code";e.s(["ATTR_DB_COLLECTION_NAME",0,h,"ATTR_DB_OPERATION_NAME",0,_,"ATTR_HTTP_RESPONSE_STATUS_CODE",0,N,"ATTR_HTTP_ROUTE",0,"http.route"],97454);let I={SpanStatusCode:{UNSET:0,OK:1,ERROR:2},trace:(i=n={end(){},setAttribute(e,t){},setStatus(e){},recordException(e){},updateName:e=>n},a={startActiveSpan:function(e,...t){return(0,t[t.length-1])(i)}},{getTracer:(e,t)=>a,getActiveSpan(){}})};function R(){return t||(t=e.A(46358).then(e=>{r=e}).catch(()=>void 0)),r??I}function S(e,t){let{SpanStatusCode:r}=R();!function(e){if(null!=e&&"object"==typeof e&&"name"in e&&"APIError"===e.name&&"statusCode"in e){let t=e.statusCode;return t>=300&&t<400}return!1}(t)?(e.recordException(t),e.setStatus({code:r.ERROR,message:String(t?.message??t)})):(e.setAttribute(N,t.statusCode),e.setStatus({code:r.OK})),e.end()}function L(e,t,r){let{trace:n}=R();return n.getTracer("better-auth","1.6.23").startActiveSpan(e,{attributes:t},e=>{try{let t=r();if(t instanceof Promise)return t.then(t=>(e.end(),t)).catch(t=>{throw S(e,t),t});return e.end(),t}catch(t){throw S(e,t),t}})}e.s(["withSpan",0,L],47171);let D=[],w=-1;function $(e){return 8>(0,l.getColorDepth)()?`#${e}`:`${u.TTY_COLORS.fg.magenta}#${e}${u.TTY_COLORS.reset}`}function v(e,t){return`${u.TTY_COLORS.bg.black}${u.TTY_COLORS.fg.yellow}[${e}/${t}]${u.TTY_COLORS.reset}`}function C(e){return`${u.TTY_COLORS.bright}${e}${u.TTY_COLORS.reset}`}function U(e){return`${u.TTY_COLORS.dim}(${e})${u.TTY_COLORS.reset}`}e.s(["createAdapterFactory",0,({adapter:e,config:t})=>r=>{let n=Math.random().toString(36).substring(2,15),a={...t,supportsBooleans:t.supportsBooleans??!0,supportsDates:t.supportsDates??!0,supportsJSON:t.supportsJSON??!1,adapterName:t.adapterName??t.adapterId,supportsNumericIds:t.supportsNumericIds??!0,supportsUUIDs:t.supportsUUIDs??!1,supportsArrays:t.supportsArrays??!1,transaction:t.transaction??!1,disableTransformInput:t.disableTransformInput??!1,disableTransformOutput:t.disableTransformOutput??!1,disableTransformJoin:t.disableTransformJoin??!1};if(r.advanced?.database?.generateId==="serial"&&!1===a.supportsNumericIds)throw new s.BetterAuthError(`[${a.adapterName}] Your database or database adapter does not support numeric ids. Please disable "useNumberId" in your config.`);let i=(0,d.getAuthTables)(r),l=(...e)=>{if(!0===a.debugLogs||"object"==typeof a.debugLogs){let t=(0,u.createLogger)({level:"info"});if("object"==typeof a.debugLogs&&"isRunningAdapterTests"in a.debugLogs){a.debugLogs.isRunningAdapterTests&&(e.shift(),D.push({instance:n,args:e}));return}if("object"!=typeof a.debugLogs||!a.debugLogs.logCondition||a.debugLogs.logCondition?.())if("object"==typeof e[0]&&"method"in e[0]){let r=e.shift().method;if("object"==typeof a.debugLogs){if("create"===r&&!a.debugLogs.create)return;else if("update"===r&&!a.debugLogs.update)return;else if("updateMany"===r&&!a.debugLogs.updateMany)return;else if("findOne"===r&&!a.debugLogs.findOne)return;else if("findMany"===r&&!a.debugLogs.findMany)return;else if("delete"===r&&!a.debugLogs.delete)return;else if("deleteMany"===r&&!a.debugLogs.deleteMany)return;else if("consumeOne"===r&&!a.debugLogs.consumeOne)return;else if("incrementOne"===r&&!a.debugLogs.incrementOne)return;else if("count"===r&&!a.debugLogs.count)return}t.info(`[${a.adapterName}]`,...e)}else t.info(`[${a.adapterName}]`,...e)}},c=(0,u.createLogger)(r.logger),f=p({usePlural:a.usePlural,schema:i}),O=E({usePlural:a.usePlural,schema:i}),T=b({usePlural:a.usePlural,schema:i}),A=y({schema:i,usePlural:a.usePlural}),N=g({schema:i,options:r,usePlural:a.usePlural,disableIdGeneration:a.disableIdGeneration,customIdGenerator:a.customIdGenerator,supportsUUIDs:a.supportsUUIDs}),I=(({usePlural:e,schema:t,options:r,customIdGenerator:n,disableIdGeneration:a})=>{let i=p({usePlural:e,schema:t}),o=E({usePlural:e,schema:t}),d=g({usePlural:e,schema:t,options:r,customIdGenerator:n,disableIdGeneration:a});return({model:e,field:r})=>{let n=i(e),a=o({field:r,model:n}),l=t[n].fields;l.id=d({customModelName:n});let u=l[a];if(!u)throw new s.BetterAuthError(`Field ${r} not found in model ${e}`);return u}})({schema:i,options:r,usePlural:a.usePlural,disableIdGeneration:a.disableIdGeneration,customIdGenerator:a.customIdGenerator}),R=async(e,t,n,o)=>{let s={},d=i[t].fields,l=a.mapKeysTransformInput??{},u=r.advanced?.database?.generateId==="serial";for(let f in d.id=N({customModelName:t,forceAllowId:o&&"id"in e}),d){let o=e[f],m=d[f],p=l[f]||d[f].fieldName||f;if(void 0===o&&(void 0===m.defaultValue&&!m.transform?.input&&!("update"===n&&m.onUpdate)||"update"===n&&!m.onUpdate))continue;if(m&&"date"===m.type&&!(o instanceof Date)&&"string"==typeof o)try{o=new Date(o)}catch{c.error("[Adapter Factory] Failed to convert string to date",{value:o,field:f})}let E=function(e,t,r){if("update"===r)return void 0===e&&void 0!==t.onUpdate?"function"==typeof t.onUpdate?t.onUpdate():t.onUpdate:e;return"create"===r&&(void 0===e||!0===t.required&&null===e)&&void 0!==t.defaultValue?"function"==typeof t.defaultValue?t.defaultValue():t.defaultValue:e}(o,m,n);m.transform?.input&&(E=await m.transform.input(E)),m.references?.field==="id"&&u?E=Array.isArray(E)?E.map(e=>null!==e?Number(e):null):null!==E?Number(E):null:!1===a.supportsJSON&&"object"==typeof E&&"json"===m.type||!1===a.supportsArrays&&Array.isArray(E)&&("string[]"===m.type||"number[]"===m.type)?E=JSON.stringify(E):!1===a.supportsDates&&E instanceof Date&&"date"===m.type?E=E.toISOString():!1===a.supportsBooleans&&"boolean"==typeof E&&(E=+!!E),a.customTransformInput&&(E=a.customTransformInput({data:E,action:n,field:p,fieldAttributes:m,model:T(t),schema:i,options:r})),void 0!==E&&(s[p]=E)}return s},S=async(e,t,n=[],o)=>{let s=async(e,t,n=[])=>{if(!e)return null;let o=a.mapKeysTransformOutput??{},s={},d=i[f(t)].fields;for(let l in d[Object.entries(o).find(([e,t])=>"id"===t)?.[0]??"id"]={type:r.advanced?.database?.generateId==="serial"?"number":"string"},d){if(n.length&&!n.includes(l))continue;let u=d[l];if(u){let d=u.fieldName||l,c=e[Object.entries(o).find(([e,t])=>t===d)?.[0]||d];u.transform?.output&&(c=await u.transform.output(c));let f=o[l]||l;"id"===d||u.references?.field==="id"?null!=c&&(c=String(c)):!1===a.supportsJSON&&"string"==typeof c&&"json"===u.type||!1===a.supportsArrays&&"string"==typeof c&&("string[]"===u.type||"number[]"===u.type)?c=m(c):!1===a.supportsDates&&"string"==typeof c&&"date"===u.type?c=new Date(c):!1===a.supportsBooleans&&"number"==typeof c&&"boolean"===u.type&&(c=1===c),a.customTransformOutput&&(c=a.customTransformOutput({data:c,field:f,fieldAttributes:u,select:n,model:T(t),schema:i,options:r})),s[f]=c}}return s};if(!o||0===Object.keys(o).length)return await s(e,t,n);t=f(t);let d=await s(e,t,n),l=Object.entries(o).map(([e,t])=>({modelName:T(e),defaultModelName:f(e),joinConfig:t}));if(!e)return null;for(let{modelName:n,defaultModelName:a,joinConfig:i}of l){let o=await (async()=>r.experimental?.joins?e[n]:await k({baseModel:t,baseData:d,joinModel:n,specificJoinConfig:i}))();null==o&&(o="one-to-one"===i.relation?null:[]),"one-to-many"!==i.relation||Array.isArray(o)||(o=[o]);let l=[];if(Array.isArray(o))for(let e of o){let t=await s(e,n,[]);l.push(t)}else{let e=await s(o,n,[]);l.push(e)}d[a]=("one-to-one"===i.relation?l[0]:l)??null}return d},M=({model:e,where:t,action:n})=>{if(!t)return;let o=a.mapKeysTransformInput??{};return t.map(t=>{let{field:d,value:l,operator:u="eq",connector:c="AND",mode:m="sensitive"}=t;if("in"===u&&!Array.isArray(l))throw new s.BetterAuthError("Value must be an array");let p=l,E=f(e),g=O({field:d,model:e}),y=o[g]||A({field:g,model:E}),b=I({field:g,model:E}),h=r.advanced?.database?.generateId==="serial";if(("id"===g||b.references?.field==="id")&&h&&(p=Array.isArray(l)?l.map(Number):Number(l)),"date"===b.type&&l instanceof Date&&!a.supportsDates&&(p=l.toISOString()),"boolean"===b.type&&"string"==typeof p&&(p="true"===p),"number"===b.type){if("string"==typeof p&&""!==p.trim()){let e=Number(p);Number.isNaN(e)||(p=e)}else if(Array.isArray(p)){let e=p.map(e=>"string"==typeof e&&""!==e.trim()?Number(e):NaN);e.every(e=>!Number.isNaN(e))&&(p=e)}}if("boolean"!==b.type||"boolean"!=typeof p||a.supportsBooleans||(p=+!!p),"json"===b.type&&"object"==typeof l&&!a.supportsJSON)try{p=JSON.stringify(l)}catch(e){throw Error(`Failed to stringify JSON value for field ${y}`,{cause:e})}return a.customTransformInput&&(p=a.customTransformInput({data:p,fieldAttributes:b,field:y,model:T(e),schema:i,options:r,action:n})),{operator:u,connector:c,field:y,value:p,mode:m}})},P=(e,t,n)=>{if(!t||0===Object.keys(t).length)return;let a={};for(let[o,d]of Object.entries(t)){let t,l,u;if(!d)continue;let c=f(o),m=f(e),p=Object.entries(i[c].fields).filter(([e,t])=>t.references&&f(t.references.model)===m),E=!0;if(p.length||(p=Object.entries(i[m].fields).filter(([e,t])=>t.references&&f(t.references.model)===c),E=!1),p.length){if(p.length>1)throw new s.BetterAuthError(`Multiple foreign keys found for model ${o} and base model ${e} while performing join operation. Only one foreign key is supported.`)}else throw new s.BetterAuthError(`No foreign key found for model ${o} and base model ${e} while performing join operation.`);let[O,g]=p[0];if(!g.references)throw new s.BetterAuthError(`No references found for foreign key ${O} on model ${o} while performing join operation.`);E?(t=A({model:e,field:u=g.references.field}),l=A({model:o,field:O})):(t=A({model:e,field:u=O}),l=A({model:o,field:g.references.field})),n&&!n.includes(u)&&n.push(u);let y="id"===l||(g.unique??!1),b=r.advanced?.database?.defaultFindManyLimit??100;y?b=1:"object"==typeof d&&"number"==typeof d.limit&&(b=d.limit),a[T(o)]={on:{from:t,to:l},limit:b,relation:y?"one-to-one":"one-to-many"}}return{join:a,select:n}},k=async({baseModel:e,baseData:t,joinModel:n,specificJoinConfig:a})=>{let i;if(!t)return t;let o=T(n),s=a.on.to,d=t[O({field:a.on.from,model:e})];if(null==d)return"one-to-one"===a.relation?null:[];let l=M({model:o,where:[{field:s,value:d,operator:"eq",connector:"AND"}],action:"findOne"});try{if("one-to-one"===a.relation)i=await L(`db findOne ${o}`,{[_]:"findOne",[h]:o},()=>x.findOne({model:o,where:l}));else{let e=a.limit??r.advanced?.database?.defaultFindManyLimit??100;i=await L(`db findMany ${o}`,{[_]:"findMany",[h]:o},()=>x.findMany({model:o,where:l,limit:e}))}}catch(e){throw c.error(`Failed to query fallback join for model ${o}:`,{where:l,limit:a.limit}),console.error(e),e}return i},x=e({options:r,schema:i,debugLog:l,getFieldName:A,getModelName:T,getDefaultModelName:f,getDefaultFieldName:O,getFieldAttributes:I,transformInput:R,transformOutput:S,transformWhereClause:M}),B=null,j={transaction:async e=>{if(!B)if(a.transaction)c.debug(`[${a.adapterName}] - Using provided transaction implementation.`),B=a.transaction;else B=e=>e(j);return B(e)},create:async({data:e,model:t,select:r,forceAllowId:n=!1})=>{let i=++w,o=T(t);t=f(t),"id"in e&&void 0!==e.id&&!n&&(c.warn(`[${a.adapterName}] - You are trying to create a record with an id. This is not allowed as we handle id generation for you, unless you pass in the \`forceAllowId\` parameter. The id will be ignored.`),console.log(Error().stack?.split("\n").filter((e,t)=>1!==t).join("\n").replace("Error:","Create method with `id` being called at:")),e.id=void 0),l({method:"create"},`${$(i)} ${v(1,4)}`,`${C("create")} ${U("Unsafe Input")}:`,{model:o,data:e});let s=e;a.disableTransformInput||(s=await R(e,t,"create",n)),l({method:"create"},`${$(i)} ${v(2,4)}`,`${C("create")} ${U("Parsed Input")}:`,{model:o,data:s});let d=await L(`db create ${o}`,{[_]:"create",[h]:o},()=>x.create({data:s,model:o}));l({method:"create"},`${$(i)} ${v(3,4)}`,`${C("create")} ${U("DB Result")}:`,{model:o,res:d});let u=d;return a.disableTransformOutput||(u=await S(d,t,r,void 0)),l({method:"create"},`${$(i)} ${v(4,4)}`,`${C("create")} ${U("Parsed Result")}:`,{model:o,data:u}),u},update:async({model:e,where:t,update:r})=>{let n=++w,i=T(e=f(e)),o=M({model:e,where:t,action:"update"});if(0===o.length)return null;l({method:"update"},`${$(n)} ${v(1,4)}`,`${C("update")} ${U("Unsafe Input")}:`,{model:i,data:r});let s=r;a.disableTransformInput||(s=await R(r,e,"update")),l({method:"update"},`${$(n)} ${v(2,4)}`,`${C("update")} ${U("Parsed Input")}:`,{model:i,data:s});let d=await L(`db update ${i}`,{[_]:"update",[h]:i},()=>x.update({model:i,where:o,update:s}));l({method:"update"},`${$(n)} ${v(3,4)}`,`${C("update")} ${U("DB Result")}:`,{model:i,data:d});let u=d;return a.disableTransformOutput||(u=await S(d,e,void 0,void 0)),l({method:"update"},`${$(n)} ${v(4,4)}`,`${C("update")} ${U("Parsed Result")}:`,{model:i,data:u}),u},updateMany:async({model:e,where:t,update:r})=>{let n=++w,i=T(e),o=M({model:e,where:t,action:"updateMany"});e=f(e),l({method:"updateMany"},`${$(n)} ${v(1,4)}`,`${C("updateMany")} ${U("Unsafe Input")}:`,{model:i,data:r});let s=r;a.disableTransformInput||(s=await R(r,e,"update")),l({method:"updateMany"},`${$(n)} ${v(2,4)}`,`${C("updateMany")} ${U("Parsed Input")}:`,{model:i,data:s});let d=await L(`db updateMany ${i}`,{[_]:"updateMany",[h]:i},()=>x.updateMany({model:i,where:o,update:s}));return l({method:"updateMany"},`${$(n)} ${v(3,4)}`,`${C("updateMany")} ${U("DB Result")}:`,{model:i,data:d}),l({method:"updateMany"},`${$(n)} ${v(4,4)}`,`${C("updateMany")} ${U("Parsed Result")}:`,{model:i,data:d}),d},findOne:async({model:e,where:t,select:n,join:i})=>{let o,s=++w,d=T(e),u=M({model:e,where:t,action:"findOne"});e=f(e);let c=!0;if(a.disableTransformJoin)o=i;else{let t=P(e,i,n);t&&(o=t.join,n=t.select),!r.experimental?.joins&&o&&Object.keys(o).length>0&&(c=!1)}l({method:"findOne"},`${$(s)} ${v(1,3)}`,`${C("findOne")}:`,{model:d,where:u,select:n,join:o});let m=await L(`db findOne ${d}`,{[_]:"findOne",[h]:d},()=>x.findOne({model:d,where:u,select:n,join:c?o:void 0}));l({method:"findOne"},`${$(s)} ${v(2,3)}`,`${C("findOne")} ${U("DB Result")}:`,{model:d,data:m});let p=m;return a.disableTransformOutput||(p=await S(m,e,n,o)),l({method:"findOne"},`${$(s)} ${v(3,3)}`,`${C("findOne")} ${U("Parsed Result")}:`,{model:d,data:p}),p},findMany:async({model:e,where:t,limit:n,select:i,sortBy:o,offset:s,join:d})=>{let u,c=++w,m=n??r.advanced?.database?.defaultFindManyLimit??100,p=T(e),E=M({model:e,where:t,action:"findMany"});e=f(e);let O=!0;if(a.disableTransformJoin)u=d;else{let t=P(e,d,i);t&&(u=t.join,i=t.select),!r.experimental?.joins&&u&&Object.keys(u).length>0&&(O=!1)}l({method:"findMany"},`${$(c)} ${v(1,3)}`,`${C("findMany")}:`,{model:p,where:E,limit:m,sortBy:o,offset:s,join:u});let A=await L(`db findMany ${p}`,{[_]:"findMany",[h]:p},()=>x.findMany({model:p,where:E,limit:m,select:i,sortBy:o,offset:s,join:O?u:void 0}));l({method:"findMany"},`${$(c)} ${v(2,3)}`,`${C("findMany")} ${U("DB Result")}:`,{model:p,data:A});let g=A;return a.disableTransformOutput||(g=await Promise.all(A.map(async t=>await S(t,e,void 0,u)))),l({method:"findMany"},`${$(c)} ${v(3,3)}`,`${C("findMany")} ${U("Parsed Result")}:`,{model:p,data:g}),g},delete:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"delete"});e=f(e),l({method:"delete"},`${$(r)} ${v(1,2)}`,`${C("delete")}:`,{model:n,where:a}),await L(`db delete ${n}`,{[_]:"delete",[h]:n},()=>x.delete({model:n,where:a})),l({method:"delete"},`${$(r)} ${v(2,2)}`,`${C("delete")} ${U("DB Result")}:`,{model:n})},deleteMany:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"deleteMany"});e=f(e),l({method:"deleteMany"},`${$(r)} ${v(1,2)}`,`${C("deleteMany")} ${U("DeleteMany")}:`,{model:n,where:a});let i=await L(`db deleteMany ${n}`,{[_]:"deleteMany",[h]:n},()=>x.deleteMany({model:n,where:a}));return l({method:"deleteMany"},`${$(r)} ${v(2,2)}`,`${C("deleteMany")} ${U("DB Result")}:`,{model:n,data:i}),i},consumeOne:async({model:e,where:t})=>{let r,n=++w,i=T(e),d=M({model:e,where:t,action:"consumeOne"});e=f(e),l({method:"consumeOne"},`${$(n)} ${v(1,3)}`,`${C("consumeOne")} ${U("ConsumeOne")}:`,{model:i,where:d});let u=!0;x.consumeOne?r=await L(`db consumeOne ${i}`,{[_]:"consumeOne",[h]:i},()=>x.consumeOne({model:i,where:d})):(r=await L(`db consumeOne ${i}`,{[_]:"consumeOne",[h]:i},()=>(0,o.runWithTransaction)(j,async()=>{let r=await (0,o.getCurrentAdapter)(j),n=(await r.findMany({model:e,where:t,limit:1}))[0];if(!n)return null;let i=await r.deleteMany({model:e,where:[...t,{field:"id",value:n.id,operator:"eq",connector:"AND",mode:"sensitive"}]});if("number"!=typeof i)throw new s.BetterAuthError(`Adapter "${a.adapterId}" returned a non-numeric value from deleteMany during the consumeOne fallback. Return the number of deleted rows, or implement a native consumeOne for atomic single-use consumption.`);return i>0?n:null})),u=!1),l({method:"consumeOne"},`${$(n)} ${v(2,3)}`,`${C("consumeOne")} ${U("DB Result")}:`,{model:i,data:r});let c=r;return!a.disableTransformOutput&&u&&r&&(c=await S(r,e,void 0,void 0)),l({method:"consumeOne"},`${$(n)} ${v(3,3)}`,`${C("consumeOne")} ${U("Parsed Result")}:`,{model:i,data:c}),c},incrementOne:async({model:e,where:t,increment:r,set:n})=>{let i,d=Object.keys(r).length>0,u=!!n&&Object.keys(n).length>0;if(!d&&!u)throw new s.BetterAuthError("incrementOne requires a non-empty `increment` or `set`; both were empty.");let c=++w,m=T(e),p=M({model:e,where:t,action:"incrementOne"});e=f(e),l({method:"incrementOne"},`${$(c)} ${v(1,3)}`,`${C("incrementOne")} ${U("IncrementOne")}:`,{model:m,where:p,increment:r,set:n});let E=!0;if(x.incrementOne){let t,o=a.mapKeysTransformInput??{},d={};for(let[t,n]of Object.entries(r))d[o[t]||A({model:e,field:t})]=n;if(t=n&&!a.disableTransformInput?await R(n,e,"update"):n,0===Object.keys(d).length&&(!t||0===Object.keys(t).length))throw new s.BetterAuthError("incrementOne resolved to an empty update: every increment/set field was unknown to the schema or transformed away.");i=await L(`db incrementOne ${m}`,{[_]:"incrementOne",[h]:m},()=>x.incrementOne({model:m,where:p,increment:d,set:t}))}else i=await L(`db incrementOne ${m}`,{[_]:"incrementOne",[h]:m},()=>(0,o.runWithTransaction)(j,async()=>{let i=await (0,o.getCurrentAdapter)(j),d=(await i.findMany({model:e,where:t,limit:1}))[0];if(!d)return null;let l={...n??{}};for(let[e,t]of Object.entries(r))l[e]=("number"==typeof d[e]?d[e]:0)+t;let u=await i.updateMany({model:e,where:[...t,{field:"id",value:d.id,operator:"eq",connector:"AND",mode:"sensitive"}],update:l});if("number"!=typeof u)throw new s.BetterAuthError(`Adapter "${a.adapterId}" returned a non-numeric value from updateMany during the incrementOne fallback. Return the number of updated rows, or implement a native incrementOne for atomic guarded counter updates.`);return u>0?{...d,...l}:null})),E=!1;l({method:"incrementOne"},`${$(c)} ${v(2,3)}`,`${C("incrementOne")} ${U("DB Result")}:`,{model:m,data:i});let O=i;return!a.disableTransformOutput&&E&&i&&(O=await S(i,e,void 0,void 0)),l({method:"incrementOne"},`${$(c)} ${v(3,3)}`,`${C("incrementOne")} ${U("Parsed Result")}:`,{model:m,data:O}),O},count:async({model:e,where:t})=>{let r=++w,n=T(e),a=M({model:e,where:t,action:"count"});e=f(e),l({method:"count"},`${$(r)} ${v(1,2)}`,`${C("count")}:`,{model:n,where:a});let i=await L(`db count ${n}`,{[_]:"count",[h]:n},()=>x.count({model:n,where:a}));return l({method:"count"},`${$(r)} ${v(2,2)}`,`${C("count")}:`,{model:n,data:i}),i},createSchema:x.createSchema?async(e,t)=>{let n=(0,d.getAuthTables)(r);return r.secondaryStorage&&!r.session?.storeSessionInDatabase&&delete n.session,x.createSchema({file:t,tables:n})}:void 0,options:{adapterConfig:a,...x.options??{}},id:a.adapterId,...a.debugLogs?.isRunningAdapterTests?{adapterTestDebugLogs:{resetDebugLogs(){D=D.filter(e=>e.instance!==n)},printDebugLogs(){let e="─".repeat(80),t=D.filter(e=>e.instance===n);0===t.length||console.log(...t.reverse().map(e=>(e.args[0]=`
|
|
2
2
|
${e.args[0]}`,[...e.args,"\n"])).reduce((e,t)=>[...t,...e],[`
|
|
3
3
|
${e}`]))}}}:{}};return j}],70901)}];
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__04h15ml._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__04jgk9x._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__07ednlo._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0a7djvw._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0ig1bot._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0szd4sh._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0t7o5ed._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(
|
|
1
|
+
module.exports=[63003,e=>{"use strict";e.i(7876);var s=e.i(37173);e.i(78737),e.s(["PostgresStore",()=>s.PostgresStore])},6194,e=>{e.v(s=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(s=>e.l(s))).then(()=>s(8844)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__1-0flwc._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},44733,e=>{"use strict";let t,r,n,i,a,o,s,c,l,d,u;var p,f,h,m,y=e.i(56710),g=e.i(82809),w=e.i(74001),b=e.i(73300),A=e.i(68744),E=e.i(98570),v=e.i(56147),k=e.i(32931),_=e.i(61810),S=e.i(59963),x=e.i(44491),R=e.i(74916),T=e.i(33073),I=e.i(98603),U=e.i(93317),O=e.i(93695);e.i(95533);var P=e.i(75616);function C(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}function D(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let i=n+1;for(;i<e.length&&" "===e[i];)i++;for(;i<e.length&&"="!==e[i]&&";"!==e[i]&&","!==e[i];)i++;if(i<e.length&&"="===e[i]){let i=e.slice(r,n).trim();for(i&&t.push(i),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let i=e.slice(r).trim();return i&&t.push(i),t}let L=/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E\x5F\x60\x61-\x7A\x7C\x7E]+$/,$=/^[\x20\x21\x23-\x3A\x3C-\x5B\x5D-\x7E]*$/;function z(e){return!(e.length<2)&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function N(e){let t=0,r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(32!==r&&9!==r)break;t++}for(;r>t;){let t=e.charCodeAt(r-1);if(32!==t&&9!==t)break;r--}return 0===t&&r===e.length?e:e.slice(t,r)}function j(e){let t=new Map;if(e.length<2)return t;for(let r of e.split(";")){let e=r.indexOf("=");if(-1===e)continue;let n=N(r.slice(0,e)),i=z(N(r.slice(e+1)));L.test(n)&&$.test(i)&&t.set(n,C(i))}return t}var H=e.i(10469),B=e.i(69772);let q=async()=>{let e=(0,H.__getBetterAuthGlobal)();if(!e.context.requestStateAsyncStorage){let t=await (0,B.getAsyncLocalStorage)();e.context.requestStateAsyncStorage=new t}return e.context.requestStateAsyncStorage};async function M(){return void 0!==(await q()).getStore()}async function V(){let e=(await q()).getStore();if(!e)throw Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");return e}async function K(e,t){return(await q()).run(e,t)}function W(e){let t=Object.freeze({});return{get ref(){return t},async get(){let r=await V();if(!r.has(t)){let n=await e();return r.set(t,n),n}return r.get(t)},async set(e){(await V()).set(t,e)}}}let{get:F,set:J}=W(()=>!1),Z=async()=>{let e=(0,H.__getBetterAuthGlobal)();if(!e.context.endpointContextAsyncStorage){let t=await (0,B.getAsyncLocalStorage)();e.context.endpointContextAsyncStorage=new t}return e.context.endpointContextAsyncStorage};async function G(){let e=(await Z()).getStore();if(!e)throw Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");return e}async function Q(e,t){return(await Z()).run(e,t)}var Y=e.i(36004),X=e.i(58461);let ee=/^application\/([a-z0-9.+-]*\+)?json/i;async function et(e,t){let r=e.headers.get("content-type")||"",n=r.toLowerCase();if(e.body){if(t&&t.length>0&&!t.some(e=>{let t=n.split(";")[0].trim(),r=e.toLowerCase().trim();return t===r||t.includes(r)})){if(!n)throw new X.APIError(415,{message:`Content-Type is required. Allowed types: ${t.join(", ")}`,code:"UNSUPPORTED_MEDIA_TYPE"});throw new X.APIError(415,{message:`Content-Type "${r}" is not allowed. Allowed types: ${t.join(", ")}`,code:"UNSUPPORTED_MEDIA_TYPE"})}if(ee.test(n))try{return await e.json()}catch(e){if(e instanceof SyntaxError)throw new X.APIError(400,{message:"Invalid JSON in request body",code:"BAD_REQUEST"});throw e}if(n.includes("application/x-www-form-urlencoded")){let t=await e.formData(),r={};return t.forEach((e,t)=>{r[t]=e.toString()}),r}if(n.includes("multipart/form-data")){let t=await e.formData(),r={};return t.forEach((e,t)=>{r[t]=e}),r}return n.includes("text/plain")?await e.text():n.includes("application/octet-stream")?await e.arrayBuffer():n.includes("application/pdf")||n.includes("image/")||n.includes("video/")?await e.blob():n.includes("application/stream")||e.body instanceof ReadableStream?e.body:await e.text()}}function er(e){return e instanceof X.APIError||e?.name==="APIError"}async function en(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}function ei(e){return e instanceof Request||"[object Request]"===Object.prototype.toString.call(e)}let ea=new Set(["host","user-agent","referer","from","expect","authorization","proxy-authorization","cookie","origin","accept-charset","accept-encoding","accept-language","if-match","if-none-match","if-modified-since","if-unmodified-since","if-range","range","max-forwards","connection","keep-alive","transfer-encoding","te","upgrade","trailer","proxy-connection","content-length"]);function eo(e){for(let t of ea)e.delete(t)}function es(e,t){if(t)for(let[r,n]of new Headers(t).entries())"set-cookie"===r.toLowerCase()?e.append(r,n):e.set(r,n)}function ec(e,t){if(e instanceof Response){if(t?.headers){let r=new Headers(t.headers);eo(r),es(e.headers,r)}return e}if(e&&"object"==typeof e&&"_flag"in e&&"json"===e._flag){let r=e.body,n=e.routerResponse;if(n instanceof Response)return n;let i=new Headers;if(es(i,n?.headers),es(i,e.headers),t?.headers){let e=new Headers(t.headers);eo(e),es(i,e)}return i.set("Content-Type","application/json"),new Response(JSON.stringify(r),{...n,headers:i,status:e.status??t?.status??n?.status,statusText:t?.statusText??n?.statusText})}if(er(e))return ec(e.body,{status:t?.status??e.statusCode,statusText:e.status.toString(),headers:t?.headers||e.headers});let r=e,n=new Headers(t?.headers);if(eo(n),e){if("string"==typeof e)r=e,n.set("Content-Type","text/plain");else if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))r=e,n.set("Content-Type","application/octet-stream");else if(e instanceof Blob)r=e,n.set("Content-Type",e.type||"application/octet-stream");else if(e instanceof FormData)r=e;else if(e instanceof URLSearchParams)r=e,n.set("Content-Type","application/x-www-form-urlencoded");else if(e instanceof ReadableStream)r=e,n.set("Content-Type","application/octet-stream");else if(function(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}(e)){let t,i,a;t=new WeakMap,i=new WeakMap,a=0,r=JSON.stringify(e,function(e,r){if("bigint"==typeof r)return r.toString();if("object"==typeof r&&null!==r){if(((e,r)=>{let n=r;for(;n;){if(n===e)return!0;n=t.get(n)}return!1})(r,this))return`[Circular ref-${i.get(r)}]`;t.set(r,this),i.has(r)||i.set(r,a++)}return r}),n.set("Content-Type","application/json")}}else null===e&&(r=JSON.stringify(null)),n.set("content-type","application/json");return new Response(r,{...t,headers:n})}function el(){let e="u">typeof globalThis&&globalThis.crypto;if(e&&"object"==typeof e.subtle&&null!=e.subtle)return e.subtle;throw Error("crypto.subtle must be defined")}let ed={name:"HMAC",hash:"SHA-256"},eu=async e=>{let t="string"==typeof e?new TextEncoder().encode(e):e;return await el().importKey("raw",t,ed,!1,["sign","verify"])},ep=async(e,t,r)=>{try{let n=atob(e),i=new Uint8Array(n.length);for(let e=0,t=n.length;e<t;e++)i[e]=n.charCodeAt(e);return await el().verify(ed,r,i,new TextEncoder().encode(t))}catch(e){return!1}},ef=async(e,t)=>{let r=await eu(t);return btoa(String.fromCharCode(...new Uint8Array(await el().sign(ed.name,r,new TextEncoder().encode(e)))))},eh=async(e,t)=>{let r=await ef(e,t);return encodeURIComponent(e=`${e}.${r}`)},em=(e,t)=>{let r=e;if(t)if("secure"===t)r="__Secure-"+e;else{if("host"!==t)return;r="__Host-"+e}return r},ey=(e,t,r={})=>{let n;if(n=r?.prefix==="secure"?`__Secure-${e}=${t}`:r?.prefix==="host"?`__Host-${e}=${t}`:`${e}=${t}`,e.startsWith("__Secure-")&&!r.secure&&(r.secure=!0),e.startsWith("__Host-")&&(r.secure||(r.secure=!0),"/"!==r.path&&(r.path="/"),r.domain&&(r.domain=void 0)),r&&"number"==typeof r.maxAge&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${Math.floor(r.maxAge)}`}if(r.domain&&"host"!==r.prefix&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}return r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.partitioned&&(r.secure||(r.secure=!0),n+="; Partitioned"),n},eg=(e,t,r)=>ey(e,t=encodeURIComponent(t),r),ew=async(e,t,r,n)=>ey(e,t=await eh(t,r),n);async function eb(e,t={}){let r={body:t.body,query:t.query};if(e.body){let n=await e.body["~standard"].validate(t.body);if(n.issues)return{data:null,error:eA(n.issues,"body")};r.body=n.value}if(e.query){let n=await e.query["~standard"].validate(t.query);if(n.issues)return{data:null,error:eA(n.issues,"query")};r.query=n.value}return e.requireHeaders&&!t.headers?{data:null,error:{message:"Headers is required",issues:[]}}:e.requireRequest&&!t.request?{data:null,error:{message:"Request is required",issues:[]}}:{data:r,error:null}}function eA(e,t){return{message:e.map(e=>`[${e.path?.length?`${t}.`+e.path.map(e=>"object"==typeof e?e.key:e).join("."):t}] ${e.message}`).join("; "),issues:e}}let eE=async(e,{options:t,path:r})=>{let n,i=new Headers,{data:a,error:o}=await eb(t,e);if(o)throw new X.ValidationError(o.message,o.issues);let s="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&ei(e.request)?e.request.headers:null,c=s?.get("cookie"),l=c?function(e){if("string"!=typeof e)throw TypeError("argument str must be a string");let t=new Map,r=0;for(;r<e.length;){let n=e.indexOf("=",r);if(-1===n)break;let i=e.indexOf(";",r);if(-1===i)i=e.length;else if(i<n){r=e.lastIndexOf(";",n-1)+1;continue}let a=e.slice(r,n).trim();if(!t.has(a)){let r=e.slice(n+1,i).trim();34===r.codePointAt(0)&&(r=r.slice(1,-1)),t.set(a,function(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}(r))}r=i+1}return t}(c):void 0,d={...e,body:a.body,query:a.query,path:e.path||r||"virtual:",context:"context"in e&&e.context?e.context:{},returned:void 0,headers:e?.headers,request:e?.request,params:"params"in e?e.params:void 0,method:e.method??(Array.isArray(t.method)?t.method[0]:"*"===t.method?"GET":t.method),setHeader:(e,t)=>{i.set(e,t)},getHeader:e=>s?s.get(e):null,getCookie:(e,t)=>{let r=em(e,t);return r&&l?.get(r)||null},getSignedCookie:async(e,t,r)=>{let n=em(e,r);if(!n)return null;let i=l?.get(n);if(!i)return null;let a=i.lastIndexOf(".");if(a<1)return null;let o=i.substring(0,a),s=i.substring(a+1);return 44===s.length&&s.endsWith("=")?!!await ep(s,o,await eu(t))&&o:null},setCookie:(e,t,r)=>{let n=eg(e,t,r);return i.append("set-cookie",n),n},setSignedCookie:async(e,t,r,n)=>{let a=await ew(e,t,r,n);return i.append("set-cookie",a),a},redirect:e=>(i.set("location",e),new X.APIError("FOUND",void 0,i)),error:(e,t,r)=>new X.APIError(e,t,r),setStatus:e=>{n=e},json:(t,r)=>e.asResponse?{body:r?.body||t,routerResponse:r,_flag:"json"}:t,responseHeaders:i,get responseStatus(){return n}};for(let e of t.use||[]){let t=await e({...d,returnHeaders:!0,asResponse:!1});t.response&&Object.assign(d.context,t.response),t.headers&&t.headers.forEach((e,t)=>{d.responseHeaders.set(t,e)})}return d};function ev(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r;if(("GET"===i.method||"HEAD"===i.method)&&i.body)throw new X.BetterCallError("Body is not allowed with GET or HEAD methods");if(n&&/\/{2,}/.test(n))throw new X.BetterCallError("Path cannot contain consecutive slashes");let o=async(...e)=>{let t=e[0]||{},{data:r,error:o}=await en(eE(t,{options:i,path:n}));if(o){if(!(o instanceof X.ValidationError))throw o;throw i.onValidationError&&await i.onValidationError({message:o.message,issues:o.issues}),new X.APIError(400,{message:o.message,code:"VALIDATION_ERROR"})}let s=await a(r).catch(async e=>{if(er(e)){let r=i.onAPIError;if(r&&await r(e),t.asResponse)return e}throw e}),c=r.responseHeaders,l=r.responseStatus;return t.asResponse?ec(s,{headers:c,status:l}):t.returnHeaders?t.returnStatus?{headers:c,response:s,status:l}:{headers:c,response:s}:t.returnStatus?{response:s,status:l}:s};return o.options=i,o.path=n,o}function ek(e,t){let r=async r=>{let n="function"==typeof e?e:t,i=await eE(r,{options:"function"==typeof e?{}:e,path:"/"});if(!n)throw Error("handler must be defined");try{let e=await n(i),t=i.responseHeaders;return r.returnHeaders?{headers:t,response:e}:e}catch(e){throw er(e)&&Object.defineProperty(e,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,get:()=>i.responseHeaders}),e}};return r.options="function"==typeof e?{}:e,r}function e_(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}ev.create=e=>(t,r,n)=>ev(t,{...r,use:[...r?.use||[],...e?.use||[]]},n),ek.create=e=>function(t,r){if("function"==typeof t)return ek({use:e?.use},t);if(!r)throw Error("Middleware handler is required");return ek({...t,method:"*",use:[...e?.use||[],...t.use||[]]},r)},Symbol("zod_brand");class eS extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ex extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(h=globalThis).__zod_globalConfig??(h.__zod_globalConfig={});let eR=globalThis.__zod_globalConfig;function eT(e){return e&&Object.assign(eR,e),eR}function eI(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function eU(e,t){return"bigint"==typeof t?t.toString():t}function eO(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function eP(e){return null==e}function eC(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eD(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}let eL=Symbol("evaluating");function e$(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==eL)return void 0===n&&(n=eL,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ez(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function eN(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function ej(e){return JSON.stringify(e)}function eH(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let eB="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eq(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let eM=eO(()=>{if(eR.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eV(e){if(!1===eq(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eq(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let eK=new Set(["string","number","symbol"]),eW=new Set(["string","number","bigint","boolean","symbol","undefined"]);function eF(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eJ(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function eZ(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function eG(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function eQ(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let eY={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},eX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function e0(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function e1(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function e2(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function e5(e){return"string"==typeof e?e:e?.message}function e6(e,t,r){let n=e.message?e.message:e5(e.inst?._zod.def?.error?.(e))??e5(t?.error?.(e))??e5(r.customError?.(e))??e5(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function e4(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function e8(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function e3(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function e9(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function e7(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,eX,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,eY,"aborted",0,e0,"allowsEval",0,eM,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,ez,"base64ToUint8Array",0,e9,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return e9(t+r)},"cached",0,eO,"captureStackTrace",0,eB,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,eC,"clone",0,eJ,"cloneDef",0,function(e){return eN(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,e$,"esc",0,ej,"escapeRegex",0,eF,"explicitlyAborted",0,e1,"extend",0,function(e,t){if(!eV(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ez(this,"shape",r),r}});return eJ(e,n)},"finalizeIssue",0,e6,"floatSafeRemainder",0,eD,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,eI,"getLengthableOrigin",0,e8,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,e4,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,eq,"isPlainObject",0,eV,"issue",0,e3,"joinValues",0,function(e,t="|"){return e.map(e=>eG(e)).join(t)},"jsonStringifyReplacer",0,eU,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ez(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return eJ(e,r)},"mergeDefs",0,eN,"normalizeParams",0,eZ,"nullish",0,eP,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=eN(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return ez(this,"shape",n),n},checks:[]});return eJ(e,i)},"optionalKeys",0,eQ,"parsedType",0,function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t},"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=eN(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return ez(this,"shape",i),i},checks:[]});return eJ(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=eN(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return ez(this,"shape",e),e},checks:[]});return eJ(e,i)},"prefixIssues",0,e2,"primitiveTypes",0,eW,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,eK,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=eN(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return ez(this,"shape",i),i}});return eJ(t,n)},"safeExtend",0,function(e,t){if(!eV(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ez(this,"shape",r),r}});return eJ(e,r)},"shallowClone",0,function(e){return eV(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e},"slugify",0,eH,"stringifyPrimitive",0,eG,"uint8ArrayToBase64",0,e7,"uint8ArrayToBase64url",0,function(e){return e7(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,e5],2721);let te=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,tr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tn=/^[0-9a-vA-V]{20}$/,ti=/^[A-Za-z0-9]{27}$/,ta=/^[a-zA-Z0-9_-]{21}$/,to=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ts=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tl=tc(4),td=tc(6),tu=tc(7),tp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function th(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let tm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ty=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tg=e=>{let t=eF(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},tw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tE=/^[A-Za-z0-9_-]*$/,tv=/^https?$/,tk=/^\+[1-9]\d{6,14}$/,t_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",tS=RegExp(`^${t_}$`);function tx(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tR(e){return RegExp(`^${tx(e)}$`)}function tT(e){let t=tx({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${t_}T(?:${n})$`)}let tI=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},tU=/^-?\d+n?$/,tO=/^-?\d+$/,tP=/^-?\d+(?:\.\d+)?$/,tC=/^(?:true|false)$/i,tD=/^null$/i,tL=/^undefined$/i,t$=/^[^A-Z]*$/,tz=/^[^a-z]*$/;function tN(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function tj(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let tH=tN(22,"=="),tB=tj(22),tq=tN(27,"="),tM=tj(27),tV=tN(43,"="),tK=tj(43),tW=tN(64,""),tF=tj(64),tJ=tN(86,"=="),tZ=tj(86);e.s(["base64",0,tA,"base64url",0,tE,"bigint",0,tU,"boolean",0,tC,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,tw,"cidrv6",0,tb,"cuid",0,te,"cuid2",0,tt,"date",0,tS,"datetime",0,tT,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,to,"e164",0,tk,"email",0,tp,"emoji",0,th,"extendedDuration",0,/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,"guid",0,ts,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,tv,"idnEmail",0,tf,"integer",0,tO,"ipv4",0,tm,"ipv6",0,ty,"ksuid",0,ti,"lowercase",0,t$,"mac",0,tg,"md5_base64",0,tH,"md5_base64url",0,tB,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,ta,"null",0,tD,"number",0,tP,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,tq,"sha1_base64url",0,tM,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,tV,"sha256_base64url",0,tK,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,tW,"sha384_base64url",0,tF,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,tJ,"sha512_base64url",0,tZ,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,tI,"time",0,tR,"ulid",0,tr,"undefined",0,tL,"unicodeEmail",0,tf,"uppercase",0,tz,"uuid",0,tc,"uuid4",0,tl,"uuid6",0,td,"uuid7",0,tu,"xid",0,tn],10107);let tG=e_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tQ={number:"number",bigint:"bigint",object:"date"},tY=e_("$ZodCheckLessThan",(e,t)=>{tG.init(e,t);let r=tQ[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tX=e_("$ZodCheckGreaterThan",(e,t)=>{tG.init(e,t);let r=tQ[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),t0=e_("$ZodCheckMultipleOf",(e,t)=>{tG.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===eD(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),t1=e_("$ZodCheckNumberFormat",(e,t)=>{tG.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=eY[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=tO)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),t2=e_("$ZodCheckBigIntFormat",(e,t)=>{tG.init(e,t);let[r,n]=eX[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),t5=e_("$ZodCheckMaxSize",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:e4(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t6=e_("$ZodCheckMinSize",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:e4(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t4=e_("$ZodCheckSizeEquals",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:e4(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),t8=e_("$ZodCheckMaxLength",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=e8(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t3=e_("$ZodCheckMinLength",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=e8(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t9=e_("$ZodCheckLengthEquals",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=e8(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),t7=e_("$ZodCheckStringFormat",(e,t)=>{var r,n;tG.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),re=e_("$ZodCheckRegex",(e,t)=>{t7.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rt=e_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t$),t7.init(e,t)}),rr=e_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tz),t7.init(e,t)}),rn=e_("$ZodCheckIncludes",(e,t)=>{tG.init(e,t);let r=eF(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ri=e_("$ZodCheckStartsWith",(e,t)=>{tG.init(e,t);let r=RegExp(`^${eF(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ra=e_("$ZodCheckEndsWith",(e,t)=>{tG.init(e,t);let r=RegExp(`.*${eF(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});(e,t)=>{tG.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}};let ro=e_("$ZodCheckOverwrite",(e,t)=>{tG.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class rs{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let rc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,eU,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rl=e_("$ZodError",rc),rd=e_("$ZodError",rc,{Parent:Error}),ru=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new eS;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>e6(e,a,eT())));throw eB(t,i?.callee),t}return o.value},rp=ru(rd),rf=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>e6(e,a,eT())));throw eB(t,i?.callee),t}return o.value},rh=rf(rd),rm=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new eS;return a.issues.length?{success:!1,error:new(e??rl)(a.issues.map(e=>e6(e,i,eT())))}:{success:!0,data:a.value}},ry=rm(rd),rg=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>e6(e,i,eT())))}:{success:!0,data:a.value}},rw=rg(rd),rb={major:4,minor:4,patch:3},rA=e_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rb;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=e0(e);for(let a of t){if(a._zod.def.when){if(e1(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new eS;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=e0(e,t)))});else{if(e.issues.length===t)continue;i||(i=e0(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(e0(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new eS;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new eS;return o.then(e=>t(e,n,a))}return t(o,n,a)}}e$(e,"~standard",()=>({validate:t=>{try{let r=ry(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return rw(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),rE=e_("$ZodString",(e,t)=>{rA.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??tI(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),rv=e_("$ZodStringFormat",(e,t)=>{t7.init(e,t),rE.init(e,t)}),rk=e_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ts),rv.init(e,t)}),r_=e_("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tc(e))}else t.pattern??(t.pattern=tc());rv.init(e,t)}),rS=e_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tp),rv.init(e,t)}),rx=e_("$ZodURL",(e,t)=>{rv.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===tv.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rR=e_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=th()),rv.init(e,t)}),rT=e_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ta),rv.init(e,t)}),rI=e_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=te),rv.init(e,t)}),rU=e_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tt),rv.init(e,t)}),rO=e_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tr),rv.init(e,t)}),rP=e_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tn),rv.init(e,t)}),rC=e_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ti),rv.init(e,t)}),rD=e_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tT(t)),rv.init(e,t)}),rL=e_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tS),rv.init(e,t)}),r$=e_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tR(t)),rv.init(e,t)}),rz=e_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=to),rv.init(e,t)}),rN=e_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tm),rv.init(e,t),e._zod.bag.format="ipv4"}),rj=e_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ty),rv.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rH=((e,t)=>{t.pattern??(t.pattern=tg(t.delimiter)),rv.init(e,t),e._zod.bag.format="mac"},e_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tw),rv.init(e,t)})),rB=e_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tb),rv.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function rq(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rM=e_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tA),rv.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{rq(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rV=e_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tE),rv.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!tE.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rq(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rK=e_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tk),rv.init(e,t)}),rW=e_("$ZodJWT",(e,t)=>{rv.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rF=((e,t)=>{rv.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}},e_("$ZodNumber",(e,t)=>{rA.init(e,t),e._zod.pattern=e._zod.bag.pattern??tP,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}})),rJ=e_("$ZodNumberFormat",(e,t)=>{t1.init(e,t),rF.init(e,t)}),rZ=e_("$ZodBoolean",(e,t)=>{rA.init(e,t),e._zod.pattern=tC,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rG=e_("$ZodBigInt",(e,t)=>{rA.init(e,t),e._zod.pattern=tU,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),rQ=((e,t)=>{t2.init(e,t),rG.init(e,t)},e_("$ZodAny",(e,t)=>{rA.init(e,t),e._zod.parse=e=>e})),rY=e_("$ZodUnknown",(e,t)=>{rA.init(e,t),e._zod.parse=e=>e}),rX=e_("$ZodNever",(e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),r0=((e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}},e_("$ZodDate",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}}));function r1(e,t,r){e.issues.length&&t.issues.push(...e2(r,e.issues)),t.value[r]=e.value}let r2=e_("$ZodArray",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>r1(t,r,e))):r1(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function r5(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...e2(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function r6(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=eQ(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function r4(e,t,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,d="optional"===c.optin,u="optional"===c.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===l){o.push(i);continue}let a=c.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>r5(e,r,i,t,d,u))):r5(a,r,i,t,d,u)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let r8=e_("$ZodObject",(e,t)=>{let r;rA.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=eO(()=>r6(t));e$(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!eq(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],c=r.shape;for(let e of r.keys){let r=c[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,l=r._zod.run({value:o[e],issues:[]},n);l instanceof Promise?s.push(l.then(r=>r5(r,t,e,o,i,a))):r5(l,t,e,o,i,a)}return a?r4(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),r3=e_("$ZodObjectJIT",(e,t)=>{let r,n;r8.init(e,t);let i=e._zod.parse,a=eO(()=>r6(t)),o=!eR.jitless,s=o&&eM.value,c=t.catchall;e._zod.parse=(l,d)=>{n??(n=a.value);let u=l.value;return eq(u)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new rs(["shape","payload","ctx"]),r=a.value,n=e=>{let t=ej(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=ej(a),s=e[a],c=s?._zod?.optin==="optional",l=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),c&&l?t.write(`
|
|
1
|
+
module.exports=[2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},44733,e=>{"use strict";let t,r,n,i,a,o,s,c,l,d,u;var p,f,h,m,y=e.i(56710),g=e.i(82809),w=e.i(74001),b=e.i(73300),A=e.i(68744),E=e.i(98570),v=e.i(56147),k=e.i(32931),_=e.i(61810),S=e.i(59963),x=e.i(44491),R=e.i(74916),T=e.i(33073),I=e.i(98603),U=e.i(93317),O=e.i(93695);e.i(95533);var P=e.i(75616);function C(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}function D(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let i=n+1;for(;i<e.length&&" "===e[i];)i++;for(;i<e.length&&"="!==e[i]&&";"!==e[i]&&","!==e[i];)i++;if(i<e.length&&"="===e[i]){let i=e.slice(r,n).trim();for(i&&t.push(i),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let i=e.slice(r).trim();return i&&t.push(i),t}let L=/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E\x5F\x60\x61-\x7A\x7C\x7E]+$/,$=/^[\x20\x21\x23-\x3A\x3C-\x5B\x5D-\x7E]*$/;function z(e){return!(e.length<2)&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function N(e){let t=0,r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(32!==r&&9!==r)break;t++}for(;r>t;){let t=e.charCodeAt(r-1);if(32!==t&&9!==t)break;r--}return 0===t&&r===e.length?e:e.slice(t,r)}function j(e){let t=new Map;if(e.length<2)return t;for(let r of e.split(";")){let e=r.indexOf("=");if(-1===e)continue;let n=N(r.slice(0,e)),i=z(N(r.slice(e+1)));L.test(n)&&$.test(i)&&t.set(n,C(i))}return t}var H=e.i(10469),B=e.i(15705);let q=async()=>{let e=(0,H.__getBetterAuthGlobal)();if(!e.context.requestStateAsyncStorage){let t=await (0,B.getAsyncLocalStorage)();e.context.requestStateAsyncStorage=new t}return e.context.requestStateAsyncStorage};async function M(){return void 0!==(await q()).getStore()}async function V(){let e=(await q()).getStore();if(!e)throw Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");return e}async function K(e,t){return(await q()).run(e,t)}function W(e){let t=Object.freeze({});return{get ref(){return t},async get(){let r=await V();if(!r.has(t)){let n=await e();return r.set(t,n),n}return r.get(t)},async set(e){(await V()).set(t,e)}}}let{get:F,set:J}=W(()=>!1),Z=async()=>{let e=(0,H.__getBetterAuthGlobal)();if(!e.context.endpointContextAsyncStorage){let t=await (0,B.getAsyncLocalStorage)();e.context.endpointContextAsyncStorage=new t}return e.context.endpointContextAsyncStorage};async function G(){let e=(await Z()).getStore();if(!e)throw Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");return e}async function Q(e,t){return(await Z()).run(e,t)}var Y=e.i(36004),X=e.i(58461);let ee=/^application\/([a-z0-9.+-]*\+)?json/i;async function et(e,t){let r=e.headers.get("content-type")||"",n=r.toLowerCase();if(e.body){if(t&&t.length>0&&!t.some(e=>{let t=n.split(";")[0].trim(),r=e.toLowerCase().trim();return t===r||t.includes(r)})){if(!n)throw new X.APIError(415,{message:`Content-Type is required. Allowed types: ${t.join(", ")}`,code:"UNSUPPORTED_MEDIA_TYPE"});throw new X.APIError(415,{message:`Content-Type "${r}" is not allowed. Allowed types: ${t.join(", ")}`,code:"UNSUPPORTED_MEDIA_TYPE"})}if(ee.test(n))try{return await e.json()}catch(e){if(e instanceof SyntaxError)throw new X.APIError(400,{message:"Invalid JSON in request body",code:"BAD_REQUEST"});throw e}if(n.includes("application/x-www-form-urlencoded")){let t=await e.formData(),r={};return t.forEach((e,t)=>{r[t]=e.toString()}),r}if(n.includes("multipart/form-data")){let t=await e.formData(),r={};return t.forEach((e,t)=>{r[t]=e}),r}return n.includes("text/plain")?await e.text():n.includes("application/octet-stream")?await e.arrayBuffer():n.includes("application/pdf")||n.includes("image/")||n.includes("video/")?await e.blob():n.includes("application/stream")||e.body instanceof ReadableStream?e.body:await e.text()}}function er(e){return e instanceof X.APIError||e?.name==="APIError"}async function en(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}function ei(e){return e instanceof Request||"[object Request]"===Object.prototype.toString.call(e)}let ea=new Set(["host","user-agent","referer","from","expect","authorization","proxy-authorization","cookie","origin","accept-charset","accept-encoding","accept-language","if-match","if-none-match","if-modified-since","if-unmodified-since","if-range","range","max-forwards","connection","keep-alive","transfer-encoding","te","upgrade","trailer","proxy-connection","content-length"]);function eo(e){for(let t of ea)e.delete(t)}function es(e,t){if(t)for(let[r,n]of new Headers(t).entries())"set-cookie"===r.toLowerCase()?e.append(r,n):e.set(r,n)}function ec(e,t){if(e instanceof Response){if(t?.headers){let r=new Headers(t.headers);eo(r),es(e.headers,r)}return e}if(e&&"object"==typeof e&&"_flag"in e&&"json"===e._flag){let r=e.body,n=e.routerResponse;if(n instanceof Response)return n;let i=new Headers;if(es(i,n?.headers),es(i,e.headers),t?.headers){let e=new Headers(t.headers);eo(e),es(i,e)}return i.set("Content-Type","application/json"),new Response(JSON.stringify(r),{...n,headers:i,status:e.status??t?.status??n?.status,statusText:t?.statusText??n?.statusText})}if(er(e))return ec(e.body,{status:t?.status??e.statusCode,statusText:e.status.toString(),headers:t?.headers||e.headers});let r=e,n=new Headers(t?.headers);if(eo(n),e){if("string"==typeof e)r=e,n.set("Content-Type","text/plain");else if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))r=e,n.set("Content-Type","application/octet-stream");else if(e instanceof Blob)r=e,n.set("Content-Type",e.type||"application/octet-stream");else if(e instanceof FormData)r=e;else if(e instanceof URLSearchParams)r=e,n.set("Content-Type","application/x-www-form-urlencoded");else if(e instanceof ReadableStream)r=e,n.set("Content-Type","application/octet-stream");else if(function(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}(e)){let t,i,a;t=new WeakMap,i=new WeakMap,a=0,r=JSON.stringify(e,function(e,r){if("bigint"==typeof r)return r.toString();if("object"==typeof r&&null!==r){if(((e,r)=>{let n=r;for(;n;){if(n===e)return!0;n=t.get(n)}return!1})(r,this))return`[Circular ref-${i.get(r)}]`;t.set(r,this),i.has(r)||i.set(r,a++)}return r}),n.set("Content-Type","application/json")}}else null===e&&(r=JSON.stringify(null)),n.set("content-type","application/json");return new Response(r,{...t,headers:n})}function el(){let e="u">typeof globalThis&&globalThis.crypto;if(e&&"object"==typeof e.subtle&&null!=e.subtle)return e.subtle;throw Error("crypto.subtle must be defined")}let ed={name:"HMAC",hash:"SHA-256"},eu=async e=>{let t="string"==typeof e?new TextEncoder().encode(e):e;return await el().importKey("raw",t,ed,!1,["sign","verify"])},ep=async(e,t,r)=>{try{let n=atob(e),i=new Uint8Array(n.length);for(let e=0,t=n.length;e<t;e++)i[e]=n.charCodeAt(e);return await el().verify(ed,r,i,new TextEncoder().encode(t))}catch(e){return!1}},ef=async(e,t)=>{let r=await eu(t);return btoa(String.fromCharCode(...new Uint8Array(await el().sign(ed.name,r,new TextEncoder().encode(e)))))},eh=async(e,t)=>{let r=await ef(e,t);return encodeURIComponent(e=`${e}.${r}`)},em=(e,t)=>{let r=e;if(t)if("secure"===t)r="__Secure-"+e;else{if("host"!==t)return;r="__Host-"+e}return r},ey=(e,t,r={})=>{let n;if(n=r?.prefix==="secure"?`__Secure-${e}=${t}`:r?.prefix==="host"?`__Host-${e}=${t}`:`${e}=${t}`,e.startsWith("__Secure-")&&!r.secure&&(r.secure=!0),e.startsWith("__Host-")&&(r.secure||(r.secure=!0),"/"!==r.path&&(r.path="/"),r.domain&&(r.domain=void 0)),r&&"number"==typeof r.maxAge&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${Math.floor(r.maxAge)}`}if(r.domain&&"host"!==r.prefix&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}return r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.partitioned&&(r.secure||(r.secure=!0),n+="; Partitioned"),n},eg=(e,t,r)=>ey(e,t=encodeURIComponent(t),r),ew=async(e,t,r,n)=>ey(e,t=await eh(t,r),n);async function eb(e,t={}){let r={body:t.body,query:t.query};if(e.body){let n=await e.body["~standard"].validate(t.body);if(n.issues)return{data:null,error:eA(n.issues,"body")};r.body=n.value}if(e.query){let n=await e.query["~standard"].validate(t.query);if(n.issues)return{data:null,error:eA(n.issues,"query")};r.query=n.value}return e.requireHeaders&&!t.headers?{data:null,error:{message:"Headers is required",issues:[]}}:e.requireRequest&&!t.request?{data:null,error:{message:"Request is required",issues:[]}}:{data:r,error:null}}function eA(e,t){return{message:e.map(e=>`[${e.path?.length?`${t}.`+e.path.map(e=>"object"==typeof e?e.key:e).join("."):t}] ${e.message}`).join("; "),issues:e}}let eE=async(e,{options:t,path:r})=>{let n,i=new Headers,{data:a,error:o}=await eb(t,e);if(o)throw new X.ValidationError(o.message,o.issues);let s="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&ei(e.request)?e.request.headers:null,c=s?.get("cookie"),l=c?function(e){if("string"!=typeof e)throw TypeError("argument str must be a string");let t=new Map,r=0;for(;r<e.length;){let n=e.indexOf("=",r);if(-1===n)break;let i=e.indexOf(";",r);if(-1===i)i=e.length;else if(i<n){r=e.lastIndexOf(";",n-1)+1;continue}let a=e.slice(r,n).trim();if(!t.has(a)){let r=e.slice(n+1,i).trim();34===r.codePointAt(0)&&(r=r.slice(1,-1)),t.set(a,function(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}(r))}r=i+1}return t}(c):void 0,d={...e,body:a.body,query:a.query,path:e.path||r||"virtual:",context:"context"in e&&e.context?e.context:{},returned:void 0,headers:e?.headers,request:e?.request,params:"params"in e?e.params:void 0,method:e.method??(Array.isArray(t.method)?t.method[0]:"*"===t.method?"GET":t.method),setHeader:(e,t)=>{i.set(e,t)},getHeader:e=>s?s.get(e):null,getCookie:(e,t)=>{let r=em(e,t);return r&&l?.get(r)||null},getSignedCookie:async(e,t,r)=>{let n=em(e,r);if(!n)return null;let i=l?.get(n);if(!i)return null;let a=i.lastIndexOf(".");if(a<1)return null;let o=i.substring(0,a),s=i.substring(a+1);return 44===s.length&&s.endsWith("=")?!!await ep(s,o,await eu(t))&&o:null},setCookie:(e,t,r)=>{let n=eg(e,t,r);return i.append("set-cookie",n),n},setSignedCookie:async(e,t,r,n)=>{let a=await ew(e,t,r,n);return i.append("set-cookie",a),a},redirect:e=>(i.set("location",e),new X.APIError("FOUND",void 0,i)),error:(e,t,r)=>new X.APIError(e,t,r),setStatus:e=>{n=e},json:(t,r)=>e.asResponse?{body:r?.body||t,routerResponse:r,_flag:"json"}:t,responseHeaders:i,get responseStatus(){return n}};for(let e of t.use||[]){let t=await e({...d,returnHeaders:!0,asResponse:!1});t.response&&Object.assign(d.context,t.response),t.headers&&t.headers.forEach((e,t)=>{d.responseHeaders.set(t,e)})}return d};function ev(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r;if(("GET"===i.method||"HEAD"===i.method)&&i.body)throw new X.BetterCallError("Body is not allowed with GET or HEAD methods");if(n&&/\/{2,}/.test(n))throw new X.BetterCallError("Path cannot contain consecutive slashes");let o=async(...e)=>{let t=e[0]||{},{data:r,error:o}=await en(eE(t,{options:i,path:n}));if(o){if(!(o instanceof X.ValidationError))throw o;throw i.onValidationError&&await i.onValidationError({message:o.message,issues:o.issues}),new X.APIError(400,{message:o.message,code:"VALIDATION_ERROR"})}let s=await a(r).catch(async e=>{if(er(e)){let r=i.onAPIError;if(r&&await r(e),t.asResponse)return e}throw e}),c=r.responseHeaders,l=r.responseStatus;return t.asResponse?ec(s,{headers:c,status:l}):t.returnHeaders?t.returnStatus?{headers:c,response:s,status:l}:{headers:c,response:s}:t.returnStatus?{response:s,status:l}:s};return o.options=i,o.path=n,o}function ek(e,t){let r=async r=>{let n="function"==typeof e?e:t,i=await eE(r,{options:"function"==typeof e?{}:e,path:"/"});if(!n)throw Error("handler must be defined");try{let e=await n(i),t=i.responseHeaders;return r.returnHeaders?{headers:t,response:e}:e}catch(e){throw er(e)&&Object.defineProperty(e,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,get:()=>i.responseHeaders}),e}};return r.options="function"==typeof e?{}:e,r}function e_(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}ev.create=e=>(t,r,n)=>ev(t,{...r,use:[...r?.use||[],...e?.use||[]]},n),ek.create=e=>function(t,r){if("function"==typeof t)return ek({use:e?.use},t);if(!r)throw Error("Middleware handler is required");return ek({...t,method:"*",use:[...e?.use||[],...t.use||[]]},r)},Symbol("zod_brand");class eS extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ex extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(h=globalThis).__zod_globalConfig??(h.__zod_globalConfig={});let eR=globalThis.__zod_globalConfig;function eT(e){return e&&Object.assign(eR,e),eR}function eI(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function eU(e,t){return"bigint"==typeof t?t.toString():t}function eO(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function eP(e){return null==e}function eC(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eD(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}let eL=Symbol("evaluating");function e$(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==eL)return void 0===n&&(n=eL,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ez(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function eN(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function ej(e){return JSON.stringify(e)}function eH(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let eB="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eq(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let eM=eO(()=>{if(eR.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eV(e){if(!1===eq(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eq(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let eK=new Set(["string","number","symbol"]),eW=new Set(["string","number","bigint","boolean","symbol","undefined"]);function eF(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eJ(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function eZ(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function eG(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function eQ(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let eY={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},eX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function e0(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function e1(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function e2(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function e5(e){return"string"==typeof e?e:e?.message}function e6(e,t,r){let n=e.message?e.message:e5(e.inst?._zod.def?.error?.(e))??e5(t?.error?.(e))??e5(r.customError?.(e))??e5(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function e4(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function e8(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function e3(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function e9(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function e7(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,eX,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,eY,"aborted",0,e0,"allowsEval",0,eM,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,ez,"base64ToUint8Array",0,e9,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return e9(t+r)},"cached",0,eO,"captureStackTrace",0,eB,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,eC,"clone",0,eJ,"cloneDef",0,function(e){return eN(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,e$,"esc",0,ej,"escapeRegex",0,eF,"explicitlyAborted",0,e1,"extend",0,function(e,t){if(!eV(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ez(this,"shape",r),r}});return eJ(e,n)},"finalizeIssue",0,e6,"floatSafeRemainder",0,eD,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,eI,"getLengthableOrigin",0,e8,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,e4,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,eq,"isPlainObject",0,eV,"issue",0,e3,"joinValues",0,function(e,t="|"){return e.map(e=>eG(e)).join(t)},"jsonStringifyReplacer",0,eU,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ez(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return eJ(e,r)},"mergeDefs",0,eN,"normalizeParams",0,eZ,"nullish",0,eP,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=eN(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return ez(this,"shape",n),n},checks:[]});return eJ(e,i)},"optionalKeys",0,eQ,"parsedType",0,function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t},"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=eN(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return ez(this,"shape",i),i},checks:[]});return eJ(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=eN(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return ez(this,"shape",e),e},checks:[]});return eJ(e,i)},"prefixIssues",0,e2,"primitiveTypes",0,eW,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,eK,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=eN(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return ez(this,"shape",i),i}});return eJ(t,n)},"safeExtend",0,function(e,t){if(!eV(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=eN(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ez(this,"shape",r),r}});return eJ(e,r)},"shallowClone",0,function(e){return eV(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e},"slugify",0,eH,"stringifyPrimitive",0,eG,"uint8ArrayToBase64",0,e7,"uint8ArrayToBase64url",0,function(e){return e7(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,e5],2721);let te=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,tr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tn=/^[0-9a-vA-V]{20}$/,ti=/^[A-Za-z0-9]{27}$/,ta=/^[a-zA-Z0-9_-]{21}$/,to=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ts=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tl=tc(4),td=tc(6),tu=tc(7),tp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function th(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let tm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ty=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tg=e=>{let t=eF(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},tw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tE=/^[A-Za-z0-9_-]*$/,tv=/^https?$/,tk=/^\+[1-9]\d{6,14}$/,t_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",tS=RegExp(`^${t_}$`);function tx(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tR(e){return RegExp(`^${tx(e)}$`)}function tT(e){let t=tx({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${t_}T(?:${n})$`)}let tI=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},tU=/^-?\d+n?$/,tO=/^-?\d+$/,tP=/^-?\d+(?:\.\d+)?$/,tC=/^(?:true|false)$/i,tD=/^null$/i,tL=/^undefined$/i,t$=/^[^A-Z]*$/,tz=/^[^a-z]*$/;function tN(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function tj(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let tH=tN(22,"=="),tB=tj(22),tq=tN(27,"="),tM=tj(27),tV=tN(43,"="),tK=tj(43),tW=tN(64,""),tF=tj(64),tJ=tN(86,"=="),tZ=tj(86);e.s(["base64",0,tA,"base64url",0,tE,"bigint",0,tU,"boolean",0,tC,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,tw,"cidrv6",0,tb,"cuid",0,te,"cuid2",0,tt,"date",0,tS,"datetime",0,tT,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,to,"e164",0,tk,"email",0,tp,"emoji",0,th,"extendedDuration",0,/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,"guid",0,ts,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,tv,"idnEmail",0,tf,"integer",0,tO,"ipv4",0,tm,"ipv6",0,ty,"ksuid",0,ti,"lowercase",0,t$,"mac",0,tg,"md5_base64",0,tH,"md5_base64url",0,tB,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,ta,"null",0,tD,"number",0,tP,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,tq,"sha1_base64url",0,tM,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,tV,"sha256_base64url",0,tK,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,tW,"sha384_base64url",0,tF,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,tJ,"sha512_base64url",0,tZ,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,tI,"time",0,tR,"ulid",0,tr,"undefined",0,tL,"unicodeEmail",0,tf,"uppercase",0,tz,"uuid",0,tc,"uuid4",0,tl,"uuid6",0,td,"uuid7",0,tu,"xid",0,tn],10107);let tG=e_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tQ={number:"number",bigint:"bigint",object:"date"},tY=e_("$ZodCheckLessThan",(e,t)=>{tG.init(e,t);let r=tQ[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tX=e_("$ZodCheckGreaterThan",(e,t)=>{tG.init(e,t);let r=tQ[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),t0=e_("$ZodCheckMultipleOf",(e,t)=>{tG.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===eD(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),t1=e_("$ZodCheckNumberFormat",(e,t)=>{tG.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=eY[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=tO)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),t2=e_("$ZodCheckBigIntFormat",(e,t)=>{tG.init(e,t);let[r,n]=eX[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),t5=e_("$ZodCheckMaxSize",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:e4(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t6=e_("$ZodCheckMinSize",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:e4(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t4=e_("$ZodCheckSizeEquals",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:e4(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),t8=e_("$ZodCheckMaxLength",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=e8(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t3=e_("$ZodCheckMinLength",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=e8(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t9=e_("$ZodCheckLengthEquals",(e,t)=>{var r;tG.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!eP(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=e8(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),t7=e_("$ZodCheckStringFormat",(e,t)=>{var r,n;tG.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),re=e_("$ZodCheckRegex",(e,t)=>{t7.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rt=e_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t$),t7.init(e,t)}),rr=e_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tz),t7.init(e,t)}),rn=e_("$ZodCheckIncludes",(e,t)=>{tG.init(e,t);let r=eF(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ri=e_("$ZodCheckStartsWith",(e,t)=>{tG.init(e,t);let r=RegExp(`^${eF(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ra=e_("$ZodCheckEndsWith",(e,t)=>{tG.init(e,t);let r=RegExp(`.*${eF(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});(e,t)=>{tG.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}};let ro=e_("$ZodCheckOverwrite",(e,t)=>{tG.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class rs{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let rc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,eU,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rl=e_("$ZodError",rc),rd=e_("$ZodError",rc,{Parent:Error}),ru=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new eS;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>e6(e,a,eT())));throw eB(t,i?.callee),t}return o.value},rp=ru(rd),rf=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>e6(e,a,eT())));throw eB(t,i?.callee),t}return o.value},rh=rf(rd),rm=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new eS;return a.issues.length?{success:!1,error:new(e??rl)(a.issues.map(e=>e6(e,i,eT())))}:{success:!0,data:a.value}},ry=rm(rd),rg=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>e6(e,i,eT())))}:{success:!0,data:a.value}},rw=rg(rd),rb={major:4,minor:4,patch:3},rA=e_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rb;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=e0(e);for(let a of t){if(a._zod.def.when){if(e1(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new eS;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=e0(e,t)))});else{if(e.issues.length===t)continue;i||(i=e0(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(e0(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new eS;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new eS;return o.then(e=>t(e,n,a))}return t(o,n,a)}}e$(e,"~standard",()=>({validate:t=>{try{let r=ry(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return rw(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),rE=e_("$ZodString",(e,t)=>{rA.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??tI(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),rv=e_("$ZodStringFormat",(e,t)=>{t7.init(e,t),rE.init(e,t)}),rk=e_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ts),rv.init(e,t)}),r_=e_("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tc(e))}else t.pattern??(t.pattern=tc());rv.init(e,t)}),rS=e_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tp),rv.init(e,t)}),rx=e_("$ZodURL",(e,t)=>{rv.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===tv.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rR=e_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=th()),rv.init(e,t)}),rT=e_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ta),rv.init(e,t)}),rI=e_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=te),rv.init(e,t)}),rU=e_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tt),rv.init(e,t)}),rO=e_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tr),rv.init(e,t)}),rP=e_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tn),rv.init(e,t)}),rC=e_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ti),rv.init(e,t)}),rD=e_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tT(t)),rv.init(e,t)}),rL=e_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tS),rv.init(e,t)}),r$=e_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tR(t)),rv.init(e,t)}),rz=e_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=to),rv.init(e,t)}),rN=e_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tm),rv.init(e,t),e._zod.bag.format="ipv4"}),rj=e_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ty),rv.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rH=((e,t)=>{t.pattern??(t.pattern=tg(t.delimiter)),rv.init(e,t),e._zod.bag.format="mac"},e_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tw),rv.init(e,t)})),rB=e_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tb),rv.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function rq(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rM=e_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tA),rv.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{rq(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rV=e_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tE),rv.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!tE.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rq(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rK=e_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tk),rv.init(e,t)}),rW=e_("$ZodJWT",(e,t)=>{rv.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rF=((e,t)=>{rv.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}},e_("$ZodNumber",(e,t)=>{rA.init(e,t),e._zod.pattern=e._zod.bag.pattern??tP,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}})),rJ=e_("$ZodNumberFormat",(e,t)=>{t1.init(e,t),rF.init(e,t)}),rZ=e_("$ZodBoolean",(e,t)=>{rA.init(e,t),e._zod.pattern=tC,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rG=e_("$ZodBigInt",(e,t)=>{rA.init(e,t),e._zod.pattern=tU,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),rQ=((e,t)=>{t2.init(e,t),rG.init(e,t)},e_("$ZodAny",(e,t)=>{rA.init(e,t),e._zod.parse=e=>e})),rY=e_("$ZodUnknown",(e,t)=>{rA.init(e,t),e._zod.parse=e=>e}),rX=e_("$ZodNever",(e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),r0=((e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}},e_("$ZodDate",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}}));function r1(e,t,r){e.issues.length&&t.issues.push(...e2(r,e.issues)),t.value[r]=e.value}let r2=e_("$ZodArray",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>r1(t,r,e))):r1(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function r5(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...e2(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function r6(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=eQ(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function r4(e,t,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,d="optional"===c.optin,u="optional"===c.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===l){o.push(i);continue}let a=c.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>r5(e,r,i,t,d,u))):r5(a,r,i,t,d,u)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let r8=e_("$ZodObject",(e,t)=>{let r;rA.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=eO(()=>r6(t));e$(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!eq(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],c=r.shape;for(let e of r.keys){let r=c[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,l=r._zod.run({value:o[e],issues:[]},n);l instanceof Promise?s.push(l.then(r=>r5(r,t,e,o,i,a))):r5(l,t,e,o,i,a)}return a?r4(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),r3=e_("$ZodObjectJIT",(e,t)=>{let r,n;r8.init(e,t);let i=e._zod.parse,a=eO(()=>r6(t)),o=!eR.jitless,s=o&&eM.value,c=t.catchall;e._zod.parse=(l,d)=>{n??(n=a.value);let u=l.value;return eq(u)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new rs(["shape","payload","ctx"]),r=a.value,n=e=>{let t=ej(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=ej(a),s=e[a],c=s?._zod?.optin==="optional",l=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),c&&l?t.write(`
|
|
2
2
|
if (${r}.issues.length) {
|
|
3
3
|
if (${o} in input) {
|
|
4
4
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|