@walkeros/web-destination-meta 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})};import{getEnv as a}from"@walkeros/web-core";var n,r,s,i={};t(i,{BRAND:()=>ze,DIRTY:()=>w,EMPTY_PATH:()=>y,INVALID:()=>x,NEVER:()=>Et,OK:()=>Z,ParseStatus:()=>k,Schema:()=>I,ZodAny:()=>le,ZodArray:()=>fe,ZodBigInt:()=>se,ZodBoolean:()=>ie,ZodBranded:()=>De,ZodCatch:()=>Le,ZodDate:()=>oe,ZodDefault:()=>Re,ZodDiscriminatedUnion:()=>be,ZodEffects:()=>Ee,ZodEnum:()=>je,ZodError:()=>l,ZodFirstPartyTypeKind:()=>Ke,ZodFunction:()=>Pe,ZodIntersection:()=>xe,ZodIssueCode:()=>c,ZodLazy:()=>Te,ZodLiteral:()=>Oe,ZodMap:()=>Ae,ZodNaN:()=>Fe,ZodNativeEnum:()=>Ne,ZodNever:()=>me,ZodNull:()=>ue,ZodNullable:()=>$e,ZodNumber:()=>re,ZodObject:()=>ye,ZodOptional:()=>Me,ZodParsedType:()=>o,ZodPipeline:()=>Ue,ZodPromise:()=>Ie,ZodReadonly:()=>Ve,ZodRecord:()=>Ze,ZodSchema:()=>I,ZodSet:()=>Se,ZodString:()=>ae,ZodSymbol:()=>de,ZodTransformer:()=>Ee,ZodTuple:()=>we,ZodType:()=>I,ZodUndefined:()=>ce,ZodUnion:()=>ve,ZodUnknown:()=>pe,ZodVoid:()=>he,addIssueToContext:()=>v,any:()=>st,array:()=>ct,bigint:()=>Xe,boolean:()=>et,coerce:()=>It,custom:()=>Be,date:()=>tt,datetimeRegex:()=>Q,defaultErrorMap:()=>p,discriminatedUnion:()=>mt,effect:()=>At,enum:()=>xt,function:()=>_t,getErrorMap:()=>f,getParsedType:()=>d,instanceof:()=>Je,intersection:()=>ht,isAborted:()=>A,isAsync:()=>T,isDirty:()=>S,isValid:()=>P,late:()=>He,lazy:()=>bt,literal:()=>kt,makeIssue:()=>g,map:()=>yt,nan:()=>Qe,nativeEnum:()=>wt,never:()=>ot,null:()=>rt,nullable:()=>Pt,number:()=>Ge,object:()=>ut,objectUtil:()=>s,oboolean:()=>Nt,onumber:()=>jt,optional:()=>St,ostring:()=>Ct,pipeline:()=>Ot,preprocess:()=>Tt,promise:()=>Zt,quotelessJson:()=>u,record:()=>gt,set:()=>vt,setErrorMap:()=>h,strictObject:()=>lt,string:()=>Ye,symbol:()=>at,transformer:()=>At,tuple:()=>ft,undefined:()=>nt,union:()=>pt,unknown:()=>it,util:()=>n,void:()=>dt}),(r=n||(n={})).assertEqual=e=>{},r.assertIs=function(e){},r.assertNever=function(e){throw new Error},r.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},r.getValidEnumValues=e=>{const t=r.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const n of t)a[n]=e[n];return r.objectValues(a)},r.objectValues=e=>r.objectKeys(e).map(function(t){return e[t]}),r.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},r.find=(e,t)=>{for(const a of e)if(t(a))return a},r.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,r.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},r.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(s||(s={})).mergeShapes=(e,t)=>({...e,...t});var o=n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d=e=>{switch(typeof e){case"undefined":return o.undefined;case"string":return o.string;case"number":return Number.isNaN(e)?o.nan:o.number;case"boolean":return o.boolean;case"function":return o.function;case"bigint":return o.bigint;case"symbol":return o.symbol;case"object":return Array.isArray(e)?o.array:null===e?o.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?o.promise:"undefined"!=typeof Map&&e instanceof Map?o.map:"undefined"!=typeof Set&&e instanceof Set?o.set:"undefined"!=typeof Date&&e instanceof Date?o.date:o.object;default:return o.unknown}},c=n.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),u=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),l=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,n=0;for(;n<r.path.length;){const a=r.path[n];n===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};l.create=e=>new l(e);var p=(e,t)=>{let a;switch(e.code){case c.invalid_type:a=e.received===o.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case c.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,n.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:a=`Unrecognized key(s) in object: ${n.joinValues(e.keys,", ")}`;break;case c.invalid_union:a="Invalid input";break;case c.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${n.joinValues(e.options)}`;break;case c.invalid_enum_value:a=`Invalid enum value. Expected ${n.joinValues(e.options)}, received '${e.received}'`;break;case c.invalid_arguments:a="Invalid function arguments";break;case c.invalid_return_type:a="Invalid function return type";break;case c.invalid_date:a="Invalid date";break;case c.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:n.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case c.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case c.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case c.custom:a="Invalid input";break;case c.invalid_intersection_types:a="Intersection results could not be merged";break;case c.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case c.not_finite:a="Number must be finite";break;default:a=t.defaultError,n.assertNever(e)}return{message:a}},m=p;function h(e){m=e}function f(){return m}var g=e=>{const{data:t,path:a,errorMaps:n,issueData:r}=e,s=[...a,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const d=n.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},y=[];function v(e,t){const a=f(),n=g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===p?void 0:p].filter(e=>!!e)});e.common.issues.push(n)}var _,b,k=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return x;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(t,a){const n=[];for(const e of a){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return x;if("aborted"===r.status)return x;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}},x=Object.freeze({status:"aborted"}),w=e=>({status:"dirty",value:e}),Z=e=>({status:"valid",value:e}),A=e=>"aborted"===e.status,S=e=>"dirty"===e.status,P=e=>"valid"===e.status,T=e=>"undefined"!=typeof Promise&&e instanceof Promise;(b=_||(_={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},b.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var O=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}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}},C=(e,t)=>{if(P(t))return{success:!0,data:t.value};if(!e.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 l(e.common.issues);return this._error=t,this._error}}};function j(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:r}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(s=null!=o?o:n)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:a)?i:r.defaultError}},description:r}}var N,I=class{get description(){return this._def.description}_getType(e){return d(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(T(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 a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const n={common:{issues:[],async:null!=(a=null==t?void 0:t.async)&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)},r=this._parseSync({data:e,path:n.path,parent:n});return C(n,r)}"~validate"(e){var t,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return P(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null==(a=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>P(e)?{value:e.value}:{issues:n.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)},n=this._parse({data:e,path:a.path,parent:a}),r=await(T(n)?n:Promise.resolve(n));return C(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const r=e(t),s=()=>n.addIssue({code:c.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!1)})}refinement(e,t){return this._refinement((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1))}_refinement(e){return new Ee({schema:this,typeName:Ke.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:e=>this["~validate"](e)}}optional(){return Me.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return Ie.create(this,this._def)}or(e){return ve.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new Ee({...j(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Re({...j(this._def),innerType:this,defaultValue:t,typeName:Ke.ZodDefault})}brand(){return new De({typeName:Ke.ZodBranded,type:this,...j(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Le({...j(this._def),innerType:this,catchValue:t,typeName:Ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ue.create(this,e)}readonly(){return Ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},E=/^c[^\s-]{8,}$/i,M=/^[0-9a-z]+$/,$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R=/^[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,L=/^[a-z0-9_-]{21}$/i,F=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z=/^[-+]?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)?)??$/,D=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U=/^(?:(?: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])$/,V=/^(?:(?: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])$/,q=/^(([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]))$/,B=/^(([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])$/,K=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H="((\\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])))",J=new RegExp(`^${H}$`);function Y(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function G(e){return new RegExp(`^${Y(e)}$`)}function Q(e){let t=`${H}T${Y(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function X(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!q.test(e))}function ee(e,t){if(!F.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(n));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===(null==r?void 0:r.typ))&&(!!r.alg&&(!t||r.alg===t)))}catch(e){return!1}}function te(e,t){return!("v4"!==t&&t||!V.test(e))||!("v6"!==t&&t||!B.test(e))}var ae=class e extends I{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==o.string){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.string,received:t.parsedType}),x}const t=new k;let a;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?v(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&v(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)D.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"email",code:c.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)N||(N=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),N.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"emoji",code:c.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)R.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"uuid",code:c.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)L.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"nanoid",code:c.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)E.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid",code:c.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)M.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid2",code:c.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)$.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ulid",code:c.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(n){a=this._getOrReturnCtx(e,a),v(a,{validation:"url",code:c.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"regex",code:c.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){Q(r).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){J.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){G(r).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:c.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?z.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"duration",code:c.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?X(e.data,r.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ip",code:c.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?ee(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"jwt",code:c.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?te(e.data,r.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cidr",code:c.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?K.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64",code:c.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?W.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64url",code:c.invalid_string,message:r.message}),t.dirty()):n.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:c.invalid_string,..._.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(a=null==e?void 0:e.local)&&a,..._.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,..._.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,..._.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function ne(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ae.create=e=>{var t;return new ae({checks:[],typeName:Ke.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...j(e)})};var re=class e extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==o.number){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.number,received:t.parsedType}),x}let t;const a=new k;for(const r of this._def.checks)if("int"===r.kind)n.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:c.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==ne(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:c.not_finite,message:r.message}),a.dirty()):n.assertNever(r);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(t,a,n,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:n,message:_.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&n.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};re.create=e=>new re({checks:[],typeName:Ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...j(e)});var se=class e extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==o.bigint)return this._getInvalidInput(e);let t;const a=new k;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),v(t,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):n.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.bigint,received:t.parsedType}),x}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(t,a,n,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:n,message:_.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};se.create=e=>{var t;return new se({checks:[],typeName:Ke.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...j(e)})};var ie=class extends I{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==o.boolean){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.boolean,received:t.parsedType}),x}return Z(e.data)}};ie.create=e=>new ie({typeName:Ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...j(e)});var oe=class e extends I{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==o.date){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.date,received:t.parsedType}),x}if(Number.isNaN(e.data.getTime())){return v(this._getOrReturnCtx(e),{code:c.invalid_date}),x}const t=new k;let a;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:c.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:c.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):n.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};oe.create=e=>new oe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ke.ZodDate,...j(e)});var de=class extends I{_parse(e){if(this._getType(e)!==o.symbol){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.symbol,received:t.parsedType}),x}return Z(e.data)}};de.create=e=>new de({typeName:Ke.ZodSymbol,...j(e)});var ce=class extends I{_parse(e){if(this._getType(e)!==o.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.undefined,received:t.parsedType}),x}return Z(e.data)}};ce.create=e=>new ce({typeName:Ke.ZodUndefined,...j(e)});var ue=class extends I{_parse(e){if(this._getType(e)!==o.null){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.null,received:t.parsedType}),x}return Z(e.data)}};ue.create=e=>new ue({typeName:Ke.ZodNull,...j(e)});var le=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}};le.create=e=>new le({typeName:Ke.ZodAny,...j(e)});var pe=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}};pe.create=e=>new pe({typeName:Ke.ZodUnknown,...j(e)});var me=class extends I{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.never,received:t.parsedType}),x}};me.create=e=>new me({typeName:Ke.ZodNever,...j(e)});var he=class extends I{_parse(e){if(this._getType(e)!==o.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.void,received:t.parsedType}),x}return Z(e.data)}};he.create=e=>new he({typeName:Ke.ZodVoid,...j(e)});var fe=class e extends I{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==o.array)return v(t,{code:c.invalid_type,expected:o.array,received:t.parsedType}),x;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(v(t,{code:e?c.too_big:c.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(v(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(v(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new O(t,e,t.path,a)))).then(e=>k.mergeArray(a,e));const r=[...t.data].map((e,a)=>n.type._parseSync(new O(t,e,t.path,a)));return k.mergeArray(a,r)}get element(){return this._def.type}min(t,a){return new e({...this._def,minLength:{value:t,message:_.toString(a)}})}max(t,a){return new e({...this._def,maxLength:{value:t,message:_.toString(a)}})}length(t,a){return new e({...this._def,exactLength:{value:t,message:_.toString(a)}})}nonempty(e){return this.min(1,e)}};function ge(e){if(e instanceof ye){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=Me.create(ge(n))}return new ye({...e._def,shape:()=>t})}return e instanceof fe?new fe({...e._def,type:ge(e.element)}):e instanceof Me?Me.create(ge(e.unwrap())):e instanceof $e?$e.create(ge(e.unwrap())):e instanceof we?we.create(e.items.map(e=>ge(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...j(t)});var ye=class e extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=n.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==o.object){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.object,received:t.parsedType}),x}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof me&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=n[e],r=a.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new O(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof me){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)s.length>0&&(v(a,{code:c.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new O(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>k.mergeObjectSync(t,e)):k.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return _.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,a)=>{var n,r,s,i;const o=null!=(s=null==(r=(n=this._def).errorMap)?void 0:r.call(n,e,a).message)?s:a.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=_.errToObj(t).message)?i:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const a={};for(const e of n.objectKeys(t))t[e]&&this.shape[e]&&(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}omit(t){const a={};for(const e of n.objectKeys(this.shape))t[e]||(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}deepPartial(){return ge(this)}partial(t){const a={};for(const e of n.objectKeys(this.shape)){const n=this.shape[e];t&&!t[e]?a[e]=n:a[e]=n.optional()}return new e({...this._def,shape:()=>a})}required(t){const a={};for(const e of n.objectKeys(this.shape))if(t&&!t[e])a[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Me;)t=t._def.innerType;a[e]=t}return new e({...this._def,shape:()=>a})}keyof(){return Ce(n.objectKeys(this.shape))}};ye.create=(e,t)=>new ye({shape:()=>e,unknownKeys:"strip",catchall:me.create(),typeName:Ke.ZodObject,...j(t)}),ye.strictCreate=(e,t)=>new ye({shape:()=>e,unknownKeys:"strict",catchall:me.create(),typeName:Ke.ZodObject,...j(t)}),ye.lazycreate=(e,t)=>new ye({shape:e,unknownKeys:"strip",catchall:me.create(),typeName:Ke.ZodObject,...j(t)});var ve=class extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new l(e.ctx.common.issues));return v(t,{code:c.invalid_union,unionErrors:a}),x});{let e;const n=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map(e=>new l(e));return v(t,{code:c.invalid_union,unionErrors:r}),x}}get options(){return this._def.options}};ve.create=(e,t)=>new ve({options:e,typeName:Ke.ZodUnion,...j(t)});var _e=e=>e instanceof Te?_e(e.schema):e instanceof Ee?_e(e.innerType()):e instanceof Oe?[e.value]:e instanceof je?e.options:e instanceof Ne?n.objectValues(e.enum):e instanceof Re?_e(e._def.innerType):e instanceof ce?[void 0]:e instanceof ue?[null]:e instanceof Me?[void 0,..._e(e.unwrap())]:e instanceof $e?[null,..._e(e.unwrap())]:e instanceof De||e instanceof Ve?_e(e.unwrap()):e instanceof Le?_e(e._def.innerType):[],be=class e extends I{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.object)return v(t,{code:c.invalid_type,expected:o.object,received:t.parsedType}),x;const a=this.discriminator,n=t.data[a],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,a,n){const r=new Map;for(const e of a){const a=_e(e.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const n of a){if(r.has(n))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);r.set(n,e)}}return new e({typeName:Ke.ZodDiscriminatedUnion,discriminator:t,options:a,optionsMap:r,...j(n)})}};function ke(e,t){const a=d(e),r=d(t);if(e===t)return{valid:!0,data:e};if(a===o.object&&r===o.object){const a=n.objectKeys(t),r=n.objectKeys(e).filter(e=>-1!==a.indexOf(e)),s={...e,...t};for(const a of r){const n=ke(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(a===o.array&&r===o.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const r=ke(e[n],t[n]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===o.date&&r===o.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var xe=class extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(A(e)||A(n))return x;const r=ke(e.value,n.value);return r.valid?((S(e)||S(n))&&t.dirty(),{status:t.value,value:r.data}):(v(a,{code:c.invalid_intersection_types}),x)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};xe.create=(e,t,a)=>new xe({left:e,right:t,typeName:Ke.ZodIntersection,...j(a)});var we=class e extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==o.array)return v(a,{code:c.invalid_type,expected:o.array,received:a.parsedType}),x;if(a.data.length<this._def.items.length)return v(a,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&a.data.length>this._def.items.length&&(v(a,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new O(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>k.mergeArray(t,e)):k.mergeArray(t,n)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};we.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:e,typeName:Ke.ZodTuple,rest:null,...j(t)})};var Ze=class e extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==o.object)return v(a,{code:c.invalid_type,expected:o.object,received:a.parsedType}),x;const n=[],r=this._def.keyType,s=this._def.valueType;for(const e in a.data)n.push({key:r._parse(new O(a,e,a.path,e)),value:s._parse(new O(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?k.mergeObjectAsync(t,n):k.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(t,a,n){return new e(a instanceof I?{keyType:t,valueType:a,typeName:Ke.ZodRecord,...j(n)}:{keyType:ae.create(),valueType:t,typeName:Ke.ZodRecord,...j(a)})}},Ae=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==o.map)return v(a,{code:c.invalid_type,expected:o.map,received:a.parsedType}),x;const n=this._def.keyType,r=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:n._parse(new O(a,e,a.path,[s,"key"])),value:r._parse(new O(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const n=await a.key,r=await a.value;if("aborted"===n.status||"aborted"===r.status)return x;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const n=a.key,r=a.value;if("aborted"===n.status||"aborted"===r.status)return x;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}};Ae.create=(e,t,a)=>new Ae({valueType:t,keyType:e,typeName:Ke.ZodMap,...j(a)});var Se=class e extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==o.set)return v(a,{code:c.invalid_type,expected:o.set,received:a.parsedType}),x;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(v(a,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(v(a,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const a=new Set;for(const n of e){if("aborted"===n.status)return x;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map((e,t)=>r._parse(new O(a,e,a.path,t)));return a.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,a){return new e({...this._def,minSize:{value:t,message:_.toString(a)}})}max(t,a){return new e({...this._def,maxSize:{value:t,message:_.toString(a)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Se.create=(e,t)=>new Se({valueType:e,minSize:null,maxSize:null,typeName:Ke.ZodSet,...j(t)});var Pe=class e extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.function)return v(t,{code:c.invalid_type,expected:o.function,received:t.parsedType}),x;function a(e,a){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),p].filter(e=>!!e),issueData:{code:c.invalid_arguments,argumentsError:a}})}function n(e,a){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),p].filter(e=>!!e),issueData:{code:c.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ie){const e=this;return Z(async function(...t){const i=new l([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw i.addIssue(a(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,r).catch(e=>{throw i.addIssue(n(d,e)),i})})}{const e=this;return Z(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new l([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,r);if(!d.success)throw new l([n(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:we.create(t).rest(pe.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,a,n){return new e({args:t||we.create([]).rest(pe.create()),returns:a||pe.create(),typeName:Ke.ZodFunction,...j(n)})}},Te=class extends I{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})}};Te.create=(e,t)=>new Te({getter:e,typeName:Ke.ZodLazy,...j(t)});var Oe=class extends I{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ce(e,t){return new je({values:e,typeName:Ke.ZodEnum,...j(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:Ke.ZodLiteral,...j(t)});var je=class e extends I{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return v(t,{expected:n.joinValues(a),received:t.parsedType,code:c.invalid_type}),x}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return v(t,{received:t.data,code:c.invalid_enum_value,options:a}),x}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,a=this._def){return e.create(t,{...this._def,...a})}exclude(t,a=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...a})}};je.create=Ce;var Ne=class extends I{_parse(e){const t=n.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==o.string&&a.parsedType!==o.number){const e=n.objectValues(t);return v(a,{expected:n.joinValues(e),received:a.parsedType,code:c.invalid_type}),x}if(this._cache||(this._cache=new Set(n.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=n.objectValues(t);return v(a,{received:a.data,code:c.invalid_enum_value,options:e}),x}return Z(e.data)}get enum(){return this._def.values}};Ne.create=(e,t)=>new Ne({values:e,typeName:Ke.ZodNativeEnum,...j(t)});var Ie=class extends I{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.promise&&!1===t.common.async)return v(t,{code:c.invalid_type,expected:o.promise,received:t.parsedType}),x;const a=t.parsedType===o.promise?t.data:Promise.resolve(t.data);return Z(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ie.create=(e,t)=>new Ie({type:e,typeName:Ke.ZodPromise,...j(t)});var Ee=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:e=>{v(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return x;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?w(n.value):n});{if("aborted"===t.value)return x;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?w(n.value):n}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?x:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?x:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!P(e))return x;const n=r.transform(e.value,s);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>P(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:t.value,value:e})):x)}n.assertNever(r)}};Ee.create=(e,t,a)=>new Ee({schema:e,typeName:Ke.ZodEffects,effect:t,...j(a)}),Ee.createWithPreprocess=(e,t,a)=>new Ee({schema:t,effect:{type:"preprocess",transform:e},typeName:Ke.ZodEffects,...j(a)});var Me=class extends I{_parse(e){return this._getType(e)===o.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Me.create=(e,t)=>new Me({innerType:e,typeName:Ke.ZodOptional,...j(t)});var $e=class extends I{_parse(e){return this._getType(e)===o.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:Ke.ZodNullable,...j(t)});var Re=class extends I{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===o.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:Ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...j(t)});var Le=class extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return T(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new l(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new l(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Le.create=(e,t)=>new Le({innerType:e,typeName:Ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...j(t)});var Fe=class extends I{_parse(e){if(this._getType(e)!==o.nan){const t=this._getOrReturnCtx(e);return v(t,{code:c.invalid_type,expected:o.nan,received:t.parsedType}),x}return{status:"valid",value:e.data}}};Fe.create=e=>new Fe({typeName:Ke.ZodNaN,...j(e)});var ze=Symbol("zod_brand"),De=class extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Ue=class e extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),w(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(t,a){return new e({in:t,out:a,typeName:Ke.ZodPipeline})}},Ve=class extends I{_parse(e){const t=this._def.innerType._parse(e),a=e=>(P(e)&&(e.value=Object.freeze(e.value)),e);return T(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}};function qe(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function Be(e,t={},a){return e?le.create().superRefine((n,r)=>{var s,i;const o=e(n);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=qe(t,n),o=null==(i=null!=(s=e.fatal)?s:a)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=qe(t,n),o=null==(i=null!=(s=e.fatal)?s:a)||i;r.addIssue({code:"custom",...e,fatal:o})}}):le.create()}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Ke.ZodReadonly,...j(t)});var Ke,We,He={object:ye.lazycreate};(We=Ke||(Ke={})).ZodString="ZodString",We.ZodNumber="ZodNumber",We.ZodNaN="ZodNaN",We.ZodBigInt="ZodBigInt",We.ZodBoolean="ZodBoolean",We.ZodDate="ZodDate",We.ZodSymbol="ZodSymbol",We.ZodUndefined="ZodUndefined",We.ZodNull="ZodNull",We.ZodAny="ZodAny",We.ZodUnknown="ZodUnknown",We.ZodNever="ZodNever",We.ZodVoid="ZodVoid",We.ZodArray="ZodArray",We.ZodObject="ZodObject",We.ZodUnion="ZodUnion",We.ZodDiscriminatedUnion="ZodDiscriminatedUnion",We.ZodIntersection="ZodIntersection",We.ZodTuple="ZodTuple",We.ZodRecord="ZodRecord",We.ZodMap="ZodMap",We.ZodSet="ZodSet",We.ZodFunction="ZodFunction",We.ZodLazy="ZodLazy",We.ZodLiteral="ZodLiteral",We.ZodEnum="ZodEnum",We.ZodEffects="ZodEffects",We.ZodNativeEnum="ZodNativeEnum",We.ZodOptional="ZodOptional",We.ZodNullable="ZodNullable",We.ZodDefault="ZodDefault",We.ZodCatch="ZodCatch",We.ZodPromise="ZodPromise",We.ZodBranded="ZodBranded",We.ZodPipeline="ZodPipeline",We.ZodReadonly="ZodReadonly";var Je=(e,t={message:`Input not instance of ${e.name}`})=>Be(t=>t instanceof e,t),Ye=ae.create,Ge=re.create,Qe=Fe.create,Xe=se.create,et=ie.create,tt=oe.create,at=de.create,nt=ce.create,rt=ue.create,st=le.create,it=pe.create,ot=me.create,dt=he.create,ct=fe.create,ut=ye.create,lt=ye.strictCreate,pt=ve.create,mt=be.create,ht=xe.create,ft=we.create,gt=Ze.create,yt=Ae.create,vt=Se.create,_t=Pe.create,bt=Te.create,kt=Oe.create,xt=je.create,wt=Ne.create,Zt=Ie.create,At=Ee.create,St=Me.create,Pt=$e.create,Tt=Ee.createWithPreprocess,Ot=Ue.create,Ct=()=>Ye().optional(),jt=()=>Ge().optional(),Nt=()=>et().optional(),It={string:e=>ae.create({...e,coerce:!0}),number:e=>re.create({...e,coerce:!0}),boolean:e=>ie.create({...e,coerce:!0}),bigint:e=>se.create({...e,coerce:!0}),date:e=>oe.create({...e,coerce:!0})},Et=x,Mt=Symbol("Let zodToJsonSchema decide on which parser to use"),$t={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Rt=e=>{const t=(e=>"string"==typeof e?{...$t,name:e}:{...$t,...e})(e),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Lt(e,t,a,n){(null==n?void 0:n.errorMessages)&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function Ft(e,t,a,n,r){e[t]=a,Lt(e,t,n,r)}var zt=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function Dt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?zt(t,e.currentPath):t.join("/")}}function Ut(e,t){return fa(e.type._def,t)}function Vt(e,t,a){const n=null!=a?a:t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,n)=>Vt(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qt(e,t)}}var qt=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const n of e.checks)switch(n.kind){case"min":Ft(a,"minimum",n.value,n.message,t);break;case"max":Ft(a,"maximum",n.value,n.message,t)}return a};var Bt=void 0,Kt=/^[cC][^\s-]{8,}$/,Wt=/^[0-9a-z]+$/,Ht=/^[0-9A-HJKMNP-TV-Z]{26}$/,Jt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Yt=()=>(void 0===Bt&&(Bt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bt),Gt=/^(?:(?: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])$/,Qt=/^(([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])$/,Xt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ea=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ta=/^[a-zA-Z0-9_-]{21}$/,aa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function na(e,t){const a={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":Ft(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t);break;case"max":Ft(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":ia(a,"email",n.message,t);break;case"format:idn-email":ia(a,"idn-email",n.message,t);break;case"pattern:zod":oa(a,Jt,n.message,t)}break;case"url":ia(a,"uri",n.message,t);break;case"uuid":ia(a,"uuid",n.message,t);break;case"regex":oa(a,n.regex,n.message,t);break;case"cuid":oa(a,Kt,n.message,t);break;case"cuid2":oa(a,Wt,n.message,t);break;case"startsWith":oa(a,RegExp(`^${ra(n.value,t)}`),n.message,t);break;case"endsWith":oa(a,RegExp(`${ra(n.value,t)}$`),n.message,t);break;case"datetime":ia(a,"date-time",n.message,t);break;case"date":ia(a,"date",n.message,t);break;case"time":ia(a,"time",n.message,t);break;case"duration":ia(a,"duration",n.message,t);break;case"length":Ft(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t),Ft(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"includes":oa(a,RegExp(ra(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&ia(a,"ipv4",n.message,t),"v4"!==n.version&&ia(a,"ipv6",n.message,t);break;case"base64url":oa(a,ea,n.message,t);break;case"jwt":oa(a,aa,n.message,t);break;case"cidr":"v6"!==n.version&&oa(a,Gt,n.message,t),"v4"!==n.version&&oa(a,Qt,n.message,t);break;case"emoji":oa(a,Yt(),n.message,t);break;case"ulid":oa(a,Ht,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":ia(a,"binary",n.message,t);break;case"contentEncoding:base64":Ft(a,"contentEncoding","base64",n.message,t);break;case"pattern:zod":oa(a,Xt,n.message,t)}break;case"nanoid":oa(a,ta,n.message,t)}return a}function ra(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)sa.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}var sa=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ia(e,t,a,n){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):Ft(e,"format",t,a,n)}function oa(e,t,a,n){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:da(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):Ft(e,"pattern",da(t,n),a,n)}function da(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;const n=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=n?e.source.toLowerCase():e.source;let o="",d=!1,c=!1,u=!1;for(let e=0;e<i.length;e++)if(d)o+=i[e],d=!1;else{if(n)if(c){if(i[e].match(/[a-z]/)){u?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),u=!1):"-"===i[e+1]&&(null==(a=i[e+2])?void 0:a.match(/[a-z]/))?(o+=i[e],u=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(r){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=c?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?d=!0:c&&"]"===i[e]?c=!1:c||"["!==i[e]||(c=!0))}try{new RegExp(o)}catch(a){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ca(e,t){var a,n,r,s,i,o,d;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(a=e.keyType)?void 0:a._def.typeName)===Ke.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,n)=>{var r;return{...a,[n]:null!=(r=fa(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]}))?r:Dt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const c={type:"object",additionalProperties:null!=(n=fa(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?n:t.allowedAdditionalProperties};if("openApi3"===t.target)return c;if((null==(r=e.keyType)?void 0:r._def.typeName)===Ke.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:a,...n}=na(e.keyType._def,t);return{...c,propertyNames:n}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Ke.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Ke.ZodBranded&&e.keyType._def.type._def.typeName===Ke.ZodString&&(null==(d=e.keyType._def.type._def.checks)?void 0:d.length)){const{type:a,...n}=Ut(e.keyType._def,t);return{...c,propertyNames:n}}return c}var ua={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var la=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>fa(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function pa(e,t){const a="openAi"===t.target,n={type:"object",properties:{}},r=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=ma(i);o&&a&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const d=fa(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(n.properties[e]=d,o||r.push(e))}r.length&&(n.required=r);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return fa(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(n.additionalProperties=i),n}function ma(e){try{return e.isOptional()}catch(e){return!0}}var ha=(e,t,a)=>{switch(t){case Ke.ZodString:return na(e,a);case Ke.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"int":a.type="integer",Lt(a,"type",n.message,t);break;case"min":"jsonSchema7"===t.target?n.inclusive?Ft(a,"minimum",n.value,n.message,t):Ft(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),Ft(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?Ft(a,"maximum",n.value,n.message,t):Ft(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),Ft(a,"maximum",n.value,n.message,t));break;case"multipleOf":Ft(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Ke.ZodObject:return pa(e,a);case Ke.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"min":"jsonSchema7"===t.target?n.inclusive?Ft(a,"minimum",n.value,n.message,t):Ft(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),Ft(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?Ft(a,"maximum",n.value,n.message,t):Ft(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),Ft(a,"maximum",n.value,n.message,t));break;case"multipleOf":Ft(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Ke.ZodBoolean:return{type:"boolean"};case Ke.ZodDate:return Vt(e,a);case Ke.ZodUndefined:return function(e){return{not:Dt(e)}}(a);case Ke.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Ke.ZodArray:return function(e,t){var a,n,r;const s={type:"array"};return(null==(a=e.type)?void 0:a._def)&&(null==(r=null==(n=e.type)?void 0:n._def)?void 0:r.typeName)!==Ke.ZodAny&&(s.items=fa(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Ft(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Ft(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Ft(s,"minItems",e.exactLength.value,e.exactLength.message,t),Ft(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,a);case Ke.ZodUnion:case Ke.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return la(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in ua&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=ua[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return la(e,t)}(e,a);case Ke.ZodIntersection:return function(e,t){const a=[fa(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),fa(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let n="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...n}=e;t=n}else n=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(n=void 0);var t}),r.length?{allOf:r,...n}:void 0}(e,a);case Ke.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>fa(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:fa(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>fa(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Ke.ZodRecord:return ca(e,a);case Ke.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case Ke.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ke.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(a.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:a}}(e);case Ke.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:ua[e.innerType._def.typeName],nullable:!0}:{type:[ua[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=fa(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=fa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Ke.ZodOptional:return((e,t)=>{var a;if(t.currentPath.toString()===(null==(a=t.propertyPath)?void 0:a.toString()))return fa(e.innerType._def,t);const n=fa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Dt(t)},n]}:Dt(t)})(e,a);case Ke.ZodMap:return function(e,t){return"record"===t.mapStrategy?ca(e,t):{type:"array",maxItems:125,items:{type:"array",items:[fa(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Dt(t),fa(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Dt(t)],minItems:2,maxItems:2}}}(e,a);case Ke.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:fa(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Ft(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Ft(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Ke.ZodLazy:return()=>e.getter()._def;case Ke.ZodPromise:return function(e,t){return fa(e.type._def,t)}(e,a);case Ke.ZodNaN:case Ke.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Dt({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Ke.ZodEffects:return function(e,t){return"input"===t.effectStrategy?fa(e.schema._def,t):Dt(t)}(e,a);case Ke.ZodAny:return Dt(a);case Ke.ZodUnknown:return function(e){return Dt(e)}(a);case Ke.ZodDefault:return function(e,t){return{...fa(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Ke.ZodBranded:return Ut(e,a);case Ke.ZodReadonly:case Ke.ZodCatch:return((e,t)=>fa(e.innerType._def,t))(e,a);case Ke.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return fa(e.in._def,t);if("output"===t.pipeStrategy)return fa(e.out._def,t);const a=fa(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,fa(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Ke.ZodFunction:case Ke.ZodVoid:case Ke.ZodSymbol:default:return}};function fa(e,t,a=!1){var n;const r=t.seen.get(e);if(t.override){const s=null==(n=t.override)?void 0:n.call(t,e,t,r,a);if(s!==Mt)return s}if(r&&!a){const e=ga(r,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=ha(e,e.typeName,t),o="function"==typeof i?fa(i(),t):i;if(o&&ya(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return s.jsonSchema=o,a}return s.jsonSchema=o,o}var ga=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:zt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Dt(t)):"seen"===t.$refStrategy?Dt(t):void 0}},ya=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a),va=(e,t)=>{var a;const n=Rt(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>{var r;return{...e,[t]:null!=(r=fa(a._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0))?r:Dt(n)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(a=fa(e._def,void 0===s?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))?a:Dt(n),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));const d=void 0===s?r?{...i,[n.definitionPath]:r}:i:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...r,[s]:i}};return"jsonSchema7"===n.target?d.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==n.target&&"openAi"!==n.target||(d.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in d||"oneOf"in d||"allOf"in d||"type"in d&&Array.isArray(d.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),d},_a=i.record(i.string(),i.boolean()).describe("Consent requirement mapping"),ba=i.lazy(()=>i.union([i.string(),i.number(),i.boolean(),Za,i.array(ba)])),ka=i.tuple([ba,ba]).describe("Loop: [source, transform] tuple for array transformations"),xa=i.array(ba).describe("Set: Array of values"),wa=i.record(i.string(),ba).describe("Map: Object mapping keys to values"),Za=i.object({key:i.string().optional().describe('Property path (e.g., "data.id")'),value:i.union([i.string(),i.number(),i.boolean()]).optional().describe("Static primitive value"),fn:i.string().optional().describe("Function string for custom transformation"),map:wa.optional().describe("Object with key-value mappings"),loop:ka.optional().describe("Tuple [source, transform]"),set:xa.optional().describe("Array of values"),consent:_a.optional().describe("Required consent states"),condition:i.string().optional().describe("Condition function string"),validate:i.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),Aa=ka,Sa=xa,Pa=wa;va(Za,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),va(Aa,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),va(Sa,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),va(Pa,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"});function Ta(e,t){const a=[],n={};for(const[t,r]of Object.entries(e)){r.required&&a.push(t);const e={type:r.type};if(r.description&&(e.description=r.description),r.pattern&&(e.pattern=r.pattern),void 0!==r.minLength&&(e.minLength=r.minLength),void 0!==r.maxLength&&(e.maxLength=r.maxLength),void 0!==r.minimum&&(e.minimum=r.minimum),void 0!==r.maximum&&(e.maximum=r.maximum),r.enum&&(e.enum=[...r.enum]),void 0!==r.default&&(e.default=r.default),"object"===r.type&&r.properties){const t={};for(const[e,a]of Object.entries(r.properties))t[e]=Oa(a);e.properties=t}"array"===r.type&&r.items&&(e.items=Oa(r.items)),n[t]=e}const r={type:"object",properties:n};return t&&(r.title=t),a.length>0&&(r.required=a),r}function Oa(e){const t={type:e.type};if(e.description&&(t.description=e.description),e.pattern&&(t.pattern=e.pattern),void 0!==e.minLength&&(t.minLength=e.minLength),void 0!==e.maxLength&&(t.maxLength=e.maxLength),void 0!==e.minimum&&(t.minimum=e.minimum),void 0!==e.maximum&&(t.maximum=e.maximum),e.enum&&(t.enum=[...e.enum]),void 0!==e.default&&(t.default=e.default),"object"===e.type&&e.properties){const a={};for(const[t,n]of Object.entries(e.properties))a[t]=Oa(n);t.properties=a}return"array"===e.type&&e.items&&(t.items=Oa(e.items)),t}var Ca={merge:!0,shallow:!0,extend:!0};function ja(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Na(e={}){var t;const a=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",r=e.count||1,s=function(e,t={},a={}){a={...Ca,...a};const n=Object.entries(t).reduce((t,[n,r])=>{const s=e[n];return a.merge&&Array.isArray(s)&&Array.isArray(r)?t[n]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(a.extend||n in e)&&(t[n]=r),t},{});return a.shallow?{...e,...n}:(Object.assign(e,n),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${a}-${n}-${r}`,trigger:"test",entity:"entity",action:"action",timestamp:a,timing:3.14,group:n,count:r,version:{source:"0.2.1",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[a,n]=null!=(t=e.name.split(" "))?t:[];a&&n&&(s.entity=a,s.action=n)}return s}function Ia(e="entity action",t={}){const a=t.timestamp||(new Date).setHours(0,13,37,0),n={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return Na({...{"cart view":{data:{currency:"EUR",value:2*n.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...n.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:n.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...n,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...n,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...n,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...n,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...n.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:a,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}import{getEnv as Ea}from"@walkeros/web-core";var Ma={},$a={};t($a,{env:()=>Ra,events:()=>Da,mapping:()=>Ka});var Ra={};t(Ra,{init:()=>Fa,push:()=>za});var La=()=>{},Fa={window:{fbq:void 0,_fbq:void 0},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},za={window:{fbq:Object.assign(La,{callMethod:La,queue:[],push:La,loaded:!0,version:"2.0"}),_fbq:Object.assign(La,{callMethod:La,queue:[],push:La,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},Da={};function Ua(){const e=Ia("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function Va(){const e=Ia("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function qa(){const e=Ia("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function Ba(){const e=Ia("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}t(Da,{AddToCart:()=>Va,InitiateCheckout:()=>qa,Purchase:()=>Ua,ViewContent:()=>Ba});var Ka={};t(Ka,{AddToCart:()=>Ha,InitiateCheckout:()=>Ja,Purchase:()=>Wa,ViewContent:()=>Ya,config:()=>Ga});var Wa={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>ja(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},Ha={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},Ja={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>ja(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},Ya={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},Ga={order:{complete:Wa},product:{view:Ya,add:Ha},cart:{view:Ja}},Qa={};t(Qa,{dataSchema:()=>nn,dataUiSchema:()=>rn,mappingSchema:()=>tn,mappingUiSchema:()=>an,settingsSchema:()=>Xa,settingsUiSchema:()=>en});var Xa={type:"object",title:"Meta Pixel Settings",properties:{pixelId:{type:"string",title:"Pixel ID",description:"Your Meta (Facebook) Pixel ID",minLength:1,pattern:"^[0-9]+$"}},required:["pixelId"]},en={pixelId:{"ui:placeholder":"e.g., 1234567890123456","ui:help":"Find your Pixel ID in Meta Events Manager"}},tn={type:"object",title:"Meta Pixel Mapping",properties:{track:{type:"string",title:"Standard Event Name",description:"Meta Pixel standard event name",enum:["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]},trackCustom:{type:"string",title:"Custom Event Name",description:"Custom event name for trackCustom"}}},an={track:{"ui:placeholder":"Select standard event","ui:help":"Use standard events for better conversion tracking"},trackCustom:{"ui:placeholder":"e.g., CustomEventName","ui:help":"Custom events for tracking non-standard actions"},"ui:order":["track","trackCustom"]},nn={type:"object",title:"Meta Pixel Event Data",description:"Properties that can be sent with Meta Pixel events",properties:{value:{type:"number",title:"Value",description:"Monetary value of the event (e.g., purchase total, product price)"},currency:{type:"string",title:"Currency",description:"Currency code in ISO 4217 format (e.g., USD, EUR, GBP)",enum:["USD","EUR","GBP","JPY","CAD","AUD","CHF","CNY","SEK","NZD","KRW","SGD","NOK","MXN","INR","BRL","ZAR","DKK","PLN","THB","IDR","HUF","CZK","ILS","CLP","PHP","AED","COP","SAR","MYR","RON"]},content_name:{type:"string",title:"Content Name",description:"Name of the page, product, or content"},content_category:{type:"string",title:"Content Category",description:"Category of the page or product"},content_ids:{type:"array",title:"Content IDs",description:"Array of product IDs, SKUs, or content identifiers",items:{type:"string"}},contents:{type:"array",title:"Contents",description:"Array of product items with details (id, quantity, etc.)",items:{type:"object",properties:{id:{type:"string",title:"Product ID",description:"Product identifier or SKU"},quantity:{type:"number",title:"Quantity",description:"Quantity of this product"},item_price:{type:"number",title:"Item Price",description:"Price per item"}}}},content_type:{type:"string",title:"Content Type",description:"Type of content (product or product_group)",enum:["product","product_group"]},num_items:{type:"number",title:"Number of Items",description:"Total number of items (e.g., in cart or order)"},predicted_ltv:{type:"number",title:"Predicted LTV",description:"Predicted lifetime value of the customer"},search_string:{type:"string",title:"Search String",description:"Search query entered by the user"},status:{type:"boolean",title:"Status",description:"Status of the registration or checkout"}},additionalProperties:!0},rn={value:{"ui:placeholder":"e.g., 99.99","ui:help":"The monetary value associated with this event"},currency:{"ui:placeholder":"Select currency","ui:help":"Use the ISO 4217 currency code"},content_name:{"ui:placeholder":"e.g., Blue Running Shoes","ui:help":"Descriptive name of the content or product"},content_category:{"ui:placeholder":"e.g., Shoes > Running","ui:help":"Category hierarchy for the content"},content_ids:{"ui:placeholder":"Add product IDs","ui:help":"List of product identifiers"},contents:{"ui:help":"Array of products with detailed information"},content_type:{"ui:placeholder":"Select content type","ui:help":"Specify whether tracking individual products or product groups"},num_items:{"ui:placeholder":"e.g., 3","ui:help":"Total quantity of items"},search_string:{"ui:placeholder":"e.g., running shoes","ui:help":"The search term used by the customer"}},sn=Ta({pixelId:{type:"string",required:!0,pattern:"^[0-9]+$",description:"Your Meta (Facebook) Pixel ID",minLength:1}},"Meta Pixel Settings"),on=Ta({track:{type:"string",description:"Meta Pixel standard event name",enum:["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]},trackCustom:{type:"string",description:"Custom event name for trackCustom"},enabled:{type:"boolean",description:"Enable or disable this tracking rule"}},"Meta Pixel Mapping"),dn={pixelId:{"ui:placeholder":"e.g., 1234567890123456","ui:help":"Find your Pixel ID in Meta Events Manager"}},cn={track:{"ui:placeholder":"Select standard event","ui:help":"Use standard events for better conversion tracking"},trackCustom:{"ui:placeholder":"e.g., CustomEventName","ui:help":"Custom events for tracking non-standard actions"},"ui:order":["track","trackCustom"]},un={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:r}=e,{pixelId:s}=n;if(r&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=a(e),r=n.createElement("script");r.src=t,r.async=!0,n.head.appendChild(r)}(t),!s)return!1;!function(e){const{window:t}=a(e),n=t;if(n.fbq)return;const r=function(...e){r.callMethod?r.callMethod.apply(r,e):r.queue.push(e)};n.fbq=r,n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}(t);const{window:i}=Ea(t);return(0,i.fbq)("init",s),e},push(e,{config:t,mapping:a={},data:n,env:r}){const{track:s,trackCustom:i}=a.settings||{},{window:o}=Ea(r),d=o.fbq;"page view"!==e.name||a.settings||(e.name="PageView");const c=s||i||e.name;d(i?"trackCustom":"track",String(c),ja(n)?n:{},{eventID:e.id})}},ln=un;export{Ma as DestinationMeta,ln as default,un as destinationMeta,$a as examples,on as mappingSchemaGenerated,cn as mappingUiSchemaGenerated,Qa as schema,sn as settingsSchemaGenerated,dn as settingsUiSchemaGenerated};//# sourceMappingURL=index.mjs.map
1
+ var e=Object.defineProperty,t=(t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})};import{getEnv as n}from"@walkeros/web-core";var a,r,i,s={};t(s,{BRAND:()=>Le,DIRTY:()=>x,EMPTY_PATH:()=>y,INVALID:()=>S,NEVER:()=>It,OK:()=>w,ParseStatus:()=>k,Schema:()=>N,ZodAny:()=>le,ZodArray:()=>fe,ZodBigInt:()=>ie,ZodBoolean:()=>se,ZodBranded:()=>Fe,ZodCatch:()=>De,ZodDate:()=>oe,ZodDefault:()=>Me,ZodDiscriminatedUnion:()=>_e,ZodEffects:()=>Ie,ZodEnum:()=>Oe,ZodError:()=>l,ZodFirstPartyTypeKind:()=>Je,ZodFunction:()=>Pe,ZodIntersection:()=>Se,ZodIssueCode:()=>d,ZodLazy:()=>Ae,ZodLiteral:()=>Ce,ZodMap:()=>Ze,ZodNaN:()=>ze,ZodNativeEnum:()=>Ee,ZodNever:()=>me,ZodNull:()=>ue,ZodNullable:()=>Re,ZodNumber:()=>re,ZodObject:()=>ye,ZodOptional:()=>$e,ZodParsedType:()=>o,ZodPipeline:()=>Ue,ZodPromise:()=>Ne,ZodReadonly:()=>qe,ZodRecord:()=>we,ZodSchema:()=>N,ZodSet:()=>je,ZodString:()=>ne,ZodSymbol:()=>ce,ZodTransformer:()=>Ie,ZodTuple:()=>xe,ZodType:()=>N,ZodUndefined:()=>de,ZodUnion:()=>ve,ZodUnknown:()=>pe,ZodVoid:()=>he,addIssueToContext:()=>v,any:()=>it,array:()=>dt,bigint:()=>Xe,boolean:()=>et,coerce:()=>Nt,custom:()=>Be,date:()=>tt,datetimeRegex:()=>Q,defaultErrorMap:()=>p,discriminatedUnion:()=>mt,effect:()=>Zt,enum:()=>St,function:()=>bt,getErrorMap:()=>f,getParsedType:()=>c,instanceof:()=>He,intersection:()=>ht,isAborted:()=>Z,isAsync:()=>A,isDirty:()=>j,isValid:()=>P,late:()=>Ke,lazy:()=>_t,literal:()=>kt,makeIssue:()=>g,map:()=>yt,nan:()=>Qe,nativeEnum:()=>xt,never:()=>ot,null:()=>rt,nullable:()=>Pt,number:()=>Ge,object:()=>ut,objectUtil:()=>i,oboolean:()=>Et,onumber:()=>Ot,optional:()=>jt,ostring:()=>Tt,pipeline:()=>Ct,preprocess:()=>At,promise:()=>wt,quotelessJson:()=>u,record:()=>gt,set:()=>vt,setErrorMap:()=>h,strictObject:()=>lt,string:()=>Ye,symbol:()=>nt,transformer:()=>Zt,tuple:()=>ft,undefined:()=>at,union:()=>pt,unknown:()=>st,util:()=>a,void:()=>ct}),(r=a||(a={})).assertEqual=e=>{},r.assertIs=function(e){},r.assertNever=function(e){throw new Error},r.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},r.getValidEnumValues=e=>{const t=r.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return r.objectValues(n)},r.objectValues=e=>r.objectKeys(e).map(function(t){return e[t]}),r.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},r.find=(e,t)=>{for(const n of e)if(t(n))return n},r.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,r.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},r.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(i||(i={})).mergeShapes=(e,t)=>({...e,...t});var o=a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),c=e=>{switch(typeof e){case"undefined":return o.undefined;case"string":return o.string;case"number":return Number.isNaN(e)?o.nan:o.number;case"boolean":return o.boolean;case"function":return o.function;case"bigint":return o.bigint;case"symbol":return o.symbol;case"object":return Array.isArray(e)?o.array:null===e?o.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?o.promise:"undefined"!=typeof Map&&e instanceof Map?o.map:"undefined"!=typeof Set&&e instanceof Set?o.set:"undefined"!=typeof Date&&e instanceof Date?o.date:o.object;default:return o.unknown}},d=a.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),u=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),l=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};l.create=e=>new l(e);var p=(e,t)=>{let n;switch(e.code){case d.invalid_type:n=e.received===o.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,a.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${a.joinValues(e.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${a.joinValues(e.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${a.joinValues(e.options)}, received '${e.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:a.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case d.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case d.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=t.defaultError,a.assertNever(e)}return{message:n}},m=p;function h(e){m=e}function f(){return m}var g=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,i=[...n,...r.path||[]],s={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(s,{data:t,defaultError:o}).message;return{...r,path:i,message:o}},y=[];function v(e,t){const n=f(),a=g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===p?void 0:p].filter(e=>!!e)});e.common.issues.push(a)}var b,_,k=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return S;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const a=[];for(const e of n){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return e.mergeObjectSync(t,a)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return S;if("aborted"===r.status)return S;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}},S=Object.freeze({status:"aborted"}),x=e=>({status:"dirty",value:e}),w=e=>({status:"valid",value:e}),Z=e=>"aborted"===e.status,j=e=>"dirty"===e.status,P=e=>"valid"===e.status,A=e=>"undefined"!=typeof Promise&&e instanceof Promise;(_=b||(b={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},_.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var C=class{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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}},T=(e,t)=>{if(P(t))return{success:!0,data:t.value};if(!e.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 l(e.common.issues);return this._error=t,this._error}}};function O(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var i,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(i=null!=o?o:a)?i:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(s=null!=o?o:n)?s:r.defaultError}},description:r}}var E,N=class{get description(){return this._def.description}_getType(e){return c(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:c(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:c(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(A(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!=(n=null==t?void 0:t.async)&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:c(e)},r=this._parseSync({data:e,path:a.path,parent:a});return T(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:c(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return P(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>P(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:c(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(A(a)?a:Promise.resolve(a));return T(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const r=e(t),i=()=>a.addIssue({code:d.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(i(),!1)):!!r||(i(),!1)})}refinement(e,t){return this._refinement((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1))}_refinement(e){return new Ie({schema:this,typeName:Je.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:e=>this["~validate"](e)}}optional(){return $e.create(this,this._def)}nullable(){return Re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return Ne.create(this,this._def)}or(e){return ve.create([this,e],this._def)}and(e){return Se.create(this,e,this._def)}transform(e){return new Ie({...O(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Me({...O(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new Fe({typeName:Je.ZodBranded,type:this,...O(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new De({...O(this._def),innerType:this,catchValue:t,typeName:Je.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ue.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},I=/^c[^\s-]{8,}$/i,$=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M=/^[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,D=/^[a-z0-9_-]{21}$/i,z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L=/^[-+]?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)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U=/^(?:(?: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])$/,q=/^(?:(?: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])$/,V=/^(([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]))$/,B=/^(([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])$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,K="((\\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])))",H=new RegExp(`^${K}$`);function Y(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function G(e){return new RegExp(`^${Y(e)}$`)}function Q(e){let t=`${K}T${Y(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function X(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!V.test(e))}function ee(e,t){if(!z.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===(null==r?void 0:r.typ))&&(!!r.alg&&(!t||r.alg===t)))}catch(e){return!1}}function te(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!B.test(e))}var ne=class e extends N{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==o.string){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.string,received:t.parsedType}),S}const t=new k;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const a=e.data.length>r.value,i=e.data.length<r.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?v(n,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&v(n,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"email",code:d.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)E||(E=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),E.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"emoji",code:d.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)M.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"uuid",code:d.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)D.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"nanoid",code:d.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)I.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid",code:d.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)$.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid2",code:d.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)R.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ulid",code:d.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(a){n=this._getOrReturnCtx(e,n),v(n,{validation:"url",code:d.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"regex",code:d.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){Q(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){H.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){G(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:d.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?L.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"duration",code:d.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?X(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ip",code:d.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?ee(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"jwt",code:d.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?te(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cidr",code:d.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?J.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64",code:d.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?W.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64url",code:d.invalid_string,message:r.message}),t.dirty()):a.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:d.invalid_string,...b.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(n=null==e?void 0:e.local)&&n,...b.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...b.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...b.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function ae(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ne.create=e=>{var t;return new ne({checks:[],typeName:Je.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...O(e)})};var re=class e extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==o.number){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.number,received:t.parsedType}),S}let t;const n=new k;for(const r of this._def.checks)if("int"===r.kind)a.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:d.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==ae(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:d.not_finite,message:r.message}),n.dirty()):a.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:b.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&a.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};re.create=e=>new re({checks:[],typeName:Je.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...O(e)});var ie=class e extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==o.bigint)return this._getInvalidInput(e);let t;const n=new k;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),v(t,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):a.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:b.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};ie.create=e=>{var t;return new ie({checks:[],typeName:Je.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...O(e)})};var se=class extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==o.boolean){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.boolean,received:t.parsedType}),S}return w(e.data)}};se.create=e=>new se({typeName:Je.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...O(e)});var oe=class e extends N{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==o.date){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.date,received:t.parsedType}),S}if(Number.isNaN(e.data.getTime())){return v(this._getOrReturnCtx(e),{code:d.invalid_date}),S}const t=new k;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:d.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:d.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):a.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};oe.create=e=>new oe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Je.ZodDate,...O(e)});var ce=class extends N{_parse(e){if(this._getType(e)!==o.symbol){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.symbol,received:t.parsedType}),S}return w(e.data)}};ce.create=e=>new ce({typeName:Je.ZodSymbol,...O(e)});var de=class extends N{_parse(e){if(this._getType(e)!==o.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.undefined,received:t.parsedType}),S}return w(e.data)}};de.create=e=>new de({typeName:Je.ZodUndefined,...O(e)});var ue=class extends N{_parse(e){if(this._getType(e)!==o.null){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.null,received:t.parsedType}),S}return w(e.data)}};ue.create=e=>new ue({typeName:Je.ZodNull,...O(e)});var le=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};le.create=e=>new le({typeName:Je.ZodAny,...O(e)});var pe=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};pe.create=e=>new pe({typeName:Je.ZodUnknown,...O(e)});var me=class extends N{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.never,received:t.parsedType}),S}};me.create=e=>new me({typeName:Je.ZodNever,...O(e)});var he=class extends N{_parse(e){if(this._getType(e)!==o.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.void,received:t.parsedType}),S}return w(e.data)}};he.create=e=>new he({typeName:Je.ZodVoid,...O(e)});var fe=class e extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==o.array)return v(t,{code:d.invalid_type,expected:o.array,received:t.parsedType}),S;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(v(t,{code:e?d.too_big:d.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(v(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(v(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new C(t,e,t.path,n)))).then(e=>k.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new C(t,e,t.path,n)));return k.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:b.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:b.toString(n)}})}nonempty(e){return this.min(1,e)}};function ge(e){if(e instanceof ye){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=$e.create(ge(a))}return new ye({...e._def,shape:()=>t})}return e instanceof fe?new fe({...e._def,type:ge(e.element)}):e instanceof $e?$e.create(ge(e.unwrap())):e instanceof Re?Re.create(ge(e.unwrap())):e instanceof xe?xe.create(e.items.map(e=>ge(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...O(t)});var ye=class e extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=a.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==o.object){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.object,received:t.parsedType}),S}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof me&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const s=[];for(const e of r){const t=a[e],r=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new C(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof me){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(v(n,{code:d.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new C(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of s){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>k.mergeObjectSync(t,e)):k.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return b.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,i,s;const o=null!=(i=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?i:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(s=b.errToObj(t).message)?s:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const n={};for(const e of a.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){const n={};for(const e of a.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ge(this)}partial(t){const n={};for(const e of a.objectKeys(this.shape)){const a=this.shape[e];t&&!t[e]?n[e]=a:n[e]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){const n={};for(const e of a.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof $e;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Te(a.objectKeys(this.shape))}};ye.create=(e,t)=>new ye({shape:()=>e,unknownKeys:"strip",catchall:me.create(),typeName:Je.ZodObject,...O(t)}),ye.strictCreate=(e,t)=>new ye({shape:()=>e,unknownKeys:"strict",catchall:me.create(),typeName:Je.ZodObject,...O(t)}),ye.lazycreate=(e,t)=>new ye({shape:e,unknownKeys:"strip",catchall:me.create(),typeName:Je.ZodObject,...O(t)});var ve=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new l(e.ctx.common.issues));return v(t,{code:d.invalid_union,unionErrors:n}),S});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new l(e));return v(t,{code:d.invalid_union,unionErrors:r}),S}}get options(){return this._def.options}};ve.create=(e,t)=>new ve({options:e,typeName:Je.ZodUnion,...O(t)});var be=e=>e instanceof Ae?be(e.schema):e instanceof Ie?be(e.innerType()):e instanceof Ce?[e.value]:e instanceof Oe?e.options:e instanceof Ee?a.objectValues(e.enum):e instanceof Me?be(e._def.innerType):e instanceof de?[void 0]:e instanceof ue?[null]:e instanceof $e?[void 0,...be(e.unwrap())]:e instanceof Re?[null,...be(e.unwrap())]:e instanceof Fe||e instanceof qe?be(e.unwrap()):e instanceof De?be(e._def.innerType):[],_e=class e extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.object)return v(t,{code:d.invalid_type,expected:o.object,received:t.parsedType}),S;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,a){const r=new Map;for(const e of n){const n=be(e.shape[t]);if(!n.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of n){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,e)}}return new e({typeName:Je.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...O(a)})}};function ke(e,t){const n=c(e),r=c(t);if(e===t)return{valid:!0,data:e};if(n===o.object&&r===o.object){const n=a.objectKeys(t),r=a.objectKeys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const n of r){const a=ke(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===o.array&&r===o.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=ke(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===o.date&&r===o.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Se=class extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Z(e)||Z(a))return S;const r=ke(e.value,a.value);return r.valid?((j(e)||j(a))&&t.dirty(),{status:t.value,value:r.data}):(v(n,{code:d.invalid_intersection_types}),S)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Se.create=(e,t,n)=>new Se({left:e,right:t,typeName:Je.ZodIntersection,...O(n)});var xe=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==o.array)return v(n,{code:d.invalid_type,expected:o.array,received:n.parsedType}),S;if(n.data.length<this._def.items.length)return v(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&n.data.length>this._def.items.length&&(v(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new C(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>k.mergeArray(t,e)):k.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:Je.ZodTuple,rest:null,...O(t)})};var we=class e extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==o.object)return v(n,{code:d.invalid_type,expected:o.object,received:n.parsedType}),S;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new C(n,e,n.path,e)),value:i._parse(new C(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?k.mergeObjectAsync(t,a):k.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof N?{keyType:t,valueType:n,typeName:Je.ZodRecord,...O(a)}:{keyType:ne.create(),valueType:t,typeName:Je.ZodRecord,...O(n)})}},Ze=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==o.map)return v(n,{code:d.invalid_type,expected:o.map,received:n.parsedType}),S;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:a._parse(new C(n,e,n.path,[i,"key"])),value:r._parse(new C(n,t,n.path,[i,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of i){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return S;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of i){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return S;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Ze.create=(e,t,n)=>new Ze({valueType:t,keyType:e,typeName:Je.ZodMap,...O(n)});var je=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==o.set)return v(n,{code:d.invalid_type,expected:o.set,received:n.parsedType}),S;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(v(n,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(v(n,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const n=new Set;for(const a of e){if("aborted"===a.status)return S;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map((e,t)=>r._parse(new C(n,e,n.path,t)));return n.common.async?Promise.all(s).then(e=>i(e)):i(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:b.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};je.create=(e,t)=>new je({valueType:e,minSize:null,maxSize:null,typeName:Je.ZodSet,...O(t)});var Pe=class e extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.function)return v(t,{code:d.invalid_type,expected:o.function,received:t.parsedType}),S;function n(e,n){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),p].filter(e=>!!e),issueData:{code:d.invalid_arguments,argumentsError:n}})}function a(e,n){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),p].filter(e=>!!e),issueData:{code:d.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ne){const e=this;return w(async function(...t){const s=new l([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw s.addIssue(n(t,e)),s}),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw s.addIssue(a(c,e)),s})})}{const e=this;return w(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new l([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new l([a(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:xe.create(t).rest(pe.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,a){return new e({args:t||xe.create([]).rest(pe.create()),returns:n||pe.create(),typeName:Je.ZodFunction,...O(a)})}},Ae=class extends N{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})}};Ae.create=(e,t)=>new Ae({getter:e,typeName:Je.ZodLazy,...O(t)});var Ce=class extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Te(e,t){return new Oe({values:e,typeName:Je.ZodEnum,...O(t)})}Ce.create=(e,t)=>new Ce({value:e,typeName:Je.ZodLiteral,...O(t)});var Oe=class e extends N{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{expected:a.joinValues(n),received:t.parsedType,code:d.invalid_type}),S}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{received:t.data,code:d.invalid_enum_value,options:n}),S}return w(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(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Oe.create=Te;var Ee=class extends N{_parse(e){const t=a.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==o.string&&n.parsedType!==o.number){const e=a.objectValues(t);return v(n,{expected:a.joinValues(e),received:n.parsedType,code:d.invalid_type}),S}if(this._cache||(this._cache=new Set(a.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=a.objectValues(t);return v(n,{received:n.data,code:d.invalid_enum_value,options:e}),S}return w(e.data)}get enum(){return this._def.values}};Ee.create=(e,t)=>new Ee({values:e,typeName:Je.ZodNativeEnum,...O(t)});var Ne=class extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.promise&&!1===t.common.async)return v(t,{code:d.invalid_type,expected:o.promise,received:t.parsedType}),S;const n=t.parsedType===o.promise?t.data:Promise.resolve(t.data);return w(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ne.create=(e,t)=>new Ne({type:e,typeName:Je.ZodPromise,...O(t)});var Ie=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{v(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return S;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?S:"dirty"===a.status||"dirty"===t.value?x(a.value):a});{if("aborted"===t.value)return S;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?S:"dirty"===a.status||"dirty"===t.value?x(a.value):a}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?S:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?S:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!P(e))return S;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>P(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):S)}a.assertNever(r)}};Ie.create=(e,t,n)=>new Ie({schema:e,typeName:Je.ZodEffects,effect:t,...O(n)}),Ie.createWithPreprocess=(e,t,n)=>new Ie({schema:t,effect:{type:"preprocess",transform:e},typeName:Je.ZodEffects,...O(n)});var $e=class extends N{_parse(e){return this._getType(e)===o.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:Je.ZodOptional,...O(t)});var Re=class extends N{_parse(e){return this._getType(e)===o.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:Je.ZodNullable,...O(t)});var Me=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===o.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Me.create=(e,t)=>new Me({innerType:e,typeName:Je.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...O(t)});var De=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return A(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new l(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new l(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};De.create=(e,t)=>new De({innerType:e,typeName:Je.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...O(t)});var ze=class extends N{_parse(e){if(this._getType(e)!==o.nan){const t=this._getOrReturnCtx(e);return v(t,{code:d.invalid_type,expected:o.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}};ze.create=e=>new ze({typeName:Je.ZodNaN,...O(e)});var Le=Symbol("zod_brand"),Fe=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Ue=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),x(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Je.ZodPipeline})}},qe=class extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(P(e)&&(e.value=Object.freeze(e.value)),e);return A(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ve(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Be(e,t={},n){return e?le.create().superRefine((a,r)=>{var i,s;const o=e(a);if(o instanceof Promise)return o.then(e=>{var i,s;if(!e){const e=Ve(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ve(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):le.create()}qe.create=(e,t)=>new qe({innerType:e,typeName:Je.ZodReadonly,...O(t)});var Je,We,Ke={object:ye.lazycreate};(We=Je||(Je={})).ZodString="ZodString",We.ZodNumber="ZodNumber",We.ZodNaN="ZodNaN",We.ZodBigInt="ZodBigInt",We.ZodBoolean="ZodBoolean",We.ZodDate="ZodDate",We.ZodSymbol="ZodSymbol",We.ZodUndefined="ZodUndefined",We.ZodNull="ZodNull",We.ZodAny="ZodAny",We.ZodUnknown="ZodUnknown",We.ZodNever="ZodNever",We.ZodVoid="ZodVoid",We.ZodArray="ZodArray",We.ZodObject="ZodObject",We.ZodUnion="ZodUnion",We.ZodDiscriminatedUnion="ZodDiscriminatedUnion",We.ZodIntersection="ZodIntersection",We.ZodTuple="ZodTuple",We.ZodRecord="ZodRecord",We.ZodMap="ZodMap",We.ZodSet="ZodSet",We.ZodFunction="ZodFunction",We.ZodLazy="ZodLazy",We.ZodLiteral="ZodLiteral",We.ZodEnum="ZodEnum",We.ZodEffects="ZodEffects",We.ZodNativeEnum="ZodNativeEnum",We.ZodOptional="ZodOptional",We.ZodNullable="ZodNullable",We.ZodDefault="ZodDefault",We.ZodCatch="ZodCatch",We.ZodPromise="ZodPromise",We.ZodBranded="ZodBranded",We.ZodPipeline="ZodPipeline",We.ZodReadonly="ZodReadonly";var He=(e,t={message:`Input not instance of ${e.name}`})=>Be(t=>t instanceof e,t),Ye=ne.create,Ge=re.create,Qe=ze.create,Xe=ie.create,et=se.create,tt=oe.create,nt=ce.create,at=de.create,rt=ue.create,it=le.create,st=pe.create,ot=me.create,ct=he.create,dt=fe.create,ut=ye.create,lt=ye.strictCreate,pt=ve.create,mt=_e.create,ht=Se.create,ft=xe.create,gt=we.create,yt=Ze.create,vt=je.create,bt=Pe.create,_t=Ae.create,kt=Ce.create,St=Oe.create,xt=Ee.create,wt=Ne.create,Zt=Ie.create,jt=$e.create,Pt=Re.create,At=Ie.createWithPreprocess,Ct=Ue.create,Tt=()=>Ye().optional(),Ot=()=>Ge().optional(),Et=()=>et().optional(),Nt={string:e=>ne.create({...e,coerce:!0}),number:e=>re.create({...e,coerce:!0}),boolean:e=>se.create({...e,coerce:!0}),bigint:e=>ie.create({...e,coerce:!0}),date:e=>oe.create({...e,coerce:!0})},It=S,$t=Symbol("Let zodToJsonSchema decide on which parser to use"),Rt={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Mt=e=>{const t=(e=>"string"==typeof e?{...Rt,name:e}:{...Rt,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Dt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function zt(e,t,n,a,r){e[t]=n,Dt(e,t,a,r)}var Lt=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Ft(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Lt(t,e.currentPath):t.join("/")}}function Ut(e,t){return gn(e.type._def,t)}function qt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>qt(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Vt(e,t)}}var Vt=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const a of e.checks)switch(a.kind){case"min":zt(n,"minimum",a.value,a.message,t);break;case"max":zt(n,"maximum",a.value,a.message,t)}return n};var Bt=void 0,Jt=/^[cC][^\s-]{8,}$/,Wt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ht=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Yt=()=>(void 0===Bt&&(Bt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bt),Gt=/^(?:(?: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])$/,Qt=/^(([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])$/,Xt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,en=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tn=/^[a-zA-Z0-9_-]{21}$/,nn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function an(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":zt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":zt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":on(n,"email",a.message,t);break;case"format:idn-email":on(n,"idn-email",a.message,t);break;case"pattern:zod":cn(n,Ht,a.message,t)}break;case"url":on(n,"uri",a.message,t);break;case"uuid":on(n,"uuid",a.message,t);break;case"regex":cn(n,a.regex,a.message,t);break;case"cuid":cn(n,Jt,a.message,t);break;case"cuid2":cn(n,Wt,a.message,t);break;case"startsWith":cn(n,RegExp(`^${rn(a.value,t)}`),a.message,t);break;case"endsWith":cn(n,RegExp(`${rn(a.value,t)}$`),a.message,t);break;case"datetime":on(n,"date-time",a.message,t);break;case"date":on(n,"date",a.message,t);break;case"time":on(n,"time",a.message,t);break;case"duration":on(n,"duration",a.message,t);break;case"length":zt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),zt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":cn(n,RegExp(rn(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&on(n,"ipv4",a.message,t),"v4"!==a.version&&on(n,"ipv6",a.message,t);break;case"base64url":cn(n,en,a.message,t);break;case"jwt":cn(n,nn,a.message,t);break;case"cidr":"v6"!==a.version&&cn(n,Gt,a.message,t),"v4"!==a.version&&cn(n,Qt,a.message,t);break;case"emoji":cn(n,Yt(),a.message,t);break;case"ulid":cn(n,Kt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":on(n,"binary",a.message,t);break;case"contentEncoding:base64":zt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":cn(n,Xt,a.message,t)}break;case"nanoid":cn(n,tn,a.message,t)}return n}function rn(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)sn.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var sn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function on(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):zt(e,"format",t,n,a)}function cn(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:dn(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):zt(e,"pattern",dn(t,a),n,a)}function dn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),i=e.flags.includes("s"),s=a?e.source.toLowerCase():e.source;let o="",c=!1,d=!1,u=!1;for(let e=0;e<s.length;e++)if(c)o+=s[e],c=!1;else{if(a)if(d){if(s[e].match(/[a-z]/)){u?(o+=s[e],o+=`${s[e-2]}-${s[e]}`.toUpperCase(),u=!1):"-"===s[e+1]&&(null==(n=s[e+2])?void 0:n.match(/[a-z]/))?(o+=s[e],u=!0):o+=`${s[e]}${s[e].toUpperCase()}`;continue}}else if(s[e].match(/[a-z]/)){o+=`[${s[e]}${s[e].toUpperCase()}]`;continue}if(r){if("^"===s[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===s[e]){o+="($|(?=[\r\n]))";continue}}i&&"."===s[e]?o+=d?`${s[e]}\r\n`:`[${s[e]}\r\n]`:(o+=s[e],"\\"===s[e]?c=!0:d&&"]"===s[e]?d=!1:d||"["!==s[e]||(d=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function un(e,t){var n,a,r,i,s,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===Je.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=gn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Ft(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=gn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return d;if((null==(r=e.keyType)?void 0:r._def.typeName)===Je.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=an(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Je.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Je.ZodBranded&&e.keyType._def.type._def.typeName===Je.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Ut(e.keyType._def,t);return{...d,propertyNames:a}}return d}var ln={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var pn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>gn(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function mn(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],i=e.shape();for(const e in i){let s=i[e];if(void 0===s||void 0===s._def)continue;let o=hn(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=gn(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return gn(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==s&&(a.additionalProperties=s),a}function hn(e){try{return e.isOptional()}catch(e){return!0}}var fn=(e,t,n)=>{switch(t){case Je.ZodString:return an(e,n);case Je.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"int":n.type="integer",Dt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?zt(n,"minimum",a.value,a.message,t):zt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),zt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?zt(n,"maximum",a.value,a.message,t):zt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),zt(n,"maximum",a.value,a.message,t));break;case"multipleOf":zt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Je.ZodObject:return mn(e,n);case Je.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?zt(n,"minimum",a.value,a.message,t):zt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),zt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?zt(n,"maximum",a.value,a.message,t):zt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),zt(n,"maximum",a.value,a.message,t));break;case"multipleOf":zt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Je.ZodBoolean:return{type:"boolean"};case Je.ZodDate:return qt(e,n);case Je.ZodUndefined:return function(e){return{not:Ft(e)}}(n);case Je.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Je.ZodArray:return function(e,t){var n,a,r;const i={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==Je.ZodAny&&(i.items=gn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&zt(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&zt(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(zt(i,"minItems",e.exactLength.value,e.exactLength.message,t),zt(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Je.ZodUnion:case Je.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return pn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in ln&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=ln[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return pn(e,t)}(e,n);case Je.ZodIntersection:return function(e,t){const n=[gn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),gn(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...a}=e;t=a}else a=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),r.length?{allOf:r,...a}:void 0}(e,n);case Je.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>gn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:gn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>gn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Je.ZodRecord:return un(e,n);case Je.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case Je.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Je.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(n.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case Je.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:ln[e.innerType._def.typeName],nullable:!0}:{type:[ln[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=gn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=gn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Je.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return gn(e.innerType._def,t);const a=gn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Ft(t)},a]}:Ft(t)})(e,n);case Je.ZodMap:return function(e,t){return"record"===t.mapStrategy?un(e,t):{type:"array",maxItems:125,items:{type:"array",items:[gn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ft(t),gn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ft(t)],minItems:2,maxItems:2}}}(e,n);case Je.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:gn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&zt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&zt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Je.ZodLazy:return()=>e.getter()._def;case Je.ZodPromise:return function(e,t){return gn(e.type._def,t)}(e,n);case Je.ZodNaN:case Je.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Ft({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Je.ZodEffects:return function(e,t){return"input"===t.effectStrategy?gn(e.schema._def,t):Ft(t)}(e,n);case Je.ZodAny:return Ft(n);case Je.ZodUnknown:return function(e){return Ft(e)}(n);case Je.ZodDefault:return function(e,t){return{...gn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Je.ZodBranded:return Ut(e,n);case Je.ZodReadonly:case Je.ZodCatch:return((e,t)=>gn(e.innerType._def,t))(e,n);case Je.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return gn(e.in._def,t);if("output"===t.pipeStrategy)return gn(e.out._def,t);const n=gn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,gn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Je.ZodFunction:case Je.ZodVoid:case Je.ZodSymbol:default:return}};function gn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const i=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(i!==$t)return i}if(r&&!n){const e=yn(r,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const s=fn(e,e.typeName,t),o="function"==typeof s?gn(s(),t):s;if(o&&vn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var yn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Lt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ft(t)):"seen"===t.$refStrategy?Ft(t):void 0}},vn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),bn=(e,t)=>{var n;const a=Mt(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=gn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Ft(a)}},{}):void 0;const i="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,s=null!=(n=gn(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:Ft(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(s.title=o),a.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[a.openAiAnyTypeName]||(r[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const c=void 0===i?r?{...s,[a.definitionPath]:r}:s:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,i].join("/"),[a.definitionPath]:{...r,[i]:s}};return"jsonSchema7"===a.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},_n=Object.defineProperty,kn=(e,t)=>{for(var n in t)_n(e,n,{get:t[n],enumerable:!0})},Sn=s.string(),xn=s.number(),wn=(s.boolean(),s.string().min(1)),Zn=s.number().int().positive(),jn=s.number().int().nonnegative(),Pn=s.number().describe("Tagging version number");s.union([s.string(),s.number(),s.boolean()]).optional();kn({},{ErrorHandlerSchema:()=>Tn,HandlerSchema:()=>En,LogHandlerSchema:()=>On,StorageSchema:()=>Cn,StorageTypeSchema:()=>An,errorHandlerJsonSchema:()=>$n,handlerJsonSchema:()=>Mn,logHandlerJsonSchema:()=>Rn,storageJsonSchema:()=>In,storageTypeJsonSchema:()=>Nn});var An=s.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),Cn=s.object({Local:s.literal("local"),Session:s.literal("session"),Cookie:s.literal("cookie")}).describe("Storage type constants for type-safe references"),Tn=s.any().describe("Error handler function: (error, state?) => void"),On=s.any().describe("Log handler function: (message, verbose?) => void"),En=s.object({Error:Tn.describe("Error handler function"),Log:On.describe("Log handler function")}).describe("Handler interface with error and log functions"),Nn=bn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),In=bn(Cn,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),$n=bn(Tn,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Rn=bn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Mn=bn(En,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});s.object({onError:Tn.optional().describe("Error handler function: (error, state?) => void"),onLog:On.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),s.object({verbose:s.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),s.object({queue:s.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),s.object({}).partial(),s.object({init:s.boolean().describe("Whether to initialize immediately").optional(),loadScript:s.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),s.object({disabled:s.boolean().describe("Set to true to disable").optional()}).partial(),s.object({primary:s.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),s.object({settings:s.any().optional().describe("Implementation-specific configuration")}).partial(),s.object({env:s.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),s.object({type:s.string().optional().describe("Instance type identifier"),config:s.any().describe("Instance configuration")}).partial(),s.object({collector:s.any().describe("Collector instance (runtime object)"),config:s.any().describe("Configuration"),env:s.any().describe("Environment dependencies")}).partial(),s.object({batch:s.number().optional().describe("Batch size: bundle N events for batch processing"),batched:s.any().optional().describe("Batch of events to be processed")}).partial(),s.object({ignore:s.boolean().describe("Set to true to skip processing").optional(),condition:s.string().optional().describe("Condition function: return true to process")}).partial(),s.object({sources:s.record(s.string(),s.any()).describe("Map of source instances")}).partial(),s.object({destinations:s.record(s.string(),s.any()).describe("Map of destination instances")}).partial();kn({},{ConsentSchema:()=>qn,DeepPartialEventSchema:()=>Gn,EntitiesSchema:()=>Kn,EntitySchema:()=>Wn,EventSchema:()=>Hn,OrderedPropertiesSchema:()=>Fn,PartialEventSchema:()=>Yn,PropertiesSchema:()=>Ln,PropertySchema:()=>zn,PropertyTypeSchema:()=>Dn,SourceSchema:()=>Jn,SourceTypeSchema:()=>Un,UserSchema:()=>Vn,VersionSchema:()=>Bn,consentJsonSchema:()=>ia,entityJsonSchema:()=>aa,eventJsonSchema:()=>Qn,orderedPropertiesJsonSchema:()=>na,partialEventJsonSchema:()=>Xn,propertiesJsonSchema:()=>ta,sourceTypeJsonSchema:()=>ra,userJsonSchema:()=>ea});var Dn=s.lazy(()=>s.union([s.boolean(),s.string(),s.number(),s.record(s.string(),zn)])),zn=s.lazy(()=>s.union([Dn,s.array(Dn)])),Ln=s.record(s.string(),zn.optional()).describe("Flexible property collection with optional values"),Fn=s.record(s.string(),s.tuple([zn,s.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Un=s.union([s.enum(["web","server","app","other"]),s.string()]).describe("Source type: web, server, app, other, or custom"),qn=s.record(s.string(),s.boolean()).describe("Consent requirement mapping (group name → state)"),Vn=Ln.and(s.object({id:s.string().optional().describe("User identifier"),device:s.string().optional().describe("Device identifier"),session:s.string().optional().describe("Session identifier"),hash:s.string().optional().describe("Hashed identifier"),address:s.string().optional().describe("User address"),email:s.string().email().optional().describe("User email address"),phone:s.string().optional().describe("User phone number"),userAgent:s.string().optional().describe("Browser user agent string"),browser:s.string().optional().describe("Browser name"),browserVersion:s.string().optional().describe("Browser version"),deviceType:s.string().optional().describe("Device type (mobile, desktop, tablet)"),os:s.string().optional().describe("Operating system"),osVersion:s.string().optional().describe("Operating system version"),screenSize:s.string().optional().describe("Screen dimensions"),language:s.string().optional().describe("User language"),country:s.string().optional().describe("User country"),region:s.string().optional().describe("User region/state"),city:s.string().optional().describe("User city"),zip:s.string().optional().describe("User postal code"),timezone:s.string().optional().describe("User timezone"),ip:s.string().optional().describe("User IP address"),internal:s.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Bn=Ln.and(s.object({source:Sn.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Pn})).describe("Walker version information"),Jn=Ln.and(s.object({type:Un.describe("Source type identifier"),id:Sn.describe("Source identifier (typically URL on web)"),previous_id:Sn.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),Wn=s.lazy(()=>s.object({entity:s.string().describe("Entity name"),data:Ln.describe("Entity-specific properties"),nested:s.array(Wn).describe("Nested child entities"),context:Fn.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),Kn=s.array(Wn).describe("Array of nested entities"),Hn=s.object({name:s.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Ln.describe("Event-specific properties"),context:Fn.describe("Ordered context properties with priorities"),globals:Ln.describe("Global properties shared across events"),custom:Ln.describe("Custom implementation-specific properties"),user:Vn.describe("User identification and attributes"),nested:Kn.describe("Related nested entities"),consent:qn.describe("Consent states at event time"),id:wn.describe("Unique event identifier (timestamp-based)"),trigger:Sn.describe("Event trigger identifier"),entity:Sn.describe("Parsed entity from event name"),action:Sn.describe("Parsed action from event name"),timestamp:Zn.describe("Unix timestamp in milliseconds since epoch"),timing:xn.describe("Event processing timing information"),group:Sn.describe("Event grouping identifier"),count:jn.describe("Event count in session"),version:Bn.describe("Walker version information"),source:Jn.describe("Event source information")}).describe("Complete walkerOS event structure"),Yn=Hn.partial().describe("Partial event structure with all fields optional"),Gn=s.lazy(()=>Hn.deepPartial()).describe("Deep partial event structure with all nested fields optional"),Qn=bn(Hn,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),Xn=bn(Yn,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),ea=bn(Vn,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),ta=bn(Ln,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),na=bn(Fn,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),aa=bn(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),ra=bn(Un,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),ia=bn(qn,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});kn({},{ConfigSchema:()=>fa,LoopSchema:()=>ca,MapSchema:()=>ua,PolicySchema:()=>pa,ResultSchema:()=>ga,RuleSchema:()=>ma,RulesSchema:()=>ha,SetSchema:()=>da,ValueConfigSchema:()=>la,ValueSchema:()=>sa,ValuesSchema:()=>oa,configJsonSchema:()=>Za,loopJsonSchema:()=>ba,mapJsonSchema:()=>ka,policyJsonSchema:()=>Sa,ruleJsonSchema:()=>xa,rulesJsonSchema:()=>wa,setJsonSchema:()=>_a,valueConfigJsonSchema:()=>va,valueJsonSchema:()=>ya});var sa=s.lazy(()=>s.union([s.string().describe('String value or property path (e.g., "data.id")'),s.number().describe("Numeric value"),s.boolean().describe("Boolean value"),la,s.array(sa).describe("Array of values")])),oa=s.array(sa).describe("Array of transformation values"),ca=s.tuple([sa,sa]).describe("Loop transformation: [source, transform] tuple for array processing"),da=s.array(sa).describe("Set: Array of values for selection or combination"),ua=s.record(s.string(),sa).describe("Map: Object mapping keys to transformation values"),la=s.object({key:s.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:s.union([s.string(),s.number(),s.boolean()]).optional().describe("Static primitive value"),fn:s.string().optional().describe("Custom transformation function as string (serialized)"),map:ua.optional().describe("Object mapping: transform event data to structured output"),loop:ca.optional().describe("Loop transformation: [source, transform] for array processing"),set:da.optional().describe("Set of values: combine or select from multiple values"),consent:qn.optional().describe("Required consent states to include this value"),condition:s.string().optional().describe("Condition function as string: return true to include value"),validate:s.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),pa=s.record(s.string(),sa).describe("Policy rules for event pre-processing (key → value mapping)"),ma=s.object({batch:s.number().optional().describe("Batch size: bundle N events for batch processing"),condition:s.string().optional().describe("Condition function as string: return true to process event"),consent:qn.optional().describe("Required consent states to process this event"),settings:s.any().optional().describe("Destination-specific settings for this event mapping"),data:s.union([sa,oa]).optional().describe("Data transformation rules for event"),ignore:s.boolean().optional().describe("Set to true to skip processing this event"),name:s.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:pa.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),ha=s.record(s.string(),s.record(s.string(),s.union([ma,s.array(ma)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),fa=s.object({consent:qn.optional().describe("Required consent states to process any events"),data:s.union([sa,oa]).optional().describe("Global data transformation applied to all events"),mapping:ha.optional().describe("Entity-action specific mapping rules"),policy:pa.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),ga=s.object({eventMapping:ma.optional().describe("Resolved mapping rule for event"),mappingKey:s.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),ya=bn(sa,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),va=bn(la,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ba=bn(ca,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),_a=bn(da,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ka=bn(ua,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Sa=bn(pa,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),xa=bn(ma,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),wa=bn(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Za=bn(fa,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});kn({},{BatchSchema:()=>Ia,ConfigSchema:()=>ja,ContextSchema:()=>Ca,DLQSchema:()=>qa,DataSchema:()=>$a,DestinationPolicySchema:()=>Aa,DestinationsSchema:()=>za,InitDestinationsSchema:()=>Da,InitSchema:()=>Ma,InstanceSchema:()=>Ra,PartialConfigSchema:()=>Pa,PushBatchContextSchema:()=>Oa,PushContextSchema:()=>Ta,PushEventSchema:()=>Ea,PushEventsSchema:()=>Na,PushResultSchema:()=>Fa,RefSchema:()=>La,ResultSchema:()=>Ua,batchJsonSchema:()=>Ka,configJsonSchema:()=>Va,contextJsonSchema:()=>Ja,instanceJsonSchema:()=>Ha,partialConfigJsonSchema:()=>Ba,pushContextJsonSchema:()=>Wa,resultJsonSchema:()=>Ya});var ja=s.object({consent:qn.optional().describe("Required consent states to send events to this destination"),settings:s.any().describe("Implementation-specific configuration").optional(),data:s.union([sa,oa]).optional().describe("Global data transformation applied to all events for this destination"),env:s.any().describe("Environment dependencies (platform-specific)").optional(),id:wn.describe("Destination instance identifier (defaults to destination key)").optional(),init:s.boolean().describe("Whether to initialize immediately").optional(),loadScript:s.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:ha.optional().describe("Entity-action specific mapping rules for this destination"),policy:pa.optional().describe("Pre-processing policy rules applied before event mapping"),queue:s.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:s.boolean().describe("Enable verbose logging for debugging").optional(),onError:Tn.optional(),onLog:On.optional()}).describe("Destination configuration"),Pa=ja.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Aa=pa.describe("Destination policy rules for event pre-processing"),Ca=s.object({collector:s.any().describe("Collector instance (runtime object)"),config:ja.describe("Destination configuration"),data:s.union([s.any(),s.undefined(),s.array(s.union([s.any(),s.undefined()]))]).optional().describe("Transformed event data"),env:s.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ta=Ca.extend({mapping:ma.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Oa=Ta.describe("Batch push context with event-specific mapping"),Ea=s.object({event:Hn.describe("The event to process"),mapping:ma.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Na=s.array(Ea).describe("Array of events with mappings"),Ia=s.object({key:s.string().describe('Batch key (usually mapping key like "product.view")'),events:s.array(Hn).describe("Array of events in batch"),data:s.array(s.union([s.any(),s.undefined(),s.array(s.union([s.any(),s.undefined()]))])).describe("Transformed data for each event"),mapping:ma.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),$a=s.union([s.any(),s.undefined(),s.array(s.union([s.any(),s.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Ra=s.object({config:ja.describe("Destination configuration"),queue:s.array(Hn).optional().describe("Queued events awaiting consent"),dlq:s.array(s.tuple([Hn,s.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:s.string().optional().describe("Destination type identifier"),env:s.any().optional().describe("Environment dependencies"),init:s.any().optional().describe("Initialization function"),push:s.any().describe("Push function for single events"),pushBatch:s.any().optional().describe("Batch push function"),on:s.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ma=s.object({code:Ra.describe("Destination instance with implementation"),config:Pa.optional().describe("Partial configuration overrides"),env:s.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Da=s.record(s.string(),Ma).describe("Map of destination IDs to initialization configurations"),za=s.record(s.string(),Ra).describe("Map of destination IDs to runtime instances"),La=s.object({id:s.string().describe("Destination ID"),destination:Ra.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Fa=s.object({queue:s.array(Hn).optional().describe("Events queued (awaiting consent)"),error:s.any().optional().describe("Error if push failed")}).describe("Push operation result"),Ua=s.object({successful:s.array(La).describe("Destinations that processed successfully"),queued:s.array(La).describe("Destinations that queued events"),failed:s.array(La).describe("Destinations that failed to process")}).describe("Overall destination processing result"),qa=s.array(s.tuple([Hn,s.any()])).describe("Dead letter queue: [(event, error), ...]"),Va=bn(ja,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),Ba=bn(Pa,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),Ja=bn(Ca,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),Wa=bn(Ta,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),Ka=bn(Ia,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),Ha=bn(Ra,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),Ya=bn(Ua,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});kn({},{CommandTypeSchema:()=>Ga,ConfigSchema:()=>Qa,DestinationsSchema:()=>ar,InitConfigSchema:()=>er,InstanceSchema:()=>rr,PushContextSchema:()=>tr,SessionDataSchema:()=>Xa,SourcesSchema:()=>nr,commandTypeJsonSchema:()=>ir,configJsonSchema:()=>sr,initConfigJsonSchema:()=>cr,instanceJsonSchema:()=>ur,pushContextJsonSchema:()=>dr,sessionDataJsonSchema:()=>or});var Ga=s.union([s.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),s.string()]).describe("Collector command type: standard commands or custom string for extensions"),Qa=s.object({run:s.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Pn,globalsStatic:Ln.describe("Static global properties that persist across collector runs"),sessionStatic:s.record(s.any()).describe("Static session data that persists across collector runs"),verbose:s.boolean().describe("Enable verbose logging for debugging"),onError:Tn.optional(),onLog:On.optional()}).describe("Core collector configuration"),Xa=Ln.and(s.object({isStart:s.boolean().describe("Whether this is a new session start"),storage:s.boolean().describe("Whether storage is available"),id:wn.describe("Session identifier").optional(),start:Zn.describe("Session start timestamp").optional(),marketing:s.literal(!0).optional().describe("Marketing attribution flag"),updated:Zn.describe("Last update timestamp").optional(),isNew:s.boolean().describe("Whether this is a new session").optional(),device:wn.describe("Device identifier").optional(),count:jn.describe("Event count in session").optional(),runs:jn.describe("Number of runs").optional()})).describe("Session state and tracking data"),er=Qa.partial().extend({consent:qn.optional().describe("Initial consent state"),user:Vn.optional().describe("Initial user data"),globals:Ln.optional().describe("Initial global properties"),sources:s.any().optional().describe("Source configurations"),destinations:s.any().optional().describe("Destination configurations"),custom:Ln.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),tr=s.object({mapping:fa.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),nr=s.record(s.string(),s.any()).describe("Map of source IDs to source instances"),ar=s.record(s.string(),s.any()).describe("Map of destination IDs to destination instances"),rr=s.object({push:s.any().describe("Push function for processing events"),command:s.any().describe("Command function for walker commands"),allowed:s.boolean().describe("Whether event processing is allowed"),config:Qa.describe("Current collector configuration"),consent:qn.describe("Current consent state"),count:s.number().describe("Event count (increments with each event)"),custom:Ln.describe("Custom implementation-specific properties"),sources:nr.describe("Registered source instances"),destinations:ar.describe("Registered destination instances"),globals:Ln.describe("Current global properties"),group:s.string().describe("Event grouping identifier"),hooks:s.any().describe("Lifecycle hook functions"),on:s.any().describe("Event lifecycle configuration"),queue:s.array(Hn).describe("Queued events awaiting processing"),round:s.number().describe("Collector run count (increments with each run)"),session:s.union([s.undefined(),Xa]).describe("Current session state"),timing:s.number().describe("Event processing timing information"),user:Vn.describe("Current user data"),version:s.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),ir=bn(Ga,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),sr=bn(Qa,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),or=bn(Xa,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),cr=bn(er,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),dr=bn(tr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),ur=bn(rr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});kn({},{BaseEnvSchema:()=>lr,ConfigSchema:()=>pr,InitSchema:()=>fr,InitSourceSchema:()=>gr,InitSourcesSchema:()=>yr,InstanceSchema:()=>hr,PartialConfigSchema:()=>mr,baseEnvJsonSchema:()=>vr,configJsonSchema:()=>br,initSourceJsonSchema:()=>Sr,initSourcesJsonSchema:()=>xr,instanceJsonSchema:()=>kr,partialConfigJsonSchema:()=>_r});var lr=s.object({push:s.any().describe("Collector push function"),command:s.any().describe("Collector command function"),sources:s.any().optional().describe("Map of registered source instances"),elb:s.any().describe("Public API function (alias for collector.push)")}).catchall(s.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),pr=fa.extend({settings:s.any().describe("Implementation-specific configuration").optional(),env:lr.optional().describe("Environment dependencies (platform-specific)"),id:wn.describe("Source identifier (defaults to source key)").optional(),onError:Tn.optional(),disabled:s.boolean().describe("Set to true to disable").optional(),primary:s.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),mr=pr.deepPartial().describe("Partial source configuration with all fields deeply optional"),hr=s.object({type:s.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:pr.describe("Current source configuration"),push:s.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:s.any().optional().describe("Cleanup function called when source is removed"),on:s.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),fr=s.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),gr=s.object({code:fr.describe("Source initialization function"),config:mr.optional().describe("Partial configuration overrides"),env:lr.partial().optional().describe("Partial environment overrides"),primary:s.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),yr=s.record(s.string(),gr).describe("Map of source IDs to initialization configurations"),vr=bn(lr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),br=bn(pr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),_r=bn(mr,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),kr=bn(hr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),Sr=bn(gr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),xr=bn(yr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function wr(e){return bn(e,{target:"jsonSchema7",$refStrategy:"none"})}var Zr={merge:!0,shallow:!0,extend:!0};function jr(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Pr(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",r=e.count||1,i=function(e,t={},n={}){n={...Zr,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const i=e[a];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${n}-${a}-${r}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:r,version:{source:"0.3.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(i.entity=n,i.action=a)}return i}function Ar(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return Pr({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}import{getEnv as Cr}from"@walkeros/web-core";var Tr={},Or={};t(Or,{env:()=>Er,events:()=>Rr,mapping:()=>Fr});var Er={};t(Er,{init:()=>Ir,push:()=>$r});var Nr=()=>{},Ir={window:{fbq:void 0,_fbq:void 0},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},$r={window:{fbq:Object.assign(Nr,{callMethod:Nr,queue:[],push:Nr,loaded:!0,version:"2.0"}),_fbq:Object.assign(Nr,{callMethod:Nr,queue:[],push:Nr,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},Rr={};function Mr(){const e=Ar("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function Dr(){const e=Ar("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function zr(){const e=Ar("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function Lr(){const e=Ar("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}t(Rr,{AddToCart:()=>Dr,InitiateCheckout:()=>zr,Purchase:()=>Mr,ViewContent:()=>Lr});var Fr={};t(Fr,{AddToCart:()=>qr,InitiateCheckout:()=>Vr,Purchase:()=>Ur,ViewContent:()=>Br,config:()=>Jr});var Ur={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>jr(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},qr={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},Vr={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>jr(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},Br={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},Jr={order:{complete:Ur},product:{view:Br,add:qr},cart:{view:Vr}},Wr={};t(Wr,{CustomEventName:()=>Yr,MappingSchema:()=>Qr,PixelId:()=>Kr,SettingsSchema:()=>Gr,StandardEventName:()=>Hr,mapping:()=>ei,settings:()=>Xr});var Kr=s.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),Hr=s.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),Yr=s.string().min(1),Gr=s.object({pixelId:Kr.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")}),Qr=s.object({track:Hr.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:Yr.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),Xr=wr(Gr),ei=wr(Qr),ti={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:a,loadScript:r}=e,{pixelId:i}=a||{};if(r&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:a}=n(e),r=a.createElement("script");r.src=t,r.async=!0,a.head.appendChild(r)}(t),!i)return!1;!function(e){const{window:t}=n(e),a=t;if(a.fbq)return;const r=function(...e){r.callMethod?r.callMethod.apply(r,e):r.queue.push(e)};a.fbq=r,a._fbq||(a._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}(t);const{window:s}=Cr(t);(0,s.fbq)("init",i)},push(e,{config:t,mapping:n={},data:a,env:r}){const{track:i,trackCustom:s}=n.settings||{},{window:o}=Cr(r),c=o.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=i||s||e.name;c(s?"trackCustom":"track",String(d),jr(a)?a:{},{eventID:e.id})}},ni=ti;export{Tr as DestinationMeta,ni as default,ti as destinationMeta,Or as examples,Wr as schemas};//# sourceMappingURL=index.mjs.map