@bylqwjc/media-editor-server 1.0.14 → 1.0.18

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.
Files changed (40) hide show
  1. package/core/dist/browser.cjs +1 -1
  2. package/core/dist/browser.js +2 -2
  3. package/core/dist/chunk-MGKYVYOH.js +1 -1
  4. package/core/dist/chunk-USY6UDGL.js +1 -1
  5. package/core/dist/chunk-XCBM7P7N.js +1 -1
  6. package/core/dist/engine.cjs +1 -1
  7. package/core/dist/engine.js +1 -1
  8. package/core/dist/filerobot.cjs +1 -1
  9. package/core/dist/filerobot.js +1 -1
  10. package/core/dist/index.cjs +1 -1
  11. package/core/dist/index.js +1 -1
  12. package/core/package.json +1 -1
  13. package/core/zod/index.cjs +1 -1
  14. package/core/zod/index.js +1 -1
  15. package/core/zod/v3/ZodError.cjs +1 -1
  16. package/core/zod/v3/ZodError.js +1 -1
  17. package/core/zod/v3/errors.cjs +1 -1
  18. package/core/zod/v3/errors.js +1 -1
  19. package/core/zod/v3/external.cjs +1 -1
  20. package/core/zod/v3/helpers/errorUtil.cjs +1 -1
  21. package/core/zod/v3/helpers/errorUtil.js +1 -1
  22. package/core/zod/v3/helpers/parseUtil.cjs +1 -1
  23. package/core/zod/v3/helpers/parseUtil.js +1 -1
  24. package/core/zod/v3/helpers/util.cjs +1 -1
  25. package/core/zod/v3/helpers/util.js +1 -1
  26. package/core/zod/v3/index.cjs +1 -1
  27. package/core/zod/v3/index.js +1 -1
  28. package/core/zod/v3/locales/en.cjs +1 -1
  29. package/core/zod/v3/locales/en.js +1 -1
  30. package/core/zod/v3/types.cjs +1 -1
  31. package/core/zod/v3/types.js +1 -1
  32. package/dist/adapters/express.cjs +1 -1
  33. package/dist/adapters/express.d.ts +2 -2
  34. package/dist/adapters/express.js +1 -1
  35. package/dist/adapters/web.cjs +1 -1
  36. package/dist/adapters/web.d.ts +2 -2
  37. package/dist/adapters/web.js +1 -1
  38. package/dist/index.cjs +4 -4
  39. package/dist/index.js +3 -3
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.discriminatedUnion=exports.date=exports.boolean=exports.bigint=exports.array=exports.any=exports.coerce=exports.ZodFirstPartyTypeKind=exports.late=exports.ZodSchema=exports.Schema=exports.ZodReadonly=exports.ZodPipeline=exports.ZodBranded=exports.BRAND=exports.ZodNaN=exports.ZodCatch=exports.ZodDefault=exports.ZodNullable=exports.ZodOptional=exports.ZodTransformer=exports.ZodEffects=exports.ZodPromise=exports.ZodNativeEnum=exports.ZodEnum=exports.ZodLiteral=exports.ZodLazy=exports.ZodFunction=exports.ZodSet=exports.ZodMap=exports.ZodRecord=exports.ZodTuple=exports.ZodIntersection=exports.ZodDiscriminatedUnion=exports.ZodUnion=exports.ZodObject=exports.ZodArray=exports.ZodVoid=exports.ZodNever=exports.ZodUnknown=exports.ZodAny=exports.ZodNull=exports.ZodUndefined=exports.ZodSymbol=exports.ZodDate=exports.ZodBoolean=exports.ZodBigInt=exports.ZodNumber=exports.ZodString=exports.ZodType=void 0,exports.NEVER=exports.void=exports.unknown=exports.union=exports.undefined=exports.tuple=exports.transformer=exports.symbol=exports.string=exports.strictObject=exports.set=exports.record=exports.promise=exports.preprocess=exports.pipeline=exports.ostring=exports.optional=exports.onumber=exports.oboolean=exports.object=exports.number=exports.nullable=exports.null=exports.never=exports.nativeEnum=exports.nan=exports.map=exports.literal=exports.lazy=exports.intersection=exports.instanceof=exports.function=exports.enum=exports.effect=void 0,exports.datetimeRegex=he,exports.custom=me;const u=require("./ZodError.cjs"),Q=require("./errors.cjs"),h=require("./helpers/errorUtil.cjs"),i=require("./helpers/parseUtil.cjs"),c=require("./helpers/util.cjs");class T{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ue=(r,e)=>{if((0,i.isValid)(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 u.ZodError(r.common.issues);return this._error=t,this._error}}};function m(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(d,o)=>{const{message:l}=r;return d.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:d.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return(0,c.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,c.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new i.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,c.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,i.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,c.getParsedType)(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ue(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,c.getParsedType)(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return(0,i.isValid)(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>(0,i.isValid)(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,c.getParsedType)(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await((0,i.isAsync)(a)?a:Promise.resolve(a));return ue(s,n)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const d=e(a),o=()=>n.addIssue({code:u.ZodIssueCode.custom,...s(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(l=>l?!0:(o(),!1)):d?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new x({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return C.create(this,this._def)}nullable(){return A.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return I.create(this)}promise(){return D.create(this,this._def)}or(e){return $.create([this,e],this._def)}and(e){return B.create(this,e,this._def)}transform(e){return new x({...m(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new K({...m(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new oe({typeName:p.ZodBranded,type:this,...m(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Y({...m(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return H.create(this,e)}readonly(){return J.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}exports.ZodType=y,exports.Schema=y,exports.ZodSchema=y;const xe=/^c[^\s-]{8,}$/i,Ie=/^[0-9a-z]+$/,Ze=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Te=/^[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,Ce=/^[a-z0-9_-]{21}$/i,ke=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,be=/^[-+]?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)?)??$/,we=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ae="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const Ne=/^(?:(?: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])$/,Se=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Oe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Re=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ve=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ce="((\\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])))",Ue=new RegExp(`^${ce}$`);function le(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Le(r){return new RegExp(`^${le(r)}$`)}function he(r){let e=`${ce}T${le(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 De(r,e){return!!((e==="v4"||!e)&&Ne.test(r)||(e==="v6"||!e)&&Oe.test(r))}function Ee(r,e){if(!ke.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function je(r,e){return!!((e==="v4"||!e)&&Se.test(r)||(e==="v6"||!e)&&Pe.test(r))}class Z extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.ZodParsedType.string){const n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.string,received:n.parsedType}),i.INVALID}const s=new i.ParseStatus;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const d=e.data.length>n.value,o=e.data.length<n.value;(d||o)&&(a=this._getOrReturnCtx(e,a),d?(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")we.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"email",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")ne||(ne=new RegExp(Ae,"u")),ne.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"emoji",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Te.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"uuid",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Ce.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"nanoid",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")xe.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"cuid",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"cuid2",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"ulid",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"url",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"regex",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?he(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Ue.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Le(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?be.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"duration",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?De(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"ip",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Ee(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"jwt",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?je(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"cidr",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Re.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"base64",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Ve.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{validation:"base64url",code:u.ZodIssueCode.invalid_string,message:n.message}),s.dirty()):c.util.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:u.ZodIssueCode.invalid_string,...h.errorUtil.errToObj(s)})}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errorUtil.errToObj(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?.precision>"u"?null:e?.precision,...h.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,h.errorUtil.errToObj(e))}trim(){return new Z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodString=Z,Z.create=r=>new Z({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,...m(r)});function Me(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return n%d/10**a}class N extends y{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)!==c.ZodParsedType.number){const n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.number,received:n.parsedType}),i.INVALID}let s;const a=new i.ParseStatus;for(const n of this._def.checks)n.kind==="int"?c.util.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Me(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.not_finite,message:n.message}),a.dirty()):c.util.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new N({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.errorUtil.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"&&c.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}exports.ZodNumber=N,N.create=r=>new N({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,...m(r)});class S extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==c.ZodParsedType.bigint)return this._getInvalidInput(e);let s;const a=new i.ParseStatus;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):c.util.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.bigint,received:t.parsedType}),i.INVALID}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new S({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new S({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.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}}exports.ZodBigInt=S,S.create=r=>new S({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,...m(r)});class j extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.ZodParsedType.boolean){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.boolean,received:s.parsedType}),i.INVALID}return(0,i.OK)(e.data)}}exports.ZodBoolean=j,j.create=r=>new j({typeName:p.ZodBoolean,coerce:r?.coerce||!1,...m(r)});class R extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.ZodParsedType.date){const n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.date,received:n.parsedType}),i.INVALID}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:u.ZodIssueCode.invalid_date}),i.INVALID}const s=new i.ParseStatus;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),(0,i.addIssueToContext)(a,{code:u.ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):c.util.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.errorUtil.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}}exports.ZodDate=R,R.create=r=>new R({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,...m(r)});class X extends y{_parse(e){if(this._getType(e)!==c.ZodParsedType.symbol){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.symbol,received:s.parsedType}),i.INVALID}return(0,i.OK)(e.data)}}exports.ZodSymbol=X,X.create=r=>new X({typeName:p.ZodSymbol,...m(r)});class M extends y{_parse(e){if(this._getType(e)!==c.ZodParsedType.undefined){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.undefined,received:s.parsedType}),i.INVALID}return(0,i.OK)(e.data)}}exports.ZodUndefined=M,M.create=r=>new M({typeName:p.ZodUndefined,...m(r)});class z extends y{_parse(e){if(this._getType(e)!==c.ZodParsedType.null){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.null,received:s.parsedType}),i.INVALID}return(0,i.OK)(e.data)}}exports.ZodNull=z,z.create=r=>new z({typeName:p.ZodNull,...m(r)});class U extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,i.OK)(e.data)}}exports.ZodAny=U,U.create=r=>new U({typeName:p.ZodAny,...m(r)});class P extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,i.OK)(e.data)}}exports.ZodUnknown=P,P.create=r=>new P({typeName:p.ZodUnknown,...m(r)});class b extends y{_parse(e){const t=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.never,received:t.parsedType}),i.INVALID}}exports.ZodNever=b,b.create=r=>new b({typeName:p.ZodNever,...m(r)});class ee extends y{_parse(e){if(this._getType(e)!==c.ZodParsedType.undefined){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.void,received:s.parsedType}),i.INVALID}return(0,i.OK)(e.data)}}exports.ZodVoid=ee,ee.create=r=>new ee({typeName:p.ZodVoid,...m(r)});class I extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==c.ZodParsedType.array)return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.array,received:t.parsedType}),i.INVALID;if(a.exactLength!==null){const d=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(d||o)&&((0,i.addIssueToContext)(t,{code:d?u.ZodIssueCode.too_big:u.ZodIssueCode.too_small,minimum:o?a.exactLength.value:void 0,maximum:d?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,i.addIssueToContext)(t,{code:u.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,i.addIssueToContext)(t,{code:u.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((d,o)=>a.type._parseAsync(new T(t,d,t.path,o)))).then(d=>i.ParseStatus.mergeArray(s,d));const n=[...t.data].map((d,o)=>a.type._parseSync(new T(t,d,t.path,o)));return i.ParseStatus.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new I({...this._def,minLength:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new I({...this._def,maxLength:{value:e,message:h.errorUtil.toString(t)}})}length(e,t){return new I({...this._def,exactLength:{value:e,message:h.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}exports.ZodArray=I,I.create=(r,e)=>new I({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...m(e)});function L(r){if(r instanceof g){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=C.create(L(s))}return new g({...r._def,shape:()=>e})}else return r instanceof I?new I({...r._def,type:L(r.element)}):r instanceof C?C.create(L(r.unwrap())):r instanceof A?A.create(L(r.unwrap())):r instanceof k?k.create(r.items.map(e=>L(e))):r}class g extends y{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=c.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.ZodParsedType.object){const f=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(f,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:f.parsedType}),i.INVALID}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:d}=this._getCached(),o=[];if(!(this._def.catchall instanceof b&&this._def.unknownKeys==="strip"))for(const f in a.data)d.includes(f)||o.push(f);const l=[];for(const f of d){const _=n[f],v=a.data[f];l.push({key:{status:"valid",value:f},value:_._parse(new T(a,v,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof b){const f=this._def.unknownKeys;if(f==="passthrough")for(const _ of o)l.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}});else if(f==="strict")o.length>0&&((0,i.addIssueToContext)(a,{code:u.ZodIssueCode.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const _ of o){const v=a.data[_];l.push({key:{status:"valid",value:_},value:f._parse(new T(a,v,a.path,_)),alwaysSet:_ in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const _ of l){const v=await _.key,de=await _.value;f.push({key:v,value:de,alwaysSet:_.alwaysSet})}return f}).then(f=>i.ParseStatus.mergeObjectSync(s,f)):i.ParseStatus.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return h.errorUtil.errToObj,new g({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errorUtil.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(e){return new g({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new g({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new g({...this._def,catchall:e})}pick(e){const t={};for(const s of c.util.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}omit(e){const t={};for(const s of c.util.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}deepPartial(){return L(this)}partial(e){const t={};for(const s of c.util.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new g({...this._def,shape:()=>t})}required(e){const t={};for(const s of c.util.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof C;)n=n._def.innerType;t[s]=n}return new g({...this._def,shape:()=>t})}keyof(){return fe(c.util.objectKeys(this.shape))}}exports.ZodObject=g,g.create=(r,e)=>new g({shape:()=>r,unknownKeys:"strip",catchall:b.create(),typeName:p.ZodObject,...m(e)}),g.strictCreate=(r,e)=>new g({shape:()=>r,unknownKeys:"strict",catchall:b.create(),typeName:p.ZodObject,...m(e)}),g.lazycreate=(r,e)=>new g({shape:r,unknownKeys:"strip",catchall:b.create(),typeName:p.ZodObject,...m(e)});class $ extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const d=n.map(o=>new u.ZodError(o.ctx.common.issues));return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_union,unionErrors:d}),i.INVALID}if(t.common.async)return Promise.all(s.map(async n=>{const d={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(a);{let n;const d=[];for(const l of s){const f={...t,common:{...t.common,issues:[]},parent:null},_=l._parseSync({data:t.data,path:t.path,parent:f});if(_.status==="valid")return _;_.status==="dirty"&&!n&&(n={result:_,ctx:f}),f.common.issues.length&&d.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=d.map(l=>new u.ZodError(l));return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_union,unionErrors:o}),i.INVALID}}get options(){return this._def.options}}exports.ZodUnion=$,$.create=(r,e)=>new $({options:r,typeName:p.ZodUnion,...m(e)});const w=r=>r instanceof F?w(r.schema):r instanceof x?w(r.innerType()):r instanceof W?[r.value]:r instanceof O?r.options:r instanceof q?c.util.objectValues(r.enum):r instanceof K?w(r._def.innerType):r instanceof M?[void 0]:r instanceof z?[null]:r instanceof C?[void 0,...w(r.unwrap())]:r instanceof A?[null,...w(r.unwrap())]:r instanceof oe||r instanceof J?w(r.unwrap()):r instanceof Y?w(r._def.innerType):[];class re extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.ZodParsedType.object)return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:t.parsedType}),i.INVALID;const s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):((0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),i.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const n of t){const d=w(n.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of d){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new re({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...m(s)})}}exports.ZodDiscriminatedUnion=re;function ie(r,e){const t=(0,c.getParsedType)(r),s=(0,c.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===c.ZodParsedType.object&&s===c.ZodParsedType.object){const a=c.util.objectKeys(e),n=c.util.objectKeys(r).filter(o=>a.indexOf(o)!==-1),d={...r,...e};for(const o of n){const l=ie(r[o],e[o]);if(!l.valid)return{valid:!1};d[o]=l.data}return{valid:!0,data:d}}else if(t===c.ZodParsedType.array&&s===c.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<r.length;n++){const d=r[n],o=e[n],l=ie(d,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===c.ZodParsedType.date&&s===c.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class B extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(n,d)=>{if((0,i.isAborted)(n)||(0,i.isAborted)(d))return i.INVALID;const o=ie(n.value,d.value);return o.valid?(((0,i.isDirty)(n)||(0,i.isDirty)(d))&&t.dirty(),{status:t.value,value:o.data}):((0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_intersection_types}),i.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,d])=>a(n,d)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}exports.ZodIntersection=B,B.create=(r,e,t)=>new B({left:r,right:e,typeName:p.ZodIntersection,...m(t)});class k extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==c.ZodParsedType.array)return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.array,received:s.parsedType}),i.INVALID;if(s.data.length<this._def.items.length)return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((d,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new T(s,d,s.path,o)):null}).filter(d=>!!d);return s.common.async?Promise.all(n).then(d=>i.ParseStatus.mergeArray(t,d)):i.ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new k({...this._def,rest:e})}}exports.ZodTuple=k,k.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new k({items:r,typeName:p.ZodTuple,rest:null,...m(e)})};class G extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==c.ZodParsedType.object)return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:s.parsedType}),i.INVALID;const a=[],n=this._def.keyType,d=this._def.valueType;for(const o in s.data)a.push({key:n._parse(new T(s,o,s.path,o)),value:d._parse(new T(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?i.ParseStatus.mergeObjectAsync(t,a):i.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new G({keyType:e,valueType:t,typeName:p.ZodRecord,...m(s)}):new G({keyType:Z.create(),valueType:e,typeName:p.ZodRecord,...m(t)})}}exports.ZodRecord=G;class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==c.ZodParsedType.map)return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.map,received:s.parsedType}),i.INVALID;const a=this._def.keyType,n=this._def.valueType,d=[...s.data.entries()].map(([o,l],f)=>({key:a._parse(new T(s,o,s.path,[f,"key"])),value:n._parse(new T(s,l,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of d){const f=await l.key,_=await l.value;if(f.status==="aborted"||_.status==="aborted")return i.INVALID;(f.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(f.value,_.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of d){const f=l.key,_=l.value;if(f.status==="aborted"||_.status==="aborted")return i.INVALID;(f.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(f.value,_.value)}return{status:t.value,value:o}}}}exports.ZodMap=te,te.create=(r,e,t)=>new te({valueType:e,keyType:r,typeName:p.ZodMap,...m(t)});class V extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==c.ZodParsedType.set)return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.set,received:s.parsedType}),i.INVALID;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&((0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&((0,i.addIssueToContext)(s,{code:u.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function d(l){const f=new Set;for(const _ of l){if(_.status==="aborted")return i.INVALID;_.status==="dirty"&&t.dirty(),f.add(_.value)}return{status:t.value,value:f}}const o=[...s.data.values()].map((l,f)=>n._parse(new T(s,l,s.path,f)));return s.common.async?Promise.all(o).then(l=>d(l)):d(o)}min(e,t){return new V({...this._def,minSize:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new V({...this._def,maxSize:{value:e,message:h.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}exports.ZodSet=V,V.create=(r,e)=>new V({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,...m(e)});class E extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.ZodParsedType.function)return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.function,received:t.parsedType}),i.INVALID;function s(o,l){return(0,i.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,Q.getErrorMap)(),Q.defaultErrorMap].filter(f=>!!f),issueData:{code:u.ZodIssueCode.invalid_arguments,argumentsError:l}})}function a(o,l){return(0,i.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,Q.getErrorMap)(),Q.defaultErrorMap].filter(f=>!!f),issueData:{code:u.ZodIssueCode.invalid_return_type,returnTypeError:l}})}const n={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof D){const o=this;return(0,i.OK)(async function(...l){const f=new u.ZodError([]),_=await o._def.args.parseAsync(l,n).catch(ae=>{throw f.addIssue(s(l,ae)),f}),v=await Reflect.apply(d,this,_);return await o._def.returns._def.type.parseAsync(v,n).catch(ae=>{throw f.addIssue(a(v,ae)),f})})}else{const o=this;return(0,i.OK)(function(...l){const f=o._def.args.safeParse(l,n);if(!f.success)throw new u.ZodError([s(l,f.error)]);const _=Reflect.apply(d,this,f.data),v=o._def.returns.safeParse(_,n);if(!v.success)throw new u.ZodError([a(_,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new E({...this._def,args:k.create(e).rest(P.create())})}returns(e){return new E({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new E({args:e||k.create([]).rest(P.create()),returns:t||P.create(),typeName:p.ZodFunction,...m(s)})}}exports.ZodFunction=E;class F extends y{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})}}exports.ZodLazy=F,F.create=(r,e)=>new F({getter:r,typeName:p.ZodLazy,...m(e)});class W extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(t,{received:t.data,code:u.ZodIssueCode.invalid_literal,expected:this._def.value}),i.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}exports.ZodLiteral=W,W.create=(r,e)=>new W({value:r,typeName:p.ZodLiteral,...m(e)});function fe(r,e){return new O({values:r,typeName:p.ZodEnum,...m(e)})}class O extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,i.addIssueToContext)(t,{expected:c.util.joinValues(s),received:t.parsedType,code:u.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,i.addIssueToContext)(t,{received:t.data,code:u.ZodIssueCode.invalid_enum_value,options:s}),i.INVALID}return(0,i.OK)(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 O.create(e,{...this._def,...t})}exclude(e,t=this._def){return O.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}exports.ZodEnum=O,O.create=fe;class q extends y{_parse(e){const t=c.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==c.ZodParsedType.string&&s.parsedType!==c.ZodParsedType.number){const a=c.util.objectValues(t);return(0,i.addIssueToContext)(s,{expected:c.util.joinValues(a),received:s.parsedType,code:u.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||(this._cache=new Set(c.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=c.util.objectValues(t);return(0,i.addIssueToContext)(s,{received:s.data,code:u.ZodIssueCode.invalid_enum_value,options:a}),i.INVALID}return(0,i.OK)(e.data)}get enum(){return this._def.values}}exports.ZodNativeEnum=q,q.create=(r,e)=>new q({values:r,typeName:p.ZodNativeEnum,...m(e)});class D extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.ZodParsedType.promise&&t.common.async===!1)return(0,i.addIssueToContext)(t,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.promise,received:t.parsedType}),i.INVALID;const s=t.parsedType===c.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,i.OK)(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}exports.ZodPromise=D,D.create=(r,e)=>new D({type:r,typeName:p.ZodPromise,...m(e)});class x extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:d=>{(0,i.addIssueToContext)(s,d),d.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const d=a.transform(s.data,n);if(s.common.async)return Promise.resolve(d).then(async o=>{if(t.value==="aborted")return i.INVALID;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?i.INVALID:l.status==="dirty"||t.value==="dirty"?(0,i.DIRTY)(l.value):l});{if(t.value==="aborted")return i.INVALID;const o=this._def.schema._parseSync({data:d,path:s.path,parent:s});return o.status==="aborted"?i.INVALID:o.status==="dirty"||t.value==="dirty"?(0,i.DIRTY)(o.value):o}}if(a.type==="refinement"){const d=o=>{const l=a.refinement(o,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?i.INVALID:(o.status==="dirty"&&t.dirty(),d(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?i.INVALID:(o.status==="dirty"&&t.dirty(),d(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,i.isValid)(d))return i.INVALID;const o=a.transform(d.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>(0,i.isValid)(d)?Promise.resolve(a.transform(d.value,n)).then(o=>({status:t.value,value:o})):i.INVALID);c.util.assertNever(a)}}exports.ZodEffects=x,exports.ZodTransformer=x,x.create=(r,e,t)=>new x({schema:r,typeName:p.ZodEffects,effect:e,...m(t)}),x.createWithPreprocess=(r,e,t)=>new x({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,...m(t)});class C extends y{_parse(e){return this._getType(e)===c.ZodParsedType.undefined?(0,i.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodOptional=C,C.create=(r,e)=>new C({innerType:r,typeName:p.ZodOptional,...m(e)});class A extends y{_parse(e){return this._getType(e)===c.ZodParsedType.null?(0,i.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodNullable=A,A.create=(r,e)=>new A({innerType:r,typeName:p.ZodNullable,...m(e)});class K extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===c.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}exports.ZodDefault=K,K.create=(r,e)=>new K({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...m(e)});class Y extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,i.isAsync)(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new u.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new u.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}exports.ZodCatch=Y,Y.create=(r,e)=>new Y({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...m(e)});class se extends y{_parse(e){if(this._getType(e)!==c.ZodParsedType.nan){const s=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(s,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.nan,received:s.parsedType}),i.INVALID}return{status:"valid",value:e.data}}}exports.ZodNaN=se,se.create=r=>new se({typeName:p.ZodNaN,...m(r)}),exports.BRAND=Symbol("zod_brand");class oe extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}exports.ZodBranded=oe;class H extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?i.INVALID:n.status==="dirty"?(t.dirty(),(0,i.DIRTY)(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?i.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new H({in:e,out:t,typeName:p.ZodPipeline})}}exports.ZodPipeline=H;class J extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>((0,i.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,i.isAsync)(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}exports.ZodReadonly=J,J.create=(r,e)=>new J({innerType:r,typeName:p.ZodReadonly,...m(e)});function pe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function me(r,e={},t){return r?U.create().superRefine((s,a)=>{const n=r(s);if(n instanceof Promise)return n.then(d=>{if(!d){const o=pe(e,s),l=o.fatal??t??!0;a.addIssue({code:"custom",...o,fatal:l})}});if(!n){const d=pe(e,s),o=d.fatal??t??!0;a.addIssue({code:"custom",...d,fatal:o})}}):U.create()}exports.late={object:g.lazycreate};var p;(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"})(p||(exports.ZodFirstPartyTypeKind=p={}));class It{constructor(...e){}}const ze=(r,e={message:`Input not instance of ${r.name}`})=>me(t=>t instanceof r,e);exports.instanceof=ze;const ye=Z.create;exports.string=ye;const _e=N.create;exports.number=_e;const $e=se.create;exports.nan=$e;const Be=S.create;exports.bigint=Be;const ge=j.create;exports.boolean=ge;const Fe=R.create;exports.date=Fe;const We=X.create;exports.symbol=We;const qe=M.create;exports.undefined=qe;const Ke=z.create;exports.null=Ke;const Ye=U.create;exports.any=Ye;const Je=P.create;exports.unknown=Je;const He=b.create;exports.never=He;const Ge=ee.create;exports.void=Ge;const Qe=I.create;exports.array=Qe;const Xe=g.create;exports.object=Xe;const et=g.strictCreate;exports.strictObject=et;const tt=$.create;exports.union=tt;const st=re.create;exports.discriminatedUnion=st;const rt=B.create;exports.intersection=rt;const at=k.create;exports.tuple=at;const nt=G.create;exports.record=nt;const it=te.create;exports.map=it;const ot=V.create;exports.set=ot;const dt=E.create;exports.function=dt;const ut=F.create;exports.lazy=ut;const ct=W.create;exports.literal=ct;const lt=O.create;exports.enum=lt;const ht=q.create;exports.nativeEnum=ht;const ft=D.create;exports.promise=ft;const ve=x.create;exports.effect=ve,exports.transformer=ve;const pt=C.create;exports.optional=pt;const mt=A.create;exports.nullable=mt;const yt=x.createWithPreprocess;exports.preprocess=yt;const _t=H.create;exports.pipeline=_t;const gt=()=>ye().optional();exports.ostring=gt;const vt=()=>_e().optional();exports.onumber=vt;const xt=()=>ge().optional();exports.oboolean=xt,exports.coerce={string:(r=>Z.create({...r,coerce:!0})),number:(r=>N.create({...r,coerce:!0})),boolean:(r=>j.create({...r,coerce:!0})),bigint:(r=>S.create({...r,coerce:!0})),date:(r=>R.create({...r,coerce:!0}))},exports.NEVER=i.INVALID;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.discriminatedUnion=exports.date=exports.boolean=exports.bigint=exports.array=exports.any=exports.coerce=exports.ZodFirstPartyTypeKind=exports.late=exports.ZodSchema=exports.Schema=exports.ZodReadonly=exports.ZodPipeline=exports.ZodBranded=exports.BRAND=exports.ZodNaN=exports.ZodCatch=exports.ZodDefault=exports.ZodNullable=exports.ZodOptional=exports.ZodTransformer=exports.ZodEffects=exports.ZodPromise=exports.ZodNativeEnum=exports.ZodEnum=exports.ZodLiteral=exports.ZodLazy=exports.ZodFunction=exports.ZodSet=exports.ZodMap=exports.ZodRecord=exports.ZodTuple=exports.ZodIntersection=exports.ZodDiscriminatedUnion=exports.ZodUnion=exports.ZodObject=exports.ZodArray=exports.ZodVoid=exports.ZodNever=exports.ZodUnknown=exports.ZodAny=exports.ZodNull=exports.ZodUndefined=exports.ZodSymbol=exports.ZodDate=exports.ZodBoolean=exports.ZodBigInt=exports.ZodNumber=exports.ZodString=exports.ZodType=void 0,exports.NEVER=exports.void=exports.unknown=exports.union=exports.undefined=exports.tuple=exports.transformer=exports.symbol=exports.string=exports.strictObject=exports.set=exports.record=exports.promise=exports.preprocess=exports.pipeline=exports.ostring=exports.optional=exports.onumber=exports.oboolean=exports.object=exports.number=exports.nullable=exports.null=exports.never=exports.nativeEnum=exports.nan=exports.map=exports.literal=exports.lazy=exports.intersection=exports.instanceof=exports.function=exports.enum=exports.effect=void 0,exports.datetimeRegex=le,exports.custom=me;const o=require("./ZodError.cjs"),X=require("./errors.cjs"),h=require("./helpers/errorUtil.cjs"),n=require("./helpers/parseUtil.cjs"),u=require("./helpers/util.cjs");class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const oe=(r,e)=>{if((0,n.isValid)(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 o.ZodError(r.common.issues);return this._error=t,this._error}}};function f(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(c,d)=>{const{message:i}=r;return c.code==="invalid_enum_value"?{message:i??d.defaultError}:typeof d.data>"u"?{message:i??s??d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:i??t??d.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return(0,u.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new n.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,n.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parseSync({data:e,path:s.path,parent:s});return oe(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parse({data:e,path:s.path,parent:s}),c=await((0,n.isAsync)(a)?a:Promise.resolve(a));return oe(s,c)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,c)=>{const d=e(a),i=()=>c.addIssue({code:o.ZodIssueCode.custom,...s(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(l=>l?!0:(i(),!1)):d?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new v({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return T.create(this,this._def)}nullable(){return A.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return R.create(this,this._def)}or(e){return z.create([this,e],this._def)}and(e){return $.create(this,e,this._def)}transform(e){return new v({...f(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new q({...f(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new de({typeName:p.ZodBranded,type:this,...f(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Y({...f(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return G.create(this,e)}readonly(){return J.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}exports.ZodType=y,exports.Schema=y,exports.ZodSchema=y;const ve=/^c[^\s-]{8,}$/i,Ze=/^[0-9a-z]+$/,Ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xe=/^[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,Te=/^[a-z0-9_-]{21}$/i,Ce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ke=/^[-+]?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)?)??$/,be=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,we="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const Ae=/^(?:(?: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])$/,Ne=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Pe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Oe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Le=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ue="((\\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])))",Ue=new RegExp(`^${ue}$`);function ce(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function De(r){return new RegExp(`^${ce(r)}$`)}function le(r){let e=`${ue}T${ce(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 Ee(r,e){return!!((e==="v4"||!e)&&Ae.test(r)||(e==="v6"||!e)&&Pe.test(r))}function Re(r,e){if(!Ce.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function je(r,e){return!!((e==="v4"||!e)&&Ne.test(r)||(e==="v6"||!e)&&Oe.test(r))}class I extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.ZodParsedType.string){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.string,received:a.parsedType}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="length"){const c=e.data.length>a.value,d=e.data.length<a.value;(c||d)&&(s=this._getOrReturnCtx(e,s),c?(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if(a.kind==="email")be.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"email",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="emoji")ne||(ne=new RegExp(we,"u")),ne.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"emoji",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="uuid")xe.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"uuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="nanoid")Te.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"nanoid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid")ve.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid2")Ze.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid2",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="ulid")Ie.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ulid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"regex",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.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),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):a.kind==="datetime"?le(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),t.dirty()):a.kind==="date"?Ue.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"date",message:a.message}),t.dirty()):a.kind==="time"?De(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"time",message:a.message}),t.dirty()):a.kind==="duration"?ke.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"duration",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="ip"?Ee(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ip",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="jwt"?Re(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"jwt",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="cidr"?je(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cidr",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64"?Se.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64url"?Le.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:o.ZodIssueCode.invalid_string,...h.errorUtil.errToObj(s)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errorUtil.errToObj(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?.precision>"u"?null:e?.precision,...h.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,h.errorUtil.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodString=I,I.create=r=>new I({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,...f(r)});function Ve(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,c=Number.parseInt(r.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return c%d/10**a}class N extends y{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)!==u.ZodParsedType.number){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.number,received:a.parsedType}),n.INVALID}let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="int"?u.util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.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)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Ve(e.data,a.value)!==0&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_finite,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new N({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.errorUtil.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"&&u.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}exports.ZodNumber=N,N.create=r=>new N({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,...f(r)});class P extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.ZodParsedType.bigint)return this._getInvalidInput(e);let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.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)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.bigint,received:t.parsedType}),n.INVALID}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.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}}exports.ZodBigInt=P,P.create=r=>new P({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,...f(r)});class V extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.boolean,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodBoolean=V,V.create=r=>new V({typeName:p.ZodBoolean,coerce:r?.coerce||!1,...f(r)});class L extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.ZodParsedType.date){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.date,received:a.parsedType}),n.INVALID}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_date}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.errorUtil.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}}exports.ZodDate=L,L.create=r=>new L({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,...f(r)});class Q extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.symbol,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodSymbol=Q,Q.create=r=>new Q({typeName:p.ZodSymbol,...f(r)});class F extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.undefined,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodUndefined=F,F.create=r=>new F({typeName:p.ZodUndefined,...f(r)});class M extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.null){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.null,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodNull=M,M.create=r=>new M({typeName:p.ZodNull,...f(r)});class D extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodAny=D,D.create=r=>new D({typeName:p.ZodAny,...f(r)});class S extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodUnknown=S,S.create=r=>new S({typeName:p.ZodUnknown,...f(r)});class k extends y{_parse(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.never,received:t.parsedType}),n.INVALID}}exports.ZodNever=k,k.create=r=>new k({typeName:p.ZodNever,...f(r)});class ee extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.void,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodVoid=ee,ee.create=r=>new ee({typeName:p.ZodVoid,...f(r)});class Z extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:t.parsedType}),n.INVALID;if(a.exactLength!==null){const d=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(d||i)&&((0,n.addIssueToContext)(t,{code:d?o.ZodIssueCode.too_big:o.ZodIssueCode.too_small,minimum:i?a.exactLength.value:void 0,maximum:d?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((d,i)=>a.type._parseAsync(new x(t,d,t.path,i)))).then(d=>n.ParseStatus.mergeArray(s,d));const c=[...t.data].map((d,i)=>a.type._parseSync(new x(t,d,t.path,i)));return n.ParseStatus.mergeArray(s,c)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:h.errorUtil.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:h.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}exports.ZodArray=Z,Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...f(e)});function E(r){if(r instanceof g){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=T.create(E(s))}return new g({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:E(r.element)}):r instanceof T?T.create(E(r.unwrap())):r instanceof A?A.create(E(r.unwrap())):r instanceof C?C.create(r.items.map(e=>E(e))):r}class g extends y{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=u.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.ZodParsedType.object){const l=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(l,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:l.parsedType}),n.INVALID}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof k&&this._def.unknownKeys==="strip"))for(const l in s.data)c.includes(l)||d.push(l);const i=[];for(const l of c){const m=a[l],_=s.data[l];i.push({key:{status:"valid",value:l},value:m._parse(new x(s,_,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof k){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of d)i.push({key:{status:"valid",value:m},value:{status:"valid",value:s.data[m]}});else if(l==="strict")d.length>0&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.unrecognized_keys,keys:d}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of d){const _=s.data[m];i.push({key:{status:"valid",value:m},value:l._parse(new x(s,_,s.path,m)),alwaysSet:m in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of i){const _=await m.key,b=await m.value;l.push({key:_,value:b,alwaysSet:m.alwaysSet})}return l}).then(l=>n.ParseStatus.mergeObjectSync(t,l)):n.ParseStatus.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return h.errorUtil.errToObj,new g({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errorUtil.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(e){return new g({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new g({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new g({...this._def,catchall:e})}pick(e){const t={};for(const s of u.util.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}omit(e){const t={};for(const s of u.util.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}deepPartial(){return E(this)}partial(e){const t={};for(const s of u.util.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new g({...this._def,shape:()=>t})}required(e){const t={};for(const s of u.util.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof T;)a=a._def.innerType;t[s]=a}return new g({...this._def,shape:()=>t})}keyof(){return he(u.util.objectKeys(this.shape))}}exports.ZodObject=g,g.create=(r,e)=>new g({shape:()=>r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.strictCreate=(r,e)=>new g({shape:()=>r,unknownKeys:"strict",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.lazycreate=(r,e)=>new g({shape:r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)});class z extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(c){for(const i of c)if(i.result.status==="valid")return i.result;for(const i of c)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;const d=c.map(i=>new o.ZodError(i.ctx.common.issues));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:d}),n.INVALID}if(t.common.async)return Promise.all(s.map(async c=>{const d={...t,common:{...t.common,issues:[]},parent:null};return{result:await c._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(a);{let c;const d=[];for(const l of s){const m={...t,common:{...t.common,issues:[]},parent:null},_=l._parseSync({data:t.data,path:t.path,parent:m});if(_.status==="valid")return _;_.status==="dirty"&&!c&&(c={result:_,ctx:m}),m.common.issues.length&&d.push(m.common.issues)}if(c)return t.common.issues.push(...c.ctx.common.issues),c.result;const i=d.map(l=>new o.ZodError(l));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:i}),n.INVALID}}get options(){return this._def.options}}exports.ZodUnion=z,z.create=(r,e)=>new z({options:r,typeName:p.ZodUnion,...f(e)});const w=r=>r instanceof K?w(r.schema):r instanceof v?w(r.innerType()):r instanceof B?[r.value]:r instanceof O?r.options:r instanceof W?u.util.objectValues(r.enum):r instanceof q?w(r._def.innerType):r instanceof F?[void 0]:r instanceof M?[null]:r instanceof T?[void 0,...w(r.unwrap())]:r instanceof A?[null,...w(r.unwrap())]:r instanceof de||r instanceof J?w(r.unwrap()):r instanceof Y?w(r._def.innerType):[];class ae extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:t.parsedType}),n.INVALID;const s=this.discriminator,a=t.data[s],c=this.optionsMap.get(a);return c?t.common.async?c._parseAsync({data:t.data,path:t.path,parent:t}):c._parseSync({data:t.data,path:t.path,parent:t}):((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),n.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const c of t){const d=w(c.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of d){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,c)}}return new ae({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...f(s)})}}exports.ZodDiscriminatedUnion=ae;function ie(r,e){const t=(0,u.getParsedType)(r),s=(0,u.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===u.ZodParsedType.object&&s===u.ZodParsedType.object){const a=u.util.objectKeys(e),c=u.util.objectKeys(r).filter(i=>a.indexOf(i)!==-1),d={...r,...e};for(const i of c){const l=ie(r[i],e[i]);if(!l.valid)return{valid:!1};d[i]=l.data}return{valid:!0,data:d}}else if(t===u.ZodParsedType.array&&s===u.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let c=0;c<r.length;c++){const d=r[c],i=e[c],l=ie(d,i);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===u.ZodParsedType.date&&s===u.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $ extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(c,d)=>{if((0,n.isAborted)(c)||(0,n.isAborted)(d))return n.INVALID;const i=ie(c.value,d.value);return i.valid?(((0,n.isDirty)(c)||(0,n.isDirty)(d))&&t.dirty(),{status:t.value,value:i.data}):((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_intersection_types}),n.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([c,d])=>a(c,d)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}exports.ZodIntersection=$,$.create=(r,e,t)=>new $({left:r,right:e,typeName:p.ZodIntersection,...f(t)});class C extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:s.parsedType}),n.INVALID;if(s.data.length<this._def.items.length)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((c,d)=>{const i=this._def.items[d]||this._def.rest;return i?i._parse(new x(s,c,s.path,d)):null}).filter(c=>!!c);return s.common.async?Promise.all(a).then(c=>n.ParseStatus.mergeArray(t,c)):n.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new C({...this._def,rest:e})}}exports.ZodTuple=C,C.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new C({items:r,typeName:p.ZodTuple,rest:null,...f(e)})};class H extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:s.parsedType}),n.INVALID;const a=[],c=this._def.keyType,d=this._def.valueType;for(const i in s.data)a.push({key:c._parse(new x(s,i,s.path,i)),value:d._parse(new x(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?n.ParseStatus.mergeObjectAsync(t,a):n.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new H({keyType:e,valueType:t,typeName:p.ZodRecord,...f(s)}):new H({keyType:I.create(),valueType:e,typeName:p.ZodRecord,...f(t)})}}exports.ZodRecord=H;class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.map)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.map,received:s.parsedType}),n.INVALID;const a=this._def.keyType,c=this._def.valueType,d=[...s.data.entries()].map(([i,l],m)=>({key:a._parse(new x(s,i,s.path,[m,"key"])),value:c._parse(new x(s,l,s.path,[m,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of d){const m=await l.key,_=await l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}})}else{const i=new Map;for(const l of d){const m=l.key,_=l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}}}}exports.ZodMap=te,te.create=(r,e,t)=>new te({valueType:e,keyType:r,typeName:p.ZodMap,...f(t)});class U extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.set)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.set,received:s.parsedType}),n.INVALID;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const c=this._def.valueType;function d(l){const m=new Set;for(const _ of l){if(_.status==="aborted")return n.INVALID;_.status==="dirty"&&t.dirty(),m.add(_.value)}return{status:t.value,value:m}}const i=[...s.data.values()].map((l,m)=>c._parse(new x(s,l,s.path,m)));return s.common.async?Promise.all(i).then(l=>d(l)):d(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:h.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}exports.ZodSet=U,U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,...f(e)});class j extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.function)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.function,received:t.parsedType}),n.INVALID;function s(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_arguments,argumentsError:l}})}function a(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_return_type,returnTypeError:l}})}const c={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof R){const i=this;return(0,n.OK)(async function(...l){const m=new o.ZodError([]),_=await i._def.args.parseAsync(l,c).catch(re=>{throw m.addIssue(s(l,re)),m}),b=await Reflect.apply(d,this,_);return await i._def.returns._def.type.parseAsync(b,c).catch(re=>{throw m.addIssue(a(b,re)),m})})}else{const i=this;return(0,n.OK)(function(...l){const m=i._def.args.safeParse(l,c);if(!m.success)throw new o.ZodError([s(l,m.error)]);const _=Reflect.apply(d,this,m.data),b=i._def.returns.safeParse(_,c);if(!b.success)throw new o.ZodError([a(_,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new j({...this._def,args:C.create(e).rest(S.create())})}returns(e){return new j({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new j({args:e||C.create([]).rest(S.create()),returns:t||S.create(),typeName:p.ZodFunction,...f(s)})}}exports.ZodFunction=j;class K extends y{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})}}exports.ZodLazy=K,K.create=(r,e)=>new K({getter:r,typeName:p.ZodLazy,...f(e)});class B extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_literal,expected:this._def.value}),n.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}exports.ZodLiteral=B,B.create=(r,e)=>new B({value:r,typeName:p.ZodLiteral,...f(e)});function he(r,e){return new O({values:r,typeName:p.ZodEnum,...f(e)})}class O extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{expected:u.util.joinValues(s),received:t.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_enum_value,options:s}),n.INVALID}return(0,n.OK)(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 O.create(e,{...this._def,...t})}exclude(e,t=this._def){return O.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}exports.ZodEnum=O,O.create=he;class W extends y{_parse(e){const t=u.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.ZodParsedType.string&&s.parsedType!==u.ZodParsedType.number){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{expected:u.util.joinValues(a),received:s.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(u.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{received:s.data,code:o.ZodIssueCode.invalid_enum_value,options:a}),n.INVALID}return(0,n.OK)(e.data)}get enum(){return this._def.values}}exports.ZodNativeEnum=W,W.create=(r,e)=>new W({values:r,typeName:p.ZodNativeEnum,...f(e)});class R extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.promise&&t.common.async===!1)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.promise,received:t.parsedType}),n.INVALID;const s=t.parsedType===u.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,n.OK)(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}exports.ZodPromise=R,R.create=(r,e)=>new R({type:r,typeName:p.ZodPromise,...f(e)});class v extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,c={addIssue:d=>{(0,n.addIssueToContext)(s,d),d.fatal?t.abort():t.dirty()},get path(){return s.path}};if(c.addIssue=c.addIssue.bind(c),a.type==="preprocess"){const d=a.transform(s.data,c);if(s.common.async)return Promise.resolve(d).then(async i=>{if(t.value==="aborted")return n.INVALID;const l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?n.INVALID:l.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(l.value):l});{if(t.value==="aborted")return n.INVALID;const i=this._def.schema._parseSync({data:d,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:i.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(i.value):i}}if(a.type==="refinement"){const d=i=>{const l=a.refinement(i,c);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,n.isValid)(d))return n.INVALID;const i=a.transform(d.value,c);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>(0,n.isValid)(d)?Promise.resolve(a.transform(d.value,c)).then(i=>({status:t.value,value:i})):n.INVALID);u.util.assertNever(a)}}exports.ZodEffects=v,exports.ZodTransformer=v,v.create=(r,e,t)=>new v({schema:r,typeName:p.ZodEffects,effect:e,...f(t)}),v.createWithPreprocess=(r,e,t)=>new v({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,...f(t)});class T extends y{_parse(e){return this._getType(e)===u.ZodParsedType.undefined?(0,n.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodOptional=T,T.create=(r,e)=>new T({innerType:r,typeName:p.ZodOptional,...f(e)});class A extends y{_parse(e){return this._getType(e)===u.ZodParsedType.null?(0,n.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodNullable=A,A.create=(r,e)=>new A({innerType:r,typeName:p.ZodNullable,...f(e)});class q extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}exports.ZodDefault=q,q.create=(r,e)=>new q({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...f(e)});class Y extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,n.isAsync)(a)?a.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}exports.ZodCatch=Y,Y.create=(r,e)=>new Y({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...f(e)});class se extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.nan){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.nan,received:t.parsedType}),n.INVALID}return{status:"valid",value:e.data}}}exports.ZodNaN=se,se.create=r=>new se({typeName:p.ZodNaN,...f(r)}),exports.BRAND=Symbol("zod_brand");class de extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}exports.ZodBranded=de;class G extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),(0,n.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new G({in:e,out:t,typeName:p.ZodPipeline})}}exports.ZodPipeline=G;class J extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>((0,n.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,n.isAsync)(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}exports.ZodReadonly=J,J.create=(r,e)=>new J({innerType:r,typeName:p.ZodReadonly,...f(e)});function pe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function me(r,e={},t){return r?D.create().superRefine((s,a)=>{const c=r(s);if(c instanceof Promise)return c.then(d=>{if(!d){const i=pe(e,s),l=i.fatal??t??!0;a.addIssue({code:"custom",...i,fatal:l})}});if(!c){const d=pe(e,s),i=d.fatal??t??!0;a.addIssue({code:"custom",...d,fatal:i})}}):D.create()}exports.late={object:g.lazycreate};var p;(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"})(p||(exports.ZodFirstPartyTypeKind=p={}));class Zt{constructor(...e){}}const Fe=(r,e={message:`Input not instance of ${r.name}`})=>me(t=>t instanceof r,e);exports.instanceof=Fe;const fe=I.create;exports.string=fe;const ye=N.create;exports.number=ye;const Me=se.create;exports.nan=Me;const ze=P.create;exports.bigint=ze;const _e=V.create;exports.boolean=_e;const $e=L.create;exports.date=$e;const Ke=Q.create;exports.symbol=Ke;const Be=F.create;exports.undefined=Be;const We=M.create;exports.null=We;const qe=D.create;exports.any=qe;const Ye=S.create;exports.unknown=Ye;const Je=k.create;exports.never=Je;const Ge=ee.create;exports.void=Ge;const He=Z.create;exports.array=He;const Xe=g.create;exports.object=Xe;const Qe=g.strictCreate;exports.strictObject=Qe;const et=z.create;exports.union=et;const tt=ae.create;exports.discriminatedUnion=tt;const st=$.create;exports.intersection=st;const at=C.create;exports.tuple=at;const rt=H.create;exports.record=rt;const nt=te.create;exports.map=nt;const it=U.create;exports.set=it;const dt=j.create;exports.function=dt;const ot=K.create;exports.lazy=ot;const ut=B.create;exports.literal=ut;const ct=O.create;exports.enum=ct;const lt=W.create;exports.nativeEnum=lt;const ht=R.create;exports.promise=ht;const ge=v.create;exports.effect=ge,exports.transformer=ge;const pt=T.create;exports.optional=pt;const mt=A.create;exports.nullable=mt;const ft=v.createWithPreprocess;exports.preprocess=ft;const yt=G.create;exports.pipeline=yt;const _t=()=>fe().optional();exports.ostring=_t;const gt=()=>ye().optional();exports.onumber=gt;const vt=()=>_e().optional();exports.oboolean=vt,exports.coerce={string:(r=>I.create({...r,coerce:!0})),number:(r=>N.create({...r,coerce:!0})),boolean:(r=>V.create({...r,coerce:!0})),bigint:(r=>P.create({...r,coerce:!0})),date:(r=>L.create({...r,coerce:!0}))},exports.NEVER=n.INVALID;
@@ -1 +1 @@
1
- import{ZodError as N,ZodIssueCode as d}from"./ZodError.js";import{defaultErrorMap as _e,getErrorMap as ye}from"./errors.js";import{errorUtil as l}from"./helpers/errorUtil.js";import{DIRTY as B,INVALID as m,OK as k,ParseStatus as w,addIssueToContext as c,isAborted as ge,isAsync as Y,isDirty as ve,isValid as z,makeIssue as xe}from"./helpers/parseUtil.js";import{util as v,ZodParsedType as f,getParsedType as I}from"./helpers/util.js";class T{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ke=(r,e)=>{if(z(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 N(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,i)=>{const{message:u}=r;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:u??t??i.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return I(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:I(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Y(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ke(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return z(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>z(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(Y(a)?a:Promise.resolve(a));return ke(s,n)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const o=e(a),i=()=>n.addIssue({code:d.custom,...s(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new C({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return R.create(this,this._def)}nullable(){return j.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return A.create(this)}promise(){return W.create(this,this._def)}or(e){return Q.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new C({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new Ce({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ie.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ne=/^c[^\s-]{8,}$/i,Ie=/^[0-9a-z]+$/,Ee=/^[0-9A-HJKMNP-TV-Z]{26}$/i,je=/^[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,Me=/^[a-z0-9_-]{21}$/i,Ve=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Le=/^[-+]?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)?)??$/,ze=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let de;const $e=/^(?:(?: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])$/,De=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ue=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Be=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,We=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,we="((\\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])))",Je=new RegExp(`^${we}$`);function be(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ye(r){return new RegExp(`^${be(r)}$`)}function qe(r){let e=`${we}T${be(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 He(r,e){return!!((e==="v4"||!e)&&$e.test(r)||(e==="v6"||!e)&&Ue.test(r))}function Ge(r,e){if(!Ve.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Qe(r,e){return!!((e==="v4"||!e)&&De.test(r)||(e==="v6"||!e)&&Be.test(r))}class Z extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:f.string,received:n.parsedType}),m}const s=new w;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(a=this._getOrReturnCtx(e,a),o?c(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&c(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")ze.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"email",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")de||(de=new RegExp(Pe,"u")),de.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"emoji",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")je.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"uuid",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Me.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"nanoid",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Ne.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid2",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ee.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ulid",code:d.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),c(a,{validation:"url",code:d.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"regex",code:d.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?qe(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Je.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ye(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:d.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Le.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"duration",code:d.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?He(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ip",code:d.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Ge(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"jwt",code:d.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Qe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cidr",code:d.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Fe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64",code:d.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?We.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64url",code:d.invalid_string,message:n.message}),s.dirty()):v.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:d.invalid_string,...l.errToObj(s)})}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...l.errToObj(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?.precision>"u"?null:e?.precision,...l.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...l.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new Z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Z.create=r=>new Z({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,..._(r)});function Xe(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return n%o/10**a}class M extends y{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 n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:f.number,received:n.parsedType}),m}let s;const a=new w;for(const n of this._def.checks)n.kind==="int"?v.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Xe(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_finite,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.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"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}M.create=r=>new M({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,..._(r)});class V extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s;const a=new w;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:f.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.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}}V.create=r=>new V({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,..._(r)});class q extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.boolean,received:s.parsedType}),m}return k(e.data)}}q.create=r=>new q({typeName:p.ZodBoolean,coerce:r?.coerce||!1,..._(r)});class D extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:f.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_date}),m}const s=new w;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):v.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.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}}D.create=r=>new D({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,..._(r)});class ce extends y{_parse(e){if(this._getType(e)!==f.symbol){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.symbol,received:s.parsedType}),m}return k(e.data)}}ce.create=r=>new ce({typeName:p.ZodSymbol,..._(r)});class H extends y{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.undefined,received:s.parsedType}),m}return k(e.data)}}H.create=r=>new H({typeName:p.ZodUndefined,..._(r)});class G extends y{_parse(e){if(this._getType(e)!==f.null){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.null,received:s.parsedType}),m}return k(e.data)}}G.create=r=>new G({typeName:p.ZodNull,..._(r)});class F extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}}F.create=r=>new F({typeName:p.ZodAny,..._(r)});class P extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}}P.create=r=>new P({typeName:p.ZodUnknown,..._(r)});class E extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),m}}E.create=r=>new E({typeName:p.ZodNever,..._(r)});class ue extends y{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.void,received:s.parsedType}),m}return k(e.data)}}ue.create=r=>new ue({typeName:p.ZodVoid,..._(r)});class A extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==f.array)return c(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),m;if(a.exactLength!==null){const o=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(o||i)&&(c(t,{code:o?d.too_big:d.too_small,minimum:i?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(c(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(c(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>a.type._parseAsync(new T(t,o,t.path,i)))).then(o=>w.mergeArray(s,o));const n=[...t.data].map((o,i)=>a.type._parseSync(new T(t,o,t.path,i)));return w.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new A({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new A({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new A({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}A.create=(r,e)=>new A({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function $(r){if(r instanceof x){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=R.create($(s))}return new x({...r._def,shape:()=>e})}else return r instanceof A?new A({...r._def,type:$(r.element)}):r instanceof R?R.create($(r.unwrap())):r instanceof j?j.create($(r.unwrap())):r instanceof O?O.create(r.items.map(e=>$(e))):r}class x extends y{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=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){const h=this._getOrReturnCtx(e);return c(h,{code:d.invalid_type,expected:f.object,received:h.parsedType}),m}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(const h in a.data)o.includes(h)||i.push(h);const u=[];for(const h of o){const g=n[h],b=a.data[h];u.push({key:{status:"valid",value:h},value:g._parse(new T(a,b,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof E){const h=this._def.unknownKeys;if(h==="passthrough")for(const g of i)u.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(h==="strict")i.length>0&&(c(a,{code:d.unrecognized_keys,keys:i}),s.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const g of i){const b=a.data[g];u.push({key:{status:"valid",value:g},value:h._parse(new T(a,b,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const g of u){const b=await g.key,me=await g.value;h.push({key:b,value:me,alwaysSet:g.alwaysSet})}return h}).then(h=>w.mergeObjectSync(s,h)):w.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const s of v.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const s of v.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}deepPartial(){return $(this)}partial(e){const t={};for(const s of v.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const s of v.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof R;)n=n._def.innerType;t[s]=n}return new x({...this._def,shape:()=>t})}keyof(){return Te(v.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:p.ZodObject,..._(e)}),x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:p.ZodObject,..._(e)}),x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:p.ZodObject,..._(e)});class Q extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(const i of n)if(i.result.status==="valid")return i.result;for(const i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;const o=n.map(i=>new N(i.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async n=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(a);{let n;const o=[];for(const u of s){const h={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:h});if(g.status==="valid")return g;g.status==="dirty"&&!n&&(n={result:g,ctx:h}),h.common.issues.length&&o.push(h.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const i=o.map(u=>new N(u));return c(t,{code:d.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}}Q.create=(r,e)=>new Q({options:r,typeName:p.ZodUnion,..._(e)});const S=r=>r instanceof K?S(r.schema):r instanceof C?S(r.innerType()):r instanceof ee?[r.value]:r instanceof L?r.options:r instanceof te?v.objectValues(r.enum):r instanceof se?S(r._def.innerType):r instanceof H?[void 0]:r instanceof G?[null]:r instanceof R?[void 0,...S(r.unwrap())]:r instanceof j?[null,...S(r.unwrap())]:r instanceof Ce||r instanceof ae?S(r.unwrap()):r instanceof re?S(r._def.innerType):[];class pe extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return c(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),m;const s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const n of t){const o=S(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new pe({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,..._(s)})}}function le(r,e){const t=I(r),s=I(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){const a=v.objectKeys(e),n=v.objectKeys(r).filter(i=>a.indexOf(i)!==-1),o={...r,...e};for(const i of n){const u=le(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<r.length;n++){const o=r[n],i=e[n],u=le(o,i);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class X extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(n,o)=>{if(ge(n)||ge(o))return m;const i=le(n.value,o.value);return i.valid?((ve(n)||ve(o))&&t.dirty(),{status:t.value,value:i.data}):(c(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>a(n,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}X.create=(r,e,t)=>new X({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class O extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return c(s,{code:d.invalid_type,expected:f.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return c(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((o,i)=>{const u=this._def.items[i]||this._def.rest;return u?u._parse(new T(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>w.mergeArray(t,o)):w.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new O({...this._def,rest:e})}}O.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:r,typeName:p.ZodTuple,rest:null,..._(e)})};class ne extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return c(s,{code:d.invalid_type,expected:f.object,received:s.parsedType}),m;const a=[],n=this._def.keyType,o=this._def.valueType;for(const i in s.data)a.push({key:n._parse(new T(s,i,s.path,i)),value:o._parse(new T(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?w.mergeObjectAsync(t,a):w.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new ne({keyType:e,valueType:t,typeName:p.ZodRecord,..._(s)}):new ne({keyType:Z.create(),valueType:e,typeName:p.ZodRecord,..._(t)})}}class he extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return c(s,{code:d.invalid_type,expected:f.map,received:s.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,u],h)=>({key:a._parse(new T(s,i,s.path,[h,"key"])),value:n._parse(new T(s,u,s.path,[h,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const u of o){const h=await u.key,g=await u.value;if(h.status==="aborted"||g.status==="aborted")return m;(h.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(h.value,g.value)}return{status:t.value,value:i}})}else{const i=new Map;for(const u of o){const h=u.key,g=u.value;if(h.status==="aborted"||g.status==="aborted")return m;(h.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(h.value,g.value)}return{status:t.value,value:i}}}}he.create=(r,e,t)=>new he({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class U extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return c(s,{code:d.invalid_type,expected:f.set,received:s.parsedType}),m;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(c(s,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(c(s,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function o(u){const h=new Set;for(const g of u){if(g.status==="aborted")return m;g.status==="dirty"&&t.dirty(),h.add(g.value)}return{status:t.value,value:h}}const i=[...s.data.values()].map((u,h)=>n._parse(new T(s,u,s.path,h)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class J extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return c(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),m;function s(i,u){return xe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),_e].filter(h=>!!h),issueData:{code:d.invalid_arguments,argumentsError:u}})}function a(i,u){return xe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),_e].filter(h=>!!h),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof W){const i=this;return k(async function(...u){const h=new N([]),g=await i._def.args.parseAsync(u,n).catch(oe=>{throw h.addIssue(s(u,oe)),h}),b=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(b,n).catch(oe=>{throw h.addIssue(a(b,oe)),h})})}else{const i=this;return k(function(...u){const h=i._def.args.safeParse(u,n);if(!h.success)throw new N([s(u,h.error)]);const g=Reflect.apply(o,this,h.data),b=i._def.returns.safeParse(g,n);if(!b.success)throw new N([a(g,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:O.create(e).rest(P.create())})}returns(e){return new J({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new J({args:e||O.create([]).rest(P.create()),returns:t||P.create(),typeName:p.ZodFunction,..._(s)})}}class K extends y{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})}}K.create=(r,e)=>new K({getter:r,typeName:p.ZodLazy,..._(e)});class ee extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}ee.create=(r,e)=>new ee({value:r,typeName:p.ZodLiteral,..._(e)});function Te(r,e){return new L({values:r,typeName:p.ZodEnum,..._(e)})}class L extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{expected:v.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return k(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 L.create(e,{...this._def,...t})}exclude(e,t=this._def){return L.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}L.create=Te;class te extends y{_parse(e){const t=v.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){const a=v.objectValues(t);return c(s,{expected:v.joinValues(a),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=v.objectValues(t);return c(s,{received:s.data,code:d.invalid_enum_value,options:a}),m}return k(e.data)}get enum(){return this._def.values}}te.create=(r,e)=>new te({values:r,typeName:p.ZodNativeEnum,..._(e)});class W extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),m;const s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return k(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}W.create=(r,e)=>new W({type:r,typeName:p.ZodPromise,..._(e)});class C extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:o=>{c(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const o=a.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return m;const u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?B(u.value):t.value==="dirty"?B(u.value):u});{if(t.value==="aborted")return m;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?B(i.value):t.value==="dirty"?B(i.value):i}}if(a.type==="refinement"){const o=i=>{const u=a.refinement(i,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!z(o))return m;const i=a.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>z(o)?Promise.resolve(a.transform(o.value,n)).then(i=>({status:t.value,value:i})):m);v.assertNever(a)}}C.create=(r,e,t)=>new C({schema:r,typeName:p.ZodEffects,effect:e,..._(t)}),C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class R extends y{_parse(e){return this._getType(e)===f.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}R.create=(r,e)=>new R({innerType:r,typeName:p.ZodOptional,..._(e)});class j extends y{_parse(e){return this._getType(e)===f.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(r,e)=>new j({innerType:r,typeName:p.ZodNullable,..._(e)});class se extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}se.create=(r,e)=>new se({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class re extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Y(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}re.create=(r,e)=>new re({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class fe extends y{_parse(e){if(this._getType(e)!==f.nan){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:f.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}}fe.create=r=>new fe({typeName:p.ZodNaN,..._(r)});const Pt=Symbol("zod_brand");class Ce extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ie extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),B(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new ie({in:e,out:t,typeName:p.ZodPipeline})}}class ae extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>(z(a)&&(a.value=Object.freeze(a.value)),a);return Y(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}ae.create=(r,e)=>new ae({innerType:r,typeName:p.ZodReadonly,..._(e)});function Ae(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Ke(r,e={},t){return r?F.create().superRefine((s,a)=>{const n=r(s);if(n instanceof Promise)return n.then(o=>{if(!o){const i=Ae(e,s),u=i.fatal??t??!0;a.addIssue({code:"custom",...i,fatal:u})}});if(!n){const o=Ae(e,s),i=o.fatal??t??!0;a.addIssue({code:"custom",...o,fatal:i})}}):F.create()}const $t={object:x.lazycreate};var p;(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"})(p||(p={}));class Dt{constructor(...e){}}const et=(r,e={message:`Input not instance of ${r.name}`})=>Ke(t=>t instanceof r,e),Ze=Z.create,Se=M.create,tt=fe.create,st=V.create,Re=q.create,rt=D.create,at=ce.create,nt=H.create,it=G.create,ot=F.create,dt=P.create,ct=E.create,ut=ue.create,lt=A.create,ht=x.create,ft=x.strictCreate,pt=Q.create,mt=pe.create,_t=X.create,yt=O.create,gt=ne.create,vt=he.create,xt=U.create,kt=J.create,wt=K.create,bt=ee.create,Tt=L.create,Ct=te.create,At=W.create,Oe=C.create,Zt=R.create,St=j.create,Rt=C.createWithPreprocess,Ot=ie.create,Nt=()=>Ze().optional(),It=()=>Se().optional(),Et=()=>Re().optional(),Ut={string:(r=>Z.create({...r,coerce:!0})),number:(r=>M.create({...r,coerce:!0})),boolean:(r=>q.create({...r,coerce:!0})),bigint:(r=>V.create({...r,coerce:!0})),date:(r=>D.create({...r,coerce:!0}))},Bt=m;export{Pt as BRAND,Bt as NEVER,y as Schema,F as ZodAny,A as ZodArray,V as ZodBigInt,q as ZodBoolean,Ce as ZodBranded,re as ZodCatch,D as ZodDate,se as ZodDefault,pe as ZodDiscriminatedUnion,C as ZodEffects,L as ZodEnum,p as ZodFirstPartyTypeKind,J as ZodFunction,X as ZodIntersection,K as ZodLazy,ee as ZodLiteral,he as ZodMap,fe as ZodNaN,te as ZodNativeEnum,E as ZodNever,G as ZodNull,j as ZodNullable,M as ZodNumber,x as ZodObject,R as ZodOptional,ie as ZodPipeline,W as ZodPromise,ae as ZodReadonly,ne as ZodRecord,y as ZodSchema,U as ZodSet,Z as ZodString,ce as ZodSymbol,C as ZodTransformer,O as ZodTuple,y as ZodType,H as ZodUndefined,Q as ZodUnion,P as ZodUnknown,ue as ZodVoid,ot as any,lt as array,st as bigint,Re as boolean,Ut as coerce,Ke as custom,rt as date,qe as datetimeRegex,mt as discriminatedUnion,Oe as effect,Tt as enum,kt as function,et as instanceof,_t as intersection,$t as late,wt as lazy,bt as literal,vt as map,tt as nan,Ct as nativeEnum,ct as never,it as null,St as nullable,Se as number,ht as object,Et as oboolean,It as onumber,Zt as optional,Nt as ostring,Ot as pipeline,Rt as preprocess,At as promise,gt as record,xt as set,ft as strictObject,Ze as string,at as symbol,Oe as transformer,yt as tuple,nt as undefined,pt as union,dt as unknown,ut as void};
1
+ import{ZodError as R,ZodIssueCode as o}from"./ZodError.js";import{defaultErrorMap as _e,getErrorMap as ye}from"./errors.js";import{errorUtil as l}from"./helpers/errorUtil.js";import{DIRTY as W,INVALID as f,OK as x,ParseStatus as w,addIssueToContext as c,isAborted as ge,isAsync as ie,isDirty as ve,isValid as D,makeIssue as ke}from"./helpers/parseUtil.js";import{util as k,ZodParsedType as h,getParsedType as j}from"./helpers/util.js";class C{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const xe=(n,e)=>{if(D(e))return{success:!0,data:e.value};if(!n.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 R(n.common.issues);return this._error=t,this._error}}};function _(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(d,i)=>{const{message:r}=n;return d.code==="invalid_enum_value"?{message:r??i.defaultError}:typeof i.data>"u"?{message:r??s??i.defaultError}:d.code!=="invalid_type"?{message:i.defaultError}:{message:r??t??i.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ie(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},a=this._parseSync({data:e,path:s.path,parent:s});return xe(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return D(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>D(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},a=this._parse({data:e,path:s.path,parent:s}),d=await(ie(a)?a:Promise.resolve(a));return xe(s,d)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,d)=>{const i=e(a),r=()=>d.addIssue({code:o.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(r(),!1)):i?!0:(r(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new b({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return I.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return K.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return G.create(this,e,this._def)}transform(e){return new b({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new te({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new fe({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ne.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const je=/^c[^\s-]{8,}$/i,Pe=/^[0-9a-z]+$/,Ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ee=/^[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,Fe=/^[a-z0-9_-]{21}$/i,Me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Le=/^[-+]?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)?)??$/,$e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ze="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pe;const De=/^(?:(?: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])$/,Ue=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ve=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ke=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Be=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,We=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,we="((\\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])))",Ye=new RegExp(`^${we}$`);function be(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function qe(n){return new RegExp(`^${be(n)}$`)}function Ze(n){let e=`${we}T${be(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function He(n,e){return!!((e==="v4"||!e)&&De.test(n)||(e==="v6"||!e)&&Ve.test(n))}function Je(n,e){if(!Me.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Ge(n,e){return!!((e==="v4"||!e)&&Ue.test(n)||(e==="v6"||!e)&&Ke.test(n))}class T extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const a=this._getOrReturnCtx(e);return c(a,{code:o.invalid_type,expected:h.string,received:a.parsedType}),f}const t=new w;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:o.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:o.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="length"){const d=e.data.length>a.value,i=e.data.length<a.value;(d||i)&&(s=this._getOrReturnCtx(e,s),d?c(s,{code:o.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&c(s,{code:o.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if(a.kind==="email")$e.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"email",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="emoji")pe||(pe=new RegExp(ze,"u")),pe.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"emoji",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="uuid")Ee.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"uuid",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="nanoid")Fe.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"nanoid",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid")je.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cuid",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid2")Pe.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cuid2",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="ulid")Ie.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"ulid",code:o.invalid_string,message:a.message}),t.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),c(s,{validation:"url",code:o.invalid_string,message:a.message}),t.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"regex",code:o.invalid_string,message:a.message}),t.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),c(s,{code:o.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.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),c(s,{code:o.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),c(s,{code:o.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):a.kind==="datetime"?Ze(a).test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:o.invalid_string,validation:"datetime",message:a.message}),t.dirty()):a.kind==="date"?Ye.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:o.invalid_string,validation:"date",message:a.message}),t.dirty()):a.kind==="time"?qe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:o.invalid_string,validation:"time",message:a.message}),t.dirty()):a.kind==="duration"?Le.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"duration",code:o.invalid_string,message:a.message}),t.dirty()):a.kind==="ip"?He(e.data,a.version)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"ip",code:o.invalid_string,message:a.message}),t.dirty()):a.kind==="jwt"?Je(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"jwt",code:o.invalid_string,message:a.message}),t.dirty()):a.kind==="cidr"?Ge(e.data,a.version)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"cidr",code:o.invalid_string,message:a.message}),t.dirty()):a.kind==="base64"?Be.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"base64",code:o.invalid_string,message:a.message}),t.dirty()):a.kind==="base64url"?We.test(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{validation:"base64url",code:o.invalid_string,message:a.message}),t.dirty()):k.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:o.invalid_string,...l.errToObj(s)})}_addCheck(e){return new T({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...l.errToObj(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?.precision>"u"?null:e?.precision,...l.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...l.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new T({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new T({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new T({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}T.create=n=>new T({checks:[],typeName:p.ZodString,coerce:n?.coerce??!1,..._(n)});function Xe(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,d=Number.parseInt(n.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return d%i/10**a}class E extends y{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)!==h.number){const a=this._getOrReturnCtx(e);return c(a,{code:o.invalid_type,expected:h.number,received:a.parsedType}),f}let t;const s=new w;for(const a of this._def.checks)a.kind==="int"?k.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),c(t,{code:o.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.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)&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Xe(e.data,a.value)!==0&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),c(t,{code:o.not_finite,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new E({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.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"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}E.create=n=>new E({checks:[],typeName:p.ZodNumber,coerce:n?.coerce||!1,..._(n)});class F extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let t;const s=new w;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.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)&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),c(t,{code:o.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.bigint,received:t.parsedType}),f}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.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}}F.create=n=>new F({checks:[],typeName:p.ZodBigInt,coerce:n?.coerce??!1,..._(n)});class Y extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.boolean,received:t.parsedType}),f}return x(e.data)}}Y.create=n=>new Y({typeName:p.ZodBoolean,coerce:n?.coerce||!1,..._(n)});class $ extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const a=this._getOrReturnCtx(e);return c(a,{code:o.invalid_type,expected:h.date,received:a.parsedType}),f}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return c(a,{code:o.invalid_date}),f}const t=new w;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:o.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),c(s,{code:o.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):k.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.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}}$.create=n=>new $({checks:[],coerce:n?.coerce||!1,typeName:p.ZodDate,..._(n)});class de extends y{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.symbol,received:t.parsedType}),f}return x(e.data)}}de.create=n=>new de({typeName:p.ZodSymbol,..._(n)});class q extends y{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.undefined,received:t.parsedType}),f}return x(e.data)}}q.create=n=>new q({typeName:p.ZodUndefined,..._(n)});class H extends y{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.null,received:t.parsedType}),f}return x(e.data)}}H.create=n=>new H({typeName:p.ZodNull,..._(n)});class U extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}}U.create=n=>new U({typeName:p.ZodAny,..._(n)});class L extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}L.create=n=>new L({typeName:p.ZodUnknown,..._(n)});class N extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.never,received:t.parsedType}),f}}N.create=n=>new N({typeName:p.ZodNever,..._(n)});class oe extends y{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.void,received:t.parsedType}),f}return x(e.data)}}oe.create=n=>new oe({typeName:p.ZodVoid,..._(n)});class Z extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==h.array)return c(t,{code:o.invalid_type,expected:h.array,received:t.parsedType}),f;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(i||r)&&(c(t,{code:i?o.too_big:o.too_small,minimum:r?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(c(t,{code:o.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(c(t,{code:o.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,r)=>a.type._parseAsync(new C(t,i,t.path,r)))).then(i=>w.mergeArray(s,i));const d=[...t.data].map((i,r)=>a.type._parseSync(new C(t,i,t.path,r)));return w.mergeArray(s,d)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}Z.create=(n,e)=>new Z({type:n,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function V(n){if(n instanceof v){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=O.create(V(s))}return new v({...n._def,shape:()=>e})}else return n instanceof Z?new Z({...n._def,type:V(n.element)}):n instanceof O?O.create(V(n.unwrap())):n instanceof I?I.create(V(n.unwrap())):n instanceof A?A.create(n.items.map(e=>V(e))):n}class v extends y{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=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const u=this._getOrReturnCtx(e);return c(u,{code:o.invalid_type,expected:h.object,received:u.parsedType}),f}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:d}=this._getCached(),i=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(const u in s.data)d.includes(u)||i.push(u);const r=[];for(const u of d){const m=a[u],g=s.data[u];r.push({key:{status:"valid",value:u},value:m._parse(new C(s,g,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof N){const u=this._def.unknownKeys;if(u==="passthrough")for(const m of i)r.push({key:{status:"valid",value:m},value:{status:"valid",value:s.data[m]}});else if(u==="strict")i.length>0&&(c(s,{code:o.unrecognized_keys,keys:i}),t.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const m of i){const g=s.data[m];r.push({key:{status:"valid",value:m},value:u._parse(new C(s,g,s.path,m)),alwaysSet:m in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const m of r){const g=await m.key,S=await m.value;u.push({key:g,value:S,alwaysSet:m.alwaysSet})}return u}).then(u=>w.mergeObjectSync(t,u)):w.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new v({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new v({...this._def,unknownKeys:"strip"})}passthrough(){return new v({...this._def,unknownKeys:"passthrough"})}extend(e){return new v({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new v({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new v({...this._def,catchall:e})}pick(e){const t={};for(const s of k.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new v({...this._def,shape:()=>t})}omit(e){const t={};for(const s of k.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new v({...this._def,shape:()=>t})}deepPartial(){return V(this)}partial(e){const t={};for(const s of k.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new v({...this._def,shape:()=>t})}required(e){const t={};for(const s of k.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof O;)a=a._def.innerType;t[s]=a}return new v({...this._def,shape:()=>t})}keyof(){return Te(k.objectKeys(this.shape))}}v.create=(n,e)=>new v({shape:()=>n,unknownKeys:"strip",catchall:N.create(),typeName:p.ZodObject,..._(e)}),v.strictCreate=(n,e)=>new v({shape:()=>n,unknownKeys:"strict",catchall:N.create(),typeName:p.ZodObject,..._(e)}),v.lazycreate=(n,e)=>new v({shape:n,unknownKeys:"strip",catchall:N.create(),typeName:p.ZodObject,..._(e)});class J extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(d){for(const r of d)if(r.result.status==="valid")return r.result;for(const r of d)if(r.result.status==="dirty")return t.common.issues.push(...r.ctx.common.issues),r.result;const i=d.map(r=>new R(r.ctx.common.issues));return c(t,{code:o.invalid_union,unionErrors:i}),f}if(t.common.async)return Promise.all(s.map(async d=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await d._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let d;const i=[];for(const u of s){const m={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!d&&(d={result:g,ctx:m}),m.common.issues.length&&i.push(m.common.issues)}if(d)return t.common.issues.push(...d.ctx.common.issues),d.result;const r=i.map(u=>new R(u));return c(t,{code:o.invalid_union,unionErrors:r}),f}}get options(){return this._def.options}}J.create=(n,e)=>new J({options:n,typeName:p.ZodUnion,..._(e)});const P=n=>n instanceof X?P(n.schema):n instanceof b?P(n.innerType()):n instanceof Q?[n.value]:n instanceof M?n.options:n instanceof ee?k.objectValues(n.enum):n instanceof te?P(n._def.innerType):n instanceof q?[void 0]:n instanceof H?[null]:n instanceof O?[void 0,...P(n.unwrap())]:n instanceof I?[null,...P(n.unwrap())]:n instanceof fe||n instanceof ae?P(n.unwrap()):n instanceof se?P(n._def.innerType):[];class le extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return c(t,{code:o.invalid_type,expected:h.object,received:t.parsedType}),f;const s=this.discriminator,a=t.data[s],d=this.optionsMap.get(a);return d?t.common.async?d._parseAsync({data:t.data,path:t.path,parent:t}):d._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const d of t){const i=P(d.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of i){if(a.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);a.set(r,d)}}return new le({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,..._(s)})}}function me(n,e){const t=j(n),s=j(e);if(n===e)return{valid:!0,data:n};if(t===h.object&&s===h.object){const a=k.objectKeys(e),d=k.objectKeys(n).filter(r=>a.indexOf(r)!==-1),i={...n,...e};for(const r of d){const u=me(n[r],e[r]);if(!u.valid)return{valid:!1};i[r]=u.data}return{valid:!0,data:i}}else if(t===h.array&&s===h.array){if(n.length!==e.length)return{valid:!1};const a=[];for(let d=0;d<n.length;d++){const i=n[d],r=e[d],u=me(i,r);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return t===h.date&&s===h.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class G extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(d,i)=>{if(ge(d)||ge(i))return f;const r=me(d.value,i.value);return r.valid?((ve(d)||ve(i))&&t.dirty(),{status:t.value,value:r.data}):(c(s,{code:o.invalid_intersection_types}),f)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([d,i])=>a(d,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}G.create=(n,e,t)=>new G({left:n,right:e,typeName:p.ZodIntersection,..._(t)});class A extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return c(s,{code:o.invalid_type,expected:h.array,received:s.parsedType}),f;if(s.data.length<this._def.items.length)return c(s,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((d,i)=>{const r=this._def.items[i]||this._def.rest;return r?r._parse(new C(s,d,s.path,i)):null}).filter(d=>!!d);return s.common.async?Promise.all(a).then(d=>w.mergeArray(t,d)):w.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new A({...this._def,rest:e})}}A.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new A({items:n,typeName:p.ZodTuple,rest:null,..._(e)})};class re extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return c(s,{code:o.invalid_type,expected:h.object,received:s.parsedType}),f;const a=[],d=this._def.keyType,i=this._def.valueType;for(const r in s.data)a.push({key:d._parse(new C(s,r,s.path,r)),value:i._parse(new C(s,s.data[r],s.path,r)),alwaysSet:r in s.data});return s.common.async?w.mergeObjectAsync(t,a):w.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new re({keyType:e,valueType:t,typeName:p.ZodRecord,..._(s)}):new re({keyType:T.create(),valueType:e,typeName:p.ZodRecord,..._(t)})}}class ce extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return c(s,{code:o.invalid_type,expected:h.map,received:s.parsedType}),f;const a=this._def.keyType,d=this._def.valueType,i=[...s.data.entries()].map(([r,u],m)=>({key:a._parse(new C(s,r,s.path,[m,"key"])),value:d._parse(new C(s,u,s.path,[m,"value"]))}));if(s.common.async){const r=new Map;return Promise.resolve().then(async()=>{for(const u of i){const m=await u.key,g=await u.value;if(m.status==="aborted"||g.status==="aborted")return f;(m.status==="dirty"||g.status==="dirty")&&t.dirty(),r.set(m.value,g.value)}return{status:t.value,value:r}})}else{const r=new Map;for(const u of i){const m=u.key,g=u.value;if(m.status==="aborted"||g.status==="aborted")return f;(m.status==="dirty"||g.status==="dirty")&&t.dirty(),r.set(m.value,g.value)}return{status:t.value,value:r}}}}ce.create=(n,e,t)=>new ce({valueType:e,keyType:n,typeName:p.ZodMap,..._(t)});class z extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return c(s,{code:o.invalid_type,expected:h.set,received:s.parsedType}),f;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(c(s,{code:o.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(c(s,{code:o.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const d=this._def.valueType;function i(u){const m=new Set;for(const g of u){if(g.status==="aborted")return f;g.status==="dirty"&&t.dirty(),m.add(g.value)}return{status:t.value,value:m}}const r=[...s.data.values()].map((u,m)=>d._parse(new C(s,u,s.path,m)));return s.common.async?Promise.all(r).then(u=>i(u)):i(r)}min(e,t){return new z({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new z({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}z.create=(n,e)=>new z({valueType:n,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class B extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return c(t,{code:o.invalid_type,expected:h.function,received:t.parsedType}),f;function s(r,u){return ke({data:r,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),_e].filter(m=>!!m),issueData:{code:o.invalid_arguments,argumentsError:u}})}function a(r,u){return ke({data:r,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),_e].filter(m=>!!m),issueData:{code:o.invalid_return_type,returnTypeError:u}})}const d={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof K){const r=this;return x(async function(...u){const m=new R([]),g=await r._def.args.parseAsync(u,d).catch(he=>{throw m.addIssue(s(u,he)),m}),S=await Reflect.apply(i,this,g);return await r._def.returns._def.type.parseAsync(S,d).catch(he=>{throw m.addIssue(a(S,he)),m})})}else{const r=this;return x(function(...u){const m=r._def.args.safeParse(u,d);if(!m.success)throw new R([s(u,m.error)]);const g=Reflect.apply(i,this,m.data),S=r._def.returns.safeParse(g,d);if(!S.success)throw new R([a(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new B({...this._def,args:A.create(e).rest(L.create())})}returns(e){return new B({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new B({args:e||A.create([]).rest(L.create()),returns:t||L.create(),typeName:p.ZodFunction,..._(s)})}}class X extends y{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})}}X.create=(n,e)=>new X({getter:n,typeName:p.ZodLazy,..._(e)});class Q extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}}Q.create=(n,e)=>new Q({value:n,typeName:p.ZodLiteral,..._(e)});function Te(n,e){return new M({values:n,typeName:p.ZodEnum,..._(e)})}class M extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{expected:k.joinValues(s),received:t.parsedType,code:o.invalid_type}),f}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{received:t.data,code:o.invalid_enum_value,options:s}),f}return x(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 M.create(e,{...this._def,...t})}exclude(e,t=this._def){return M.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}M.create=Te;class ee extends y{_parse(e){const t=k.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const a=k.objectValues(t);return c(s,{expected:k.joinValues(a),received:s.parsedType,code:o.invalid_type}),f}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=k.objectValues(t);return c(s,{received:s.data,code:o.invalid_enum_value,options:a}),f}return x(e.data)}get enum(){return this._def.values}}ee.create=(n,e)=>new ee({values:n,typeName:p.ZodNativeEnum,..._(e)});class K extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return c(t,{code:o.invalid_type,expected:h.promise,received:t.parsedType}),f;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}K.create=(n,e)=>new K({type:n,typeName:p.ZodPromise,..._(e)});class b extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,d={addIssue:i=>{c(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(d.addIssue=d.addIssue.bind(d),a.type==="preprocess"){const i=a.transform(s.data,d);if(s.common.async)return Promise.resolve(i).then(async r=>{if(t.value==="aborted")return f;const u=await this._def.schema._parseAsync({data:r,path:s.path,parent:s});return u.status==="aborted"?f:u.status==="dirty"?W(u.value):t.value==="dirty"?W(u.value):u});{if(t.value==="aborted")return f;const r=this._def.schema._parseSync({data:i,path:s.path,parent:s});return r.status==="aborted"?f:r.status==="dirty"?W(r.value):t.value==="dirty"?W(r.value):r}}if(a.type==="refinement"){const i=r=>{const u=a.refinement(r,d);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(s.common.async===!1){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?f:(r.status==="dirty"&&t.dirty(),i(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(r=>r.status==="aborted"?f:(r.status==="dirty"&&t.dirty(),i(r.value).then(()=>({status:t.value,value:r.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!D(i))return f;const r=a.transform(i.value,d);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>D(i)?Promise.resolve(a.transform(i.value,d)).then(r=>({status:t.value,value:r})):f);k.assertNever(a)}}b.create=(n,e,t)=>new b({schema:n,typeName:p.ZodEffects,effect:e,..._(t)}),b.createWithPreprocess=(n,e,t)=>new b({schema:e,effect:{type:"preprocess",transform:n},typeName:p.ZodEffects,..._(t)});class O extends y{_parse(e){return this._getType(e)===h.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}O.create=(n,e)=>new O({innerType:n,typeName:p.ZodOptional,..._(e)});class I extends y{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}I.create=(n,e)=>new I({innerType:n,typeName:p.ZodNullable,..._(e)});class te extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}te.create=(n,e)=>new te({innerType:n,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class se extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ie(a)?a.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new R(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new R(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}se.create=(n,e)=>new se({innerType:n,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class ue extends y{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:h.nan,received:t.parsedType}),f}return{status:"valid",value:e.data}}}ue.create=n=>new ue({typeName:p.ZodNaN,..._(n)});const Qe=Symbol("zod_brand");class fe extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ne extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?f:a.status==="dirty"?(t.dirty(),W(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?f:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new ne({in:e,out:t,typeName:p.ZodPipeline})}}class ae extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>(D(a)&&(a.value=Object.freeze(a.value)),a);return ie(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}ae.create=(n,e)=>new ae({innerType:n,typeName:p.ZodReadonly,..._(e)});function Ce(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Oe(n,e={},t){return n?U.create().superRefine((s,a)=>{const d=n(s);if(d instanceof Promise)return d.then(i=>{if(!i){const r=Ce(e,s),u=r.fatal??t??!0;a.addIssue({code:"custom",...r,fatal:u})}});if(!d){const i=Ce(e,s),r=i.fatal??t??!0;a.addIssue({code:"custom",...i,fatal:r})}}):U.create()}const et={object:v.lazycreate};var p;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(p||(p={}));class Ut{constructor(...e){}}const tt=(n,e={message:`Input not instance of ${n.name}`})=>Oe(t=>t instanceof n,e),Ae=T.create,Ne=E.create,st=ue.create,at=F.create,Se=Y.create,nt=$.create,rt=de.create,it=q.create,dt=H.create,ot=U.create,ct=L.create,ut=N.create,lt=oe.create,ht=Z.create,pt=v.create,mt=v.strictCreate,ft=J.create,_t=le.create,yt=G.create,gt=A.create,vt=re.create,kt=ce.create,xt=z.create,wt=B.create,bt=X.create,Zt=Q.create,Tt=M.create,Ct=ee.create,Ot=K.create,Re=b.create,At=O.create,Nt=I.create,St=b.createWithPreprocess,Rt=ne.create,jt=()=>Ae().optional(),Pt=()=>Ne().optional(),It=()=>Se().optional(),Et={string:(n=>T.create({...n,coerce:!0})),number:(n=>E.create({...n,coerce:!0})),boolean:(n=>Y.create({...n,coerce:!0})),bigint:(n=>F.create({...n,coerce:!0})),date:(n=>$.create({...n,coerce:!0}))},Ft=f;export{Qe as BRAND,Ft as NEVER,y as Schema,U as ZodAny,Z as ZodArray,F as ZodBigInt,Y as ZodBoolean,fe as ZodBranded,se as ZodCatch,$ as ZodDate,te as ZodDefault,le as ZodDiscriminatedUnion,b as ZodEffects,M as ZodEnum,p as ZodFirstPartyTypeKind,B as ZodFunction,G as ZodIntersection,X as ZodLazy,Q as ZodLiteral,ce as ZodMap,ue as ZodNaN,ee as ZodNativeEnum,N as ZodNever,H as ZodNull,I as ZodNullable,E as ZodNumber,v as ZodObject,O as ZodOptional,ne as ZodPipeline,K as ZodPromise,ae as ZodReadonly,re as ZodRecord,y as ZodSchema,z as ZodSet,T as ZodString,de as ZodSymbol,b as ZodTransformer,A as ZodTuple,y as ZodType,q as ZodUndefined,J as ZodUnion,L as ZodUnknown,oe as ZodVoid,ot as any,ht as array,at as bigint,Se as boolean,Et as coerce,Oe as custom,nt as date,Ze as datetimeRegex,_t as discriminatedUnion,Re as effect,Tt as enum,wt as function,tt as instanceof,yt as intersection,et as late,bt as lazy,Zt as literal,kt as map,st as nan,Ct as nativeEnum,ut as never,dt as null,Nt as nullable,Ne as number,pt as object,It as oboolean,Pt as onumber,At as optional,jt as ostring,Rt as pipeline,St as preprocess,Ot as promise,vt as record,xt as set,mt as strictObject,Ae as string,rt as symbol,Re as transformer,gt as tuple,it as undefined,ft as union,ct as unknown,lt as void};
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=(t,e)=>{for(var o in e)f(t,o,{get:e[o],enumerable:!0})},b=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!d.call(t,r)&&r!==o&&f(t,r,{get:()=>e[r],enumerable:!(s=y(e,r))||s.enumerable});return t},_=t=>b(f({},"__esModule",{value:!0}),t),p={};m(p,{expressPoster:()=>g,expressVideoExport:()=>v}),module.exports=_(p);function u(t){return Array.isArray(t.files)?t.files:t.files&&typeof t.files=="object"?Object.values(t.files).flat():[]}function l(t,e){const o=[];for(let s=0;;s++){const r=t.find(n=>n.fieldname===`${e}_${s}`);if(!r)break;o.push({type:r.mimetype,bytes:r.buffer})}return o}function a(t,e){if(e.ok){t.setHeader("Content-Type",e.contentType),t.setHeader("Content-Disposition",`attachment; filename="${e.filename}"`),t.setHeader("Cache-Control","no-store"),t.send(e.bytes);return}t.status(e.status).json({error:e.error,message:e.message})}function v(t){return async(e,o)=>{const s=u(e),r=s.find(i=>i.fieldname==="overlay");if(r&&r.mimetype!=="image/png"){a(o,{ok:!1,status:415,error:"BAD_OVERLAY",message:"overlay \u5FC5\u987B\u662F PNG"});return}const n={videos:l(s,"video"),audios:l(s,"audio"),overlay:r?.buffer,editStateRaw:typeof e.body?.editState=="string"?e.body.editState:""};a(o,await t.handle(n))}}function g(t){return async(e,o)=>{const r=u(e).find(i=>i.fieldname==="file"),n=e.body?.time;if(!r||typeof n!="string"){a(o,{ok:!1,status:400,error:"BAD_REQUEST",message:"\u7F3A\u5C11 file \u6216 time"});return}a(o,await t.handle({type:r.mimetype,bytes:r.buffer},Number(n)))}}
1
+ "use strict";var a=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},b=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!d.call(t,r)&&r!==n&&a(t,r,{get:()=>e[r],enumerable:!(s=c(e,r))||s.enumerable});return t},g=t=>b(a({},"__esModule",{value:!0}),t),f={};m(f,{expressPoster:()=>O,expressVideoExport:()=>v}),module.exports=g(f);function u(t){return Array.isArray(t.files)?t.files:t.files&&typeof t.files=="object"?Object.values(t.files).flat():[]}function y(t,e){const n=[];for(let s=0;;s++){const r=t.find(o=>o.fieldname===`${e}_${s}`);if(!r)break;n.push({type:r.mimetype,bytes:r.buffer})}return n}function i(t,e){if(e.ok){t.setHeader("Content-Type",e.contentType),t.setHeader("Content-Disposition",`attachment; filename="${e.filename}"`),t.setHeader("Cache-Control","no-store"),t.send(e.bytes);return}t.status(e.status).json({error:e.error,message:e.message})}function v(t){return async(e,n)=>{const s=u(e),r=s.find(l=>l.fieldname==="overlay");if(r&&r.mimetype!=="image/png"){i(n,{ok:!1,status:415,error:"BAD_OVERLAY",message:"overlay \u5FC5\u987B\u662F PNG"});return}const o={videos:y(s,"video"),audios:y(s,"audio"),overlay:r?.buffer,editStateRaw:typeof e.body?.editState=="string"?e.body.editState:""};i(n,await t.handle(o))}}function O(t){return async(e,n)=>{const s=u(e).find(o=>o.fieldname==="file"),r=e.body?.time;if(!s||typeof r!="string"){i(n,{ok:!1,status:400,error:"BAD_REQUEST",message:"\u7F3A\u5C11 file \u6216 time"});return}i(n,await t.handle({type:s.mimetype,bytes:s.buffer},Number(r)))}}
@@ -3,8 +3,8 @@ import { P as PosterHandler, V as VideoExportHandler } from '../handler-DL4Inp7o
3
3
  /**
4
4
  * Express 适配器。用法:
5
5
  * import multer from 'multer';
6
- * import { createVideoExportHandler } from '@media-editor/server';
7
- * import { expressVideoExport } from '@media-editor/server/express';
6
+ * import { createVideoExportHandler } from '@bylqwjc/media-editor-server';
7
+ * import { expressVideoExport } from '@bylqwjc/media-editor-server/express';
8
8
  * app.post('/api/editor/video', multer().any(), expressVideoExport(createVideoExportHandler()));
9
9
  * multer().any() 把所有字段放进 req.files(含 fieldname/mimetype/buffer),文本字段进 req.body。
10
10
  */
@@ -1 +1 @@
1
- function u(e){return Array.isArray(e.files)?e.files:e.files&&typeof e.files=="object"?Object.values(e.files).flat():[]}function l(e,t){const o=[];for(let i=0;;i++){const s=e.find(a=>a.fieldname===`${t}_${i}`);if(!s)break;o.push({type:s.mimetype,bytes:s.buffer})}return o}function r(e,t){if(t.ok){e.setHeader("Content-Type",t.contentType),e.setHeader("Content-Disposition",`attachment; filename="${t.filename}"`),e.setHeader("Cache-Control","no-store"),e.send(t.bytes);return}e.status(t.status).json({error:t.error,message:t.message})}function m(e){return async(t,o)=>{const i=u(t),s=i.find(n=>n.fieldname==="overlay"),a=i.find(n=>n.fieldname==="videoCover"),f=l(i,"textOverlay");if(s&&s.mimetype!=="image/png"){r(o,{ok:!1,status:415,error:"BAD_OVERLAY",message:"overlay \u5FC5\u987B\u662F PNG"});return}if(f.some(n=>n.type!=="image/png")){r(o,{ok:!1,status:415,error:"BAD_OVERLAY",message:"textOverlay \u5FC5\u987B\u662F PNG"});return}if(a&&!/^image\/(?:png|jpe?g)$/.test(a.mimetype)){r(o,{ok:!1,status:415,error:"BAD_COVER",message:"videoCover must be PNG or JPG"});return}const y={videos:l(i,"video"),audios:l(i,"audio"),overlay:s?.buffer,videoCover:a?.buffer,textOverlays:f.map(n=>n.bytes),editStateRaw:typeof t.body?.editState=="string"?t.body.editState:""};r(o,await e.handle(y))}}function d(e){return async(t,o)=>{const s=u(t).find(f=>f.fieldname==="file"),a=t.body?.time;if(!s||typeof a!="string"){r(o,{ok:!1,status:400,error:"BAD_REQUEST",message:"\u7F3A\u5C11 file \u6216 time"});return}r(o,await e.handle({type:s.mimetype,bytes:s.buffer},Number(a)))}}export{d as expressPoster,m as expressVideoExport};
1
+ function m(e){return Array.isArray(e.files)?e.files:e.files&&typeof e.files=="object"?Object.values(e.files).flat():[]}function f(e,t){const s=[];for(let r=0;;r++){const i=e.find(o=>o.fieldname===`${t}_${r}`);if(!i)break;s.push({type:i.mimetype,bytes:i.buffer})}return s}function a(e,t){if(t.ok){e.setHeader("Content-Type",t.contentType),e.setHeader("Content-Disposition",`attachment; filename="${t.filename}"`),e.setHeader("Cache-Control","no-store"),e.send(t.bytes);return}e.status(t.status).json({error:t.error,message:t.message})}function d(e){return async(t,s)=>{const r=m(t),i=r.find(n=>n.fieldname==="overlay"),o=r.find(n=>n.fieldname==="videoCover"),u=f(r,"textOverlay");if(i&&i.mimetype!=="image/png"){a(s,{ok:!1,status:415,error:"BAD_OVERLAY",message:"overlay \u5FC5\u987B\u662F PNG"});return}if(u.some(n=>n.type!=="image/png")){a(s,{ok:!1,status:415,error:"BAD_OVERLAY",message:"textOverlay \u5FC5\u987B\u662F PNG"});return}if(o&&!/^image\/(?:png|jpe?g)$/.test(o.mimetype)){a(s,{ok:!1,status:415,error:"BAD_COVER",message:"videoCover must be PNG or JPG"});return}const y={videos:f(r,"video"),audios:f(r,"audio"),overlay:i?.buffer,videoCover:o?.buffer,textOverlays:u.map(n=>n.bytes),editStateRaw:typeof t.body?.editState=="string"?t.body.editState:""};a(s,await e.handle(y))}}function l(e){return async(t,s)=>{const r=m(t).find(o=>o.fieldname==="file"),i=t.body?.time;if(!r||typeof i!="string"){a(s,{ok:!1,status:400,error:"BAD_REQUEST",message:"\u7F3A\u5C11 file \u6216 time"});return}a(s,await e.handle({type:r.mimetype,bytes:r.buffer},Number(i)))}}export{l as expressPoster,d as expressVideoExport};