@authhero/cloudflare-adapter 1.1.0 → 1.2.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 ot=Object.defineProperty;var dt=(r,e,t)=>e in r?ot(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ve=(r,e,t)=>dt(r,typeof e!="symbol"?e+"":e,t);const ct=require("wretch");var H=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});Ve(this,"res");Ve(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})}};const ut=(r,e)=>e.skipDedupe||e.method!=="GET",lt=(r,e)=>e.method+"@"+r,ft=r=>r.clone(),ht=({skip:r=ut,key:e=lt,resolver:t=ft}={})=>{const n=new Map;return s=>(a,i)=>{if(r(a,i))return s(a,i);const o=e(a,i);if(!n.has(o))n.set(o,[]);else return new Promise((u,d)=>{n.get(o).push([u,d])});try{return s(a,i).then(u=>(n.get(o).forEach(([d])=>d(t(u))),n.delete(o),u)).catch(u=>{throw n.get(o).forEach(([,d])=>d(u)),n.delete(o),u})}catch(u){return n.delete(o),Promise.reject(u)}}},pt=(r,e)=>r*e,mt=r=>r&&r.ok,yt=({delayTimer:r=500,delayRamp:e=pt,maxAttempts:t=10,until:n=mt,onRetry:s=null,retryOnNetworkError:a=!1,resolveWithLatestResponse:i=!1,skip:o}={})=>u=>(d,p)=>{let k=0;if(o&&o(d,p))return u(d,p);const O=(w,P)=>Promise.resolve(n(w,P)).then(Ne=>Ne?w&&i?w:P?Promise.reject(P):w:(k++,!t||k<=t?new Promise($=>{const be=e(r,k);setTimeout(()=>{typeof s=="function"?Promise.resolve(s({response:w,error:P,url:d,options:p})).then((B={})=>{var te,re;$(u((te=B&&B.url)!==null&&te!==void 0?te:d,(re=B&&B.options)!==null&&re!==void 0?re:p))}):$(u(d,p))},be)}).then(O).catch($=>{if(!a)throw $;return O(null,$)}):w&&i?w:Promise.reject(P||new Error("Number of attempts exceeded."))));return u(d,p).then(O).catch(w=>{if(!a)throw w;return O(null,w)})};function _t(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function vt(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(...n){const s=t.apply(this,n);return s._def.openapi=this._def.openapi,s}}function gt(r){if(typeof r.ZodType.prototype.openapi<"u")return;r.ZodType.prototype.openapi=function(s,a){var i,o,u,d,p,k;const O=typeof s=="string"?a:s,w=O??{},{param:P}=w,Ne=_t(w,["param"]),$=Object.assign(Object.assign({},(i=this._def.openapi)===null||i===void 0?void 0:i._internal),typeof s=="string"?{refId:s}:void 0),be=Object.assign(Object.assign(Object.assign({},(o=this._def.openapi)===null||o===void 0?void 0:o.metadata),Ne),!((d=(u=this._def.openapi)===null||u===void 0?void 0:u.metadata)===null||d===void 0)&&d.param||P?{param:Object.assign(Object.assign({},(k=(p=this._def.openapi)===null||p===void 0?void 0:p.metadata)===null||k===void 0?void 0:k.param),P)}:void 0),B=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys($).length>0?{_internal:$}:void 0),Object.keys(be).length>0?{metadata:be}:void 0)}));if(vt(this,"ZodObject")){const te=this.extend;B.extend=function(...re){var Re,Ie,Ae,Me,Pe,$e;const De=te.apply(this,re);return De._def.openapi={_internal:{extendedFrom:!((Ie=(Re=this._def.openapi)===null||Re===void 0?void 0:Re._internal)===null||Ie===void 0)&&Ie.refId?{refId:(Me=(Ae=this._def.openapi)===null||Ae===void 0?void 0:Ae._internal)===null||Me===void 0?void 0:Me.refId,schema:this}:(Pe=this._def.openapi)===null||Pe===void 0?void 0:Pe._internal.extendedFrom},metadata:($e=De._def.openapi)===null||$e===void 0?void 0:$e.metadata},De}}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 s=this._def.shape(),a=e.apply(this),i=a._def.shape();return Object.entries(i).forEach(([o,u])=>{var d,p;u._def.openapi=(p=(d=s[o])===null||d===void 0?void 0:d._def)===null||p===void 0?void 0:p.openapi}),a._def.openapi=void 0,a};const t=r.ZodObject.prototype.pick;r.ZodObject.prototype.pick=function(...s){const a=t.apply(this,s);return a._def.openapi=void 0,a};const n=r.ZodObject.prototype.omit;r.ZodObject.prototype.omit=function(...s){const a=n.apply(this,s);return a._def.openapi=void 0,a}}new Set(".\\+*[^]$()");var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,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"]),D=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}},c=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"]),xt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class S extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return s(this),n}static assert(e){if(!(e instanceof S))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={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=r=>new S(r);const Q=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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 c.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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Xe=Q;function bt(r){Xe=r}function ke(){return Xe}const we=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},kt=[];function l(r,e){const t=ke(),n=we({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Q?void 0:Q].filter(s=>!!s)});r.common.issues.push(n)}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 n=[];for(const s of t){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return T.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return _;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),X=r=>({status:"dirty",value:r}),Z=r=>({status:"valid",value:r}),We=r=>r.status==="aborted",qe=r=>r.status==="dirty",ie=r=>r.status==="valid",oe=r=>typeof Promise<"u"&&r instanceof Promise;function Te(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Ke(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!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 se,ae;class R{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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 Ye=(r,e)=>{if(ie(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 S(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,d;const{message:p}=r;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(u=p??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=p??t)!==null&&d!==void 0?d:o.defaultError}},description:s}}class g{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)}get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(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:D(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ye(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:D(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(oe(s)?s:Promise.resolve(s));return Ye(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return N.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return E.create(this,this._def)}promise(){return ee.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 C({...v(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new _e({...v(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new He({typeName:y.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:y.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 wt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Zt=/^[0-9A-HJKMNP-TV-Z]{26}$/,St=/^[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,Ot=/^[a-z0-9_-]{21}$/i,jt=/^[-+]?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)?)??$/,Et=/^(?!\.)(?!.*\.\.)([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 Nt=/^(?:(?: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])$/,Rt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,It=/^([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])))",At=new RegExp(`^${Qe}$`);function Fe(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Mt(r){return new RegExp(`^${Fe(r)}$`)}function et(r){let e=`${Qe}T${Fe(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 Pt(r,e){return!!((e==="v4"||!e)&&Nt.test(r)||(e==="v6"||!e)&&Rt.test(r))}class j 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:c.invalid_type,expected:f.string,received:a.parsedType}),_}const n=new T;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Et.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Le||(Le=new RegExp(Ct,"u")),Le.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")St.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?et(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?At.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Mt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Pt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...m.errToObj(n)})}_addCheck(e){return new j({...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)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var t,n;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:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!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 j({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j({...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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}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}}j.create=r=>{var e;return new j({checks:[],typeName:y.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function $t(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}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:c.invalid_type,expected:f.number,received:a.parsedType}),_}let n;const s=new T;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?$t(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_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 n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}V.create=r=>new V({checks:[],typeName:y.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&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.bigint,received:a.parsedType}),_}let n;const s=new T;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_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:y.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class de extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),_}return Z(e.data)}}de.create=r=>new de({typeName:y.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class q 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:c.invalid_type,expected:f.date,received:a.parsedType}),_}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),_}const n=new T;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new q({...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}}q.create=r=>new q({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:y.ZodDate,...v(r)});class Ze extends g{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),_}return Z(e.data)}}Ze.create=r=>new Ze({typeName:y.ZodSymbol,...v(r)});class ce extends g{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),_}return Z(e.data)}}ce.create=r=>new ce({typeName:y.ZodUndefined,...v(r)});class ue extends g{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),_}return Z(e.data)}}ue.create=r=>new ue({typeName:y.ZodNull,...v(r)});class F extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}F.create=r=>new F({typeName:y.ZodAny,...v(r)});class W extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}W.create=r=>new W({typeName:y.ZodUnknown,...v(r)});class M extends g{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),_}}M.create=r=>new M({typeName:y.ZodNever,...v(r)});class Se extends g{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),_}return Z(e.data)}}Se.create=r=>new Se({typeName:y.ZodVoid,...v(r)});class E extends g{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return l(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),_;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new R(t,i,t.path,o)))).then(i=>T.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new R(t,i,t.path,o)));return T.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new E({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new E({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new E({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}E.create=(r,e)=>new E({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...v(e)});function G(r){if(r instanceof b){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=N.create(G(n))}return new b({...r._def,shape:()=>e})}else return r instanceof E?new E({...r._def,type:G(r.element)}):r instanceof N?N.create(G(r.unwrap())):r instanceof z?z.create(G(r.unwrap())):r instanceof I?I.create(r.items.map(e=>G(e))):r}class b 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:c.invalid_type,expected:f.object,received:d.parsedType}),_}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const u=[];for(const d of i){const p=a[d],k=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new R(s,k,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof M){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")o.length>0&&(l(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of o){const k=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new R(s,k,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of u){const k=await p.key,O=await p.value;d.push({key:k,value:O,alwaysSet:p.alwaysSet})}return d}).then(d=>T.mergeObjectSync(n,d)):T.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new b({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new b({...this._def,unknownKeys:"strip"})}passthrough(){return new b({...this._def,unknownKeys:"passthrough"})}extend(e){return new b({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new b({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new b({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new b({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new b({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new b({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof N;)a=a._def.innerType;t[n]=a}}),new b({...this._def,shape:()=>t})}keyof(){return tt(x.objectKeys(this.shape))}}b.create=(r,e)=>new b({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:y.ZodObject,...v(e)});b.strictCreate=(r,e)=>new b({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:y.ZodObject,...v(e)});b.lazycreate=(r,e)=>new b({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:y.ZodObject,...v(e)});class le extends g{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(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 S(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(n.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(s);{let a;const i=[];for(const u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,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(u=>new S(u));return l(t,{code:c.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}le.create=(r,e)=>new le({options:r,typeName:y.ZodUnion,...v(e)});const A=r=>r instanceof pe?A(r.schema):r instanceof C?A(r.innerType()):r instanceof me?[r.value]:r instanceof U?r.options:r instanceof ye?x.objectValues(r.enum):r instanceof _e?A(r._def.innerType):r instanceof ce?[void 0]:r instanceof ue?[null]:r instanceof N?[void 0,...A(r.unwrap())]:r instanceof z?[null,...A(r.unwrap())]:r instanceof He||r instanceof ge?A(r.unwrap()):r instanceof ve?A(r._def.innerType):[];class Ce extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),_;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);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:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=A(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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Ce({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function Je(r,e){const t=D(r),n=D(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Je(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],u=Je(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class fe extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(We(a)||We(i))return _;const o=Je(a.value,i.value);return o.valid?((qe(a)||qe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}fe.create=(r,e,t)=>new fe({left:r,right:e,typeName:y.ZodIntersection,...v(t)});class I extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new R(n,i,n.path,o)):null}).filter(i=>!!i);return n.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 I({...this._def,rest:e})}}I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:y.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:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),_;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new R(n,o,n.path,o)),value:i._parse(new R(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?T.mergeObjectAsync(t,s):T.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof g?new he({keyType:e,valueType:t,typeName:y.ZodRecord,...v(n)}):new he({keyType:j.create(),valueType:e,typeName:y.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:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),_;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new R(n,o,n.path,[d,"key"])),value:a._parse(new R(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return _;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return _;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}}}}Oe.create=(r,e,t)=>new Oe({valueType:e,keyType:r,typeName:y.ZodMap,...v(t)});class J extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),_;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const d=new Set;for(const p of u){if(p.status==="aborted")return _;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new R(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):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:y.ZodSet,...v(e)});class K 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:c.invalid_type,expected:f.function,received:t.parsedType}),_;function n(o,u){return we({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Q].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function s(o,u){return we({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Q].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ee){const o=this;return Z(async function(...u){const d=new S([]),p=await o._def.args.parseAsync(u,a).catch(w=>{throw d.addIssue(n(u,w)),d}),k=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(k,a).catch(w=>{throw d.addIssue(s(k,w)),d})})}else{const o=this;return Z(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new S([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),k=o._def.returns.safeParse(p,a);if(!k.success)throw new S([s(p,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new K({...this._def,args:I.create(e).rest(W.create())})}returns(e){return new K({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new K({args:e||I.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,...v(n)})}}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:y.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:c.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}me.create=(r,e)=>new me({value:r,typeName:y.ZodLiteral,...v(e)});function tt(r,e){return new U({values:r,typeName:y.ZodEnum,...v(e)})}class U extends g{constructor(){super(...arguments),se.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:x.joinValues(n),received:t.parsedType,code:c.invalid_type}),_}if(Te(this,se)||Ke(this,se,new Set(this._def.values)),!Te(this,se).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:n}),_}return Z(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 U.create(e,{...this._def,...t})}exclude(e,t=this._def){return U.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}se=new WeakMap;U.create=tt;class ye extends g{constructor(){super(...arguments),ae.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return l(n,{expected:x.joinValues(s),received:n.parsedType,code:c.invalid_type}),_}if(Te(this,ae)||Ke(this,ae,new Set(x.getValidEnumValues(this._def.values))),!Te(this,ae).has(e.data)){const s=x.objectValues(t);return l(n,{received:n.data,code:c.invalid_enum_value,options:s}),_}return Z(e.data)}get enum(){return this._def.values}}ae=new WeakMap;ye.create=(r,e)=>new ye({values:r,typeName:y.ZodNativeEnum,...v(e)});class ee 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:c.invalid_type,expected:f.promise,received:t.parsedType}),_;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ee.create=(r,e)=>new ee({type:r,typeName:y.ZodPromise,...v(e)});class C extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?_:u.status==="dirty"||t.value==="dirty"?X(u.value):u});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?X(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ie(i))return i;const o=s.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:n.data,path:n.path,parent:n}).then(i=>ie(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}C.create=(r,e,t)=>new C({schema:r,typeName:y.ZodEffects,effect:e,...v(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...v(t)});class N extends g{_parse(e){return this._getType(e)===f.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(r,e)=>new N({innerType:r,typeName:y.ZodOptional,...v(e)});class z extends g{_parse(e){return this._getType(e)===f.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(r,e)=>new z({innerType:r,typeName:y.ZodNullable,...v(e)});class _e extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}_e.create=(r,e)=>new _e({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class ve extends g{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return oe(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ve.create=(r,e)=>new ve({innerType:r,typeName:y.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 n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}je.create=r=>new je({typeName:y.ZodNaN,...v(r)});const Dt=Symbol("zod_brand");class He extends g{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?_:a.status==="dirty"?(t.dirty(),X(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new xe({in:e,out:t,typeName:y.ZodPipeline})}}class ge extends g{_parse(e){const t=this._def.innerType._parse(e),n=s=>(ie(s)&&(s.value=Object.freeze(s.value)),s);return oe(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:y.ZodReadonly,...v(e)});function rt(r,e={},t){return r?F.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):F.create()}const Vt={object:b.lazycreate};var y;(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"})(y||(y={}));const Lt=(r,e={message:`Input not instance of ${r.name}`})=>rt(t=>t instanceof r,e),nt=j.create,st=V.create,Ut=je.create,zt=L.create,at=de.create,Bt=q.create,Wt=Ze.create,qt=ce.create,Jt=ue.create,Ht=F.create,Yt=W.create,Gt=M.create,Xt=Se.create,Kt=E.create,Qt=b.create,Ft=b.strictCreate,er=le.create,tr=Ce.create,rr=fe.create,nr=I.create,sr=he.create,ar=Oe.create,ir=J.create,or=K.create,dr=pe.create,cr=me.create,ur=U.create,lr=ye.create,fr=ee.create,Ge=C.create,hr=N.create,pr=z.create,mr=C.createWithPreprocess,yr=xe.create,_r=()=>nt().optional(),vr=()=>st().optional(),gr=()=>at().optional(),xr={string:r=>j.create({...r,coerce:!0}),number:r=>V.create({...r,coerce:!0}),boolean:r=>de.create({...r,coerce:!0}),bigint:r=>L.create({...r,coerce:!0}),date:r=>q.create({...r,coerce:!0})},br=_;var h=Object.freeze({__proto__:null,defaultErrorMap:Q,setErrorMap:bt,getErrorMap:ke,makeIssue:we,EMPTY_PATH:kt,addIssueToContext:l,ParseStatus:T,INVALID:_,DIRTY:X,OK:Z,isAborted:We,isDirty:qe,isValid:ie,isAsync:oe,get util(){return x},get objectUtil(){return Be},ZodParsedType:f,getParsedType:D,ZodType:g,datetimeRegex:et,ZodString:j,ZodNumber:V,ZodBigInt:L,ZodBoolean:de,ZodDate:q,ZodSymbol:Ze,ZodUndefined:ce,ZodNull:ue,ZodAny:F,ZodUnknown:W,ZodNever:M,ZodVoid:Se,ZodArray:E,ZodObject:b,ZodUnion:le,ZodDiscriminatedUnion:Ce,ZodIntersection:fe,ZodTuple:I,ZodRecord:he,ZodMap:Oe,ZodSet:J,ZodFunction:K,ZodLazy:pe,ZodLiteral:me,ZodEnum:U,ZodNativeEnum:ye,ZodPromise:ee,ZodEffects:C,ZodTransformer:C,ZodOptional:N,ZodNullable:z,ZodDefault:_e,ZodCatch:ve,ZodNaN:je,BRAND:Dt,ZodBranded:He,ZodPipeline:xe,ZodReadonly:ge,custom:rt,Schema:g,ZodSchema:g,late:Vt,get ZodFirstPartyTypeKind(){return y},coerce:xr,any:Ht,array:Kt,bigint:zt,boolean:at,date:Bt,discriminatedUnion:tr,effect:Ge,enum:ur,function:or,instanceof:Lt,intersection:rr,lazy:dr,literal:cr,map:ar,nan:Ut,nativeEnum:lr,never:Gt,null:Jt,nullable:pr,number:st,object:Qt,oboolean:gr,onumber:vr,optional:hr,ostring:_r,pipeline:yr,preprocess:mr,promise:fr,record:sr,set:ir,strictObject:Ft,string:nt,symbol:Wt,transformer:Ge,tuple:nr,undefined:qt,union:er,unknown:Yt,void:Xt,NEVER:br,ZodIssueCode:c,quotelessJson:xt,ZodError:S});gt(h);const Ee=h.object({code:h.number(),message:h.string()}),kr=h.object({message:h.string()}),wr=h.object({emails:h.array(h.string()).optional(),http_body:h.string(),http_url:h.string(),txt_name:h.string().optional(),txt_value:h.string().optional()}),Tr=h.object({ciphers:h.array(h.string()),early_hints:h.string(),http2:h.string(),min_tls_version:h.string(),tls_1_3:h.string()}),Zr=h.object({id:h.string(),bundle_method:h.string().optional(),certificate_authority:h.string(),custom_certificate:h.string().optional(),custom_csr_id:h.string().optional(),custom_key:h.string().optional(),expires_on:h.string().optional(),hosts:h.array(h.string()).optional(),issuer:h.string().optional(),method:h.string(),serial_number:h.string().optional(),settings:Tr.optional(),signature:h.string().optional(),type:h.string(),uploaded_on:h.string().optional(),validation_errors:h.array(kr).optional(),validation_records:h.array(wr).optional(),wildcard:h.boolean()}),Sr=h.object({name:h.string(),type:h.string(),value:h.string()}),Or=h.object({http_body:h.string(),http_url:h.string()}),it=h.object({id:h.string(),ssl:Zr,hostname:h.string(),custom_metadata:h.record(h.string()).optional(),custom_origin_server:h.string().optional(),custom_origin_sni:h.string().optional(),ownership_verification:Sr,ownership_verification_http:Or,status:h.string(),verification_errors:h.array(h.string()).optional(),created_at:h.string()}),Ue=h.object({errors:h.array(Ee),messages:h.array(Ee),success:h.boolean(),result:it}),jr=h.object({errors:h.array(Ee),messages:h.array(Ee),success:h.boolean(),result:h.array(it)});function Y(r){return ct(`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([yt(),ht()])}function ze(r){return{custom_domain_id:r.id,domain:r.hostname,primary:r.primary,status:r.status==="active"?"ready":"pending",type:"auth0_managed_certs"}}function Er(r){return{create:async(e,t)=>{const{result:n,errors:s,success:a}=Ue.parse(await Y(r).post({hostname:t.domain,ssl:{method:"http",type:"dv"},custom_metadata:r.enterprise?{tenant_id:e}:void 0},"/custom_hostnames").json());if(!a)throw new Error(JSON.stringify(s));const i=ze({...n,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 o;const n=await r.customDomainAdapter.get(e,t);if(!n)throw new H(404);const{result:s,errors:a,success:i}=Ue.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i)throw new H(503,{message:JSON.stringify(a)});if(r.enterprise&&((o=s.custom_metadata)==null?void 0:o.tenant_id)!==e)throw new H(404);return ze({...n,...s})},list:async e=>{const{result:t,errors:n,success:s}=jr.parse(await Y(r).get("/custom_hostnames").json());if(!s)throw new H(503,{message:JSON.stringify(n)});return t.filter(a=>{var i;return!(r.enterprise&&((i=a.custom_metadata)==null?void 0:i.tenant_id)!==e)}).map(a=>ze({...a,primary:!1}))},remove:async(e,t)=>{var s;if(r.enterprise){const{result:a,success:i}=Ue.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i||((s=a.custom_metadata)==null?void 0:s.tenant_id)!==e)throw new H(404)}const n=await Y(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();return n.ok&&await r.customDomainAdapter.remove(e,t),n.ok},update:async(e,t,n)=>{const s=await Y(r).patch(n,`/custom_hostnames/${encodeURIComponent(t)}`).res();if(!s.ok)throw new H(503,{message:await s.text()});return r.customDomainAdapter.update(e,t,n)}}}function Cr(r){return{customDomains:Er(r)}}module.exports=Cr;
1
+ "use strict";var ot=Object.defineProperty;var dt=(r,e,t)=>e in r?ot(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ve=(r,e,t)=>dt(r,typeof e!="symbol"?e+"":e,t);const ct=require("wretch");var H=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});Ve(this,"res");Ve(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})}};const ut=(r,e)=>e.skipDedupe||e.method!=="GET",lt=(r,e)=>e.method+"@"+r,ft=r=>r.clone(),ht=({skip:r=ut,key:e=lt,resolver:t=ft}={})=>{const n=new Map;return s=>(a,i)=>{if(r(a,i))return s(a,i);const o=e(a,i);if(!n.has(o))n.set(o,[]);else return new Promise((u,d)=>{n.get(o).push([u,d])});try{return s(a,i).then(u=>(n.get(o).forEach(([d])=>d(t(u))),n.delete(o),u)).catch(u=>{throw n.get(o).forEach(([,d])=>d(u)),n.delete(o),u})}catch(u){return n.delete(o),Promise.reject(u)}}},pt=(r,e)=>r*e,mt=r=>r&&r.ok,_t=({delayTimer:r=500,delayRamp:e=pt,maxAttempts:t=10,until:n=mt,onRetry:s=null,retryOnNetworkError:a=!1,resolveWithLatestResponse:i=!1,skip:o}={})=>u=>(d,p)=>{let k=0;if(o&&o(d,p))return u(d,p);const O=(w,P)=>Promise.resolve(n(w,P)).then(Ne=>Ne?w&&i?w:P?Promise.reject(P):w:(k++,!t||k<=t?new Promise($=>{const be=e(r,k);setTimeout(()=>{typeof s=="function"?Promise.resolve(s({response:w,error:P,url:d,options:p})).then((B={})=>{var te,re;$(u((te=B&&B.url)!==null&&te!==void 0?te:d,(re=B&&B.options)!==null&&re!==void 0?re:p))}):$(u(d,p))},be)}).then(O).catch($=>{if(!a)throw $;return O(null,$)}):w&&i?w:Promise.reject(P||new Error("Number of attempts exceeded."))));return u(d,p).then(O).catch(w=>{if(!a)throw w;return O(null,w)})};function yt(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function vt(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(...n){const s=t.apply(this,n);return s._def.openapi=this._def.openapi,s}}function gt(r){if(typeof r.ZodType.prototype.openapi<"u")return;r.ZodType.prototype.openapi=function(s,a){var i,o,u,d,p,k;const O=typeof s=="string"?a:s,w=O??{},{param:P}=w,Ne=yt(w,["param"]),$=Object.assign(Object.assign({},(i=this._def.openapi)===null||i===void 0?void 0:i._internal),typeof s=="string"?{refId:s}:void 0),be=Object.assign(Object.assign(Object.assign({},(o=this._def.openapi)===null||o===void 0?void 0:o.metadata),Ne),!((d=(u=this._def.openapi)===null||u===void 0?void 0:u.metadata)===null||d===void 0)&&d.param||P?{param:Object.assign(Object.assign({},(k=(p=this._def.openapi)===null||p===void 0?void 0:p.metadata)===null||k===void 0?void 0:k.param),P)}:void 0),B=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys($).length>0?{_internal:$}:void 0),Object.keys(be).length>0?{metadata:be}:void 0)}));if(vt(this,"ZodObject")){const te=this.extend;B.extend=function(...re){var Re,Ie,Ae,Me,Pe,$e;const De=te.apply(this,re);return De._def.openapi={_internal:{extendedFrom:!((Ie=(Re=this._def.openapi)===null||Re===void 0?void 0:Re._internal)===null||Ie===void 0)&&Ie.refId?{refId:(Me=(Ae=this._def.openapi)===null||Ae===void 0?void 0:Ae._internal)===null||Me===void 0?void 0:Me.refId,schema:this}:(Pe=this._def.openapi)===null||Pe===void 0?void 0:Pe._internal.extendedFrom},metadata:($e=De._def.openapi)===null||$e===void 0?void 0:$e.metadata},De}}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 s=this._def.shape(),a=e.apply(this),i=a._def.shape();return Object.entries(i).forEach(([o,u])=>{var d,p;u._def.openapi=(p=(d=s[o])===null||d===void 0?void 0:d._def)===null||p===void 0?void 0:p.openapi}),a._def.openapi=void 0,a};const t=r.ZodObject.prototype.pick;r.ZodObject.prototype.pick=function(...s){const a=t.apply(this,s);return a._def.openapi=void 0,a};const n=r.ZodObject.prototype.omit;r.ZodObject.prototype.omit=function(...s){const a=n.apply(this,s);return a._def.openapi=void 0,a}}new Set(".\\+*[^]$()");var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,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"]),D=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}},c=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"]),xt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class S extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return s(this),n}static assert(e){if(!(e instanceof S))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={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=r=>new S(r);const Q=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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 c.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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let Xe=Q;function bt(r){Xe=r}function ke(){return Xe}const we=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},kt=[];function l(r,e){const t=ke(),n=we({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Q?void 0:Q].filter(s=>!!s)});r.common.issues.push(n)}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 n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return T.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;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"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),X=r=>({status:"dirty",value:r}),Z=r=>({status:"valid",value:r}),We=r=>r.status==="aborted",qe=r=>r.status==="dirty",ie=r=>r.status==="valid",oe=r=>typeof Promise<"u"&&r instanceof Promise;function Te(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function Ke(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!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 se,ae;class R{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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 Ye=(r,e)=>{if(ie(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 S(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,d;const{message:p}=r;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(u=p??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=p??t)!==null&&d!==void 0?d:o.defaultError}},description:s}}class g{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)}get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(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:D(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ye(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:D(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(oe(s)?s:Promise.resolve(s));return Ye(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return N.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return E.create(this,this._def)}promise(){return ee.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 C({...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 He({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 wt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Zt=/^[0-9A-HJKMNP-TV-Z]{26}$/,St=/^[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,Ot=/^[a-z0-9_-]{21}$/i,jt=/^[-+]?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)?)??$/,Et=/^(?!\.)(?!.*\.\.)([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 Nt=/^(?:(?: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])$/,Rt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,It=/^([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])))",At=new RegExp(`^${Qe}$`);function Fe(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Mt(r){return new RegExp(`^${Fe(r)}$`)}function et(r){let e=`${Qe}T${Fe(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 Pt(r,e){return!!((e==="v4"||!e)&&Nt.test(r)||(e==="v6"||!e)&&Rt.test(r))}class j 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:c.invalid_type,expected:f.string,received:a.parsedType}),y}const n=new T;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Et.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Le||(Le=new RegExp(Ct,"u")),Le.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")St.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?et(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?At.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Mt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Pt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...m.errToObj(n)})}_addCheck(e){return new j({...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)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var t,n;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:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!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 j({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j({...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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}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}}j.create=r=>{var e;return new j({checks:[],typeName:_.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function $t(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}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:c.invalid_type,expected:f.number,received:a.parsedType}),y}let n;const s=new T;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?$t(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_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 n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.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&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.bigint,received:a.parsedType}),y}let n;const s=new T;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.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,n,s){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_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 de extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.boolean,received:n.parsedType}),y}return Z(e.data)}}de.create=r=>new de({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class q 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:c.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),y}const n=new T;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new q({...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}}q.create=r=>new q({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 n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.symbol,received:n.parsedType}),y}return Z(e.data)}}Ze.create=r=>new Ze({typeName:_.ZodSymbol,...v(r)});class ce extends g{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.undefined,received:n.parsedType}),y}return Z(e.data)}}ce.create=r=>new ce({typeName:_.ZodUndefined,...v(r)});class ue extends g{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.null,received:n.parsedType}),y}return Z(e.data)}}ue.create=r=>new ue({typeName:_.ZodNull,...v(r)});class F extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}F.create=r=>new F({typeName:_.ZodAny,...v(r)});class W extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}W.create=r=>new W({typeName:_.ZodUnknown,...v(r)});class M extends g{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),y}}M.create=r=>new M({typeName:_.ZodNever,...v(r)});class Se extends g{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.void,received:n.parsedType}),y}return Z(e.data)}}Se.create=r=>new Se({typeName:_.ZodVoid,...v(r)});class E extends g{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return l(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new R(t,i,t.path,o)))).then(i=>T.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new R(t,i,t.path,o)));return T.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new E({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new E({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new E({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}E.create=(r,e)=>new E({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...v(e)});function G(r){if(r instanceof b){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=N.create(G(n))}return new b({...r._def,shape:()=>e})}else return r instanceof E?new E({...r._def,type:G(r.element)}):r instanceof N?N.create(G(r.unwrap())):r instanceof z?z.create(G(r.unwrap())):r instanceof I?I.create(r.items.map(e=>G(e))):r}class b 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:c.invalid_type,expected:f.object,received:d.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const u=[];for(const d of i){const p=a[d],k=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new R(s,k,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof M){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")o.length>0&&(l(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of o){const k=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new R(s,k,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of u){const k=await p.key,O=await p.value;d.push({key:k,value:O,alwaysSet:p.alwaysSet})}return d}).then(d=>T.mergeObjectSync(n,d)):T.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new b({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new b({...this._def,unknownKeys:"strip"})}passthrough(){return new b({...this._def,unknownKeys:"passthrough"})}extend(e){return new b({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new b({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 b({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new b({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new b({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new b({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof N;)a=a._def.innerType;t[n]=a}}),new b({...this._def,shape:()=>t})}keyof(){return tt(x.objectKeys(this.shape))}}b.create=(r,e)=>new b({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:_.ZodObject,...v(e)});b.strictCreate=(r,e)=>new b({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:_.ZodObject,...v(e)});b.lazycreate=(r,e)=>new b({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:_.ZodObject,...v(e)});class le extends g{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(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 S(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.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(s);{let a;const i=[];for(const u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,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(u=>new S(u));return l(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}le.create=(r,e)=>new le({options:r,typeName:_.ZodUnion,...v(e)});const A=r=>r instanceof pe?A(r.schema):r instanceof C?A(r.innerType()):r instanceof me?[r.value]:r instanceof U?r.options:r instanceof _e?x.objectValues(r.enum):r instanceof ye?A(r._def.innerType):r instanceof ce?[void 0]:r instanceof ue?[null]:r instanceof N?[void 0,...A(r.unwrap())]:r instanceof z?[null,...A(r.unwrap())]:r instanceof He||r instanceof ge?A(r.unwrap()):r instanceof ve?A(r._def.innerType):[];class Ce extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),y;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);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:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=A(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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Ce({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function Je(r,e){const t=D(r),n=D(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Je(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],u=Je(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class fe extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(We(a)||We(i))return y;const o=Je(a.value,i.value);return o.valid?((qe(a)||qe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}fe.create=(r,e,t)=>new fe({left:r,right:e,typeName:_.ZodIntersection,...v(t)});class I extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new R(n,i,n.path,o)):null}).filter(i=>!!i);return n.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 I({...this._def,rest:e})}}I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({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:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new R(n,o,n.path,o)),value:i._parse(new R(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?T.mergeObjectAsync(t,s):T.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof g?new he({keyType:e,valueType:t,typeName:_.ZodRecord,...v(n)}):new he({keyType:j.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:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:c.invalid_type,expected:f.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new R(n,o,n.path,[d,"key"])),value:a._parse(new R(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return y;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return y;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.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:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:c.invalid_type,expected:f.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const d=new Set;for(const p of u){if(p.status==="aborted")return y;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new R(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):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 K 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:c.invalid_type,expected:f.function,received:t.parsedType}),y;function n(o,u){return we({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Q].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function s(o,u){return we({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),Q].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ee){const o=this;return Z(async function(...u){const d=new S([]),p=await o._def.args.parseAsync(u,a).catch(w=>{throw d.addIssue(n(u,w)),d}),k=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(k,a).catch(w=>{throw d.addIssue(s(k,w)),d})})}else{const o=this;return Z(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new S([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),k=o._def.returns.safeParse(p,a);if(!k.success)throw new S([s(p,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new K({...this._def,args:I.create(e).rest(W.create())})}returns(e){return new K({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new K({args:e||I.create([]).rest(W.create()),returns:t||W.create(),typeName:_.ZodFunction,...v(n)})}}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:c.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 tt(r,e){return new U({values:r,typeName:_.ZodEnum,...v(e)})}class U extends g{constructor(){super(...arguments),se.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:x.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(Te(this,se)||Ke(this,se,new Set(this._def.values)),!Te(this,se).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return Z(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 U.create(e,{...this._def,...t})}exclude(e,t=this._def){return U.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}se=new WeakMap;U.create=tt;class _e extends g{constructor(){super(...arguments),ae.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return l(n,{expected:x.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(Te(this,ae)||Ke(this,ae,new Set(x.getValidEnumValues(this._def.values))),!Te(this,ae).has(e.data)){const s=x.objectValues(t);return l(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return Z(e.data)}get enum(){return this._def.values}}ae=new WeakMap;_e.create=(r,e)=>new _e({values:r,typeName:_.ZodNativeEnum,...v(e)});class ee 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:c.invalid_type,expected:f.promise,received:t.parsedType}),y;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ee.create=(r,e)=>new ee({type:r,typeName:_.ZodPromise,...v(e)});class C 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:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?y:u.status==="dirty"||t.value==="dirty"?X(u.value):u});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?X(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});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:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ie(i))return i;const o=s.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:n.data,path:n.path,parent:n}).then(i=>ie(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}C.create=(r,e,t)=>new C({schema:r,typeName:_.ZodEffects,effect:e,...v(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...v(t)});class N extends g{_parse(e){return this._getType(e)===f.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(r,e)=>new N({innerType:r,typeName:_.ZodOptional,...v(e)});class z extends g{_parse(e){return this._getType(e)===f.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(r,e)=>new z({innerType:r,typeName:_.ZodNullable,...v(e)});class ye extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,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),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return oe(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new S(n.common.issues)},input:n.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 n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}je.create=r=>new je({typeName:_.ZodNaN,...v(r)});const Dt=Symbol("zod_brand");class He extends g{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends g{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),X(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}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),n=s=>(ie(s)&&(s.value=Object.freeze(s.value)),s);return oe(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:_.ZodReadonly,...v(e)});function rt(r,e={},t){return r?F.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):F.create()}const Vt={object:b.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 Lt=(r,e={message:`Input not instance of ${r.name}`})=>rt(t=>t instanceof r,e),nt=j.create,st=V.create,Ut=je.create,zt=L.create,at=de.create,Bt=q.create,Wt=Ze.create,qt=ce.create,Jt=ue.create,Ht=F.create,Yt=W.create,Gt=M.create,Xt=Se.create,Kt=E.create,Qt=b.create,Ft=b.strictCreate,er=le.create,tr=Ce.create,rr=fe.create,nr=I.create,sr=he.create,ar=Oe.create,ir=J.create,or=K.create,dr=pe.create,cr=me.create,ur=U.create,lr=_e.create,fr=ee.create,Ge=C.create,hr=N.create,pr=z.create,mr=C.createWithPreprocess,_r=xe.create,yr=()=>nt().optional(),vr=()=>st().optional(),gr=()=>at().optional(),xr={string:r=>j.create({...r,coerce:!0}),number:r=>V.create({...r,coerce:!0}),boolean:r=>de.create({...r,coerce:!0}),bigint:r=>L.create({...r,coerce:!0}),date:r=>q.create({...r,coerce:!0})},br=y;var h=Object.freeze({__proto__:null,defaultErrorMap:Q,setErrorMap:bt,getErrorMap:ke,makeIssue:we,EMPTY_PATH:kt,addIssueToContext:l,ParseStatus:T,INVALID:y,DIRTY:X,OK:Z,isAborted:We,isDirty:qe,isValid:ie,isAsync:oe,get util(){return x},get objectUtil(){return Be},ZodParsedType:f,getParsedType:D,ZodType:g,datetimeRegex:et,ZodString:j,ZodNumber:V,ZodBigInt:L,ZodBoolean:de,ZodDate:q,ZodSymbol:Ze,ZodUndefined:ce,ZodNull:ue,ZodAny:F,ZodUnknown:W,ZodNever:M,ZodVoid:Se,ZodArray:E,ZodObject:b,ZodUnion:le,ZodDiscriminatedUnion:Ce,ZodIntersection:fe,ZodTuple:I,ZodRecord:he,ZodMap:Oe,ZodSet:J,ZodFunction:K,ZodLazy:pe,ZodLiteral:me,ZodEnum:U,ZodNativeEnum:_e,ZodPromise:ee,ZodEffects:C,ZodTransformer:C,ZodOptional:N,ZodNullable:z,ZodDefault:ye,ZodCatch:ve,ZodNaN:je,BRAND:Dt,ZodBranded:He,ZodPipeline:xe,ZodReadonly:ge,custom:rt,Schema:g,ZodSchema:g,late:Vt,get ZodFirstPartyTypeKind(){return _},coerce:xr,any:Ht,array:Kt,bigint:zt,boolean:at,date:Bt,discriminatedUnion:tr,effect:Ge,enum:ur,function:or,instanceof:Lt,intersection:rr,lazy:dr,literal:cr,map:ar,nan:Ut,nativeEnum:lr,never:Gt,null:Jt,nullable:pr,number:st,object:Qt,oboolean:gr,onumber:vr,optional:hr,ostring:yr,pipeline:_r,preprocess:mr,promise:fr,record:sr,set:ir,strictObject:Ft,string:nt,symbol:Wt,transformer:Ge,tuple:nr,undefined:qt,union:er,unknown:Yt,void:Xt,NEVER:br,ZodIssueCode:c,quotelessJson:xt,ZodError:S});gt(h);const Ee=h.object({code:h.number(),message:h.string()}),kr=h.object({message:h.string()}),wr=h.object({emails:h.array(h.string()).optional(),http_body:h.string(),http_url:h.string(),txt_name:h.string().optional(),txt_value:h.string().optional()}),Tr=h.object({ciphers:h.array(h.string()),early_hints:h.string(),http2:h.string(),min_tls_version:h.string(),tls_1_3:h.string()}),Zr=h.object({id:h.string(),bundle_method:h.string().optional(),certificate_authority:h.string(),custom_certificate:h.string().optional(),custom_csr_id:h.string().optional(),custom_key:h.string().optional(),expires_on:h.string().optional(),hosts:h.array(h.string()).optional(),issuer:h.string().optional(),method:h.string(),serial_number:h.string().optional(),settings:Tr.optional(),signature:h.string().optional(),type:h.string(),uploaded_on:h.string().optional(),validation_errors:h.array(kr).optional(),validation_records:h.array(wr).optional(),wildcard:h.boolean()}),Sr=h.object({name:h.string(),type:h.string(),value:h.string()}),Or=h.object({http_body:h.string(),http_url:h.string()}),it=h.object({id:h.string(),ssl:Zr,hostname:h.string(),custom_metadata:h.record(h.string()).optional(),custom_origin_server:h.string().optional(),custom_origin_sni:h.string().optional(),ownership_verification:Sr,ownership_verification_http:Or,status:h.string(),verification_errors:h.array(h.string()).optional(),created_at:h.string()}),Ue=h.object({errors:h.array(Ee),messages:h.array(Ee),success:h.boolean(),result:it}),jr=h.object({errors:h.array(Ee),messages:h.array(Ee),success:h.boolean(),result:h.array(it)});function Y(r){return ct(`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([_t(),ht()])}function ze(r){return{custom_domain_id:r.id,domain:r.hostname,primary:r.primary,status:r.status==="active"?"ready":"pending",type:"auth0_managed_certs"}}function Er(r){return{create:async(e,t)=>{const{result:n,errors:s,success:a}=Ue.parse(await Y(r).post({hostname:t.domain,ssl:{method:"http",type:"dv"},custom_metadata:r.enterprise?{tenant_id:e}:void 0},"/custom_hostnames").json());if(!a)throw new Error(JSON.stringify(s));const i=ze({...n,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 o;const n=await r.customDomainAdapter.get(e,t);if(!n)throw new H(404);const{result:s,errors:a,success:i}=Ue.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i)throw new H(503,{message:JSON.stringify(a)});if(r.enterprise&&((o=s.custom_metadata)==null?void 0:o.tenant_id)!==e)throw new H(404);return ze({...n,...s})},list:async e=>{const t=await r.customDomainAdapter.list(e),{result:n,errors:s,success:a}=jr.parse(await Y(r).get("/custom_hostnames").json());if(!a)throw new H(503,{message:JSON.stringify(s)});return n.filter(i=>t.find(o=>o.custom_domain_id===i.id)).filter(i=>{var o;return!(r.enterprise&&((o=i.custom_metadata)==null?void 0:o.tenant_id)!==e)}).map(i=>ze({...t.find(o=>o.custom_domain_id===i.id),...i}))},remove:async(e,t)=>{var s;if(r.enterprise){const{result:a,success:i}=Ue.parse(await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json());if(!i||((s=a.custom_metadata)==null?void 0:s.tenant_id)!==e)throw new H(404)}const n=await Y(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();return n.ok&&await r.customDomainAdapter.remove(e,t),n.ok},update:async(e,t,n)=>{const s=await Y(r).patch(n,`/custom_hostnames/${encodeURIComponent(t)}`).res();if(!s.ok)throw new H(503,{message:await s.text()});return r.customDomainAdapter.update(e,t,n)}}}function Cr(r){return{customDomains:Er(r)}}module.exports=Cr;
@@ -38,7 +38,7 @@ const ut = (r, e) => e.skipDedupe || e.method !== "GET", lt = (r, e) => e.method
38
38
  return n.delete(o), Promise.reject(u);
39
39
  }
40
40
  };
41
- }, pt = (r, e) => r * e, mt = (r) => r && r.ok, yt = ({ delayTimer: r = 500, delayRamp: e = pt, maxAttempts: t = 10, until: n = mt, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (u) => (d, p) => {
41
+ }, pt = (r, e) => r * e, mt = (r) => r && r.ok, _t = ({ delayTimer: r = 500, delayRamp: e = pt, maxAttempts: t = 10, until: n = mt, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (u) => (d, p) => {
42
42
  let k = 0;
43
43
  if (o && o(d, p))
44
44
  return u(d, p);
@@ -66,7 +66,7 @@ const ut = (r, e) => e.skipDedupe || e.method !== "GET", lt = (r, e) => e.method
66
66
  return O(null, w);
67
67
  });
68
68
  };
69
- function _t(r, e) {
69
+ function yt(r, e) {
70
70
  var t = {};
71
71
  for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
72
72
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
@@ -90,7 +90,7 @@ function gt(r) {
90
90
  return;
91
91
  r.ZodType.prototype.openapi = function(s, a) {
92
92
  var i, o, u, d, p, k;
93
- const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w, Ne = _t(w, ["param"]), $ = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof s == "string" ? { refId: s } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Ne), !((d = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || d === void 0) && d.param || P ? {
93
+ const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w, Ne = yt(w, ["param"]), $ = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof s == "string" ? { refId: s } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Ne), !((d = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || d === void 0) && d.param || P ? {
94
94
  param: Object.assign(Object.assign({}, (k = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || k === void 0 ? void 0 : k.param), P)
95
95
  } : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys($).length > 0 ? { _internal: $ } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
96
96
  if (vt(this, "ZodObject")) {
@@ -405,7 +405,7 @@ class T {
405
405
  const n = [];
406
406
  for (const s of t) {
407
407
  if (s.status === "aborted")
408
- return _;
408
+ return y;
409
409
  s.status === "dirty" && e.dirty(), n.push(s.value);
410
410
  }
411
411
  return { status: e.value, value: n };
@@ -426,13 +426,13 @@ class T {
426
426
  for (const s of t) {
427
427
  const { key: a, value: i } = s;
428
428
  if (a.status === "aborted" || i.status === "aborted")
429
- return _;
429
+ return y;
430
430
  a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
431
431
  }
432
432
  return { status: e.value, value: n };
433
433
  }
434
434
  }
435
- const _ = Object.freeze({
435
+ const y = Object.freeze({
436
436
  status: "aborted"
437
437
  }), X = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), We = (r) => r.status === "aborted", qe = (r) => r.status === "dirty", ie = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
438
438
  function Te(r, e, t, n) {
@@ -585,7 +585,7 @@ class g {
585
585
  _refinement(e) {
586
586
  return new C({
587
587
  schema: this,
588
- typeName: y.ZodEffects,
588
+ typeName: _.ZodEffects,
589
589
  effect: { type: "refinement", refinement: e }
590
590
  });
591
591
  }
@@ -617,22 +617,22 @@ class g {
617
617
  return new C({
618
618
  ...v(this._def),
619
619
  schema: this,
620
- typeName: y.ZodEffects,
620
+ typeName: _.ZodEffects,
621
621
  effect: { type: "transform", transform: e }
622
622
  });
623
623
  }
624
624
  default(e) {
625
625
  const t = typeof e == "function" ? e : () => e;
626
- return new _e({
626
+ return new ye({
627
627
  ...v(this._def),
628
628
  innerType: this,
629
629
  defaultValue: t,
630
- typeName: y.ZodDefault
630
+ typeName: _.ZodDefault
631
631
  });
632
632
  }
633
633
  brand() {
634
634
  return new He({
635
- typeName: y.ZodBranded,
635
+ typeName: _.ZodBranded,
636
636
  type: this,
637
637
  ...v(this._def)
638
638
  });
@@ -643,7 +643,7 @@ class g {
643
643
  ...v(this._def),
644
644
  innerType: this,
645
645
  catchValue: t,
646
- typeName: y.ZodCatch
646
+ typeName: _.ZodCatch
647
647
  });
648
648
  }
649
649
  describe(e) {
@@ -692,7 +692,7 @@ class j extends g {
692
692
  code: c.invalid_type,
693
693
  expected: f.string,
694
694
  received: a.parsedType
695
- }), _;
695
+ }), y;
696
696
  }
697
697
  const n = new T();
698
698
  let s;
@@ -1037,7 +1037,7 @@ j.create = (r) => {
1037
1037
  var e;
1038
1038
  return new j({
1039
1039
  checks: [],
1040
- typeName: y.ZodString,
1040
+ typeName: _.ZodString,
1041
1041
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1042
1042
  ...v(r)
1043
1043
  });
@@ -1057,7 +1057,7 @@ class V extends g {
1057
1057
  code: c.invalid_type,
1058
1058
  expected: f.number,
1059
1059
  received: a.parsedType
1060
- }), _;
1060
+ }), y;
1061
1061
  }
1062
1062
  let n;
1063
1063
  const s = new T();
@@ -1214,7 +1214,7 @@ class V extends g {
1214
1214
  }
1215
1215
  V.create = (r) => new V({
1216
1216
  checks: [],
1217
- typeName: y.ZodNumber,
1217
+ typeName: _.ZodNumber,
1218
1218
  coerce: (r == null ? void 0 : r.coerce) || !1,
1219
1219
  ...v(r)
1220
1220
  });
@@ -1229,7 +1229,7 @@ class L extends g {
1229
1229
  code: c.invalid_type,
1230
1230
  expected: f.bigint,
1231
1231
  received: a.parsedType
1232
- }), _;
1232
+ }), y;
1233
1233
  }
1234
1234
  let n;
1235
1235
  const s = new T();
@@ -1341,7 +1341,7 @@ L.create = (r) => {
1341
1341
  var e;
1342
1342
  return new L({
1343
1343
  checks: [],
1344
- typeName: y.ZodBigInt,
1344
+ typeName: _.ZodBigInt,
1345
1345
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1346
1346
  ...v(r)
1347
1347
  });
@@ -1354,13 +1354,13 @@ class de extends g {
1354
1354
  code: c.invalid_type,
1355
1355
  expected: f.boolean,
1356
1356
  received: n.parsedType
1357
- }), _;
1357
+ }), y;
1358
1358
  }
1359
1359
  return Z(e.data);
1360
1360
  }
1361
1361
  }
1362
1362
  de.create = (r) => new de({
1363
- typeName: y.ZodBoolean,
1363
+ typeName: _.ZodBoolean,
1364
1364
  coerce: (r == null ? void 0 : r.coerce) || !1,
1365
1365
  ...v(r)
1366
1366
  });
@@ -1372,13 +1372,13 @@ class q extends g {
1372
1372
  code: c.invalid_type,
1373
1373
  expected: f.date,
1374
1374
  received: a.parsedType
1375
- }), _;
1375
+ }), y;
1376
1376
  }
1377
1377
  if (isNaN(e.data.getTime())) {
1378
1378
  const a = this._getOrReturnCtx(e);
1379
1379
  return l(a, {
1380
1380
  code: c.invalid_date
1381
- }), _;
1381
+ }), y;
1382
1382
  }
1383
1383
  const n = new T();
1384
1384
  let s;
@@ -1439,7 +1439,7 @@ class q extends g {
1439
1439
  q.create = (r) => new q({
1440
1440
  checks: [],
1441
1441
  coerce: (r == null ? void 0 : r.coerce) || !1,
1442
- typeName: y.ZodDate,
1442
+ typeName: _.ZodDate,
1443
1443
  ...v(r)
1444
1444
  });
1445
1445
  class Ze extends g {
@@ -1450,13 +1450,13 @@ class Ze extends g {
1450
1450
  code: c.invalid_type,
1451
1451
  expected: f.symbol,
1452
1452
  received: n.parsedType
1453
- }), _;
1453
+ }), y;
1454
1454
  }
1455
1455
  return Z(e.data);
1456
1456
  }
1457
1457
  }
1458
1458
  Ze.create = (r) => new Ze({
1459
- typeName: y.ZodSymbol,
1459
+ typeName: _.ZodSymbol,
1460
1460
  ...v(r)
1461
1461
  });
1462
1462
  class ce extends g {
@@ -1467,13 +1467,13 @@ class ce extends g {
1467
1467
  code: c.invalid_type,
1468
1468
  expected: f.undefined,
1469
1469
  received: n.parsedType
1470
- }), _;
1470
+ }), y;
1471
1471
  }
1472
1472
  return Z(e.data);
1473
1473
  }
1474
1474
  }
1475
1475
  ce.create = (r) => new ce({
1476
- typeName: y.ZodUndefined,
1476
+ typeName: _.ZodUndefined,
1477
1477
  ...v(r)
1478
1478
  });
1479
1479
  class ue extends g {
@@ -1484,13 +1484,13 @@ class ue extends g {
1484
1484
  code: c.invalid_type,
1485
1485
  expected: f.null,
1486
1486
  received: n.parsedType
1487
- }), _;
1487
+ }), y;
1488
1488
  }
1489
1489
  return Z(e.data);
1490
1490
  }
1491
1491
  }
1492
1492
  ue.create = (r) => new ue({
1493
- typeName: y.ZodNull,
1493
+ typeName: _.ZodNull,
1494
1494
  ...v(r)
1495
1495
  });
1496
1496
  class F extends g {
@@ -1502,7 +1502,7 @@ class F extends g {
1502
1502
  }
1503
1503
  }
1504
1504
  F.create = (r) => new F({
1505
- typeName: y.ZodAny,
1505
+ typeName: _.ZodAny,
1506
1506
  ...v(r)
1507
1507
  });
1508
1508
  class W extends g {
@@ -1514,7 +1514,7 @@ class W extends g {
1514
1514
  }
1515
1515
  }
1516
1516
  W.create = (r) => new W({
1517
- typeName: y.ZodUnknown,
1517
+ typeName: _.ZodUnknown,
1518
1518
  ...v(r)
1519
1519
  });
1520
1520
  class M extends g {
@@ -1524,11 +1524,11 @@ class M extends g {
1524
1524
  code: c.invalid_type,
1525
1525
  expected: f.never,
1526
1526
  received: t.parsedType
1527
- }), _;
1527
+ }), y;
1528
1528
  }
1529
1529
  }
1530
1530
  M.create = (r) => new M({
1531
- typeName: y.ZodNever,
1531
+ typeName: _.ZodNever,
1532
1532
  ...v(r)
1533
1533
  });
1534
1534
  class Se extends g {
@@ -1539,13 +1539,13 @@ class Se extends g {
1539
1539
  code: c.invalid_type,
1540
1540
  expected: f.void,
1541
1541
  received: n.parsedType
1542
- }), _;
1542
+ }), y;
1543
1543
  }
1544
1544
  return Z(e.data);
1545
1545
  }
1546
1546
  }
1547
1547
  Se.create = (r) => new Se({
1548
- typeName: y.ZodVoid,
1548
+ typeName: _.ZodVoid,
1549
1549
  ...v(r)
1550
1550
  });
1551
1551
  class E extends g {
@@ -1556,7 +1556,7 @@ class E extends g {
1556
1556
  code: c.invalid_type,
1557
1557
  expected: f.array,
1558
1558
  received: t.parsedType
1559
- }), _;
1559
+ }), y;
1560
1560
  if (s.exactLength !== null) {
1561
1561
  const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1562
1562
  (i || o) && (l(t, {
@@ -1618,7 +1618,7 @@ E.create = (r, e) => new E({
1618
1618
  minLength: null,
1619
1619
  maxLength: null,
1620
1620
  exactLength: null,
1621
- typeName: y.ZodArray,
1621
+ typeName: _.ZodArray,
1622
1622
  ...v(e)
1623
1623
  });
1624
1624
  function G(r) {
@@ -1654,7 +1654,7 @@ class b extends g {
1654
1654
  code: c.invalid_type,
1655
1655
  expected: f.object,
1656
1656
  received: d.parsedType
1657
- }), _;
1657
+ }), y;
1658
1658
  }
1659
1659
  const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1660
1660
  if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
@@ -1781,7 +1781,7 @@ class b extends g {
1781
1781
  ...this._def.shape(),
1782
1782
  ...e._def.shape()
1783
1783
  }),
1784
- typeName: y.ZodObject
1784
+ typeName: _.ZodObject
1785
1785
  });
1786
1786
  }
1787
1787
  // merge<
@@ -1907,21 +1907,21 @@ b.create = (r, e) => new b({
1907
1907
  shape: () => r,
1908
1908
  unknownKeys: "strip",
1909
1909
  catchall: M.create(),
1910
- typeName: y.ZodObject,
1910
+ typeName: _.ZodObject,
1911
1911
  ...v(e)
1912
1912
  });
1913
1913
  b.strictCreate = (r, e) => new b({
1914
1914
  shape: () => r,
1915
1915
  unknownKeys: "strict",
1916
1916
  catchall: M.create(),
1917
- typeName: y.ZodObject,
1917
+ typeName: _.ZodObject,
1918
1918
  ...v(e)
1919
1919
  });
1920
1920
  b.lazycreate = (r, e) => new b({
1921
1921
  shape: r,
1922
1922
  unknownKeys: "strip",
1923
1923
  catchall: M.create(),
1924
- typeName: y.ZodObject,
1924
+ typeName: _.ZodObject,
1925
1925
  ...v(e)
1926
1926
  });
1927
1927
  class le extends g {
@@ -1938,7 +1938,7 @@ class le extends g {
1938
1938
  return l(t, {
1939
1939
  code: c.invalid_union,
1940
1940
  unionErrors: i
1941
- }), _;
1941
+ }), y;
1942
1942
  }
1943
1943
  if (t.common.async)
1944
1944
  return Promise.all(n.map(async (a) => {
@@ -1985,7 +1985,7 @@ class le extends g {
1985
1985
  return l(t, {
1986
1986
  code: c.invalid_union,
1987
1987
  unionErrors: o
1988
- }), _;
1988
+ }), y;
1989
1989
  }
1990
1990
  }
1991
1991
  get options() {
@@ -1994,10 +1994,10 @@ class le extends g {
1994
1994
  }
1995
1995
  le.create = (r, e) => new le({
1996
1996
  options: r,
1997
- typeName: y.ZodUnion,
1997
+ typeName: _.ZodUnion,
1998
1998
  ...v(e)
1999
1999
  });
2000
- const A = (r) => r instanceof pe ? A(r.schema) : r instanceof C ? A(r.innerType()) : r instanceof me ? [r.value] : r instanceof U ? r.options : r instanceof ye ? x.objectValues(r.enum) : r instanceof _e ? A(r._def.innerType) : r instanceof ce ? [void 0] : r instanceof ue ? [null] : r instanceof N ? [void 0, ...A(r.unwrap())] : r instanceof z ? [null, ...A(r.unwrap())] : r instanceof He || r instanceof ge ? A(r.unwrap()) : r instanceof ve ? A(r._def.innerType) : [];
2000
+ const A = (r) => r instanceof pe ? A(r.schema) : r instanceof C ? A(r.innerType()) : r instanceof me ? [r.value] : r instanceof U ? r.options : r instanceof _e ? x.objectValues(r.enum) : r instanceof ye ? A(r._def.innerType) : r instanceof ce ? [void 0] : r instanceof ue ? [null] : r instanceof N ? [void 0, ...A(r.unwrap())] : r instanceof z ? [null, ...A(r.unwrap())] : r instanceof He || r instanceof ge ? A(r.unwrap()) : r instanceof ve ? A(r._def.innerType) : [];
2001
2001
  class Ce extends g {
2002
2002
  _parse(e) {
2003
2003
  const { ctx: t } = this._processInputParams(e);
@@ -2006,7 +2006,7 @@ class Ce extends g {
2006
2006
  code: c.invalid_type,
2007
2007
  expected: f.object,
2008
2008
  received: t.parsedType
2009
- }), _;
2009
+ }), y;
2010
2010
  const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
2011
2011
  return a ? t.common.async ? a._parseAsync({
2012
2012
  data: t.data,
@@ -2020,7 +2020,7 @@ class Ce extends g {
2020
2020
  code: c.invalid_union_discriminator,
2021
2021
  options: Array.from(this.optionsMap.keys()),
2022
2022
  path: [n]
2023
- }), _);
2023
+ }), y);
2024
2024
  }
2025
2025
  get discriminator() {
2026
2026
  return this._def.discriminator;
@@ -2052,7 +2052,7 @@ class Ce extends g {
2052
2052
  }
2053
2053
  }
2054
2054
  return new Ce({
2055
- typeName: y.ZodDiscriminatedUnion,
2055
+ typeName: _.ZodDiscriminatedUnion,
2056
2056
  discriminator: e,
2057
2057
  options: t,
2058
2058
  optionsMap: s,
@@ -2090,11 +2090,11 @@ class fe extends g {
2090
2090
  _parse(e) {
2091
2091
  const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
2092
2092
  if (We(a) || We(i))
2093
- return _;
2093
+ return y;
2094
2094
  const o = Je(a.value, i.value);
2095
2095
  return o.valid ? ((qe(a) || qe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
2096
2096
  code: c.invalid_intersection_types
2097
- }), _);
2097
+ }), y);
2098
2098
  };
2099
2099
  return n.common.async ? Promise.all([
2100
2100
  this._def.left._parseAsync({
@@ -2121,7 +2121,7 @@ class fe extends g {
2121
2121
  fe.create = (r, e, t) => new fe({
2122
2122
  left: r,
2123
2123
  right: e,
2124
- typeName: y.ZodIntersection,
2124
+ typeName: _.ZodIntersection,
2125
2125
  ...v(t)
2126
2126
  });
2127
2127
  class I extends g {
@@ -2132,7 +2132,7 @@ class I extends g {
2132
2132
  code: c.invalid_type,
2133
2133
  expected: f.array,
2134
2134
  received: n.parsedType
2135
- }), _;
2135
+ }), y;
2136
2136
  if (n.data.length < this._def.items.length)
2137
2137
  return l(n, {
2138
2138
  code: c.too_small,
@@ -2140,7 +2140,7 @@ class I extends g {
2140
2140
  inclusive: !0,
2141
2141
  exact: !1,
2142
2142
  type: "array"
2143
- }), _;
2143
+ }), y;
2144
2144
  !this._def.rest && n.data.length > this._def.items.length && (l(n, {
2145
2145
  code: c.too_big,
2146
2146
  maximum: this._def.items.length,
@@ -2169,7 +2169,7 @@ I.create = (r, e) => {
2169
2169
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2170
2170
  return new I({
2171
2171
  items: r,
2172
- typeName: y.ZodTuple,
2172
+ typeName: _.ZodTuple,
2173
2173
  rest: null,
2174
2174
  ...v(e)
2175
2175
  });
@@ -2188,7 +2188,7 @@ class he extends g {
2188
2188
  code: c.invalid_type,
2189
2189
  expected: f.object,
2190
2190
  received: n.parsedType
2191
- }), _;
2191
+ }), y;
2192
2192
  const s = [], a = this._def.keyType, i = this._def.valueType;
2193
2193
  for (const o in n.data)
2194
2194
  s.push({
@@ -2205,12 +2205,12 @@ class he extends g {
2205
2205
  return t instanceof g ? new he({
2206
2206
  keyType: e,
2207
2207
  valueType: t,
2208
- typeName: y.ZodRecord,
2208
+ typeName: _.ZodRecord,
2209
2209
  ...v(n)
2210
2210
  }) : new he({
2211
2211
  keyType: j.create(),
2212
2212
  valueType: e,
2213
- typeName: y.ZodRecord,
2213
+ typeName: _.ZodRecord,
2214
2214
  ...v(t)
2215
2215
  });
2216
2216
  }
@@ -2229,7 +2229,7 @@ class Oe extends g {
2229
2229
  code: c.invalid_type,
2230
2230
  expected: f.map,
2231
2231
  received: n.parsedType
2232
- }), _;
2232
+ }), y;
2233
2233
  const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
2234
2234
  key: s._parse(new R(n, o, n.path, [d, "key"])),
2235
2235
  value: a._parse(new R(n, u, n.path, [d, "value"]))
@@ -2240,7 +2240,7 @@ class Oe extends g {
2240
2240
  for (const u of i) {
2241
2241
  const d = await u.key, p = await u.value;
2242
2242
  if (d.status === "aborted" || p.status === "aborted")
2243
- return _;
2243
+ return y;
2244
2244
  (d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
2245
2245
  }
2246
2246
  return { status: t.value, value: o };
@@ -2250,7 +2250,7 @@ class Oe extends g {
2250
2250
  for (const u of i) {
2251
2251
  const d = u.key, p = u.value;
2252
2252
  if (d.status === "aborted" || p.status === "aborted")
2253
- return _;
2253
+ return y;
2254
2254
  (d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
2255
2255
  }
2256
2256
  return { status: t.value, value: o };
@@ -2260,7 +2260,7 @@ class Oe extends g {
2260
2260
  Oe.create = (r, e, t) => new Oe({
2261
2261
  valueType: e,
2262
2262
  keyType: r,
2263
- typeName: y.ZodMap,
2263
+ typeName: _.ZodMap,
2264
2264
  ...v(t)
2265
2265
  });
2266
2266
  class J extends g {
@@ -2271,7 +2271,7 @@ class J extends g {
2271
2271
  code: c.invalid_type,
2272
2272
  expected: f.set,
2273
2273
  received: n.parsedType
2274
- }), _;
2274
+ }), y;
2275
2275
  const s = this._def;
2276
2276
  s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
2277
2277
  code: c.too_small,
@@ -2293,7 +2293,7 @@ class J extends g {
2293
2293
  const d = /* @__PURE__ */ new Set();
2294
2294
  for (const p of u) {
2295
2295
  if (p.status === "aborted")
2296
- return _;
2296
+ return y;
2297
2297
  p.status === "dirty" && t.dirty(), d.add(p.value);
2298
2298
  }
2299
2299
  return { status: t.value, value: d };
@@ -2324,7 +2324,7 @@ J.create = (r, e) => new J({
2324
2324
  valueType: r,
2325
2325
  minSize: null,
2326
2326
  maxSize: null,
2327
- typeName: y.ZodSet,
2327
+ typeName: _.ZodSet,
2328
2328
  ...v(e)
2329
2329
  });
2330
2330
  class K extends g {
@@ -2338,7 +2338,7 @@ class K extends g {
2338
2338
  code: c.invalid_type,
2339
2339
  expected: f.function,
2340
2340
  received: t.parsedType
2341
- }), _;
2341
+ }), y;
2342
2342
  function n(o, u) {
2343
2343
  return we({
2344
2344
  data: o,
@@ -2423,7 +2423,7 @@ class K extends g {
2423
2423
  return new K({
2424
2424
  args: e || I.create([]).rest(W.create()),
2425
2425
  returns: t || W.create(),
2426
- typeName: y.ZodFunction,
2426
+ typeName: _.ZodFunction,
2427
2427
  ...v(n)
2428
2428
  });
2429
2429
  }
@@ -2439,7 +2439,7 @@ class pe extends g {
2439
2439
  }
2440
2440
  pe.create = (r, e) => new pe({
2441
2441
  getter: r,
2442
- typeName: y.ZodLazy,
2442
+ typeName: _.ZodLazy,
2443
2443
  ...v(e)
2444
2444
  });
2445
2445
  class me extends g {
@@ -2450,7 +2450,7 @@ class me extends g {
2450
2450
  received: t.data,
2451
2451
  code: c.invalid_literal,
2452
2452
  expected: this._def.value
2453
- }), _;
2453
+ }), y;
2454
2454
  }
2455
2455
  return { status: "valid", value: e.data };
2456
2456
  }
@@ -2460,13 +2460,13 @@ class me extends g {
2460
2460
  }
2461
2461
  me.create = (r, e) => new me({
2462
2462
  value: r,
2463
- typeName: y.ZodLiteral,
2463
+ typeName: _.ZodLiteral,
2464
2464
  ...v(e)
2465
2465
  });
2466
2466
  function tt(r, e) {
2467
2467
  return new U({
2468
2468
  values: r,
2469
- typeName: y.ZodEnum,
2469
+ typeName: _.ZodEnum,
2470
2470
  ...v(e)
2471
2471
  });
2472
2472
  }
@@ -2481,7 +2481,7 @@ class U extends g {
2481
2481
  expected: x.joinValues(n),
2482
2482
  received: t.parsedType,
2483
2483
  code: c.invalid_type
2484
- }), _;
2484
+ }), y;
2485
2485
  }
2486
2486
  if (Te(this, se) || Ke(this, se, new Set(this._def.values)), !Te(this, se).has(e.data)) {
2487
2487
  const t = this._getOrReturnCtx(e), n = this._def.values;
@@ -2489,7 +2489,7 @@ class U extends g {
2489
2489
  received: t.data,
2490
2490
  code: c.invalid_enum_value,
2491
2491
  options: n
2492
- }), _;
2492
+ }), y;
2493
2493
  }
2494
2494
  return Z(e.data);
2495
2495
  }
@@ -2529,7 +2529,7 @@ class U extends g {
2529
2529
  }
2530
2530
  se = /* @__PURE__ */ new WeakMap();
2531
2531
  U.create = tt;
2532
- class ye extends g {
2532
+ class _e extends g {
2533
2533
  constructor() {
2534
2534
  super(...arguments), ae.set(this, void 0);
2535
2535
  }
@@ -2541,7 +2541,7 @@ class ye extends g {
2541
2541
  expected: x.joinValues(s),
2542
2542
  received: n.parsedType,
2543
2543
  code: c.invalid_type
2544
- }), _;
2544
+ }), y;
2545
2545
  }
2546
2546
  if (Te(this, ae) || Ke(this, ae, new Set(x.getValidEnumValues(this._def.values))), !Te(this, ae).has(e.data)) {
2547
2547
  const s = x.objectValues(t);
@@ -2549,7 +2549,7 @@ class ye extends g {
2549
2549
  received: n.data,
2550
2550
  code: c.invalid_enum_value,
2551
2551
  options: s
2552
- }), _;
2552
+ }), y;
2553
2553
  }
2554
2554
  return Z(e.data);
2555
2555
  }
@@ -2558,9 +2558,9 @@ class ye extends g {
2558
2558
  }
2559
2559
  }
2560
2560
  ae = /* @__PURE__ */ new WeakMap();
2561
- ye.create = (r, e) => new ye({
2561
+ _e.create = (r, e) => new _e({
2562
2562
  values: r,
2563
- typeName: y.ZodNativeEnum,
2563
+ typeName: _.ZodNativeEnum,
2564
2564
  ...v(e)
2565
2565
  });
2566
2566
  class ee extends g {
@@ -2574,7 +2574,7 @@ class ee extends g {
2574
2574
  code: c.invalid_type,
2575
2575
  expected: f.promise,
2576
2576
  received: t.parsedType
2577
- }), _;
2577
+ }), y;
2578
2578
  const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2579
2579
  return Z(n.then((s) => this._def.type.parseAsync(s, {
2580
2580
  path: t.path,
@@ -2584,7 +2584,7 @@ class ee extends g {
2584
2584
  }
2585
2585
  ee.create = (r, e) => new ee({
2586
2586
  type: r,
2587
- typeName: y.ZodPromise,
2587
+ typeName: _.ZodPromise,
2588
2588
  ...v(e)
2589
2589
  });
2590
2590
  class C extends g {
@@ -2592,7 +2592,7 @@ class C extends g {
2592
2592
  return this._def.schema;
2593
2593
  }
2594
2594
  sourceType() {
2595
- return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2595
+ return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2596
2596
  }
2597
2597
  _parse(e) {
2598
2598
  const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
@@ -2608,23 +2608,23 @@ class C extends g {
2608
2608
  if (n.common.async)
2609
2609
  return Promise.resolve(i).then(async (o) => {
2610
2610
  if (t.value === "aborted")
2611
- return _;
2611
+ return y;
2612
2612
  const u = await this._def.schema._parseAsync({
2613
2613
  data: o,
2614
2614
  path: n.path,
2615
2615
  parent: n
2616
2616
  });
2617
- return u.status === "aborted" ? _ : u.status === "dirty" || t.value === "dirty" ? X(u.value) : u;
2617
+ return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? X(u.value) : u;
2618
2618
  });
2619
2619
  {
2620
2620
  if (t.value === "aborted")
2621
- return _;
2621
+ return y;
2622
2622
  const o = this._def.schema._parseSync({
2623
2623
  data: i,
2624
2624
  path: n.path,
2625
2625
  parent: n
2626
2626
  });
2627
- return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? X(o.value) : o;
2627
+ return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? X(o.value) : o;
2628
2628
  }
2629
2629
  }
2630
2630
  if (s.type === "refinement") {
@@ -2642,9 +2642,9 @@ class C extends g {
2642
2642
  path: n.path,
2643
2643
  parent: n
2644
2644
  });
2645
- return o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2645
+ return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2646
2646
  } else
2647
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2647
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2648
2648
  }
2649
2649
  if (s.type === "transform")
2650
2650
  if (n.common.async === !1) {
@@ -2666,14 +2666,14 @@ class C extends g {
2666
2666
  }
2667
2667
  C.create = (r, e, t) => new C({
2668
2668
  schema: r,
2669
- typeName: y.ZodEffects,
2669
+ typeName: _.ZodEffects,
2670
2670
  effect: e,
2671
2671
  ...v(t)
2672
2672
  });
2673
2673
  C.createWithPreprocess = (r, e, t) => new C({
2674
2674
  schema: e,
2675
2675
  effect: { type: "preprocess", transform: r },
2676
- typeName: y.ZodEffects,
2676
+ typeName: _.ZodEffects,
2677
2677
  ...v(t)
2678
2678
  });
2679
2679
  class N extends g {
@@ -2686,7 +2686,7 @@ class N extends g {
2686
2686
  }
2687
2687
  N.create = (r, e) => new N({
2688
2688
  innerType: r,
2689
- typeName: y.ZodOptional,
2689
+ typeName: _.ZodOptional,
2690
2690
  ...v(e)
2691
2691
  });
2692
2692
  class z extends g {
@@ -2699,10 +2699,10 @@ class z extends g {
2699
2699
  }
2700
2700
  z.create = (r, e) => new z({
2701
2701
  innerType: r,
2702
- typeName: y.ZodNullable,
2702
+ typeName: _.ZodNullable,
2703
2703
  ...v(e)
2704
2704
  });
2705
- class _e extends g {
2705
+ class ye extends g {
2706
2706
  _parse(e) {
2707
2707
  const { ctx: t } = this._processInputParams(e);
2708
2708
  let n = t.data;
@@ -2716,9 +2716,9 @@ class _e extends g {
2716
2716
  return this._def.innerType;
2717
2717
  }
2718
2718
  }
2719
- _e.create = (r, e) => new _e({
2719
+ ye.create = (r, e) => new ye({
2720
2720
  innerType: r,
2721
- typeName: y.ZodDefault,
2721
+ typeName: _.ZodDefault,
2722
2722
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2723
2723
  ...v(e)
2724
2724
  });
@@ -2761,7 +2761,7 @@ class ve extends g {
2761
2761
  }
2762
2762
  ve.create = (r, e) => new ve({
2763
2763
  innerType: r,
2764
- typeName: y.ZodCatch,
2764
+ typeName: _.ZodCatch,
2765
2765
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2766
2766
  ...v(e)
2767
2767
  });
@@ -2773,13 +2773,13 @@ class je extends g {
2773
2773
  code: c.invalid_type,
2774
2774
  expected: f.nan,
2775
2775
  received: n.parsedType
2776
- }), _;
2776
+ }), y;
2777
2777
  }
2778
2778
  return { status: "valid", value: e.data };
2779
2779
  }
2780
2780
  }
2781
2781
  je.create = (r) => new je({
2782
- typeName: y.ZodNaN,
2782
+ typeName: _.ZodNaN,
2783
2783
  ...v(r)
2784
2784
  });
2785
2785
  const Dt = Symbol("zod_brand");
@@ -2806,7 +2806,7 @@ class xe extends g {
2806
2806
  path: n.path,
2807
2807
  parent: n
2808
2808
  });
2809
- return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), X(a.value)) : this._def.out._parseAsync({
2809
+ return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), X(a.value)) : this._def.out._parseAsync({
2810
2810
  data: a.value,
2811
2811
  path: n.path,
2812
2812
  parent: n
@@ -2818,7 +2818,7 @@ class xe extends g {
2818
2818
  path: n.path,
2819
2819
  parent: n
2820
2820
  });
2821
- return s.status === "aborted" ? _ : s.status === "dirty" ? (t.dirty(), {
2821
+ return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
2822
2822
  status: "dirty",
2823
2823
  value: s.value
2824
2824
  }) : this._def.out._parseSync({
@@ -2832,7 +2832,7 @@ class xe extends g {
2832
2832
  return new xe({
2833
2833
  in: e,
2834
2834
  out: t,
2835
- typeName: y.ZodPipeline
2835
+ typeName: _.ZodPipeline
2836
2836
  });
2837
2837
  }
2838
2838
  }
@@ -2847,7 +2847,7 @@ class ge extends g {
2847
2847
  }
2848
2848
  ge.create = (r, e) => new ge({
2849
2849
  innerType: r,
2850
- typeName: y.ZodReadonly,
2850
+ typeName: _.ZodReadonly,
2851
2851
  ...v(e)
2852
2852
  });
2853
2853
  function rt(r, e = {}, t) {
@@ -2862,13 +2862,13 @@ function rt(r, e = {}, t) {
2862
2862
  const Vt = {
2863
2863
  object: b.lazycreate
2864
2864
  };
2865
- var y;
2865
+ var _;
2866
2866
  (function(r) {
2867
2867
  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";
2868
- })(y || (y = {}));
2868
+ })(_ || (_ = {}));
2869
2869
  const Lt = (r, e = {
2870
2870
  message: `Input not instance of ${r.name}`
2871
- }) => rt((t) => t instanceof r, e), nt = j.create, st = V.create, Ut = je.create, zt = L.create, at = de.create, Bt = q.create, Wt = Ze.create, qt = ce.create, Jt = ue.create, Ht = F.create, Yt = W.create, Gt = M.create, Xt = Se.create, Kt = E.create, Qt = b.create, Ft = b.strictCreate, er = le.create, tr = Ce.create, rr = fe.create, nr = I.create, sr = he.create, ar = Oe.create, ir = J.create, or = K.create, dr = pe.create, cr = me.create, ur = U.create, lr = ye.create, fr = ee.create, Ge = C.create, hr = N.create, pr = z.create, mr = C.createWithPreprocess, yr = xe.create, _r = () => nt().optional(), vr = () => st().optional(), gr = () => at().optional(), xr = {
2871
+ }) => rt((t) => t instanceof r, e), nt = j.create, st = V.create, Ut = je.create, zt = L.create, at = de.create, Bt = q.create, Wt = Ze.create, qt = ce.create, Jt = ue.create, Ht = F.create, Yt = W.create, Gt = M.create, Xt = Se.create, Kt = E.create, Qt = b.create, Ft = b.strictCreate, er = le.create, tr = Ce.create, rr = fe.create, nr = I.create, sr = he.create, ar = Oe.create, ir = J.create, or = K.create, dr = pe.create, cr = me.create, ur = U.create, lr = _e.create, fr = ee.create, Ge = C.create, hr = N.create, pr = z.create, mr = C.createWithPreprocess, _r = xe.create, yr = () => nt().optional(), vr = () => st().optional(), gr = () => at().optional(), xr = {
2872
2872
  string: (r) => j.create({ ...r, coerce: !0 }),
2873
2873
  number: (r) => V.create({ ...r, coerce: !0 }),
2874
2874
  boolean: (r) => de.create({
@@ -2877,7 +2877,7 @@ const Lt = (r, e = {
2877
2877
  }),
2878
2878
  bigint: (r) => L.create({ ...r, coerce: !0 }),
2879
2879
  date: (r) => q.create({ ...r, coerce: !0 })
2880
- }, br = _;
2880
+ }, br = y;
2881
2881
  var h = /* @__PURE__ */ Object.freeze({
2882
2882
  __proto__: null,
2883
2883
  defaultErrorMap: Q,
@@ -2887,7 +2887,7 @@ var h = /* @__PURE__ */ Object.freeze({
2887
2887
  EMPTY_PATH: kt,
2888
2888
  addIssueToContext: l,
2889
2889
  ParseStatus: T,
2890
- INVALID: _,
2890
+ INVALID: y,
2891
2891
  DIRTY: X,
2892
2892
  OK: Z,
2893
2893
  isAborted: We,
@@ -2929,13 +2929,13 @@ var h = /* @__PURE__ */ Object.freeze({
2929
2929
  ZodLazy: pe,
2930
2930
  ZodLiteral: me,
2931
2931
  ZodEnum: U,
2932
- ZodNativeEnum: ye,
2932
+ ZodNativeEnum: _e,
2933
2933
  ZodPromise: ee,
2934
2934
  ZodEffects: C,
2935
2935
  ZodTransformer: C,
2936
2936
  ZodOptional: N,
2937
2937
  ZodNullable: z,
2938
- ZodDefault: _e,
2938
+ ZodDefault: ye,
2939
2939
  ZodCatch: ve,
2940
2940
  ZodNaN: je,
2941
2941
  BRAND: Dt,
@@ -2947,7 +2947,7 @@ var h = /* @__PURE__ */ Object.freeze({
2947
2947
  ZodSchema: g,
2948
2948
  late: Vt,
2949
2949
  get ZodFirstPartyTypeKind() {
2950
- return y;
2950
+ return _;
2951
2951
  },
2952
2952
  coerce: xr,
2953
2953
  any: Ht,
@@ -2974,8 +2974,8 @@ var h = /* @__PURE__ */ Object.freeze({
2974
2974
  oboolean: gr,
2975
2975
  onumber: vr,
2976
2976
  optional: hr,
2977
- ostring: _r,
2978
- pipeline: yr,
2977
+ ostring: yr,
2978
+ pipeline: _r,
2979
2979
  preprocess: mr,
2980
2980
  promise: fr,
2981
2981
  record: sr,
@@ -3066,7 +3066,7 @@ function Y(r) {
3066
3066
  "X-Auth-Email": r.authEmail,
3067
3067
  "X-Auth-Key": r.authKey,
3068
3068
  "Content-Type": "application/json"
3069
- }).middlewares([yt(), ht()]);
3069
+ }).middlewares([_t(), ht()]);
3070
3070
  }
3071
3071
  function ze(r) {
3072
3072
  return {
@@ -3127,19 +3127,26 @@ function Er(r) {
3127
3127
  return ze({ ...n, ...s });
3128
3128
  },
3129
3129
  list: async (e) => {
3130
- const { result: t, errors: n, success: s } = jr.parse(
3130
+ const t = await r.customDomainAdapter.list(e), { result: n, errors: s, success: a } = jr.parse(
3131
3131
  await Y(r).get("/custom_hostnames").json()
3132
3132
  );
3133
- if (!s)
3133
+ if (!a)
3134
3134
  throw new H(503, {
3135
- message: JSON.stringify(n)
3135
+ message: JSON.stringify(s)
3136
3136
  });
3137
- return t.filter(
3138
- (a) => {
3139
- var i;
3140
- return !(r.enterprise && ((i = a.custom_metadata) == null ? void 0 : i.tenant_id) !== e);
3137
+ return n.filter(
3138
+ (i) => t.find((o) => o.custom_domain_id === i.id)
3139
+ ).filter(
3140
+ (i) => {
3141
+ var o;
3142
+ return !(r.enterprise && ((o = i.custom_metadata) == null ? void 0 : o.tenant_id) !== e);
3141
3143
  }
3142
- ).map((a) => ze({ ...a, primary: !1 }));
3144
+ ).map(
3145
+ (i) => ze({
3146
+ ...t.find((o) => o.custom_domain_id === i.id),
3147
+ ...i
3148
+ })
3149
+ );
3143
3150
  },
3144
3151
  remove: async (e, t) => {
3145
3152
  var s;
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.1.0",
14
+ "version": "1.2.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "devDependencies": {
29
- "@authhero/kysely-adapter": "^10.1.0",
29
+ "@authhero/kysely-adapter": "^10.4.0",
30
30
  "@hono/zod-openapi": "^0.18.0",
31
31
  "@rollup/plugin-commonjs": "^28.0.1",
32
32
  "@rollup/plugin-node-resolve": "^15.3.0",