@authhero/cloudflare-adapter 1.27.0 → 1.28.0

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.
@@ -1 +1 @@
1
- "use strict";var ct=Object.defineProperty;var dt=(r,e,t)=>e in r?ct(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ke=(r,e,t)=>dt(r,typeof e!="symbol"?e+"":e,t);const ut=require("@authhero/adapter-interfaces"),lt=require("wretch");function ft(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t}function ht(r,e){var t;return((t=r==null?void 0:r._def)===null||t===void 0?void 0:t.typeName)===e}function ne(r,e){const t=r.ZodType.prototype[e];r.ZodType.prototype[e]=function(...s){const n=t.apply(this,s);return n._def.openapi=this._def.openapi,n}}function pt(r){if(typeof r.ZodType.prototype.openapi<"u")return;r.ZodType.prototype.openapi=function(n,a){var i,o,c,d,h,b;const Z=typeof n=="string"?a:n,w=Z??{},{param:M}=w,Re=ft(w,["param"]),D=Object.assign(Object.assign({},(i=this._def.openapi)===null||i===void 0?void 0:i._internal),typeof n=="string"?{refId:n}:void 0),be=Object.assign(Object.assign(Object.assign({},(o=this._def.openapi)===null||o===void 0?void 0:o.metadata),Re),!((d=(c=this._def.openapi)===null||c===void 0?void 0:c.metadata)===null||d===void 0)&&d.param||M?{param:Object.assign(Object.assign({},(b=(h=this._def.openapi)===null||h===void 0?void 0:h.metadata)===null||b===void 0?void 0:b.param),M)}:void 0),B=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys(D).length>0?{_internal:D}:void 0),Object.keys(be).length>0?{metadata:be}:void 0)}));if(ht(this,"ZodObject")){const re=this.extend;B.extend=function(...se){var Ne,Ie,$e,Pe,Me,De;const Ve=re.apply(this,se);return Ve._def.openapi={_internal:{extendedFrom:!((Ie=(Ne=this._def.openapi)===null||Ne===void 0?void 0:Ne._internal)===null||Ie===void 0)&&Ie.refId?{refId:(Pe=($e=this._def.openapi)===null||$e===void 0?void 0:$e._internal)===null||Pe===void 0?void 0:Pe.refId,schema:this}:(Me=this._def.openapi)===null||Me===void 0?void 0:Me._internal.extendedFrom},metadata:(De=Ve._def.openapi)===null||De===void 0?void 0:De.metadata},Ve}}return B},ne(r,"optional"),ne(r,"nullable"),ne(r,"default"),ne(r,"transform"),ne(r,"refine");const e=r.ZodObject.prototype.deepPartial;r.ZodObject.prototype.deepPartial=function(){const n=this._def.shape(),a=e.apply(this),i=a._def.shape();return Object.entries(i).forEach(([o,c])=>{var d,h;c._def.openapi=(h=(d=n[o])===null||d===void 0?void 0:d._def)===null||h===void 0?void 0:h.openapi}),a._def.openapi=void 0,a};const t=r.ZodObject.prototype.pick;r.ZodObject.prototype.pick=function(...n){const a=t.apply(this,n);return a._def.openapi=void 0,a};const s=r.ZodObject.prototype.omit;r.ZodObject.prototype.omit=function(...n){const a=s.apply(this,n);return a._def.openapi=void 0,a}}var H=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});ke(this,"res");ke(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}};new Set(".\\+*[^]$()");var x;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Be;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Be||(Be={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},u=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),mt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class C extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return n(this),s}static assert(e){if(!(e instanceof C))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}C.create=r=>new C(r);const Q=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Ke=Q;function _t(r){Ke=r}function we(){return Ke}const Te=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},yt=[];function l(r,e){const t=we(),s=Te({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Q?void 0:Q].filter(n=>!!n)});r.common.issues.push(s)}class T{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return y;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return T.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const y=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),S=r=>({status:"valid",value:r}),Fe=r=>r.status==="aborted",qe=r=>r.status==="dirty",q=r=>r.status==="valid",oe=r=>typeof Promise<"u"&&r instanceof Promise;function Se(r,e,t,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Xe(r,e,t,s,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var ae,ie;class R{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const He=(r,e)=>{if(q(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new C(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{var c,d;const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(c=h??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=h??t)!==null&&d!==void 0?d:o.defaultError}},description:n}}class g{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(oe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parseSync({data:e,path:n.path,parent:n});return He(n,a)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return q(a)?{value:a.value}:{issues:n.common.issues}}catch(a){!((s=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>q(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(oe(n)?n:Promise.resolve(n));return He(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new A({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this)}promise(){return te.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return fe.create(this,e,this._def)}transform(e){return new A({...v(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ye({...v(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Je({typeName:_.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ve({...v(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vt=/^c[^\s-]{8,}$/i,gt=/^[0-9a-z]+$/,xt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kt=/^[a-z0-9_-]{21}$/i,wt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tt=/^[-+]?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)?)??$/,St=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Le;const Ct=/^(?:(?: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])$/,Ot=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,jt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,At=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Et=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qe="((\\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])))",Nt=new RegExp(`^${Qe}$`);function et(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function It(r){return new RegExp(`^${et(r)}$`)}function tt(r){let e=`${Qe}T${et(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $t(r,e){return!!((e==="v4"||!e)&&Ct.test(r)||(e==="v6"||!e)&&jt.test(r))}function Pt(r,e){if(!wt.test(r))return!1;try{const[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Mt(r,e){return!!((e==="v4"||!e)&&Ot.test(r)||(e==="v6"||!e)&&At.test(r))}class O extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.string,received:a.parsedType}),y}const s=new T;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Le||(Le=new RegExp(Zt,"u")),Le.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")bt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")kt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")vt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")gt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")xt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:u.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:u.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?tt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?It(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?$t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Pt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Mt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:u.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...m.errToObj(s)})}_addCheck(e){return new O({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...m.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...m.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...m.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new O({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}O.create=r=>{var e;return new O({checks:[],typeName:_.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function Dt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}class V extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.number,received:a.parsedType}),y}let s;const n=new T;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Dt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_finite,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}V.create=r=>new V({checks:[],typeName:_.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class L extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s;const n=new T;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}L.create=r=>{var e;return new L({checks:[],typeName:_.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class ce extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.boolean,received:s.parsedType}),y}return S(e.data)}}ce.create=r=>new ce({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class W extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_date}),y}const s=new T;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}W.create=r=>new W({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:_.ZodDate,...v(r)});class Ze extends g{_parse(e){if(this._getType(e)!==f.symbol){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.symbol,received:s.parsedType}),y}return S(e.data)}}Ze.create=r=>new Ze({typeName:_.ZodSymbol,...v(r)});class de extends g{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.undefined,received:s.parsedType}),y}return S(e.data)}}de.create=r=>new de({typeName:_.ZodUndefined,...v(r)});class ue extends g{_parse(e){if(this._getType(e)!==f.null){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.null,received:s.parsedType}),y}return S(e.data)}}ue.create=r=>new ue({typeName:_.ZodNull,...v(r)});class ee extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}ee.create=r=>new ee({typeName:_.ZodAny,...v(r)});class F extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}F.create=r=>new F({typeName:_.ZodUnknown,...v(r)});class P extends g{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),y}}P.create=r=>new P({typeName:_.ZodNever,...v(r)});class Ce extends g{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.void,received:s.parsedType}),y}return S(e.data)}}Ce.create=r=>new Ce({typeName:_.ZodVoid,...v(r)});class j extends g{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return l(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),y;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new R(t,i,t.path,o)))).then(i=>T.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new R(t,i,t.path,o)));return T.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new j({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new j({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new j({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}j.create=(r,e)=>new j({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...v(e)});function G(r){if(r instanceof k){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=E.create(G(s))}return new k({...r._def,shape:()=>e})}else return r instanceof j?new j({...r._def,type:G(r.element)}):r instanceof E?E.create(G(r.unwrap())):r instanceof U?U.create(G(r.unwrap())):r instanceof N?N.create(r.items.map(e=>G(e))):r}class k extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const d=this._getOrReturnCtx(e);return l(d,{code:u.invalid_type,expected:f.object,received:d.parsedType}),y}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const d in n.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const h=a[d],b=n.data[d];c.push({key:{status:"valid",value:d},value:h._parse(new R(n,b,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof P){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(d==="strict")o.length>0&&(l(n,{code:u.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of o){const b=n.data[h];c.push({key:{status:"valid",value:h},value:d._parse(new R(n,b,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of c){const b=await h.key,Z=await h.value;d.push({key:b,value:Z,alwaysSet:h.alwaysSet})}return d}).then(d=>T.mergeObjectSync(s,d)):T.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,o;const c=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof E;)a=a._def.innerType;t[s]=a}}),new k({...this._def,shape:()=>t})}keyof(){return rt(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...v(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...v(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...v(e)});class le extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new C(o.ctx.common.issues));return l(t,{code:u.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const c of s){const d={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new C(c));return l(t,{code:u.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}le.create=(r,e)=>new le({options:r,typeName:_.ZodUnion,...v(e)});const I=r=>r instanceof pe?I(r.schema):r instanceof A?I(r.innerType()):r instanceof me?[r.value]:r instanceof z?r.options:r instanceof _e?x.objectValues(r.enum):r instanceof ye?I(r._def.innerType):r instanceof de?[void 0]:r instanceof ue?[null]:r instanceof E?[void 0,...I(r.unwrap())]:r instanceof U?[null,...I(r.unwrap())]:r instanceof Je||r instanceof ge?I(r.unwrap()):r instanceof ve?I(r._def.innerType):[];class Ee extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),y;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=I(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new Ee({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...v(s)})}}function We(r,e){const t=$(r),s=$(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){const n=x.objectKeys(e),a=x.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=We(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=We(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class fe extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Fe(a)||Fe(i))return y;const o=We(a.value,i.value);return o.valid?((qe(a)||qe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:u.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}fe.create=(r,e,t)=>new fe({left:r,right:e,typeName:_.ZodIntersection,...v(t)});class N extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return l(s,{code:u.invalid_type,expected:f.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return l(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new R(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>T.mergeArray(t,i)):T.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new N({...this._def,rest:e})}}N.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:r,typeName:_.ZodTuple,rest:null,...v(e)})};class he extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:u.invalid_type,expected:f.object,received:s.parsedType}),y;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new R(s,o,s.path,o)),value:i._parse(new R(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?T.mergeObjectAsync(t,n):T.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof g?new he({keyType:e,valueType:t,typeName:_.ZodRecord,...v(s)}):new he({keyType:O.create(),valueType:e,typeName:_.ZodRecord,...v(t)})}}class Oe extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return l(s,{code:u.invalid_type,expected:f.map,received:s.parsedType}),y;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],d)=>({key:n._parse(new R(s,o,s.path,[d,"key"])),value:a._parse(new R(s,c,s.path,[d,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,h=await c.value;if(d.status==="aborted"||h.status==="aborted")return y;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,h=c.value;if(d.status==="aborted"||h.status==="aborted")return y;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}}}}Oe.create=(r,e,t)=>new Oe({valueType:e,keyType:r,typeName:_.ZodMap,...v(t)});class J extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return l(s,{code:u.invalid_type,expected:f.set,received:s.parsedType}),y;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),d.add(h.value)}return{status:t.value,value:d}}const o=[...s.data.values()].map((c,d)=>a._parse(new R(s,c,s.path,d)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new J({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}J.create=(r,e)=>new J({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...v(e)});class X extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),y;function s(o,c){return Te({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),Q].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:c}})}function n(o,c){return Te({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),Q].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof te){const o=this;return S(async function(...c){const d=new C([]),h=await o._def.args.parseAsync(c,a).catch(w=>{throw d.addIssue(s(c,w)),d}),b=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(b,a).catch(w=>{throw d.addIssue(n(b,w)),d})})}else{const o=this;return S(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new C([s(c,d.error)]);const h=Reflect.apply(i,this,d.data),b=o._def.returns.safeParse(h,a);if(!b.success)throw new C([n(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new X({...this._def,args:N.create(e).rest(F.create())})}returns(e){return new X({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new X({args:e||N.create([]).rest(F.create()),returns:t||F.create(),typeName:_.ZodFunction,...v(s)})}}class pe extends g{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pe.create=(r,e)=>new pe({getter:r,typeName:_.ZodLazy,...v(e)});class me extends g{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}me.create=(r,e)=>new me({value:r,typeName:_.ZodLiteral,...v(e)});function rt(r,e){return new z({values:r,typeName:_.ZodEnum,...v(e)})}class z extends g{constructor(){super(...arguments),ae.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:x.joinValues(s),received:t.parsedType,code:u.invalid_type}),y}if(Se(this,ae)||Xe(this,ae,new Set(this._def.values)),!Se(this,ae).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:u.invalid_enum_value,options:s}),y}return S(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return z.create(e,{...this._def,...t})}exclude(e,t=this._def){return z.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}ae=new WeakMap;z.create=rt;class _e extends g{constructor(){super(...arguments),ie.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){const n=x.objectValues(t);return l(s,{expected:x.joinValues(n),received:s.parsedType,code:u.invalid_type}),y}if(Se(this,ie)||Xe(this,ie,new Set(x.getValidEnumValues(this._def.values))),!Se(this,ie).has(e.data)){const n=x.objectValues(t);return l(s,{received:s.data,code:u.invalid_enum_value,options:n}),y}return S(e.data)}get enum(){return this._def.values}}ie=new WeakMap;_e.create=(r,e)=>new _e({values:r,typeName:_.ZodNativeEnum,...v(e)});class te extends g{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),y;const s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return S(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}te.create=(r,e)=>new te({type:r,typeName:_.ZodPromise,...v(e)});class A extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?K(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?K(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!q(i))return i;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>q(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(n)}}A.create=(r,e,t)=>new A({schema:r,typeName:_.ZodEffects,effect:e,...v(t)});A.createWithPreprocess=(r,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...v(t)});class E extends g{_parse(e){return this._getType(e)===f.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(r,e)=>new E({innerType:r,typeName:_.ZodOptional,...v(e)});class U extends g{_parse(e){return this._getType(e)===f.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U.create=(r,e)=>new U({innerType:r,typeName:_.ZodNullable,...v(e)});class ye extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ye.create=(r,e)=>new ye({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class ve extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return oe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ve.create=(r,e)=>new ve({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class je extends g{_parse(e){if(this._getType(e)!==f.nan){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.nan,received:s.parsedType}),y}return{status:"valid",value:e.data}}}je.create=r=>new je({typeName:_.ZodNaN,...v(r)});const Vt=Symbol("zod_brand");class Je extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?y:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new xe({in:e,out:t,typeName:_.ZodPipeline})}}class ge extends g{_parse(e){const t=this._def.innerType._parse(e),s=n=>(q(n)&&(n.value=Object.freeze(n.value)),n);return oe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:_.ZodReadonly,...v(e)});function Ye(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function st(r,e={},t){return r?ee.create().superRefine((s,n)=>{var a,i;const o=r(s);if(o instanceof Promise)return o.then(c=>{var d,h;if(!c){const b=Ye(e,s),Z=(h=(d=b.fatal)!==null&&d!==void 0?d:t)!==null&&h!==void 0?h:!0;n.addIssue({code:"custom",...b,fatal:Z})}});if(!o){const c=Ye(e,s),d=(i=(a=c.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...c,fatal:d})}}):ee.create()}const Lt={object:k.lazycreate};var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(_||(_={}));const zt=(r,e={message:`Input not instance of ${r.name}`})=>st(t=>t instanceof r,e),nt=O.create,at=V.create,Ut=je.create,Bt=L.create,it=ce.create,Ft=W.create,qt=Ze.create,Wt=de.create,Jt=ue.create,Ht=ee.create,Yt=F.create,Gt=P.create,Kt=Ce.create,Xt=j.create,Qt=k.create,er=k.strictCreate,tr=le.create,rr=Ee.create,sr=fe.create,nr=N.create,ar=he.create,ir=Oe.create,or=J.create,cr=X.create,dr=pe.create,ur=me.create,lr=z.create,fr=_e.create,hr=te.create,Ge=A.create,pr=E.create,mr=U.create,_r=A.createWithPreprocess,yr=xe.create,vr=()=>nt().optional(),gr=()=>at().optional(),xr=()=>it().optional(),br={string:r=>O.create({...r,coerce:!0}),number:r=>V.create({...r,coerce:!0}),boolean:r=>ce.create({...r,coerce:!0}),bigint:r=>L.create({...r,coerce:!0}),date:r=>W.create({...r,coerce:!0})},kr=y;var p=Object.freeze({__proto__:null,defaultErrorMap:Q,setErrorMap:_t,getErrorMap:we,makeIssue:Te,EMPTY_PATH:yt,addIssueToContext:l,ParseStatus:T,INVALID:y,DIRTY:K,OK:S,isAborted:Fe,isDirty:qe,isValid:q,isAsync:oe,get util(){return x},get objectUtil(){return Be},ZodParsedType:f,getParsedType:$,ZodType:g,datetimeRegex:tt,ZodString:O,ZodNumber:V,ZodBigInt:L,ZodBoolean:ce,ZodDate:W,ZodSymbol:Ze,ZodUndefined:de,ZodNull:ue,ZodAny:ee,ZodUnknown:F,ZodNever:P,ZodVoid:Ce,ZodArray:j,ZodObject:k,ZodUnion:le,ZodDiscriminatedUnion:Ee,ZodIntersection:fe,ZodTuple:N,ZodRecord:he,ZodMap:Oe,ZodSet:J,ZodFunction:X,ZodLazy:pe,ZodLiteral:me,ZodEnum:z,ZodNativeEnum:_e,ZodPromise:te,ZodEffects:A,ZodTransformer:A,ZodOptional:E,ZodNullable:U,ZodDefault:ye,ZodCatch:ve,ZodNaN:je,BRAND:Vt,ZodBranded:Je,ZodPipeline:xe,ZodReadonly:ge,custom:st,Schema:g,ZodSchema:g,late:Lt,get ZodFirstPartyTypeKind(){return _},coerce:br,any:Ht,array:Xt,bigint:Bt,boolean:it,date:Ft,discriminatedUnion:rr,effect:Ge,enum:lr,function:cr,instanceof:zt,intersection:sr,lazy:dr,literal:ur,map:ir,nan:Ut,nativeEnum:fr,never:Gt,null:Jt,nullable:mr,number:at,object:Qt,oboolean:xr,onumber:gr,optional:pr,ostring:vr,pipeline:yr,preprocess:_r,promise:hr,record:ar,set:or,strictObject:er,string:nt,symbol:qt,transformer:Ge,tuple:nr,undefined:Wt,union:tr,unknown:Yt,void:Kt,NEVER:kr,ZodIssueCode:u,quotelessJson:mt,ZodError:C});pt(p);const wr=(r,e)=>e.skipDedupe||e.method!=="GET",Tr=(r,e)=>e.method+"@"+r,Sr=r=>r.clone(),Zr=({skip:r=wr,key:e=Tr,resolver:t=Sr}={})=>{const s=new Map;return n=>(a,i)=>{if(r(a,i))return n(a,i);const o=e(a,i);if(!s.has(o))s.set(o,[]);else return new Promise((c,d)=>{s.get(o).push([c,d])});try{return n(a,i).then(c=>(s.get(o).forEach(([d])=>d(t(c))),s.delete(o),c)).catch(c=>{throw s.get(o).forEach(([,d])=>d(c)),s.delete(o),c})}catch(c){return s.delete(o),Promise.reject(c)}}},Cr=(r,e)=>r*e,Or=r=>r&&r.ok,jr=({delayTimer:r=500,delayRamp:e=Cr,maxAttempts:t=10,until:s=Or,onRetry:n=null,retryOnNetworkError:a=!1,resolveWithLatestResponse:i=!1,skip:o}={})=>c=>(d,h)=>{let b=0;if(o&&o(d,h))return c(d,h);const Z=(w,M)=>Promise.resolve(s(w,M)).then(Re=>Re?w&&i?w:M?Promise.reject(M):w:(b++,!t||b<=t?new Promise(D=>{const be=e(r,b);setTimeout(()=>{typeof n=="function"?Promise.resolve(n({response:w,error:M,url:d,options:h})).then((B={})=>{var re,se;D(c((re=B&&B.url)!==null&&re!==void 0?re:d,(se=B&&B.options)!==null&&se!==void 0?se:h))}):D(c(d,h))},be)}).then(Z).catch(D=>{if(!a)throw D;return Z(null,D)}):w&&i?w:Promise.reject(M||new Error("Number of attempts exceeded."))));return c(d,h).then(Z).catch(w=>{if(!a)throw w;return Z(null,w)})},Ae=p.object({code:p.number(),message:p.string()}),Ar=p.object({message:p.string()}),Er=p.object({emails:p.array(p.string()).optional(),http_body:p.string().optional(),http_url:p.string().optional(),txt_name:p.string().optional(),txt_value:p.string().optional()}),Rr=p.object({ciphers:p.array(p.string()).optional(),early_hints:p.string().optional(),http2:p.string().optional(),min_tls_version:p.string().optional(),tls_1_3:p.string().optional()}),Nr=p.object({id:p.string(),bundle_method:p.string().optional(),certificate_authority:p.string(),custom_certificate:p.string().optional(),custom_csr_id:p.string().optional(),custom_key:p.string().optional(),expires_on:p.string().optional(),hosts:p.array(p.string()).optional(),issuer:p.string().optional(),method:p.string(),serial_number:p.string().optional(),settings:Rr.optional(),signature:p.string().optional(),type:p.string(),uploaded_on:p.string().optional(),validation_errors:p.array(Ar).optional(),validation_records:p.array(Er).optional(),wildcard:p.boolean()}),Ir=p.object({name:p.string(),type:p.string(),value:p.string()}),$r=p.object({http_body:p.string().optional(),http_url:p.string().optional()}),ot=p.object({id:p.string(),ssl:Nr,hostname:p.string(),custom_metadata:p.record(p.string()).optional(),custom_origin_server:p.string().optional(),custom_origin_sni:p.string().optional(),ownership_verification:Ir.optional(),ownership_verification_http:$r.optional(),status:p.string(),verification_errors:p.array(p.string()).optional(),created_at:p.string()}),ze=p.object({errors:p.array(Ae),messages:p.array(Ae),success:p.boolean(),result:ot}),Pr=p.object({errors:p.array(Ae),messages:p.array(Ae),success:p.boolean(),result:p.array(ot)});function Y(r){return lt(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({"X-Auth-Email":r.authEmail,"X-Auth-Key":r.authKey,"Content-Type":"application/json"}).middlewares([jr(),Zr()])}function Ue(r){const e=[];if(r.ssl.validation_records)for(const t of r.ssl.validation_records)t.txt_name&&t.txt_value&&e.push({name:"txt",record:t.txt_value,domain:t.txt_name});return r.ownership_verification&&e.push({name:"txt",record:r.ownership_verification.value,domain:r.ownership_verification.name}),{custom_domain_id:r.id,domain:r.hostname,primary:r.primary,status:r.status==="active"?"ready":"pending",type:"auth0_managed_certs",verification:{methods:p.array(ut.verificationMethodsSchema).parse(e)}}}function Mr(r){return{create:async(e,t)=>{const{result:s,errors:n,success:a}=ze.parse(await Y(r).post({hostname:t.domain,ssl:{method:"txt",type:"dv"},custom_metadata:r.enterprise?{tenant_id:e}:void 0},"/custom_hostnames").json());if(!a)throw new Error(JSON.stringify(n));const i=Ue({...s,primary:!1});return await r.customDomainAdapter.create(e,{custom_domain_id:i.custom_domain_id,domain:i.domain,type:i.type}),i},get:async(e,t)=>{var c;const s=await r.customDomainAdapter.get(e,t);if(!s)throw new H(404);const n=await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(),{result:a,errors:i,success:o}=ze.parse(n);if(!o)throw new H(503,{message:JSON.stringify(i)});if(r.enterprise&&((c=a.custom_metadata)==null?void 0:c.tenant_id)!==e)throw new H(404);return Ue({...s,...a})},getByDomain:async e=>r.customDomainAdapter.getByDomain(e),list:async e=>{const t=await r.customDomainAdapter.list(e),s=await Y(r).get("/custom_hostnames").json(),{result:n,errors:a,success:i}=Pr.parse(s);if(!i)throw new H(503,{message:JSON.stringify(a)});return n.filter(o=>t.find(c=>c.custom_domain_id===o.id)).filter(o=>{var c;return!(r.enterprise&&((c=o.custom_metadata)==null?void 0:c.tenant_id)!==e)}).map(o=>Ue({...t.find(c=>c.custom_domain_id===o.id),...o}))},remove:async(e,t)=>{var n;if(r.enterprise){const{result:a,success:i}=ze.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i||((n=a.custom_metadata)==null?void 0:n.tenant_id)!==e)throw new H(404)}const s=await Y(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();return s.ok&&await r.customDomainAdapter.remove(e,t),s.ok},update:async(e,t,s)=>{const n=await Y(r).patch(s,`/custom_hostnames/${encodeURIComponent(t)}`).res();if(!n.ok)throw new H(503,{message:await n.text()});return r.customDomainAdapter.update(e,t,s)}}}class Dr{constructor(e){ke(this,"cache",null);this.config=e}async getCache(){if(this.cache)return this.cache;if(typeof caches>"u")throw new Error("caches API is not available - CloudflareCache should only be used in Cloudflare Workers");return this.config.cacheName?this.cache=await caches.open(this.config.cacheName):this.cache=caches.default,this.cache}getKey(e){return this.config.keyPrefix?`${this.config.keyPrefix}:${e}`:e}createRequest(e){return new Request(`https://cache.internal/${this.getKey(e)}`)}async get(e){try{const t=await this.getCache(),s=this.createRequest(e),n=await t.match(s);if(!n)return null;const a=await n.json();return a.expiresAt&&new Date(a.expiresAt)<new Date?(await this.delete(e),null):a.value}catch(t){return console.warn(`Cache get error for key ${e}:`,t),null}}async set(e,t,s){try{const n=await this.getCache(),a=s??this.config.defaultTtlSeconds,i=a!==void 0,o=i?Math.max(0,a):0,c={value:t,expiresAt:i?new Date(Date.now()+(o>0?o*1e3:-1)).toISOString():void 0,cachedAt:new Date().toISOString()},d=this.createRequest(e),h=new Response(JSON.stringify(c),{headers:{"Content-Type":"application/json",...i&&o>0&&{"Cache-Control":`max-age=${o}`}}});await n.put(d,h)}catch(n){console.warn(`Cache set error for key ${e}:`,n)}}async delete(e){try{const t=await this.getCache(),s=this.createRequest(e);return await t.delete(s)}catch(t){return console.warn(`Cache delete error for key ${e}:`,t),!1}}async clear(){console.warn("CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries")}}function Vr(r){return new Dr(r)}function Lr(r){const e={customDomains:Mr(r)};return(r.cacheName||r.defaultTtlSeconds||r.keyPrefix)&&(e.cache=Vr({cacheName:r.cacheName,defaultTtlSeconds:r.defaultTtlSeconds,keyPrefix:r.keyPrefix})),e}module.exports=Lr;
1
+ "use strict";var ct=Object.defineProperty;var dt=(r,e,t)=>e in r?ct(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ke=(r,e,t)=>dt(r,typeof e!="symbol"?e+"":e,t);const ut=require("@authhero/adapter-interfaces"),lt=require("wretch");function ft(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t}function ht(r,e){var t;return((t=r==null?void 0:r._def)===null||t===void 0?void 0:t.typeName)===e}function ne(r,e){const t=r.ZodType.prototype[e];r.ZodType.prototype[e]=function(...s){const n=t.apply(this,s);return n._def.openapi=this._def.openapi,n}}function pt(r){if(typeof r.ZodType.prototype.openapi<"u")return;r.ZodType.prototype.openapi=function(n,a){var i,o,c,d,h,b;const C=typeof n=="string"?a:n,w=C??{},{param:M}=w,Re=ft(w,["param"]),D=Object.assign(Object.assign({},(i=this._def.openapi)===null||i===void 0?void 0:i._internal),typeof n=="string"?{refId:n}:void 0),be=Object.assign(Object.assign(Object.assign({},(o=this._def.openapi)===null||o===void 0?void 0:o.metadata),Re),!((d=(c=this._def.openapi)===null||c===void 0?void 0:c.metadata)===null||d===void 0)&&d.param||M?{param:Object.assign(Object.assign({},(b=(h=this._def.openapi)===null||h===void 0?void 0:h.metadata)===null||b===void 0?void 0:b.param),M)}:void 0),B=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys(D).length>0?{_internal:D}:void 0),Object.keys(be).length>0?{metadata:be}:void 0)}));if(ht(this,"ZodObject")){const re=this.extend;B.extend=function(...se){var Ne,Ie,$e,Pe,Me,De;const Ve=re.apply(this,se);return Ve._def.openapi={_internal:{extendedFrom:!((Ie=(Ne=this._def.openapi)===null||Ne===void 0?void 0:Ne._internal)===null||Ie===void 0)&&Ie.refId?{refId:(Pe=($e=this._def.openapi)===null||$e===void 0?void 0:$e._internal)===null||Pe===void 0?void 0:Pe.refId,schema:this}:(Me=this._def.openapi)===null||Me===void 0?void 0:Me._internal.extendedFrom},metadata:(De=Ve._def.openapi)===null||De===void 0?void 0:De.metadata},Ve}}return B},ne(r,"optional"),ne(r,"nullable"),ne(r,"default"),ne(r,"transform"),ne(r,"refine");const e=r.ZodObject.prototype.deepPartial;r.ZodObject.prototype.deepPartial=function(){const n=this._def.shape(),a=e.apply(this),i=a._def.shape();return Object.entries(i).forEach(([o,c])=>{var d,h;c._def.openapi=(h=(d=n[o])===null||d===void 0?void 0:d._def)===null||h===void 0?void 0:h.openapi}),a._def.openapi=void 0,a};const t=r.ZodObject.prototype.pick;r.ZodObject.prototype.pick=function(...n){const a=t.apply(this,n);return a._def.openapi=void 0,a};const s=r.ZodObject.prototype.omit;r.ZodObject.prototype.omit=function(...n){const a=s.apply(this,n);return a._def.openapi=void 0,a}}var H=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});ke(this,"res");ke(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}};new Set(".\\+*[^]$()");var x;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Be;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Be||(Be={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},u=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),mt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return n(this),s}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Z.create=r=>new Z(r);const Q=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Ke=Q;function _t(r){Ke=r}function we(){return Ke}const Te=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},yt=[];function l(r,e){const t=we(),s=Te({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Q?void 0:Q].filter(n=>!!n)});r.common.issues.push(s)}class T{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return y;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return T.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const y=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),S=r=>({status:"valid",value:r}),Fe=r=>r.status==="aborted",qe=r=>r.status==="dirty",q=r=>r.status==="valid",oe=r=>typeof Promise<"u"&&r instanceof Promise;function Se(r,e,t,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Xe(r,e,t,s,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var ae,ie;class R{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const He=(r,e)=>{if(q(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Z(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{var c,d;const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(c=h??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=h??t)!==null&&d!==void 0?d:o.defaultError}},description:n}}class g{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(oe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parseSync({data:e,path:n.path,parent:n});return He(n,a)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return q(a)?{value:a.value}:{issues:n.common.issues}}catch(a){!((s=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>q(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(oe(n)?n:Promise.resolve(n));return He(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new A({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return U.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this)}promise(){return te.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return fe.create(this,e,this._def)}transform(e){return new A({...v(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ye({...v(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Je({typeName:_.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ve({...v(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vt=/^c[^\s-]{8,}$/i,gt=/^[0-9a-z]+$/,xt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kt=/^[a-z0-9_-]{21}$/i,wt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tt=/^[-+]?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)?)??$/,St=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ct="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Le;const Zt=/^(?:(?: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])$/,Ot=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,jt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,At=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Et=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qe="((\\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])))",Nt=new RegExp(`^${Qe}$`);function et(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function It(r){return new RegExp(`^${et(r)}$`)}function tt(r){let e=`${Qe}T${et(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $t(r,e){return!!((e==="v4"||!e)&&Zt.test(r)||(e==="v6"||!e)&&jt.test(r))}function Pt(r,e){if(!wt.test(r))return!1;try{const[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Mt(r,e){return!!((e==="v4"||!e)&&Ot.test(r)||(e==="v6"||!e)&&At.test(r))}class O extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.string,received:a.parsedType}),y}const s=new T;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Le||(Le=new RegExp(Ct,"u")),Le.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")bt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")kt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")vt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")gt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")xt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:u.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:u.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:u.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?tt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?It(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?$t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Pt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Mt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:u.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:u.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...m.errToObj(s)})}_addCheck(e){return new O({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...m.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...m.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...m.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new O({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}O.create=r=>{var e;return new O({checks:[],typeName:_.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function Dt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}class V extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.number,received:a.parsedType}),y}let s;const n=new T;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Dt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_finite,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}V.create=r=>new V({checks:[],typeName:_.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class L extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s;const n=new T;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}L.create=r=>{var e;return new L({checks:[],typeName:_.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class ce extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.boolean,received:s.parsedType}),y}return S(e.data)}}ce.create=r=>new ce({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class W extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_date}),y}const s=new T;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}W.create=r=>new W({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:_.ZodDate,...v(r)});class Ce extends g{_parse(e){if(this._getType(e)!==f.symbol){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.symbol,received:s.parsedType}),y}return S(e.data)}}Ce.create=r=>new Ce({typeName:_.ZodSymbol,...v(r)});class de extends g{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.undefined,received:s.parsedType}),y}return S(e.data)}}de.create=r=>new de({typeName:_.ZodUndefined,...v(r)});class ue extends g{_parse(e){if(this._getType(e)!==f.null){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.null,received:s.parsedType}),y}return S(e.data)}}ue.create=r=>new ue({typeName:_.ZodNull,...v(r)});class ee extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}ee.create=r=>new ee({typeName:_.ZodAny,...v(r)});class F extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}F.create=r=>new F({typeName:_.ZodUnknown,...v(r)});class P extends g{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),y}}P.create=r=>new P({typeName:_.ZodNever,...v(r)});class Ze extends g{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.void,received:s.parsedType}),y}return S(e.data)}}Ze.create=r=>new Ze({typeName:_.ZodVoid,...v(r)});class j extends g{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return l(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),y;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new R(t,i,t.path,o)))).then(i=>T.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new R(t,i,t.path,o)));return T.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new j({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new j({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new j({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}j.create=(r,e)=>new j({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...v(e)});function G(r){if(r instanceof k){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=E.create(G(s))}return new k({...r._def,shape:()=>e})}else return r instanceof j?new j({...r._def,type:G(r.element)}):r instanceof E?E.create(G(r.unwrap())):r instanceof U?U.create(G(r.unwrap())):r instanceof N?N.create(r.items.map(e=>G(e))):r}class k extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const d=this._getOrReturnCtx(e);return l(d,{code:u.invalid_type,expected:f.object,received:d.parsedType}),y}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const d in n.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const h=a[d],b=n.data[d];c.push({key:{status:"valid",value:d},value:h._parse(new R(n,b,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof P){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(d==="strict")o.length>0&&(l(n,{code:u.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of o){const b=n.data[h];c.push({key:{status:"valid",value:h},value:d._parse(new R(n,b,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of c){const b=await h.key,C=await h.value;d.push({key:b,value:C,alwaysSet:h.alwaysSet})}return d}).then(d=>T.mergeObjectSync(s,d)):T.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,o;const c=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new k({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof E;)a=a._def.innerType;t[s]=a}}),new k({...this._def,shape:()=>t})}keyof(){return rt(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...v(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...v(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...v(e)});class le extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Z(o.ctx.common.issues));return l(t,{code:u.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const c of s){const d={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Z(c));return l(t,{code:u.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}le.create=(r,e)=>new le({options:r,typeName:_.ZodUnion,...v(e)});const I=r=>r instanceof pe?I(r.schema):r instanceof A?I(r.innerType()):r instanceof me?[r.value]:r instanceof z?r.options:r instanceof _e?x.objectValues(r.enum):r instanceof ye?I(r._def.innerType):r instanceof de?[void 0]:r instanceof ue?[null]:r instanceof E?[void 0,...I(r.unwrap())]:r instanceof U?[null,...I(r.unwrap())]:r instanceof Je||r instanceof ge?I(r.unwrap()):r instanceof ve?I(r._def.innerType):[];class Ee extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),y;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=I(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new Ee({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...v(s)})}}function We(r,e){const t=$(r),s=$(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){const n=x.objectKeys(e),a=x.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=We(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=We(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class fe extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Fe(a)||Fe(i))return y;const o=We(a.value,i.value);return o.valid?((qe(a)||qe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:u.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}fe.create=(r,e,t)=>new fe({left:r,right:e,typeName:_.ZodIntersection,...v(t)});class N extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return l(s,{code:u.invalid_type,expected:f.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return l(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new R(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>T.mergeArray(t,i)):T.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new N({...this._def,rest:e})}}N.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new N({items:r,typeName:_.ZodTuple,rest:null,...v(e)})};class he extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:u.invalid_type,expected:f.object,received:s.parsedType}),y;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new R(s,o,s.path,o)),value:i._parse(new R(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?T.mergeObjectAsync(t,n):T.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof g?new he({keyType:e,valueType:t,typeName:_.ZodRecord,...v(s)}):new he({keyType:O.create(),valueType:e,typeName:_.ZodRecord,...v(t)})}}class Oe extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return l(s,{code:u.invalid_type,expected:f.map,received:s.parsedType}),y;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],d)=>({key:n._parse(new R(s,o,s.path,[d,"key"])),value:a._parse(new R(s,c,s.path,[d,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,h=await c.value;if(d.status==="aborted"||h.status==="aborted")return y;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,h=c.value;if(d.status==="aborted"||h.status==="aborted")return y;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}}}}Oe.create=(r,e,t)=>new Oe({valueType:e,keyType:r,typeName:_.ZodMap,...v(t)});class J extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return l(s,{code:u.invalid_type,expected:f.set,received:s.parsedType}),y;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),d.add(h.value)}return{status:t.value,value:d}}const o=[...s.data.values()].map((c,d)=>a._parse(new R(s,c,s.path,d)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new J({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}J.create=(r,e)=>new J({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...v(e)});class X extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),y;function s(o,c){return Te({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),Q].filter(d=>!!d),issueData:{code:u.invalid_arguments,argumentsError:c}})}function n(o,c){return Te({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,we(),Q].filter(d=>!!d),issueData:{code:u.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof te){const o=this;return S(async function(...c){const d=new Z([]),h=await o._def.args.parseAsync(c,a).catch(w=>{throw d.addIssue(s(c,w)),d}),b=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(b,a).catch(w=>{throw d.addIssue(n(b,w)),d})})}else{const o=this;return S(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Z([s(c,d.error)]);const h=Reflect.apply(i,this,d.data),b=o._def.returns.safeParse(h,a);if(!b.success)throw new Z([n(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new X({...this._def,args:N.create(e).rest(F.create())})}returns(e){return new X({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new X({args:e||N.create([]).rest(F.create()),returns:t||F.create(),typeName:_.ZodFunction,...v(s)})}}class pe extends g{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pe.create=(r,e)=>new pe({getter:r,typeName:_.ZodLazy,...v(e)});class me extends g{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}me.create=(r,e)=>new me({value:r,typeName:_.ZodLiteral,...v(e)});function rt(r,e){return new z({values:r,typeName:_.ZodEnum,...v(e)})}class z extends g{constructor(){super(...arguments),ae.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:x.joinValues(s),received:t.parsedType,code:u.invalid_type}),y}if(Se(this,ae)||Xe(this,ae,new Set(this._def.values)),!Se(this,ae).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:u.invalid_enum_value,options:s}),y}return S(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return z.create(e,{...this._def,...t})}exclude(e,t=this._def){return z.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}ae=new WeakMap;z.create=rt;class _e extends g{constructor(){super(...arguments),ie.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){const n=x.objectValues(t);return l(s,{expected:x.joinValues(n),received:s.parsedType,code:u.invalid_type}),y}if(Se(this,ie)||Xe(this,ie,new Set(x.getValidEnumValues(this._def.values))),!Se(this,ie).has(e.data)){const n=x.objectValues(t);return l(s,{received:s.data,code:u.invalid_enum_value,options:n}),y}return S(e.data)}get enum(){return this._def.values}}ie=new WeakMap;_e.create=(r,e)=>new _e({values:r,typeName:_.ZodNativeEnum,...v(e)});class te extends g{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),y;const s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return S(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}te.create=(r,e)=>new te({type:r,typeName:_.ZodPromise,...v(e)});class A extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?K(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?K(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!q(i))return i;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>q(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(n)}}A.create=(r,e,t)=>new A({schema:r,typeName:_.ZodEffects,effect:e,...v(t)});A.createWithPreprocess=(r,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...v(t)});class E extends g{_parse(e){return this._getType(e)===f.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(r,e)=>new E({innerType:r,typeName:_.ZodOptional,...v(e)});class U extends g{_parse(e){return this._getType(e)===f.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U.create=(r,e)=>new U({innerType:r,typeName:_.ZodNullable,...v(e)});class ye extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ye.create=(r,e)=>new ye({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class ve extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return oe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ve.create=(r,e)=>new ve({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class je extends g{_parse(e){if(this._getType(e)!==f.nan){const s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.nan,received:s.parsedType}),y}return{status:"valid",value:e.data}}}je.create=r=>new je({typeName:_.ZodNaN,...v(r)});const Vt=Symbol("zod_brand");class Je extends g{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends g{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?y:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new xe({in:e,out:t,typeName:_.ZodPipeline})}}class ge extends g{_parse(e){const t=this._def.innerType._parse(e),s=n=>(q(n)&&(n.value=Object.freeze(n.value)),n);return oe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:_.ZodReadonly,...v(e)});function Ye(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function st(r,e={},t){return r?ee.create().superRefine((s,n)=>{var a,i;const o=r(s);if(o instanceof Promise)return o.then(c=>{var d,h;if(!c){const b=Ye(e,s),C=(h=(d=b.fatal)!==null&&d!==void 0?d:t)!==null&&h!==void 0?h:!0;n.addIssue({code:"custom",...b,fatal:C})}});if(!o){const c=Ye(e,s),d=(i=(a=c.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...c,fatal:d})}}):ee.create()}const Lt={object:k.lazycreate};var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(_||(_={}));const zt=(r,e={message:`Input not instance of ${r.name}`})=>st(t=>t instanceof r,e),nt=O.create,at=V.create,Ut=je.create,Bt=L.create,it=ce.create,Ft=W.create,qt=Ce.create,Wt=de.create,Jt=ue.create,Ht=ee.create,Yt=F.create,Gt=P.create,Kt=Ze.create,Xt=j.create,Qt=k.create,er=k.strictCreate,tr=le.create,rr=Ee.create,sr=fe.create,nr=N.create,ar=he.create,ir=Oe.create,or=J.create,cr=X.create,dr=pe.create,ur=me.create,lr=z.create,fr=_e.create,hr=te.create,Ge=A.create,pr=E.create,mr=U.create,_r=A.createWithPreprocess,yr=xe.create,vr=()=>nt().optional(),gr=()=>at().optional(),xr=()=>it().optional(),br={string:r=>O.create({...r,coerce:!0}),number:r=>V.create({...r,coerce:!0}),boolean:r=>ce.create({...r,coerce:!0}),bigint:r=>L.create({...r,coerce:!0}),date:r=>W.create({...r,coerce:!0})},kr=y;var p=Object.freeze({__proto__:null,defaultErrorMap:Q,setErrorMap:_t,getErrorMap:we,makeIssue:Te,EMPTY_PATH:yt,addIssueToContext:l,ParseStatus:T,INVALID:y,DIRTY:K,OK:S,isAborted:Fe,isDirty:qe,isValid:q,isAsync:oe,get util(){return x},get objectUtil(){return Be},ZodParsedType:f,getParsedType:$,ZodType:g,datetimeRegex:tt,ZodString:O,ZodNumber:V,ZodBigInt:L,ZodBoolean:ce,ZodDate:W,ZodSymbol:Ce,ZodUndefined:de,ZodNull:ue,ZodAny:ee,ZodUnknown:F,ZodNever:P,ZodVoid:Ze,ZodArray:j,ZodObject:k,ZodUnion:le,ZodDiscriminatedUnion:Ee,ZodIntersection:fe,ZodTuple:N,ZodRecord:he,ZodMap:Oe,ZodSet:J,ZodFunction:X,ZodLazy:pe,ZodLiteral:me,ZodEnum:z,ZodNativeEnum:_e,ZodPromise:te,ZodEffects:A,ZodTransformer:A,ZodOptional:E,ZodNullable:U,ZodDefault:ye,ZodCatch:ve,ZodNaN:je,BRAND:Vt,ZodBranded:Je,ZodPipeline:xe,ZodReadonly:ge,custom:st,Schema:g,ZodSchema:g,late:Lt,get ZodFirstPartyTypeKind(){return _},coerce:br,any:Ht,array:Xt,bigint:Bt,boolean:it,date:Ft,discriminatedUnion:rr,effect:Ge,enum:lr,function:cr,instanceof:zt,intersection:sr,lazy:dr,literal:ur,map:ir,nan:Ut,nativeEnum:fr,never:Gt,null:Jt,nullable:mr,number:at,object:Qt,oboolean:xr,onumber:gr,optional:pr,ostring:vr,pipeline:yr,preprocess:_r,promise:hr,record:ar,set:or,strictObject:er,string:nt,symbol:qt,transformer:Ge,tuple:nr,undefined:Wt,union:tr,unknown:Yt,void:Kt,NEVER:kr,ZodIssueCode:u,quotelessJson:mt,ZodError:Z});pt(p);const wr=(r,e)=>e.skipDedupe||e.method!=="GET",Tr=(r,e)=>e.method+"@"+r,Sr=r=>r.clone(),Cr=({skip:r=wr,key:e=Tr,resolver:t=Sr}={})=>{const s=new Map;return n=>(a,i)=>{if(r(a,i))return n(a,i);const o=e(a,i);if(!s.has(o))s.set(o,[]);else return new Promise((c,d)=>{s.get(o).push([c,d])});try{return n(a,i).then(c=>(s.get(o).forEach(([d])=>d(t(c))),s.delete(o),c)).catch(c=>{throw s.get(o).forEach(([,d])=>d(c)),s.delete(o),c})}catch(c){return s.delete(o),Promise.reject(c)}}},Zr=(r,e)=>r*e,Or=r=>r&&r.ok,jr=({delayTimer:r=500,delayRamp:e=Zr,maxAttempts:t=10,until:s=Or,onRetry:n=null,retryOnNetworkError:a=!1,resolveWithLatestResponse:i=!1,skip:o}={})=>c=>(d,h)=>{let b=0;if(o&&o(d,h))return c(d,h);const C=(w,M)=>Promise.resolve(s(w,M)).then(Re=>Re?w&&i?w:M?Promise.reject(M):w:(b++,!t||b<=t?new Promise(D=>{const be=e(r,b);setTimeout(()=>{typeof n=="function"?Promise.resolve(n({response:w,error:M,url:d,options:h})).then((B={})=>{var re,se;D(c((re=B&&B.url)!==null&&re!==void 0?re:d,(se=B&&B.options)!==null&&se!==void 0?se:h))}):D(c(d,h))},be)}).then(C).catch(D=>{if(!a)throw D;return C(null,D)}):w&&i?w:Promise.reject(M||new Error("Number of attempts exceeded."))));return c(d,h).then(C).catch(w=>{if(!a)throw w;return C(null,w)})},Ae=p.object({code:p.number(),message:p.string()}),Ar=p.object({message:p.string()}),Er=p.object({emails:p.array(p.string()).optional(),http_body:p.string().optional(),http_url:p.string().optional(),txt_name:p.string().optional(),txt_value:p.string().optional()}),Rr=p.object({ciphers:p.array(p.string()).optional(),early_hints:p.string().optional(),http2:p.string().optional(),min_tls_version:p.string().optional(),tls_1_3:p.string().optional()}),Nr=p.object({id:p.string(),bundle_method:p.string().optional(),certificate_authority:p.string(),custom_certificate:p.string().optional(),custom_csr_id:p.string().optional(),custom_key:p.string().optional(),expires_on:p.string().optional(),hosts:p.array(p.string()).optional(),issuer:p.string().optional(),method:p.string(),serial_number:p.string().optional(),settings:Rr.optional(),signature:p.string().optional(),type:p.string(),uploaded_on:p.string().optional(),validation_errors:p.array(Ar).optional(),validation_records:p.array(Er).optional(),wildcard:p.boolean()}),Ir=p.object({name:p.string(),type:p.string(),value:p.string()}),$r=p.object({http_body:p.string().optional(),http_url:p.string().optional()}),ot=p.object({id:p.string(),ssl:Nr,hostname:p.string(),custom_metadata:p.record(p.string()).optional(),custom_origin_server:p.string().optional(),custom_origin_sni:p.string().optional(),ownership_verification:Ir.optional(),ownership_verification_http:$r.optional(),status:p.string(),verification_errors:p.array(p.string()).optional(),created_at:p.string()}),ze=p.object({errors:p.array(Ae),messages:p.array(Ae),success:p.boolean(),result:ot}),Pr=p.object({errors:p.array(Ae),messages:p.array(Ae),success:p.boolean(),result:p.array(ot)});function Y(r){return lt(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({"X-Auth-Email":r.authEmail,"X-Auth-Key":r.authKey,"Content-Type":"application/json"}).middlewares([jr(),Cr()])}function Ue(r){const e=[];if(r.ssl.validation_records)for(const t of r.ssl.validation_records)t.txt_name&&t.txt_value&&e.push({name:"txt",record:t.txt_value,domain:t.txt_name});return r.ownership_verification&&e.push({name:"txt",record:r.ownership_verification.value,domain:r.ownership_verification.name}),{custom_domain_id:r.id,domain:r.hostname,primary:r.primary,status:r.status==="active"?"ready":"pending",type:"auth0_managed_certs",verification:{methods:p.array(ut.verificationMethodsSchema).parse(e)}}}function Mr(r){return{create:async(e,t)=>{const{result:s,errors:n,success:a}=ze.parse(await Y(r).post({hostname:t.domain,ssl:{method:"txt",type:"dv"},custom_metadata:r.enterprise?{tenant_id:e}:void 0},"/custom_hostnames").json());if(!a)throw new Error(JSON.stringify(n));const i=Ue({...s,primary:!1});return await r.customDomainAdapter.create(e,{custom_domain_id:i.custom_domain_id,domain:i.domain,type:i.type}),i},get:async(e,t)=>{var c;const s=await r.customDomainAdapter.get(e,t);if(!s)throw new H(404);const n=await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(),{result:a,errors:i,success:o}=ze.parse(n);if(!o)throw new H(503,{message:JSON.stringify(i)});if(r.enterprise&&((c=a.custom_metadata)==null?void 0:c.tenant_id)!==e)throw new H(404);return Ue({...s,...a})},getByDomain:async e=>r.customDomainAdapter.getByDomain(e),list:async e=>{const t=await r.customDomainAdapter.list(e),s=await Y(r).get("/custom_hostnames").json(),{result:n,errors:a,success:i}=Pr.parse(s);if(!i)throw new H(503,{message:JSON.stringify(a)});return n.filter(o=>t.find(c=>c.custom_domain_id===o.id)).filter(o=>{var c;return!(r.enterprise&&((c=o.custom_metadata)==null?void 0:c.tenant_id)!==e)}).map(o=>Ue({...t.find(c=>c.custom_domain_id===o.id),...o}))},remove:async(e,t)=>{var n;if(r.enterprise){const{result:a,success:i}=ze.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i||((n=a.custom_metadata)==null?void 0:n.tenant_id)!==e)throw new H(404)}const s=await Y(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();return s.ok&&await r.customDomainAdapter.remove(e,t),s.ok},update:async(e,t,s)=>{const n=await Y(r).patch(s,`/custom_hostnames/${encodeURIComponent(t)}`).res();if(!n.ok)throw new H(503,{message:await n.text()});return r.customDomainAdapter.update(e,t,s)}}}class Dr{constructor(e){ke(this,"cache",null);this.config=e}async getCache(){if(this.cache)return this.cache;if(typeof caches>"u")throw new Error("caches API is not available - CloudflareCache should only be used in Cloudflare Workers");return this.config.cacheName?this.cache=await caches.open(this.config.cacheName):this.cache=caches.default,this.cache}getKey(e){return this.config.keyPrefix?`${this.config.keyPrefix}:${e}`:e}createRequest(e){return new Request(`https://cache.internal/${this.getKey(e)}`)}async get(e){try{const t=await this.getCache(),s=this.createRequest(e),n=await t.match(s);if(!n)return null;const a=await n.json();return a.expiresAt&&new Date(a.expiresAt)<new Date?(await this.delete(e),null):a.value}catch(t){return console.error(`CloudflareCache: get error for key ${e}:`,t),null}}async set(e,t,s){try{const n=await this.getCache(),a=s??this.config.defaultTtlSeconds,i=a!==void 0,o=i?Math.max(0,a):0,c={value:t,expiresAt:i?new Date(Date.now()+(o>0?o*1e3:-1)).toISOString():void 0,cachedAt:new Date().toISOString()},d=this.createRequest(e),h={"Content-Type":"application/json"};i&&o>0&&(h["Cache-Control"]=`max-age=${o}`);const b=new Response(JSON.stringify(c),{headers:h});await n.put(d,b)}catch(n){console.error(`CloudflareCache: set error for key ${e}:`,n)}}async delete(e){try{const t=await this.getCache(),s=this.createRequest(e);return await t.delete(s)}catch(t){return console.error(`CloudflareCache: delete error for key ${e}:`,t),!1}}async clear(){console.warn("CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries")}}function Vr(r={}){const e={defaultTtlSeconds:300,keyPrefix:"authhero",...r};return new Dr(e)}function Lr(r){return{customDomains:Mr(r),cache:Vr({...r.cacheName&&{cacheName:r.cacheName},...r.defaultTtlSeconds!==void 0&&{defaultTtlSeconds:r.defaultTtlSeconds},...r.keyPrefix&&{keyPrefix:r.keyPrefix}})}}module.exports=Lr;
@@ -283,7 +283,7 @@ export interface CloudflareConfig {
283
283
  }
284
284
  declare function createAdapters(config: CloudflareConfig): {
285
285
  customDomains: CustomDomainsAdapter;
286
- cache?: CacheAdapter;
286
+ cache: CacheAdapter;
287
287
  };
288
288
 
289
289
  export {
@@ -27,7 +27,7 @@ function pt(r) {
27
27
  return;
28
28
  r.ZodType.prototype.openapi = function(n, a) {
29
29
  var i, o, c, d, h, b;
30
- const Z = typeof n == "string" ? a : n, w = Z ?? {}, { param: M } = w, Re = ft(w, ["param"]), D = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof n == "string" ? { refId: n } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Re), !((d = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || d === void 0) && d.param || M ? {
30
+ const C = typeof n == "string" ? a : n, w = C ?? {}, { param: M } = w, Re = ft(w, ["param"]), D = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof n == "string" ? { refId: n } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Re), !((d = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || d === void 0) && d.param || M ? {
31
31
  param: Object.assign(Object.assign({}, (b = (h = this._def.openapi) === null || h === void 0 ? void 0 : h.metadata) === null || b === void 0 ? void 0 : b.param), M)
32
32
  } : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(D).length > 0 ? { _internal: D } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
33
33
  if (ht(this, "ZodObject")) {
@@ -185,7 +185,7 @@ const f = x.arrayToEnum([
185
185
  "not_multiple_of",
186
186
  "not_finite"
187
187
  ]), mt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
188
- class C extends Error {
188
+ class Z extends Error {
189
189
  get errors() {
190
190
  return this.issues;
191
191
  }
@@ -222,7 +222,7 @@ class C extends Error {
222
222
  return n(this), s;
223
223
  }
224
224
  static assert(e) {
225
- if (!(e instanceof C))
225
+ if (!(e instanceof Z))
226
226
  throw new Error(`Not a ZodError: ${e}`);
227
227
  }
228
228
  toString() {
@@ -244,7 +244,7 @@ class C extends Error {
244
244
  return this.flatten();
245
245
  }
246
246
  }
247
- C.create = (r) => new C(r);
247
+ Z.create = (r) => new Z(r);
248
248
  const Q = (r, e) => {
249
249
  let t;
250
250
  switch (r.code) {
@@ -422,7 +422,7 @@ const He = (r, e) => {
422
422
  get error() {
423
423
  if (this._error)
424
424
  return this._error;
425
- const t = new C(r.common.issues);
425
+ const t = new Z(r.common.issues);
426
426
  return this._error = t, this._error;
427
427
  }
428
428
  };
@@ -659,9 +659,9 @@ class g {
659
659
  return this.safeParse(null).success;
660
660
  }
661
661
  }
662
- const vt = /^c[^\s-]{8,}$/i, gt = /^[0-9a-z]+$/, xt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, bt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, kt = /^[a-z0-9_-]{21}$/i, wt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Tt = /^[-+]?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)?)??$/, St = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Zt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
662
+ const vt = /^c[^\s-]{8,}$/i, gt = /^[0-9a-z]+$/, xt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, bt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, kt = /^[a-z0-9_-]{21}$/i, wt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Tt = /^[-+]?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)?)??$/, St = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ct = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
663
663
  let Le;
664
- const Ct = /^(?:(?: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])$/, Ot = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, jt = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, At = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Et = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Rt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qe = "((\\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])))", Nt = new RegExp(`^${Qe}$`);
664
+ const Zt = /^(?:(?: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])$/, Ot = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, jt = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, At = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Et = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Rt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qe = "((\\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])))", Nt = new RegExp(`^${Qe}$`);
665
665
  function et(r) {
666
666
  let e = "[0-5]\\d";
667
667
  r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
@@ -677,7 +677,7 @@ function tt(r) {
677
677
  return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
678
678
  }
679
679
  function $t(r, e) {
680
- return !!((e === "v4" || !e) && Ct.test(r) || (e === "v6" || !e) && jt.test(r));
680
+ return !!((e === "v4" || !e) && Zt.test(r) || (e === "v6" || !e) && jt.test(r));
681
681
  }
682
682
  function Pt(r, e) {
683
683
  if (!wt.test(r))
@@ -747,7 +747,7 @@ class O extends g {
747
747
  message: a.message
748
748
  }), s.dirty());
749
749
  else if (a.kind === "emoji")
750
- Le || (Le = new RegExp(Zt, "u")), Le.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
750
+ Le || (Le = new RegExp(Ct, "u")), Le.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
751
751
  validation: "emoji",
752
752
  code: u.invalid_string,
753
753
  message: a.message
@@ -1487,7 +1487,7 @@ W.create = (r) => new W({
1487
1487
  typeName: _.ZodDate,
1488
1488
  ...v(r)
1489
1489
  });
1490
- class Ze extends g {
1490
+ class Ce extends g {
1491
1491
  _parse(e) {
1492
1492
  if (this._getType(e) !== f.symbol) {
1493
1493
  const s = this._getOrReturnCtx(e);
@@ -1500,7 +1500,7 @@ class Ze extends g {
1500
1500
  return S(e.data);
1501
1501
  }
1502
1502
  }
1503
- Ze.create = (r) => new Ze({
1503
+ Ce.create = (r) => new Ce({
1504
1504
  typeName: _.ZodSymbol,
1505
1505
  ...v(r)
1506
1506
  });
@@ -1576,7 +1576,7 @@ P.create = (r) => new P({
1576
1576
  typeName: _.ZodNever,
1577
1577
  ...v(r)
1578
1578
  });
1579
- class Ce extends g {
1579
+ class Ze extends g {
1580
1580
  _parse(e) {
1581
1581
  if (this._getType(e) !== f.undefined) {
1582
1582
  const s = this._getOrReturnCtx(e);
@@ -1589,7 +1589,7 @@ class Ce extends g {
1589
1589
  return S(e.data);
1590
1590
  }
1591
1591
  }
1592
- Ce.create = (r) => new Ce({
1592
+ Ze.create = (r) => new Ze({
1593
1593
  typeName: _.ZodVoid,
1594
1594
  ...v(r)
1595
1595
  });
@@ -1745,10 +1745,10 @@ class k extends g {
1745
1745
  return n.common.async ? Promise.resolve().then(async () => {
1746
1746
  const d = [];
1747
1747
  for (const h of c) {
1748
- const b = await h.key, Z = await h.value;
1748
+ const b = await h.key, C = await h.value;
1749
1749
  d.push({
1750
1750
  key: b,
1751
- value: Z,
1751
+ value: C,
1752
1752
  alwaysSet: h.alwaysSet
1753
1753
  });
1754
1754
  }
@@ -1979,7 +1979,7 @@ class le extends g {
1979
1979
  for (const o of a)
1980
1980
  if (o.result.status === "dirty")
1981
1981
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1982
- const i = a.map((o) => new C(o.ctx.common.issues));
1982
+ const i = a.map((o) => new Z(o.ctx.common.issues));
1983
1983
  return l(t, {
1984
1984
  code: u.invalid_union,
1985
1985
  unionErrors: i
@@ -2026,7 +2026,7 @@ class le extends g {
2026
2026
  }
2027
2027
  if (a)
2028
2028
  return t.common.issues.push(...a.ctx.common.issues), a.result;
2029
- const o = i.map((c) => new C(c));
2029
+ const o = i.map((c) => new Z(c));
2030
2030
  return l(t, {
2031
2031
  code: u.invalid_union,
2032
2032
  unionErrors: o
@@ -2420,7 +2420,7 @@ class X extends g {
2420
2420
  if (this._def.returns instanceof te) {
2421
2421
  const o = this;
2422
2422
  return S(async function(...c) {
2423
- const d = new C([]), h = await o._def.args.parseAsync(c, a).catch((w) => {
2423
+ const d = new Z([]), h = await o._def.args.parseAsync(c, a).catch((w) => {
2424
2424
  throw d.addIssue(s(c, w)), d;
2425
2425
  }), b = await Reflect.apply(i, this, h);
2426
2426
  return await o._def.returns._def.type.parseAsync(b, a).catch((w) => {
@@ -2432,10 +2432,10 @@ class X extends g {
2432
2432
  return S(function(...c) {
2433
2433
  const d = o._def.args.safeParse(c, a);
2434
2434
  if (!d.success)
2435
- throw new C([s(c, d.error)]);
2435
+ throw new Z([s(c, d.error)]);
2436
2436
  const h = Reflect.apply(i, this, d.data), b = o._def.returns.safeParse(h, a);
2437
2437
  if (!b.success)
2438
- throw new C([n(h, b.error)]);
2438
+ throw new Z([n(h, b.error)]);
2439
2439
  return b.data;
2440
2440
  });
2441
2441
  }
@@ -2786,7 +2786,7 @@ class ve extends g {
2786
2786
  status: "valid",
2787
2787
  value: a.status === "valid" ? a.value : this._def.catchValue({
2788
2788
  get error() {
2789
- return new C(s.common.issues);
2789
+ return new Z(s.common.issues);
2790
2790
  },
2791
2791
  input: s.data
2792
2792
  })
@@ -2794,7 +2794,7 @@ class ve extends g {
2794
2794
  status: "valid",
2795
2795
  value: n.status === "valid" ? n.value : this._def.catchValue({
2796
2796
  get error() {
2797
- return new C(s.common.issues);
2797
+ return new Z(s.common.issues);
2798
2798
  },
2799
2799
  input: s.data
2800
2800
  })
@@ -2907,8 +2907,8 @@ function st(r, e = {}, t) {
2907
2907
  return o.then((c) => {
2908
2908
  var d, h;
2909
2909
  if (!c) {
2910
- const b = Ye(e, s), Z = (h = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && h !== void 0 ? h : !0;
2911
- n.addIssue({ code: "custom", ...b, fatal: Z });
2910
+ const b = Ye(e, s), C = (h = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && h !== void 0 ? h : !0;
2911
+ n.addIssue({ code: "custom", ...b, fatal: C });
2912
2912
  }
2913
2913
  });
2914
2914
  if (!o) {
@@ -2926,7 +2926,7 @@ var _;
2926
2926
  })(_ || (_ = {}));
2927
2927
  const zt = (r, e = {
2928
2928
  message: `Input not instance of ${r.name}`
2929
- }) => st((t) => t instanceof r, e), nt = O.create, at = V.create, Ut = je.create, Bt = L.create, it = ce.create, Ft = W.create, qt = Ze.create, Wt = de.create, Jt = ue.create, Ht = ee.create, Yt = F.create, Gt = P.create, Kt = Ce.create, Xt = j.create, Qt = k.create, er = k.strictCreate, tr = le.create, rr = Ee.create, sr = fe.create, nr = N.create, ar = he.create, ir = Oe.create, or = J.create, cr = X.create, dr = pe.create, ur = me.create, lr = z.create, fr = _e.create, hr = te.create, Ge = A.create, pr = E.create, mr = U.create, _r = A.createWithPreprocess, yr = xe.create, vr = () => nt().optional(), gr = () => at().optional(), xr = () => it().optional(), br = {
2929
+ }) => st((t) => t instanceof r, e), nt = O.create, at = V.create, Ut = je.create, Bt = L.create, it = ce.create, Ft = W.create, qt = Ce.create, Wt = de.create, Jt = ue.create, Ht = ee.create, Yt = F.create, Gt = P.create, Kt = Ze.create, Xt = j.create, Qt = k.create, er = k.strictCreate, tr = le.create, rr = Ee.create, sr = fe.create, nr = N.create, ar = he.create, ir = Oe.create, or = J.create, cr = X.create, dr = pe.create, ur = me.create, lr = z.create, fr = _e.create, hr = te.create, Ge = A.create, pr = E.create, mr = U.create, _r = A.createWithPreprocess, yr = xe.create, vr = () => nt().optional(), gr = () => at().optional(), xr = () => it().optional(), br = {
2930
2930
  string: (r) => O.create({ ...r, coerce: !0 }),
2931
2931
  number: (r) => V.create({ ...r, coerce: !0 }),
2932
2932
  boolean: (r) => ce.create({
@@ -2967,13 +2967,13 @@ var p = /* @__PURE__ */ Object.freeze({
2967
2967
  ZodBigInt: L,
2968
2968
  ZodBoolean: ce,
2969
2969
  ZodDate: W,
2970
- ZodSymbol: Ze,
2970
+ ZodSymbol: Ce,
2971
2971
  ZodUndefined: de,
2972
2972
  ZodNull: ue,
2973
2973
  ZodAny: ee,
2974
2974
  ZodUnknown: F,
2975
2975
  ZodNever: P,
2976
- ZodVoid: Ce,
2976
+ ZodVoid: Ze,
2977
2977
  ZodArray: j,
2978
2978
  ZodObject: k,
2979
2979
  ZodUnion: le,
@@ -3050,10 +3050,10 @@ var p = /* @__PURE__ */ Object.freeze({
3050
3050
  NEVER: kr,
3051
3051
  ZodIssueCode: u,
3052
3052
  quotelessJson: mt,
3053
- ZodError: C
3053
+ ZodError: Z
3054
3054
  });
3055
3055
  pt(p);
3056
- const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method + "@" + r, Sr = (r) => r.clone(), Zr = ({ skip: r = wr, key: e = Tr, resolver: t = Sr } = {}) => {
3056
+ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method + "@" + r, Sr = (r) => r.clone(), Cr = ({ skip: r = wr, key: e = Tr, resolver: t = Sr } = {}) => {
3057
3057
  const s = /* @__PURE__ */ new Map();
3058
3058
  return (n) => (a, i) => {
3059
3059
  if (r(a, i))
@@ -3073,11 +3073,11 @@ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method
3073
3073
  return s.delete(o), Promise.reject(c);
3074
3074
  }
3075
3075
  };
3076
- }, Cr = (r, e) => r * e, Or = (r) => r && r.ok, jr = ({ delayTimer: r = 500, delayRamp: e = Cr, maxAttempts: t = 10, until: s = Or, onRetry: n = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (d, h) => {
3076
+ }, Zr = (r, e) => r * e, Or = (r) => r && r.ok, jr = ({ delayTimer: r = 500, delayRamp: e = Zr, maxAttempts: t = 10, until: s = Or, onRetry: n = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (d, h) => {
3077
3077
  let b = 0;
3078
3078
  if (o && o(d, h))
3079
3079
  return c(d, h);
3080
- const Z = (w, M) => Promise.resolve(s(w, M)).then((Re) => Re ? w && i ? w : M ? Promise.reject(M) : w : (b++, !t || b <= t ? new Promise((D) => {
3080
+ const C = (w, M) => Promise.resolve(s(w, M)).then((Re) => Re ? w && i ? w : M ? Promise.reject(M) : w : (b++, !t || b <= t ? new Promise((D) => {
3081
3081
  const be = e(r, b);
3082
3082
  setTimeout(() => {
3083
3083
  typeof n == "function" ? Promise.resolve(n({
@@ -3090,15 +3090,15 @@ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method
3090
3090
  D(c((re = B && B.url) !== null && re !== void 0 ? re : d, (se = B && B.options) !== null && se !== void 0 ? se : h));
3091
3091
  }) : D(c(d, h));
3092
3092
  }, be);
3093
- }).then(Z).catch((D) => {
3093
+ }).then(C).catch((D) => {
3094
3094
  if (!a)
3095
3095
  throw D;
3096
- return Z(null, D);
3096
+ return C(null, D);
3097
3097
  }) : w && i ? w : Promise.reject(M || new Error("Number of attempts exceeded."))));
3098
- return c(d, h).then(Z).catch((w) => {
3098
+ return c(d, h).then(C).catch((w) => {
3099
3099
  if (!a)
3100
3100
  throw w;
3101
- return Z(null, w);
3101
+ return C(null, w);
3102
3102
  });
3103
3103
  }, Ae = p.object({
3104
3104
  code: p.number(),
@@ -3171,7 +3171,7 @@ function Y(r) {
3171
3171
  "X-Auth-Email": r.authEmail,
3172
3172
  "X-Auth-Key": r.authKey,
3173
3173
  "Content-Type": "application/json"
3174
- }).middlewares([jr(), Zr()]);
3174
+ }).middlewares([jr(), Cr()]);
3175
3175
  }
3176
3176
  function Ue(r) {
3177
3177
  const e = [];
@@ -3322,7 +3322,7 @@ class Dr {
3322
3322
  const a = await n.json();
3323
3323
  return a.expiresAt && new Date(a.expiresAt) < /* @__PURE__ */ new Date() ? (await this.delete(e), null) : a.value;
3324
3324
  } catch (t) {
3325
- return console.warn(`Cache get error for key ${e}:`, t), null;
3325
+ return console.error(`CloudflareCache: get error for key ${e}:`, t), null;
3326
3326
  }
3327
3327
  }
3328
3328
  async set(e, t, s) {
@@ -3331,15 +3331,16 @@ class Dr {
3331
3331
  value: t,
3332
3332
  expiresAt: i ? new Date(Date.now() + (o > 0 ? o * 1e3 : -1)).toISOString() : void 0,
3333
3333
  cachedAt: (/* @__PURE__ */ new Date()).toISOString()
3334
- }, d = this.createRequest(e), h = new Response(JSON.stringify(c), {
3335
- headers: {
3336
- "Content-Type": "application/json",
3337
- ...i && o > 0 && { "Cache-Control": `max-age=${o}` }
3338
- }
3334
+ }, d = this.createRequest(e), h = {
3335
+ "Content-Type": "application/json"
3336
+ };
3337
+ i && o > 0 && (h["Cache-Control"] = `max-age=${o}`);
3338
+ const b = new Response(JSON.stringify(c), {
3339
+ headers: h
3339
3340
  });
3340
- await n.put(d, h);
3341
+ await n.put(d, b);
3341
3342
  } catch (n) {
3342
- console.warn(`Cache set error for key ${e}:`, n);
3343
+ console.error(`CloudflareCache: set error for key ${e}:`, n);
3343
3344
  }
3344
3345
  }
3345
3346
  async delete(e) {
@@ -3347,7 +3348,7 @@ class Dr {
3347
3348
  const t = await this.getCache(), s = this.createRequest(e);
3348
3349
  return await t.delete(s);
3349
3350
  } catch (t) {
3350
- return console.warn(`Cache delete error for key ${e}:`, t), !1;
3351
+ return console.error(`CloudflareCache: delete error for key ${e}:`, t), !1;
3351
3352
  }
3352
3353
  }
3353
3354
  async clear() {
@@ -3356,18 +3357,29 @@ class Dr {
3356
3357
  );
3357
3358
  }
3358
3359
  }
3359
- function Vr(r) {
3360
- return new Dr(r);
3360
+ function Vr(r = {}) {
3361
+ const e = {
3362
+ defaultTtlSeconds: 300,
3363
+ // 5 minutes default
3364
+ keyPrefix: "authhero",
3365
+ // default prefix
3366
+ ...r
3367
+ // user config overrides defaults
3368
+ };
3369
+ return new Dr(e);
3361
3370
  }
3362
3371
  function Br(r) {
3363
- const e = {
3364
- customDomains: Mr(r)
3372
+ return {
3373
+ customDomains: Mr(r),
3374
+ // Always create a cache adapter (let createCloudflareCache apply defaults)
3375
+ cache: Vr({
3376
+ ...r.cacheName && { cacheName: r.cacheName },
3377
+ ...r.defaultTtlSeconds !== void 0 && {
3378
+ defaultTtlSeconds: r.defaultTtlSeconds
3379
+ },
3380
+ ...r.keyPrefix && { keyPrefix: r.keyPrefix }
3381
+ })
3365
3382
  };
3366
- return (r.cacheName || r.defaultTtlSeconds || r.keyPrefix) && (e.cache = Vr({
3367
- cacheName: r.cacheName,
3368
- defaultTtlSeconds: r.defaultTtlSeconds,
3369
- keyPrefix: r.keyPrefix
3370
- })), e;
3371
3383
  }
3372
3384
  export {
3373
3385
  Br as default
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "1.27.0",
14
+ "version": "1.28.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -38,8 +38,8 @@
38
38
  "typescript": "^5.6.3",
39
39
  "vite": "^5.4.11",
40
40
  "vitest": "^2.1.5",
41
- "@authhero/kysely-adapter": "10.37.1",
42
- "@authhero/adapter-interfaces": "0.84.0"
41
+ "@authhero/adapter-interfaces": "0.84.0",
42
+ "@authhero/kysely-adapter": "10.37.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@hono/zod-openapi": "^0.19.2",