@walkeros/walker.js 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,t,n,a=Object.defineProperty,r={};((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})})(r,{BRAND:()=>Le,DIRTY:()=>k,EMPTY_PATH:()=>h,INVALID:()=>b,NEVER:()=>Ct,OK:()=>x,ParseStatus:()=>_,Schema:()=>N,ZodAny:()=>ue,ZodArray:()=>me,ZodBigInt:()=>ae,ZodBoolean:()=>re,ZodBranded:()=>Fe,ZodCatch:()=>Re,ZodDate:()=>se,ZodDefault:()=>Ie,ZodDiscriminatedUnion:()=>ve,ZodEffects:()=>Ce,ZodEnum:()=>Pe,ZodError:()=>u,ZodFirstPartyTypeKind:()=>qe,ZodFunction:()=>Ae,ZodIntersection:()=>be,ZodIssueCode:()=>o,ZodLazy:()=>Se,ZodLiteral:()=>Oe,ZodMap:()=>we,ZodNaN:()=>Me,ZodNativeEnum:()=>je,ZodNever:()=>le,ZodNull:()=>ce,ZodNullable:()=>$e,ZodNumber:()=>ne,ZodObject:()=>he,ZodOptional:()=>Ee,ZodParsedType:()=>s,ZodPipeline:()=>ze,ZodPromise:()=>Ne,ZodReadonly:()=>De,ZodRecord:()=>xe,ZodSchema:()=>N,ZodSet:()=>Ze,ZodString:()=>ee,ZodSymbol:()=>ie,ZodTransformer:()=>Ce,ZodTuple:()=>ke,ZodType:()=>N,ZodUndefined:()=>oe,ZodUnion:()=>ge,ZodUnknown:()=>de,ZodVoid:()=>pe,addIssueToContext:()=>g,any:()=>at,array:()=>ot,bigint:()=>Ye,boolean:()=>Ge,coerce:()=>Nt,custom:()=>Ve,date:()=>Qe,datetimeRegex:()=>H,defaultErrorMap:()=>d,discriminatedUnion:()=>lt,effect:()=>wt,enum:()=>bt,function:()=>yt,getErrorMap:()=>m,getParsedType:()=>i,instanceof:()=>We,intersection:()=>pt,isAborted:()=>w,isAsync:()=>S,isDirty:()=>Z,isValid:()=>A,late:()=>Ke,lazy:()=>vt,literal:()=>_t,makeIssue:()=>f,map:()=>ht,nan:()=>He,nativeEnum:()=>kt,never:()=>st,null:()=>nt,nullable:()=>At,number:()=>Je,object:()=>ct,objectUtil:()=>n,oboolean:()=>jt,onumber:()=>Pt,optional:()=>Zt,ostring:()=>Tt,pipeline:()=>Ot,preprocess:()=>St,promise:()=>xt,quotelessJson:()=>c,record:()=>ft,set:()=>gt,setErrorMap:()=>p,strictObject:()=>ut,string:()=>Xe,symbol:()=>et,transformer:()=>wt,tuple:()=>mt,undefined:()=>tt,union:()=>dt,unknown:()=>rt,util:()=>e,void:()=>it}),(t=e||(e={})).assertEqual=e=>{},t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const t of n)a[t]=e[t];return t.objectValues(a)},t.objectValues=e=>t.objectKeys(e).map(function(t){return e[t]}),t.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},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});var s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},o=e.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"]),c=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),u=class t 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(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.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()}};u.create=e=>new u(e);var d=(t,n)=>{let a;switch(t.code){case o.invalid_type:a=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case o.invalid_union:a="Invalid input";break;case o.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case o.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:a="Invalid function arguments";break;case o.invalid_return_type:a="Invalid function return type";break;case o.invalid_date:a="Invalid date";break;case o.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case o.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case o.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case o.custom:a="Invalid input";break;case o.invalid_intersection_types:a="Intersection results could not be merged";break;case o.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}},l=d;function p(e){l=e}function m(){return l}var f=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},h=[];function g(e,t){const n=m(),a=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===d?void 0:d].filter(e=>!!e)});e.common.issues.push(a)}var y,v,_=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 b;"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 b;if("aborted"===r.status)return b;"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}}},b=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,Z=e=>"dirty"===e.status,A=e=>"valid"===e.status,S=e=>"undefined"!=typeof Promise&&e instanceof Promise;(v=y||(y={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},v.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var O=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(A(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 u(e.common.issues);return this._error=t,this._error}}};function P(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 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:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var j,N=class{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S(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:i(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:i(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return A(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=>A(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:i(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(S(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),s=()=>a.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!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 Ce({schema:this,typeName:qe.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 Ee.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ne.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new Ce({...P(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ie({...P(this._def),innerType:this,defaultValue:t,typeName:qe.ZodDefault})}brand(){return new Fe({typeName:qe.ZodBranded,type:this,...P(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Re({...P(this._def),innerType:this,catchValue:t,typeName:qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ze.create(this,e)}readonly(){return De.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I=/^[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,R=/^[a-z0-9_-]{21}$/i,M=/^[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,z=/^(?:(?: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])$/,D=/^(?:(?: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])$/,U=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([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])))",W=new RegExp(`^${K}$`);function X(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 J(e){return new RegExp(`^${X(e)}$`)}function H(e){let t=`${K}T${X(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 Y(e,t){return!("v4"!==t&&t||!z.test(e))||!("v6"!==t&&t||!U.test(e))}function G(e,t){if(!M.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 Q(e,t){return!("v4"!==t&&t||!D.test(e))||!("v6"!==t&&t||!V.test(e))}var ee=class t extends N{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.string,received:e.parsedType}),b}const n=new _;let a;for(const r of this._def.checks)if("min"===r.kind)t.data.length<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("max"===r.kind)t.data.length>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("length"===r.kind){const e=t.data.length>r.value,s=t.data.length<r.value;(e||s)&&(a=this._getOrReturnCtx(t,a),e?g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if("email"===r.kind)F.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"email",code:o.invalid_string,message:r.message}),n.dirty());else if("emoji"===r.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"emoji",code:o.invalid_string,message:r.message}),n.dirty());else if("uuid"===r.kind)I.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"uuid",code:o.invalid_string,message:r.message}),n.dirty());else if("nanoid"===r.kind)R.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"nanoid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid"===r.kind)C.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid2"===r.kind)E.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid2",code:o.invalid_string,message:r.message}),n.dirty());else if("ulid"===r.kind)$.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ulid",code:o.invalid_string,message:r.message}),n.dirty());else if("url"===r.kind)try{new URL(t.data)}catch(e){a=this._getOrReturnCtx(t,a),g(a,{validation:"url",code:o.invalid_string,message:r.message}),n.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"regex",code:o.invalid_string,message:r.message}),n.dirty())}else if("trim"===r.kind)t.data=t.data.trim();else if("includes"===r.kind)t.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty());else if("toLowerCase"===r.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===r.kind)t.data=t.data.toUpperCase();else if("startsWith"===r.kind)t.data.startsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty());else if("endsWith"===r.kind)t.data.endsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty());else if("datetime"===r.kind){H(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"datetime",message:r.message}),n.dirty())}else if("date"===r.kind){W.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty())}else if("time"===r.kind){J(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"time",message:r.message}),n.dirty())}else"duration"===r.kind?L.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):"ip"===r.kind?Y(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ip",code:o.invalid_string,message:r.message}),n.dirty()):"jwt"===r.kind?G(t.data,r.alg)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"jwt",code:o.invalid_string,message:r.message}),n.dirty()):"cidr"===r.kind?Q(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cidr",code:o.invalid_string,message:r.message}),n.dirty()):"base64"===r.kind?q.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):"base64url"===r.kind?B.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):e.assertNever(r);return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:o.invalid_string,...y.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.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,...y.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,...y.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...y.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"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 te(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}ee.create=e=>{var t;return new ee({checks:[],typeName:qe.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var ne=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.number,received:e.parsedType}),b}let n;const a=new _;for(const r of this._def.checks)if("int"===r.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==te(t.data,r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_finite,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.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)}};ne.create=e=>new ne({checks:[],typeName:qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var ae=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(e){return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let n;const a=new _;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.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}};ae.create=e=>{var t;return new ae({checks:[],typeName:qe.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var re=class extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.boolean,received:t.parsedType}),b}return x(e.data)}};re.create=e=>new re({typeName:qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var se=class t extends N{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.date,received:e.parsedType}),b}if(Number.isNaN(t.data.getTime())){return g(this._getOrReturnCtx(t),{code:o.invalid_date}),b}const n=new _;let a;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?t.data.getTime()>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):e.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.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}};se.create=e=>new se({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:qe.ZodDate,...P(e)});var ie=class extends N{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.symbol,received:t.parsedType}),b}return x(e.data)}};ie.create=e=>new ie({typeName:qe.ZodSymbol,...P(e)});var oe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.undefined,received:t.parsedType}),b}return x(e.data)}};oe.create=e=>new oe({typeName:qe.ZodUndefined,...P(e)});var ce=class extends N{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.null,received:t.parsedType}),b}return x(e.data)}};ce.create=e=>new ce({typeName:qe.ZodNull,...P(e)});var ue=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};ue.create=e=>new ue({typeName:qe.ZodAny,...P(e)});var de=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}};de.create=e=>new de({typeName:qe.ZodUnknown,...P(e)});var le=class extends N{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.never,received:t.parsedType}),b}};le.create=e=>new le({typeName:qe.ZodNever,...P(e)});var pe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.void,received:t.parsedType}),b}return x(e.data)}};pe.create=e=>new pe({typeName:qe.ZodVoid,...P(e)});var me=class e extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==s.array)return g(t,{code:o.invalid_type,expected:s.array,received:t.parsedType}),b;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(g(t,{code:e?o.too_big:o.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&&(g(t,{code:o.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&&(g(t,{code:o.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 O(t,e,t.path,n)))).then(e=>_.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new O(t,e,t.path,n)));return _.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:y.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:y.toString(n)}})}nonempty(e){return this.min(1,e)}};function fe(e){if(e instanceof he){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Ee.create(fe(a))}return new he({...e._def,shape:()=>t})}return e instanceof me?new me({...e._def,type:fe(e.element)}):e instanceof Ee?Ee.create(fe(e.unwrap())):e instanceof $e?$e.create(fe(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>fe(e))):e}me.create=(e,t)=>new me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...P(t)});var he=class t 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 t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof le&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const c=[];for(const e of r){const t=a[e],r=n.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new O(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof le){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)c.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(g(n,{code:o.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];c.push({key:{status:"valid",value:t},value:e._parse(new O(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of c){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new t({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,t,n).message)?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!=(i=y.errToObj(e).message)?i:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const a={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}omit(n){const a={};for(const t of e.objectKeys(this.shape))n[t]||(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}deepPartial(){return fe(this)}partial(n){const a={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?a[t]=e:a[t]=e.optional()}return new t({...this._def,shape:()=>a})}required(n){const a={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])a[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ee;)e=e._def.innerType;a[t]=e}return new t({...this._def,shape:()=>a})}keyof(){return Te(e.objectKeys(this.shape))}};he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)});var ge=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 u(e.ctx.common.issues));return g(t,{code:o.invalid_union,unionErrors:n}),b});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,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 u(e));return g(t,{code:o.invalid_union,unionErrors:r}),b}}get options(){return this._def.options}};ge.create=(e,t)=>new ge({options:e,typeName:qe.ZodUnion,...P(t)});var ye=t=>t instanceof Se?ye(t.schema):t instanceof Ce?ye(t.innerType()):t instanceof Oe?[t.value]:t instanceof Pe?t.options:t instanceof je?e.objectValues(t.enum):t instanceof Ie?ye(t._def.innerType):t instanceof oe?[void 0]:t instanceof ce?[null]:t instanceof Ee?[void 0,...ye(t.unwrap())]:t instanceof $e?[null,...ye(t.unwrap())]:t instanceof Fe||t instanceof De?ye(t.unwrap()):t instanceof Re?ye(t._def.innerType):[],ve=class e extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b;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}):(g(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),b)}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=ye(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:qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...P(a)})}};function _e(t,n){const a=i(t),r=i(n);if(t===n)return{valid:!0,data:t};if(a===s.object&&r===s.object){const a=e.objectKeys(n),r=e.objectKeys(t).filter(e=>-1!==a.indexOf(e)),s={...t,...n};for(const e of r){const a=_e(t[e],n[e]);if(!a.valid)return{valid:!1};s[e]=a.data}return{valid:!0,data:s}}if(a===s.array&&r===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let a=0;a<t.length;a++){const r=_e(t[a],n[a]);if(!r.valid)return{valid:!1};e.push(r.data)}return{valid:!0,data:e}}return a===s.date&&r===s.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var be=class extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(w(e)||w(a))return b;const r=_e(e.value,a.value);return r.valid?((Z(e)||Z(a))&&t.dirty(),{status:t.value,value:r.data}):(g(n,{code:o.invalid_intersection_types}),b)};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}))}};be.create=(e,t,n)=>new be({left:e,right:t,typeName:qe.ZodIntersection,...P(n)});var ke=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return g(n,{code:o.invalid_type,expected:s.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return g(n,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:o.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 O(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:qe.ZodTuple,rest:null,...P(t)})};var xe=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!==s.object)return g(n,{code:o.invalid_type,expected:s.object,received:n.parsedType}),b;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new O(n,e,n.path,e)),value:i._parse(new O(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_.mergeObjectAsync(t,a):_.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:qe.ZodRecord,...P(a)}:{keyType:ee.create(),valueType:t,typeName:qe.ZodRecord,...P(n)})}},we=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!==s.map)return g(n,{code:o.invalid_type,expected:s.map,received:n.parsedType}),b;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new O(n,e,n.path,[s,"key"])),value:r._parse(new O(n,t,n.path,[s,"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 b;"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 b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};we.create=(e,t,n)=>new we({valueType:t,keyType:e,typeName:qe.ZodMap,...P(n)});var Ze=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return g(n,{code:o.invalid_type,expected:s.set,received:n.parsedType}),b;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(g(n,{code:o.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&&(g(n,{code:o.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 b;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const c=[...n.data.values()].map((e,t)=>r._parse(new O(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>i(e)):i(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:y.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ze.create=(e,t)=>new Ze({valueType:e,minSize:null,maxSize:null,typeName:qe.ZodSet,...P(t)});var Ae=class e extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return g(t,{code:o.invalid_type,expected:s.function,received:t.parsedType}),b;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_arguments,argumentsError:n}})}function a(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ne){const e=this;return x(async function(...t){const s=new u([]),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 x(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new u([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new u([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:ke.create(t).rest(de.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||ke.create([]).rest(de.create()),returns:n||de.create(),typeName:qe.ZodFunction,...P(a)})}},Se=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})}};Se.create=(e,t)=>new Se({getter:e,typeName:qe.ZodLazy,...P(t)});var Oe=class extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Te(e,t){return new Pe({values:e,typeName:qe.ZodEnum,...P(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:qe.ZodLiteral,...P(t)});var Pe=class t extends N{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),a=this._def.values;return g(n,{expected:e.joinValues(a),received:n.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return g(e,{received:e.data,code:o.invalid_enum_value,options:n}),b}return x(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};Pe.create=Te;var je=class extends N{_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==s.string&&a.parsedType!==s.number){const t=e.objectValues(n);return g(a,{expected:e.joinValues(t),received:a.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return g(a,{received:a.data,code:o.invalid_enum_value,options:t}),b}return x(t.data)}get enum(){return this._def.values}};je.create=(e,t)=>new je({values:e,typeName:qe.ZodNativeEnum,...P(t)});var Ne=class extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return g(t,{code:o.invalid_type,expected:s.promise,received:t.parsedType}),b;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return x(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ne.create=(e,t)=>new Ne({type:e,typeName:qe.ZodPromise,...P(t)});var Ce=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:e=>{g(a,e),e.fatal?n.abort():n.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"===n.value)return b;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t});{if("aborted"===n.value)return b;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t}}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 t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.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(!A(e))return b;const t=r.transform(e.value,s);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>A(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:n.value,value:e})):b)}e.assertNever(r)}};Ce.create=(e,t,n)=>new Ce({schema:e,typeName:qe.ZodEffects,effect:t,...P(n)}),Ce.createWithPreprocess=(e,t,n)=>new Ce({schema:t,effect:{type:"preprocess",transform:e},typeName:qe.ZodEffects,...P(n)});var Ee=class extends N{_parse(e){return this._getType(e)===s.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ee.create=(e,t)=>new Ee({innerType:e,typeName:qe.ZodOptional,...P(t)});var $e=class extends N{_parse(e){return this._getType(e)===s.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:qe.ZodNullable,...P(t)});var Ie=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...P(t)});var Re=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 S(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...P(t)});var Me=class extends N{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}};Me.create=e=>new Me({typeName:qe.ZodNaN,...P(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}},ze=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?b:"dirty"===e.status?(t.dirty(),k(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?b:"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:qe.ZodPipeline})}},De=class extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return S(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ue(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Ve(e,t={},n){return e?ue.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}De.create=(e,t)=>new De({innerType:e,typeName:qe.ZodReadonly,...P(t)});var qe,Be,Ke={object:he.lazycreate};(Be=qe||(qe={})).ZodString="ZodString",Be.ZodNumber="ZodNumber",Be.ZodNaN="ZodNaN",Be.ZodBigInt="ZodBigInt",Be.ZodBoolean="ZodBoolean",Be.ZodDate="ZodDate",Be.ZodSymbol="ZodSymbol",Be.ZodUndefined="ZodUndefined",Be.ZodNull="ZodNull",Be.ZodAny="ZodAny",Be.ZodUnknown="ZodUnknown",Be.ZodNever="ZodNever",Be.ZodVoid="ZodVoid",Be.ZodArray="ZodArray",Be.ZodObject="ZodObject",Be.ZodUnion="ZodUnion",Be.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Be.ZodIntersection="ZodIntersection",Be.ZodTuple="ZodTuple",Be.ZodRecord="ZodRecord",Be.ZodMap="ZodMap",Be.ZodSet="ZodSet",Be.ZodFunction="ZodFunction",Be.ZodLazy="ZodLazy",Be.ZodLiteral="ZodLiteral",Be.ZodEnum="ZodEnum",Be.ZodEffects="ZodEffects",Be.ZodNativeEnum="ZodNativeEnum",Be.ZodOptional="ZodOptional",Be.ZodNullable="ZodNullable",Be.ZodDefault="ZodDefault",Be.ZodCatch="ZodCatch",Be.ZodPromise="ZodPromise",Be.ZodBranded="ZodBranded",Be.ZodPipeline="ZodPipeline",Be.ZodReadonly="ZodReadonly";var We=(e,t={message:`Input not instance of ${e.name}`})=>Ve(t=>t instanceof e,t),Xe=ee.create,Je=ne.create,He=Me.create,Ye=ae.create,Ge=re.create,Qe=se.create,et=ie.create,tt=oe.create,nt=ce.create,at=ue.create,rt=de.create,st=le.create,it=pe.create,ot=me.create,ct=he.create,ut=he.strictCreate,dt=ge.create,lt=ve.create,pt=be.create,mt=ke.create,ft=xe.create,ht=we.create,gt=Ze.create,yt=Ae.create,vt=Se.create,_t=Oe.create,bt=Pe.create,kt=je.create,xt=Ne.create,wt=Ce.create,Zt=Ee.create,At=$e.create,St=Ce.createWithPreprocess,Ot=ze.create,Tt=()=>Xe().optional(),Pt=()=>Je().optional(),jt=()=>Ge().optional(),Nt={string:e=>ee.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>re.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>se.create({...e,coerce:!0})},Ct=b,Et=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"},It=e=>{const t=(e=>"string"==typeof e?{...$t,name:e}:{...$t,...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 Rt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Mt(e,t,n,a,r){e[t]=n,Rt(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 zt(e,t){return fn(e.type._def,t)}function Dt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Dt(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 Ut(e,t)}}var Ut=(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":Mt(n,"minimum",a.value,a.message,t);break;case"max":Mt(n,"maximum",a.value,a.message,t)}return n};var Vt=void 0,qt=/^[cC][^\s-]{8,}$/,Bt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Xt=()=>(void 0===Vt&&(Vt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Vt),Jt=/^(?:(?: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])$/,Ht=/^(([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])$/,Yt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt=/^[a-zA-Z0-9_-]{21}$/,en=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function tn(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Mt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Mt(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":rn(n,"email",a.message,t);break;case"format:idn-email":rn(n,"idn-email",a.message,t);break;case"pattern:zod":sn(n,Wt,a.message,t)}break;case"url":rn(n,"uri",a.message,t);break;case"uuid":rn(n,"uuid",a.message,t);break;case"regex":sn(n,a.regex,a.message,t);break;case"cuid":sn(n,qt,a.message,t);break;case"cuid2":sn(n,Bt,a.message,t);break;case"startsWith":sn(n,RegExp(`^${nn(a.value,t)}`),a.message,t);break;case"endsWith":sn(n,RegExp(`${nn(a.value,t)}$`),a.message,t);break;case"datetime":rn(n,"date-time",a.message,t);break;case"date":rn(n,"date",a.message,t);break;case"time":rn(n,"time",a.message,t);break;case"duration":rn(n,"duration",a.message,t);break;case"length":Mt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Mt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":sn(n,RegExp(nn(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&rn(n,"ipv4",a.message,t),"v4"!==a.version&&rn(n,"ipv6",a.message,t);break;case"base64url":sn(n,Gt,a.message,t);break;case"jwt":sn(n,en,a.message,t);break;case"cidr":"v6"!==a.version&&sn(n,Jt,a.message,t),"v4"!==a.version&&sn(n,Ht,a.message,t);break;case"emoji":sn(n,Xt(),a.message,t);break;case"ulid":sn(n,Kt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":rn(n,"binary",a.message,t);break;case"contentEncoding:base64":Mt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":sn(n,Yt,a.message,t)}break;case"nanoid":sn(n,Qt,a.message,t)}return n}function nn(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)an.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var an=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function rn(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}}})):Mt(e,"format",t,n,a)}function sn(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:on(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Mt(e,"pattern",on(t,a),n,a)}function on(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!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+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!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 cn(e,t){var n,a,r,s,i,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)===qe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Ft(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===qe.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=tn(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===qe.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===qe.ZodBranded&&e.keyType._def.type._def.typeName===qe.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=zt(e.keyType._def,t);return{...u,propertyNames:a}}return u}var un={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var dn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>fn(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 ln(e,t){const n="openAi"===t.target,a={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=pn(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=fn(i._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 i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return fn(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&&(a.additionalProperties=i),a}function pn(e){try{return e.isOptional()}catch(e){return!0}}var mn=(e,t,n)=>{switch(t){case qe.ZodString:return tn(e,n);case qe.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",Rt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Mt(n,"minimum",a.value,a.message,t):Mt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Mt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Mt(n,"maximum",a.value,a.message,t):Mt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Mt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Mt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodObject:return ln(e,n);case qe.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?Mt(n,"minimum",a.value,a.message,t):Mt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Mt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Mt(n,"maximum",a.value,a.message,t):Mt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Mt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Mt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodBoolean:return{type:"boolean"};case qe.ZodDate:return Dt(e,n);case qe.ZodUndefined:return function(e){return{not:Ft(e)}}(n);case qe.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case qe.ZodArray:return function(e,t){var n,a,r;const s={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)!==qe.ZodAny&&(s.items=fn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Mt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Mt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Mt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Mt(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case qe.ZodUnion:case qe.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return dn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in un&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=un[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 dn(e,t)}(e,n);case qe.ZodIntersection:return function(e,t){const n=[fn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),fn(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 qe.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:fn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case qe.ZodRecord:return cn(e,n);case qe.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 qe.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case qe.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 qe.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:un[e.innerType._def.typeName],nullable:!0}:{type:[un[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case qe.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return fn(e.innerType._def,t);const a=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Ft(t)},a]}:Ft(t)})(e,n);case qe.ZodMap:return function(e,t){return"record"===t.mapStrategy?cn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[fn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ft(t),fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ft(t)],minItems:2,maxItems:2}}}(e,n);case qe.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Mt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Mt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case qe.ZodLazy:return()=>e.getter()._def;case qe.ZodPromise:return function(e,t){return fn(e.type._def,t)}(e,n);case qe.ZodNaN:case qe.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Ft({...e,currentPath:[...e.currentPath,"not"]})}}(n);case qe.ZodEffects:return function(e,t){return"input"===t.effectStrategy?fn(e.schema._def,t):Ft(t)}(e,n);case qe.ZodAny:return Ft(n);case qe.ZodUnknown:return function(e){return Ft(e)}(n);case qe.ZodDefault:return function(e,t){return{...fn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case qe.ZodBranded:return zt(e,n);case qe.ZodReadonly:case qe.ZodCatch:return((e,t)=>fn(e.innerType._def,t))(e,n);case qe.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return fn(e.in._def,t);if("output"===t.pipeStrategy)return fn(e.out._def,t);const n=fn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,fn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case qe.ZodFunction:case qe.ZodVoid:case qe.ZodSymbol:default:return}};function fn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Et)return s}if(r&&!n){const e=hn(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=mn(e,e.typeName,t),o="function"==typeof i?fn(i(),t):i;if(o&&gn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var hn=(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}},gn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),yn=(e,t)=>{var n;const a=It(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=fn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Ft(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=fn(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:Ft(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.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===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};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},vn={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},_n=r.record(r.string(),r.boolean()).describe("Consent requirement mapping"),bn=r.lazy(()=>r.union([r.string(),r.number(),r.boolean(),Zn,r.array(bn)])),kn=r.tuple([bn,bn]).describe("Loop: [source, transform] tuple for array transformations"),xn=r.array(bn).describe("Set: Array of values"),wn=r.record(r.string(),bn).describe("Map: Object mapping keys to values"),Zn=r.object({key:r.string().optional().describe('Property path (e.g., "data.id")'),value:r.union([r.string(),r.number(),r.boolean()]).optional().describe("Static primitive value"),fn:r.string().optional().describe("Function string for custom transformation"),map:wn.optional().describe("Object with key-value mappings"),loop:kn.optional().describe("Tuple [source, transform]"),set:xn.optional().describe("Array of values"),consent:_n.optional().describe("Required consent states"),condition:r.string().optional().describe("Condition function string"),validate:r.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"),An=kn,Sn=xn,On=wn,Tn=(yn(Zn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),yn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),yn(Sn,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),yn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Pn(e,t={},n={}){n={...Tn,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function jn(e){return Array.isArray(e)}function Nn(e){return void 0!==e}function Cn(e){return"object"==typeof e&&null!==e&&!jn(e)&&"[object Object]"===Object.prototype.toString.call(e)}function En(e){return"string"==typeof e}function $n(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=$n(e[a],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push($n(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function In(e,t="",n){const a=t.split(".");let r=e;for(let e=0;e<a.length;e++){const t=a[e];if("*"===t&&jn(r)){const t=a.slice(e+1).join("."),s=[];for(const e of r){const a=In(e,t,n);s.push(a)}return s}if(r=r instanceof Object?r[t]:void 0,!r)break}return Nn(r)?r:n}function Rn(e,t,n){if(!Cn(e))return e;const a=$n(e),r=t.split(".");let s=a;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?s[t]=n:(t in s&&"object"==typeof s[t]&&null!==s[t]||(s[t]={}),s=s[t])}return a}function Mn(e,t={},n={}){const a={...t,...n},r={};let s=void 0===e;return Object.keys(a).forEach(t=>{a[t]&&(r[t]=!0,e&&e[t]&&(s=!0))}),!!s&&r}function Ln(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Fn(e){return function(e){return"boolean"==typeof e}(e)||En(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!Nn(e)||jn(e)&&e.every(Fn)||Cn(e)&&Object.values(e).every(Fn)}function zn(e){return Fn(e)?e:void 0}function Dn(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Un(e,t,n){return async function(...a){try{return await e(...a)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function Vn(e,t={},n={}){var a;if(!Nn(e))return;const r=Cn(e)&&e.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),s=jn(t)?t:[t];for(const t of s){const a=await Un(qn)(e,t,{...n,consent:r});if(Nn(a))return a}}async function qn(e,t,n={}){const{collector:a,consent:r}=n;return(jn(t)?t:[t]).reduce(async(t,s)=>{const i=await t;if(i)return i;const o=En(s)?{key:s}:s;if(!Object.keys(o).length)return;const{condition:c,consent:u,fn:d,key:l,loop:p,map:m,set:f,validate:h,value:g}=o;if(c&&!await Un(c)(e,s,a))return;if(u&&!Mn(u,r))return g;let y=Nn(g)?g:e;if(d&&(y=await Un(d)(e,s,n)),l&&(y=In(e,l,g)),p){const[t,a]=p,r="this"===t?[e]:await Vn(e,t,n);jn(r)&&(y=(await Promise.all(r.map(e=>Vn(e,a,n)))).filter(Nn))}else m?y=await Object.entries(m).reduce(async(t,[a,r])=>{const s=await t,i=await Vn(e,r,n);return Nn(i)&&(s[a]=i),s},Promise.resolve({})):f&&(y=await Promise.all(f.map(t=>qn(e,t,n))));h&&!await Un(h)(y)&&(y=void 0);const v=zn(y);return Nn(v)?v:zn(g)},Promise.resolve(void 0))}async function Bn(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));const{eventMapping:a,mappingKey:r}=await async function(e,t){var n;const[a,r]=(e.name||"").split(" ");if(!t||!a||!r)return{};let s,i="",o=a,c=r;const u=t=>{if(t)return(t=jn(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[o]||(o="*");const d=t[o];return d&&(d[c]||(c="*"),s=u(d[c])),s||(o="*",c="*",s=u(null==(n=t[o])?void 0:n[c])),s&&(i=`${o} ${c}`),{eventMapping:s,mappingKey:i}}(e,t.mapping);(null==a?void 0:a.policy)&&await Promise.all(Object.entries(a.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));let s=t.data&&await Vn(e,t.data,{collector:n});if(a){if(a.ignore)return{event:e,data:s,mapping:a,mappingKey:r,ignore:!0};if(a.name&&(e.name=a.name),a.data){const t=a.data&&await Vn(e,a.data,{collector:n});s=Cn(s)&&Cn(t)?Pn(s,t):t}}return{event:e,data:s,mapping:a,mappingKey:r,ignore:!1}}function Kn(e,t,n){return function(...a){let r;const s="post"+t,i=n["pre"+t],o=n[s];return r=i?i({fn:e},...a):e(...a),o&&(r=o({fn:e,result:r},...a)),r}}var Wn={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"};async function Xn(e,t,n){const{allowed:a,consent:r,globals:s,user:i}=e;if(!a)return Yn({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const o=await Promise.all(Object.entries(n||{}).map(async([n,a])=>{let o=(a.queue||[]).map(e=>({...e,consent:r}));if(a.queue=[],t){const e=$n(t);o.push(e)}if(!o.length)return{id:n,destination:a,skipped:!0};const c=[],u=o.filter(e=>{const t=Mn(a.config.consent,r,e.consent);return!t||(e.consent=t,c.push(e),!1)});if(a.queue.concat(u),!c.length)return{id:n,destination:a,queue:o};if(!await Un(Jn)(e,a))return{id:n,destination:a,queue:o};let d=!1;return a.dlq||(a.dlq=[]),await Promise.all(c.map(async t=>(t.globals=Pn(s,t.globals),t.user=Pn(i,t.user),await Un(Hn,n=>(e.config.onError&&e.config.onError(n,e),d=!0,a.dlq.push([t,n]),!1))(e,a,t),t))),{id:n,destination:a,error:d}})),c=[],u=[],d=[];for(const e of o){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?d.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),u.push(n)):c.push(n)}return Yn({ok:!d.length,event:t,successful:c,queued:u,failed:d})}async function Jn(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:Gn(t.env,t.config.env)},a=await Kn(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function Hn(e,t,n){var a;const{config:r}=t,s=await Bn(n,r,e);if(s.ignore)return!1;const i={collector:e,config:r,data:s.data,mapping:s.mapping,env:Gn(t.env,r.env)},o=s.mapping;if((null==o?void 0:o.batch)&&t.pushBatch){const n=o.batched||{key:s.mappingKey||"",events:[],data:[]};n.events.push(s.event),Nn(s.data)&&n.data.push(s.data),o.batchFn=o.batchFn||function(e,t=1e3,n=!1){let a,r=null,s=!1;return(...i)=>new Promise(o=>{const c=n&&!s;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!s||(a=e(...i),o(a))},t),c&&(s=!0,a=e(...i),o(a))})}((e,t)=>{const a={collector:t,config:r,data:s.data,mapping:o,env:Gn(e.env,r.env)};Kn(e.pushBatch,"DestinationPushBatch",t.hooks)(n,a),n.events=[],n.data=[]},o.batch),o.batched=n,null==(a=o.batchFn)||a.call(o,t,e)}else await Kn(t.push,"DestinationPush",e.hooks)(s.event,i);return!0}function Yn(e){var t;return Pn({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function Gn(e,t){return e||t?t?e&&Cn(e)&&Cn(t)?{...e,...t}:t:e:{}}function Qn(e,t,n,a){let r,s=n||[];switch(n||(s=e.on[t]||[]),t){case Wn.Consent:r=a||e.consent;break;case Wn.Session:r=e.session;break;case Wn.Ready:case Wn.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&Dn(e.on)(t,r)}),Object.values(e.destinations).forEach(e=>{if(e.on){Dn(e.on)(t,r)}}),s.length)switch(t){case Wn.Consent:!function(e,t,n){const a=n||e.consent;t.forEach(t=>{Object.keys(a).filter(e=>e in t).forEach(n=>{Dn(t[n])(e,a)})})}(e,s,a);break;case Wn.Ready:case Wn.Run:o=s,(i=e).allowed&&o.forEach(e=>{Dn(e)(i)});break;case Wn.Session:!function(e,t){e.session&&t.forEach(t=>{Dn(t)(e,e.session)})}(e,s)}var i,o}async function ea(e,t,n,a){let r;switch(t){case Wn.Config:Cn(n)&&Pn(e.config,n,{shallow:!1});break;case Wn.Consent:Cn(n)&&(r=await async function(e,t){const{consent:n}=e;let a=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,a=a||n}),e.consent=Pn(n,r),Qn(e,"consent",void 0,r),a?Xn(e):Yn({ok:!0})}(e,n));break;case Wn.Custom:Cn(n)&&(e.custom=Pn(e.custom,n));break;case Wn.Destination:Cn(n)&&"function"==typeof n.push&&(r=await async function(e,t,n){const{code:a,config:r={},env:s={}}=t,i=n||r||{init:!1},o={...a,config:i,env:Gn(a.env,s)};let c=o.config.id;if(!c)do{c=Ln(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),Xn(e,void 0,{[c]:o})}(e,{code:n},a));break;case Wn.Globals:Cn(n)&&(e.globals=Pn(e.globals,n));break;case Wn.On:En(n)&&function(e,t,n){const a=e.on,r=a[t]||[],s=jn(n)?n:[n];s.forEach(e=>{r.push(e)}),a[t]=r,Qn(e,t,s)}(e,n,a);break;case Wn.Ready:Qn(e,"ready");break;case Wn.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Ln(),e.timing=Date.now(),t&&(t.consent&&(e.consent=Pn(e.consent,t.consent)),t.user&&(e.user=Pn(e.user,t.user)),t.globals&&(e.globals=Pn(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=Pn(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await Xn(e);return Qn(e,"run"),n}(e,n);break;case Wn.Session:Qn(e,"session");break;case Wn.User:Cn(n)&&Pn(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ta(e,t){return Kn(async(n,a={})=>await Un(async()=>{let r=n;if(a.mapping){const t=await Bn(r,a.mapping,e);if(t.ignore)return Yn({ok:!0});if(a.mapping.consent&&!Mn(a.mapping.consent,e.consent,t.event.consent))return Yn({ok:!0});r=t.event}const s=t(r),i=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,a]=t.name.split(" ");if(!n||!a)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:s=e.group,count:i=e.count}=t,{name:o=`${n} ${a}`,data:c={},context:u={},globals:d=e.globals,custom:l={},user:p=e.user,nested:m=[],consent:f=e.consent,id:h=`${r}-${s}-${i}`,trigger:g="",entity:y=n,action:v=a,timing:_=0,version:b={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:o,data:c,context:u,globals:d,custom:l,user:p,nested:m,consent:f,id:h,trigger:g,entity:y,action:v,timestamp:r,timing:_,group:s,count:i,version:b,source:k}}(e,s);return await Xn(e,i)},()=>Yn({ok:!1}))(),"Push",e.hooks)}async function na(e){const t=Pn({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:n,run:!0},e,{merge:!1,extend:!1});function n(e,n){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},n||t.verbose)}t.onLog=n;const a={...t.globalsStatic,...e.globals},r={allowed:!1,config:t,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:a,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.2.1",sources:{},push:void 0,command:void 0};return r.push=ta(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(i=ea,Kn(async(e,t,n)=>await Un(async()=>await i(s,e,t,n),()=>Yn({ok:!1}))(),"Command",(s=r).hooks)),r.destinations=await async function(e,t={}){const n={};for(const[e,a]of Object.entries(t)){const{code:t,config:r={},env:s={}}=a,i={...t.config,...r},o=Gn(t.env,s);n[e]={...t,config:i,env:o}}return n}(0,e.destinations||{}),r;var s,i}async function aa(e){e=e||{};const t=await na(e),n=(a=t,{type:"elb",config:{},push:async(e,t,n,r,s,i)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return a.command(r,t,n)}let o;if("string"==typeof e)o={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(o.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};o=e,t&&"object"==typeof t&&!Array.isArray(t)&&(o.data={...o.data||{},...t})}return r&&"object"==typeof r&&(o.context=r),s&&Array.isArray(s)&&(o.nested=s),i&&"object"==typeof i&&(o.custom=i),a.push(o)}});var a;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[a,r]of Object.entries(t)){const{code:t,config:s={},env:i={},primary:o}=r,c={push:(t,n={})=>e.push(t,{...n,mapping:s}),command:e.command,sources:e.sources,elb:e.sources.elb.push,...i},u=await Un(t)(s,c);u&&(o&&(u.config={...u.config,primary:o}),n[a]=u)}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:s,user:i,globals:o,custom:c}=e;s&&await t.command("consent",s),i&&await t.command("user",i),o&&Object.assign(t.globals,o),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const d=Object.values(t.sources).filter(e=>"elb"!==e.type),l=d.find(e=>e.config.primary);return l?u=l.push:d.length>0&&(u=d[0].push),{collector:t,elb:u}}function ra(e,t){return(e.getAttribute(t)||"").trim()}var sa=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function ia(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const a=window.innerHeight,r=e.getBoundingClientRect(),s=r.height,i=r.y,o=i+s,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(s<=a){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=a/2;if(i<0&&o<e)return!1;if(o>a&&i>e)return!1;n=document.elementFromPoint(c.x,a/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function oa(e,t,n){return!1===n?e:(n||(n=la),n(e,t,la))}var ca,ua,da,la=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):sa("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):sa({name:"session start",data:e})),e};function pa(e,t=vn.Storage.Session){var n;function a(e){try{return JSON.parse(e||"")}catch(t){let n=1,a="";return e&&(n=0,a=e),{e:n,v:a}}}let r,s;switch(t){case vn.Storage.Cookie:r=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case vn.Storage.Local:s=a(window.localStorage.getItem(e));break;case vn.Storage.Session:s=a(window.sessionStorage.getItem(e))}return s&&(r=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=vn.Storage.Session){switch(t){case vn.Storage.Cookie:ma(e,"",0,t);break;case vn.Storage.Local:window.localStorage.removeItem(e);break;case vn.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),r="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(r||"")}function ma(e,t,n=30,a=vn.Storage.Session,r){const s={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(s);switch(a){case vn.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let a=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;r&&(a+="; domain="+r),document.cookie=a;break}case vn.Storage.Local:window.localStorage.setItem(e,i);break;case vn.Storage.Session:window.sessionStorage.setItem(e,i)}return pa(e,a)}function fa(e={}){const t=Date.now(),{length:n=30,deviceKey:a="elbDeviceId",deviceStorage:r="local",deviceAge:s=30,sessionKey:i="elbSessionId",sessionStorage:o="local",pulse:c=!1}=e,u=ha(e);let d=!1;const l=Dn((e,t,n)=>{let a=pa(e,n);return a||(a=Ln(8),ma(e,a,1440*t,n)),String(a)})(a,s,r),p=Dn((e,a)=>{const r=JSON.parse(String(pa(e,a)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),d=!0),d||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,d=!0):r.runs++),r},()=>{d=!0})(i,o)||{},m={id:Ln(12),start:t,isNew:!0,count:1,runs:1},f=Object.assign(m,u,p,{device:l},{isStart:d,storage:!0,updated:t},e.data);return ma(i,JSON.stringify(f),2*n,o),f}function ha(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const a=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,i=function(e,t={}){const n="clickId",a={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(Pn(r,t)).forEach(([t,r])=>{const s=e.searchParams.get(t);s&&(r===n&&(r=t,a[n]=t),a[r]=s)}),a}(a,e.parameters);if(Object.keys(i).length&&(i.marketing||(i.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(a.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:Ln(12),referrer:s},i,e.data):n}var ga=Object.defineProperty,ya=(e,t)=>{for(var n in t)ga(e,n,{get:t[n],enumerable:!0})},va={};ya(va,{BRAND:()=>es,DIRTY:()=>Ia,EMPTY_PATH:()=>Na,INVALID:()=>$a,NEVER:()=>Ks,OK:()=>Ra,ParseStatus:()=>Ea,Schema:()=>Ba,ZodAny:()=>wr,ZodArray:()=>Or,ZodBigInt:()=>yr,ZodBoolean:()=>vr,ZodBranded:()=>ts,ZodCatch:()=>Hr,ZodDate:()=>_r,ZodDefault:()=>Jr,ZodDiscriminatedUnion:()=>Cr,ZodEffects:()=>Kr,ZodEnum:()=>Vr,ZodError:()=>wa,ZodFirstPartyTypeKind:()=>Gr,ZodFunction:()=>Fr,ZodIntersection:()=>$r,ZodIssueCode:()=>ka,ZodLazy:()=>zr,ZodLiteral:()=>Dr,ZodMap:()=>Mr,ZodNaN:()=>Yr,ZodNativeEnum:()=>qr,ZodNever:()=>Ar,ZodNull:()=>xr,ZodNullable:()=>Xr,ZodNumber:()=>gr,ZodObject:()=>Pr,ZodOptional:()=>Wr,ZodParsedType:()=>_a,ZodPipeline:()=>ns,ZodPromise:()=>Br,ZodReadonly:()=>as,ZodRecord:()=>Rr,ZodSchema:()=>Ba,ZodSet:()=>Lr,ZodString:()=>fr,ZodSymbol:()=>br,ZodTransformer:()=>Kr,ZodTuple:()=>Ir,ZodType:()=>Ba,ZodUndefined:()=>kr,ZodUnion:()=>jr,ZodUnknown:()=>Zr,ZodVoid:()=>Sr,addIssueToContext:()=>Ca,any:()=>ys,array:()=>ks,bigint:()=>ls,boolean:()=>ps,coerce:()=>Bs,custom:()=>ss,date:()=>ms,datetimeRegex:()=>dr,defaultErrorMap:()=>Za,discriminatedUnion:()=>As,effect:()=>Ms,enum:()=>$s,function:()=>Ns,getErrorMap:()=>Oa,getParsedType:()=>ba,instanceof:()=>os,intersection:()=>Ss,isAborted:()=>Ma,isAsync:()=>za,isDirty:()=>La,isValid:()=>Fa,late:()=>is,lazy:()=>Cs,literal:()=>Es,makeIssue:()=>ja,map:()=>Ps,nan:()=>ds,nativeEnum:()=>Is,never:()=>_s,null:()=>gs,nullable:()=>Fs,number:()=>us,object:()=>xs,objectUtil:()=>da,oboolean:()=>qs,onumber:()=>Vs,optional:()=>Ls,ostring:()=>Us,pipeline:()=>Ds,preprocess:()=>zs,promise:()=>Rs,quotelessJson:()=>xa,record:()=>Ts,set:()=>js,setErrorMap:()=>Sa,strictObject:()=>ws,string:()=>cs,symbol:()=>fs,transformer:()=>Ms,tuple:()=>Os,undefined:()=>hs,union:()=>Zs,unknown:()=>vs,util:()=>ca,void:()=>bs}),(ua=ca||(ca={})).assertEqual=e=>{},ua.assertIs=function(e){},ua.assertNever=function(e){throw new Error},ua.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},ua.getValidEnumValues=e=>{const t=ua.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return ua.objectValues(n)},ua.objectValues=e=>ua.objectKeys(e).map(function(t){return e[t]}),ua.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},ua.find=(e,t)=>{for(const n of e)if(t(n))return n},ua.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,ua.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ua.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(da||(da={})).mergeShapes=(e,t)=>({...e,...t});var _a=ca.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ba=e=>{switch(typeof e){case"undefined":return _a.undefined;case"string":return _a.string;case"number":return Number.isNaN(e)?_a.nan:_a.number;case"boolean":return _a.boolean;case"function":return _a.function;case"bigint":return _a.bigint;case"symbol":return _a.symbol;case"object":return Array.isArray(e)?_a.array:null===e?_a.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?_a.promise:"undefined"!=typeof Map&&e instanceof Map?_a.map:"undefined"!=typeof Set&&e instanceof Set?_a.set:"undefined"!=typeof Date&&e instanceof Date?_a.date:_a.object;default:return _a.unknown}},ka=ca.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"]),xa=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),wa=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,ca.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()}};wa.create=e=>new wa(e);var Za=(e,t)=>{let n;switch(e.code){case ka.invalid_type:n=e.received===_a.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ka.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ca.jsonStringifyReplacer)}`;break;case ka.unrecognized_keys:n=`Unrecognized key(s) in object: ${ca.joinValues(e.keys,", ")}`;break;case ka.invalid_union:n="Invalid input";break;case ka.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ca.joinValues(e.options)}`;break;case ka.invalid_enum_value:n=`Invalid enum value. Expected ${ca.joinValues(e.options)}, received '${e.received}'`;break;case ka.invalid_arguments:n="Invalid function arguments";break;case ka.invalid_return_type:n="Invalid function return type";break;case ka.invalid_date:n="Invalid date";break;case ka.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}"`:ca.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ka.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 ka.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 ka.custom:n="Invalid input";break;case ka.invalid_intersection_types:n="Intersection results could not be merged";break;case ka.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ka.not_finite:n="Number must be finite";break;default:n=t.defaultError,ca.assertNever(e)}return{message:n}},Aa=Za;function Sa(e){Aa=e}function Oa(){return Aa}var Ta,Pa,ja=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},Na=[];function Ca(e,t){const n=Oa(),a=ja({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Za?void 0:Za].filter(e=>!!e)});e.common.issues.push(a)}var Ea=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 $a;"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 $a;if("aborted"===r.status)return $a;"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}}},$a=Object.freeze({status:"aborted"}),Ia=e=>({status:"dirty",value:e}),Ra=e=>({status:"valid",value:e}),Ma=e=>"aborted"===e.status,La=e=>"dirty"===e.status,Fa=e=>"valid"===e.status,za=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Pa=Ta||(Ta={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Pa.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Da,Ua=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}},Va=(e,t)=>{if(Fa(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 wa(e.common.issues);return this._error=t,this._error}}};function qa(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.');return t?{errorMap:t,description:r}:{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:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var Ba=class{get description(){return this._def.description}_getType(e){return ba(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ba(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ea,ctx:{common:e.parent.common,data:e.data,parsedType:ba(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(za(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:ba(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Va(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:ba(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Fa(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=>Fa(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:ba(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(za(a)?a:Promise.resolve(a));return Va(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),s=()=>{return a.addIssue({code:ka.custom,...(e=n,"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t)});var e};return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!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 Kr({schema:this,typeName:Gr.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 Wr.create(this,this._def)}nullable(){return Xr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this)}promise(){return Br.create(this,this._def)}or(e){return jr.create([this,e],this._def)}and(e){return $r.create(this,e,this._def)}transform(e){return new Kr({...qa(this._def),schema:this,typeName:Gr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Jr({...qa(this._def),innerType:this,defaultValue:t,typeName:Gr.ZodDefault})}brand(){return new ts({typeName:Gr.ZodBranded,type:this,...qa(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Hr({...qa(this._def),innerType:this,catchValue:t,typeName:Gr.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ns.create(this,e)}readonly(){return as.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ka=/^c[^\s-]{8,}$/i,Wa=/^[0-9a-z]+$/,Xa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ja=/^[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,Ha=/^[a-z0-9_-]{21}$/i,Ya=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ga=/^[-+]?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)?)??$/,Qa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,er=/^(?:(?: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])$/,tr=/^(?:(?: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])$/,nr=/^(([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]))$/,ar=/^(([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])$/,rr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ir="((\\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])))",or=new RegExp(`^${ir}$`);function cr(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ur(e){return new RegExp(`^${cr(e)}$`)}function dr(e){let t=`${ir}T${cr(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 lr(e,t){return!("v4"!==t&&t||!er.test(e))||!("v6"!==t&&t||!nr.test(e))}function pr(e,t){if(!Ya.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 mr(e,t){return!("v4"!==t&&t||!tr.test(e))||!("v6"!==t&&t||!ar.test(e))}var fr=class e extends Ba{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_a.string){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.string,received:t.parsedType}),$a}const t=new Ea;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,s=e.data.length<a.value;(r||s)&&(n=this._getOrReturnCtx(e,n),r?Ca(n,{code:ka.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Ca(n,{code:ka.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Qa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"email",code:ka.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Da||(Da=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Da.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"emoji",code:ka.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"uuid",code:ka.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"nanoid",code:ka.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Ka.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cuid",code:ka.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Wa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cuid2",code:ka.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Xa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"ulid",code:ka.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),Ca(n,{validation:"url",code:ka.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"regex",code:ka.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?dr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?or.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?ur(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"duration",code:ka.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?lr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"ip",code:ka.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?pr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"jwt",code:ka.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?mr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cidr",code:ka.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?rr.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"base64",code:ka.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?sr.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"base64url",code:ka.invalid_string,message:a.message}),t.dirty()):ca.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:ka.invalid_string,...Ta.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Ta.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ta.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ta.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ta.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ta.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ta.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ta.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ta.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ta.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ta.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ta.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ta.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ta.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,...Ta.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,...Ta.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ta.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ta.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ta.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ta.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ta.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ta.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ta.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ta.errToObj(t)})}nonempty(e){return this.min(1,Ta.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 hr(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}fr.create=e=>{var t;return new fr({checks:[],typeName:Gr.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qa(e)})};var gr=class e extends Ba{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_a.number){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.number,received:t.parsedType}),$a}let t;const n=new Ea;for(const a of this._def.checks)"int"===a.kind?ca.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==hr(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_finite,message:a.message}),n.dirty()):ca.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ta.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ta.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ta.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ta.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Ta.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Ta.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ta.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ta.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ta.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ta.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ta.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ta.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ta.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ta.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&&ca.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)}};gr.create=e=>new gr({checks:[],typeName:Gr.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...qa(e)});var yr=class e extends Ba{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)!==_a.bigint)return this._getInvalidInput(e);let t;const n=new Ea;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ca.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.bigint,received:t.parsedType}),$a}gte(e,t){return this.setLimit("min",e,!0,Ta.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ta.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ta.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ta.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Ta.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:Ta.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ta.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ta.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ta.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ta.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}};yr.create=e=>{var t;return new yr({checks:[],typeName:Gr.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qa(e)})};var vr=class extends Ba{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==_a.boolean){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.boolean,received:t.parsedType}),$a}return Ra(e.data)}};vr.create=e=>new vr({typeName:Gr.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...qa(e)});var _r=class e extends Ba{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_a.date){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.date,received:t.parsedType}),$a}if(Number.isNaN(e.data.getTime()))return Ca(this._getOrReturnCtx(e),{code:ka.invalid_date}),$a;const t=new Ea;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ca.assertNever(a);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:Ta.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ta.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}};_r.create=e=>new _r({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Gr.ZodDate,...qa(e)});var br=class extends Ba{_parse(e){if(this._getType(e)!==_a.symbol){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.symbol,received:t.parsedType}),$a}return Ra(e.data)}};br.create=e=>new br({typeName:Gr.ZodSymbol,...qa(e)});var kr=class extends Ba{_parse(e){if(this._getType(e)!==_a.undefined){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.undefined,received:t.parsedType}),$a}return Ra(e.data)}};kr.create=e=>new kr({typeName:Gr.ZodUndefined,...qa(e)});var xr=class extends Ba{_parse(e){if(this._getType(e)!==_a.null){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.null,received:t.parsedType}),$a}return Ra(e.data)}};xr.create=e=>new xr({typeName:Gr.ZodNull,...qa(e)});var wr=class extends Ba{constructor(){super(...arguments),this._any=!0}_parse(e){return Ra(e.data)}};wr.create=e=>new wr({typeName:Gr.ZodAny,...qa(e)});var Zr=class extends Ba{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ra(e.data)}};Zr.create=e=>new Zr({typeName:Gr.ZodUnknown,...qa(e)});var Ar=class extends Ba{_parse(e){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.never,received:t.parsedType}),$a}};Ar.create=e=>new Ar({typeName:Gr.ZodNever,...qa(e)});var Sr=class extends Ba{_parse(e){if(this._getType(e)!==_a.undefined){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.void,received:t.parsedType}),$a}return Ra(e.data)}};Sr.create=e=>new Sr({typeName:Gr.ZodVoid,...qa(e)});var Or=class e extends Ba{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==_a.array)return Ca(t,{code:ka.invalid_type,expected:_a.array,received:t.parsedType}),$a;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(Ca(t,{code:e?ka.too_big:ka.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&&(Ca(t,{code:ka.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&&(Ca(t,{code:ka.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 Ua(t,e,t.path,n)))).then(e=>Ea.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new Ua(t,e,t.path,n)));return Ea.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Ta.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Ta.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Ta.toString(n)}})}nonempty(e){return this.min(1,e)}};function Tr(e){if(e instanceof Pr){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Wr.create(Tr(a))}return new Pr({...e._def,shape:()=>t})}return e instanceof Or?new Or({...e._def,type:Tr(e.element)}):e instanceof Wr?Wr.create(Tr(e.unwrap())):e instanceof Xr?Xr.create(Tr(e.unwrap())):e instanceof Ir?Ir.create(e.items.map(e=>Tr(e))):e}Or.create=(e,t)=>new Or({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Gr.ZodArray,...qa(t)});var Pr=class e extends Ba{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=ca.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_a.object){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.object,received:t.parsedType}),$a}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ar&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=a[e],r=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new Ua(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ar){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(Ca(n,{code:ka.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 a=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Ua(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>Ea.mergeObjectSync(t,e)):Ea.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return Ta.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?s:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=Ta.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:Gr.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 ca.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 ca.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Tr(this)}partial(t){const n={};for(const e of ca.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 ca.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Wr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ur(ca.objectKeys(this.shape))}};Pr.create=(e,t)=>new Pr({shape:()=>e,unknownKeys:"strip",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)}),Pr.strictCreate=(e,t)=>new Pr({shape:()=>e,unknownKeys:"strict",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)}),Pr.lazycreate=(e,t)=>new Pr({shape:e,unknownKeys:"strip",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)});var jr=class extends Ba{_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 wa(e.ctx.common.issues));return Ca(t,{code:ka.invalid_union,unionErrors:n}),$a});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,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 wa(e));return Ca(t,{code:ka.invalid_union,unionErrors:r}),$a}}get options(){return this._def.options}};jr.create=(e,t)=>new jr({options:e,typeName:Gr.ZodUnion,...qa(t)});var Nr=e=>e instanceof zr?Nr(e.schema):e instanceof Kr?Nr(e.innerType()):e instanceof Dr?[e.value]:e instanceof Vr?e.options:e instanceof qr?ca.objectValues(e.enum):e instanceof Jr?Nr(e._def.innerType):e instanceof kr?[void 0]:e instanceof xr?[null]:e instanceof Wr?[void 0,...Nr(e.unwrap())]:e instanceof Xr?[null,...Nr(e.unwrap())]:e instanceof ts||e instanceof as?Nr(e.unwrap()):e instanceof Hr?Nr(e._def.innerType):[],Cr=class e extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.object)return Ca(t,{code:ka.invalid_type,expected:_a.object,received:t.parsedType}),$a;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}):(Ca(t,{code:ka.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$a)}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=Nr(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:Gr.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...qa(a)})}};function Er(e,t){const n=ba(e),a=ba(t);if(e===t)return{valid:!0,data:e};if(n===_a.object&&a===_a.object){const n=ca.objectKeys(t),a=ca.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Er(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===_a.array&&a===_a.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Er(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===_a.date&&a===_a.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var $r=class extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Ma(e)||Ma(a))return $a;const r=Er(e.value,a.value);return r.valid?((La(e)||La(a))&&t.dirty(),{status:t.value,value:r.data}):(Ca(n,{code:ka.invalid_intersection_types}),$a)};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}))}};$r.create=(e,t,n)=>new $r({left:e,right:t,typeName:Gr.ZodIntersection,...qa(n)});var Ir=class e extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.array)return Ca(n,{code:ka.invalid_type,expected:_a.array,received:n.parsedType}),$a;if(n.data.length<this._def.items.length)return Ca(n,{code:ka.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$a;!this._def.rest&&n.data.length>this._def.items.length&&(Ca(n,{code:ka.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 Ua(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ea.mergeArray(t,e)):Ea.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ir.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ir({items:e,typeName:Gr.ZodTuple,rest:null,...qa(t)})};var Rr=class e extends Ba{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!==_a.object)return Ca(n,{code:ka.invalid_type,expected:_a.object,received:n.parsedType}),$a;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new Ua(n,e,n.path,e)),value:s._parse(new Ua(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ea.mergeObjectAsync(t,a):Ea.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Ba?{keyType:t,valueType:n,typeName:Gr.ZodRecord,...qa(a)}:{keyType:fr.create(),valueType:t,typeName:Gr.ZodRecord,...qa(n)})}},Mr=class extends Ba{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!==_a.map)return Ca(n,{code:ka.invalid_type,expected:_a.map,received:n.parsedType}),$a;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new Ua(n,e,n.path,[s,"key"])),value:r._parse(new Ua(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of s){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return $a;"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 s){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return $a;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Mr.create=(e,t,n)=>new Mr({valueType:t,keyType:e,typeName:Gr.ZodMap,...qa(n)});var Lr=class e extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.set)return Ca(n,{code:ka.invalid_type,expected:_a.set,received:n.parsedType}),$a;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(Ca(n,{code:ka.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&&(Ca(n,{code:ka.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const n=new Set;for(const a of e){if("aborted"===a.status)return $a;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>r._parse(new Ua(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,n){return new e({...this._def,minSize:{value:t,message:Ta.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Ta.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Lr.create=(e,t)=>new Lr({valueType:e,minSize:null,maxSize:null,typeName:Gr.ZodSet,...qa(t)});var Fr=class e extends Ba{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.function)return Ca(t,{code:ka.invalid_type,expected:_a.function,received:t.parsedType}),$a;function n(e,n){return ja({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oa(),Za].filter(e=>!!e),issueData:{code:ka.invalid_arguments,argumentsError:n}})}function a(e,n){return ja({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oa(),Za].filter(e=>!!e),issueData:{code:ka.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Br){const e=this;return Ra(async function(...t){const i=new wa([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw i.addIssue(n(t,e)),i}),c=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw i.addIssue(a(c,e)),i})})}{const e=this;return Ra(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new wa([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new wa([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:Ir.create(t).rest(Zr.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||Ir.create([]).rest(Zr.create()),returns:n||Zr.create(),typeName:Gr.ZodFunction,...qa(a)})}},zr=class extends Ba{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})}};zr.create=(e,t)=>new zr({getter:e,typeName:Gr.ZodLazy,...qa(t)});var Dr=class extends Ba{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ca(t,{received:t.data,code:ka.invalid_literal,expected:this._def.value}),$a}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ur(e,t){return new Vr({values:e,typeName:Gr.ZodEnum,...qa(t)})}Dr.create=(e,t)=>new Dr({value:e,typeName:Gr.ZodLiteral,...qa(t)});var Vr=class e extends Ba{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Ca(t,{expected:ca.joinValues(n),received:t.parsedType,code:ka.invalid_type}),$a}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 Ca(t,{received:t.data,code:ka.invalid_enum_value,options:n}),$a}return Ra(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})}};Vr.create=Ur;var qr=class extends Ba{_parse(e){const t=ca.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_a.string&&n.parsedType!==_a.number){const e=ca.objectValues(t);return Ca(n,{expected:ca.joinValues(e),received:n.parsedType,code:ka.invalid_type}),$a}if(this._cache||(this._cache=new Set(ca.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ca.objectValues(t);return Ca(n,{received:n.data,code:ka.invalid_enum_value,options:e}),$a}return Ra(e.data)}get enum(){return this._def.values}};qr.create=(e,t)=>new qr({values:e,typeName:Gr.ZodNativeEnum,...qa(t)});var Br=class extends Ba{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.promise&&!1===t.common.async)return Ca(t,{code:ka.invalid_type,expected:_a.promise,received:t.parsedType}),$a;const n=t.parsedType===_a.promise?t.data:Promise.resolve(t.data);return Ra(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:Gr.ZodPromise,...qa(t)});var Kr=class extends Ba{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{Ca(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return $a;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?$a:"dirty"===a.status||"dirty"===t.value?Ia(a.value):a});{if("aborted"===t.value)return $a;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?$a:"dirty"===a.status||"dirty"===t.value?Ia(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);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?$a:("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?$a:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Fa(e))return $a;const s=a.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Fa(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):$a)}ca.assertNever(a)}};Kr.create=(e,t,n)=>new Kr({schema:e,typeName:Gr.ZodEffects,effect:t,...qa(n)}),Kr.createWithPreprocess=(e,t,n)=>new Kr({schema:t,effect:{type:"preprocess",transform:e},typeName:Gr.ZodEffects,...qa(n)});var Wr=class extends Ba{_parse(e){return this._getType(e)===_a.undefined?Ra(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:Gr.ZodOptional,...qa(t)});var Xr=class extends Ba{_parse(e){return this._getType(e)===_a.null?Ra(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:Gr.ZodNullable,...qa(t)});var Jr=class extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===_a.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:Gr.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...qa(t)});var Hr=class extends Ba{_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 za(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:Gr.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...qa(t)});var Yr=class extends Ba{_parse(e){if(this._getType(e)!==_a.nan){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.nan,received:t.parsedType}),$a}return{status:"valid",value:e.data}}};Yr.create=e=>new Yr({typeName:Gr.ZodNaN,...qa(e)});var Gr,Qr,es=Symbol("zod_brand"),ts=class extends Ba{_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}},ns=class e extends Ba{_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?$a:"dirty"===e.status?(t.dirty(),Ia(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?$a:"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:Gr.ZodPipeline})}},as=class extends Ba{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Fa(e)&&(e.value=Object.freeze(e.value)),e);return za(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function rs(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function ss(e,t={},n){return e?wr.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=rs(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=rs(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):wr.create()}as.create=(e,t)=>new as({innerType:e,typeName:Gr.ZodReadonly,...qa(t)});var is={object:Pr.lazycreate};(Qr=Gr||(Gr={})).ZodString="ZodString",Qr.ZodNumber="ZodNumber",Qr.ZodNaN="ZodNaN",Qr.ZodBigInt="ZodBigInt",Qr.ZodBoolean="ZodBoolean",Qr.ZodDate="ZodDate",Qr.ZodSymbol="ZodSymbol",Qr.ZodUndefined="ZodUndefined",Qr.ZodNull="ZodNull",Qr.ZodAny="ZodAny",Qr.ZodUnknown="ZodUnknown",Qr.ZodNever="ZodNever",Qr.ZodVoid="ZodVoid",Qr.ZodArray="ZodArray",Qr.ZodObject="ZodObject",Qr.ZodUnion="ZodUnion",Qr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Qr.ZodIntersection="ZodIntersection",Qr.ZodTuple="ZodTuple",Qr.ZodRecord="ZodRecord",Qr.ZodMap="ZodMap",Qr.ZodSet="ZodSet",Qr.ZodFunction="ZodFunction",Qr.ZodLazy="ZodLazy",Qr.ZodLiteral="ZodLiteral",Qr.ZodEnum="ZodEnum",Qr.ZodEffects="ZodEffects",Qr.ZodNativeEnum="ZodNativeEnum",Qr.ZodOptional="ZodOptional",Qr.ZodNullable="ZodNullable",Qr.ZodDefault="ZodDefault",Qr.ZodCatch="ZodCatch",Qr.ZodPromise="ZodPromise",Qr.ZodBranded="ZodBranded",Qr.ZodPipeline="ZodPipeline",Qr.ZodReadonly="ZodReadonly";var os=(e,t={message:`Input not instance of ${e.name}`})=>ss(t=>t instanceof e,t),cs=fr.create,us=gr.create,ds=Yr.create,ls=yr.create,ps=vr.create,ms=_r.create,fs=br.create,hs=kr.create,gs=xr.create,ys=wr.create,vs=Zr.create,_s=Ar.create,bs=Sr.create,ks=Or.create,xs=Pr.create,ws=Pr.strictCreate,Zs=jr.create,As=Cr.create,Ss=$r.create,Os=Ir.create,Ts=Rr.create,Ps=Mr.create,js=Lr.create,Ns=Fr.create,Cs=zr.create,Es=Dr.create,$s=Vr.create,Is=qr.create,Rs=Br.create,Ms=Kr.create,Ls=Wr.create,Fs=Xr.create,zs=Kr.createWithPreprocess,Ds=ns.create,Us=()=>cs().optional(),Vs=()=>us().optional(),qs=()=>ps().optional(),Bs={string:e=>fr.create({...e,coerce:!0}),number:e=>gr.create({...e,coerce:!0}),boolean:e=>vr.create({...e,coerce:!0}),bigint:e=>yr.create({...e,coerce:!0}),date:e=>_r.create({...e,coerce:!0})},Ks=$a,Ws=Symbol("Let zodToJsonSchema decide on which parser to use"),Xs={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"};function Js(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Hs(e,t,n,a,r){e[t]=n,Js(e,t,a,r)}var Ys=(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 Gs(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Ys(t,e.currentPath):t.join("/")}}function Qs(e,t){return Ai(e.type._def,t)}function ei(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ei(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 ti(e,t)}}var ti=(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":Hs(n,"minimum",a.value,a.message,t);break;case"max":Hs(n,"maximum",a.value,a.message,t)}return n},ni=void 0,ai=/^[cC][^\s-]{8,}$/,ri=/^[0-9a-z]+$/,si=/^[0-9A-HJKMNP-TV-Z]{26}$/,ii=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,oi=()=>(void 0===ni&&(ni=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ni),ci=/^(?:(?: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])$/,ui=/^(([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])$/,di=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,li=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pi=/^[a-zA-Z0-9_-]{21}$/,mi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function fi(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Hs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Hs(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":yi(n,"email",a.message,t);break;case"format:idn-email":yi(n,"idn-email",a.message,t);break;case"pattern:zod":vi(n,ii,a.message,t)}break;case"url":yi(n,"uri",a.message,t);break;case"uuid":yi(n,"uuid",a.message,t);break;case"regex":vi(n,a.regex,a.message,t);break;case"cuid":vi(n,ai,a.message,t);break;case"cuid2":vi(n,ri,a.message,t);break;case"startsWith":vi(n,RegExp(`^${hi(a.value,t)}`),a.message,t);break;case"endsWith":vi(n,RegExp(`${hi(a.value,t)}$`),a.message,t);break;case"datetime":yi(n,"date-time",a.message,t);break;case"date":yi(n,"date",a.message,t);break;case"time":yi(n,"time",a.message,t);break;case"duration":yi(n,"duration",a.message,t);break;case"length":Hs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Hs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":vi(n,RegExp(hi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&yi(n,"ipv4",a.message,t),"v4"!==a.version&&yi(n,"ipv6",a.message,t);break;case"base64url":vi(n,li,a.message,t);break;case"jwt":vi(n,mi,a.message,t);break;case"cidr":"v6"!==a.version&&vi(n,ci,a.message,t),"v4"!==a.version&&vi(n,ui,a.message,t);break;case"emoji":vi(n,oi(),a.message,t);break;case"ulid":vi(n,si,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":yi(n,"binary",a.message,t);break;case"contentEncoding:base64":Hs(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":vi(n,di,a.message,t)}break;case"nanoid":vi(n,pi,a.message,t)}return n}function hi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)gi.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var gi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yi(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}}})):Hs(e,"format",t,n,a)}function vi(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:_i(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Hs(e,"pattern",_i(t,a),n,a)}function _i(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!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+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!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 bi(e,t){var n,a,r,s,i,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)===Gr.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Gs(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===Gr.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=fi(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Gr.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Gr.ZodBranded&&e.keyType._def.type._def.typeName===Gr.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Qs(e.keyType._def,t);return{...u,propertyNames:a}}return u}var ki={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},xi=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Ai(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 wi(e){try{return e.isOptional()}catch(e){return!0}}var Zi=(e,t,n)=>{switch(t){case Gr.ZodString:return fi(e,n);case Gr.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",Js(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Hs(n,"minimum",a.value,a.message,t):Hs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Hs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Hs(n,"maximum",a.value,a.message,t):Hs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Hs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Hs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gr.ZodObject:return function(e,t){const n="openAi"===t.target,a={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=wi(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=Ai(i._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 i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Ai(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&&(a.additionalProperties=i),a}(e,n);case Gr.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?Hs(n,"minimum",a.value,a.message,t):Hs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Hs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Hs(n,"maximum",a.value,a.message,t):Hs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Hs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Hs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gr.ZodBoolean:return{type:"boolean"};case Gr.ZodDate:return ei(e,n);case Gr.ZodUndefined:return{not:Gs(n)};case Gr.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Gr.ZodArray:return function(e,t){var n,a,r;const s={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)!==Gr.ZodAny&&(s.items=Ai(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Hs(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Hs(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Hs(s,"minItems",e.exactLength.value,e.exactLength.message,t),Hs(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case Gr.ZodUnion:case Gr.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return xi(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in ki&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=ki[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 xi(e,t)}(e,n);case Gr.ZodIntersection:return function(e,t){const n=[Ai(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ai(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 Gr.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Ai(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Ai(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Ai(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Gr.ZodRecord:return bi(e,n);case Gr.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 Gr.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Gr.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 Gr.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:ki[e.innerType._def.typeName],nullable:!0}:{type:[ki[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Gr.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Ai(e.innerType._def,t);const a=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Gs(t)},a]}:Gs(t)})(e,n);case Gr.ZodMap:return function(e,t){return"record"===t.mapStrategy?bi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Ai(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Gs(t),Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Gs(t)],minItems:2,maxItems:2}}}(e,n);case Gr.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Hs(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Hs(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Gr.ZodLazy:return()=>e.getter()._def;case Gr.ZodPromise:return function(e,t){return Ai(e.type._def,t)}(e,n);case Gr.ZodNaN:case Gr.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Gs({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Gr.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Ai(e.schema._def,t):Gs(t)}(e,n);case Gr.ZodAny:return Gs(n);case Gr.ZodUnknown:return function(e){return Gs(e)}(n);case Gr.ZodDefault:return function(e,t){return{...Ai(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Gr.ZodBranded:return Qs(e,n);case Gr.ZodReadonly:case Gr.ZodCatch:return((e,t)=>Ai(e.innerType._def,t))(e,n);case Gr.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Ai(e.in._def,t);if("output"===t.pipeStrategy)return Ai(e.out._def,t);const n=Ai(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Ai(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Gr.ZodFunction:case Gr.ZodVoid:case Gr.ZodSymbol:default:return}};function Ai(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Ws)return s}if(r&&!n){const e=Si(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=Zi(e,e.typeName,t),o="function"==typeof i?Ai(i(),t):i;if(o&&Oi(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Si=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ys(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`),Gs(t)):"seen"===t.$refStrategy?Gs(t):void 0}},Oi=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),Ti=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Xs,name:a}:{...Xs,...a},n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;var a;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}]))}})(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=Ai(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Gs(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=Ai(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:Gs(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.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===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};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},Pi=va.record(va.string(),va.boolean()).describe("Consent requirement mapping"),ji=va.lazy(()=>va.union([va.string(),va.number(),va.boolean(),$i,va.array(ji)])),Ni=va.tuple([ji,ji]).describe("Loop: [source, transform] tuple for array transformations"),Ci=va.array(ji).describe("Set: Array of values"),Ei=va.record(va.string(),ji).describe("Map: Object mapping keys to values"),$i=va.object({key:va.string().optional().describe('Property path (e.g., "data.id")'),value:va.union([va.string(),va.number(),va.boolean()]).optional().describe("Static primitive value"),fn:va.string().optional().describe("Function string for custom transformation"),map:Ei.optional().describe("Object with key-value mappings"),loop:Ni.optional().describe("Tuple [source, transform]"),set:Ci.optional().describe("Array of values"),consent:Pi.optional().describe("Required consent states"),condition:va.string().optional().describe("Condition function string"),validate:va.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"),Ii=Ni,Ri=Ci,Mi=Ei,Li=(Ti($i,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Ti(Ii,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Ti(Ri,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Ti(Mi,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Fi(e,t={},n={}){n={...Li,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function zi(e){return Array.isArray(e)}function Di(e){return e===document||e instanceof Element}function Ui(e){return"object"==typeof e&&null!==e&&!zi(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Vi(e){return"string"==typeof e}function qi(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Bi(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Ki(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Wi(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Xi(e,t,n,a=!0){return so(ra(t,Wi(e,n,a))||"").reduce((e,n)=>{let[a,r]=io(n);if(!a)return e;if(r||(a.endsWith(":")&&(a=a.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return a.endsWith("[]")?(a=a.slice(0,-2),zi(e[a])||(e[a]=[]),e[a].push(qi(r))):e[a]=qi(r),e},{})}function Ji(e,t=Wn.Prefix){var n;const a=e||document.body;if(!a)return[];let r=[];const s=Wn.Action,i=`[${Wi(t,s,!1)}]`,o=e=>{Object.keys(Xi(t,e,s,!1)).forEach(n=>{r=r.concat(Hi(e,n,t))})};return a!==document&&(null==(n=a.matches)?void 0:n.call(a,i))&&o(a),ro(a,i,o),r}function Hi(e,t,n=Wn.Prefix){const a=[],{actions:r,nearestOnly:s}=function(e,t,n){let a=t;for(;a;){const t=ra(a,Wi(e,Wn.Actions,!1));if(t){const e=Qi(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=ra(a,Wi(e,Wn.Action,!1));if(r){const e=Qi(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}a=no(e,a)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const i=so(r.actionParams||"",",").reduce((e,t)=>(e[Ki(t)]=!0,e),{}),o=eo(n,e,i,s);if(!o.length){const t="page",a=`[${Wi(n,t)}]`,[r,s]=ao(e,a,n,t);o.push({entity:t,data:r,nested:[],context:s})}o.forEach(e=>{a.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),a):a}function Yi(e=Wn.Prefix,t=document){const n=Wi(e,Wn.Globals,!1);let a={};return ro(t,`[${n}]`,t=>{a=Fi(a,Xi(e,t,Wn.Globals,!1))}),a}function Gi(e,t){const n=window.location,a="page",r=t===document?document.body:t,[s,i]=ao(r,`[${Wi(e,a)}]`,e,a);return s.domain=n.hostname,s.title=document.title,s.referrer=document.referrer,n.search&&(s.search=n.search),n.hash&&(s.hash=n.hash),[s,i]}function Qi(e){const t={};return so(e).forEach(e=>{const[n,a]=io(e),[r,s]=oo(n);if(!r)return;let[i,o]=oo(a||"");i=i||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:s,action:i,actionParams:o})}),t}function eo(e,t,n,a=!1){const r=[];let s=t;for(n=0!==Object.keys(n||{}).length?n:void 0;s;){const i=to(e,s,t,n);if(i&&(r.push(i),a))break;s=no(e,s)}return r}function to(e,t,n,a){const r=ra(t,Wi(e));if(!r||a&&!a[r])return null;const s=[t],i=`[${Wi(e,r)}],[${Wi(e,"")}]`,o=Wi(e,Wn.Link,!1);let c={};const u=[],[d,l]=ao(n||t,i,e,r);ro(t,`[${o}]`,t=>{const[n,a]=io(ra(t,o));"parent"===a&&ro(document.body,`[${o}="${n}:child"]`,t=>{s.push(t);const n=to(e,t);n&&u.push(n)})});const p=[];s.forEach(e=>{e.matches(i)&&p.push(e),ro(e,i,e=>p.push(e))});let m={};return p.forEach(t=>{m=Fi(m,Xi(e,t,"")),c=Fi(c,Xi(e,t,r))}),c=Fi(Fi(m,c),d),s.forEach(t=>{ro(t,`[${Wi(e)}]`,t=>{const n=to(e,t);n&&u.push(n)})}),{entity:r,data:c,context:l,nested:u}}function no(e,t){const n=Wi(e,Wn.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=io(ra(t,n));if("child"===a)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ao(e,t,n,a){let r={};const s={};let i=e;const o=`[${Wi(n,Wn.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(r=Fi(Xi(n,i,""),r),r=Fi(Xi(n,i,a),r)),i.matches(o)&&(Object.entries(Xi(n,i,Wn.Context,!1)).forEach(([e,t])=>{t&&!s[e]&&(s[e]=[t,c])}),++c),i=no(n,i);return[r,s]}function ro(e,t,n){e.querySelectorAll(t).forEach(n)}function so(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function io(e){const[t,n]=e.split(/:(.+)/,2);return[Ki(t),Ki(n)]}function oo(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var co,uo=new WeakMap,lo=new WeakMap,po=new WeakMap;function mo(e){const t=Date.now();let n=lo.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:ia(e),lastChecked:t},lo.set(e,n)),n.isVisible}function fo(e){if(window.IntersectionObserver)return Bi(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,a;const r=t.target,s=po.get(e);if(!s)return;const i=s.timers.get(r);if(t.intersectionRatio>0){const a=Date.now();let o=uo.get(r);if((!o||a-o.lastChecked>1e3)&&(o={isLarge:r.offsetHeight>window.innerHeight,lastChecked:a},uo.set(r,o)),t.intersectionRatio>=.5||o.isLarge&&mo(r)){const t=null==(n=s.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!i){const t=window.setTimeout(async()=>{var t,n;if(mo(r)){const a=null==(t=s.elementConfigs)?void 0:t.get(r);(null==a?void 0:a.context)&&await Oo(a.context,r,a.trigger);const i=null==(n=s.elementConfigs)?void 0:n.get(r);(null==i?void 0:i.multiple)?i.blocked=!0:function(e,t){const n=po.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const a=n.timers.get(t);a&&(clearTimeout(a),n.timers.delete(t)),uo.delete(t),lo.delete(t)}(e,r)}},s.duration);s.timers.set(r,t)}return}}i&&(clearTimeout(i),s.timers.delete(r));const o=null==(a=s.elementConfigs)?void 0:a.get(r);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function ho(e,t,n={multiple:!1}){var a;const r=e.settings.scope||document,s=po.get(r);(null==s?void 0:s.observer)&&t&&(s.elementConfigs||(s.elementConfigs=new WeakMap),s.elementConfigs.set(t,{multiple:null!=(a=n.multiple)&&a,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),s.observer.observe(t))}function go(e){if(!e)return;const t=po.get(e);t&&(t.observer&&t.observer.disconnect(),po.delete(e))}function yo(e,t,n,a,r,s,i){const{elb:o,settings:c}=e;if(Vi(t)&&t.startsWith("walker "))return o(t,n);if(Ui(t)){const e=t;return e.source||(e.source=vo()),e.globals||(e.globals=Yi(c.prefix,c.scope||document)),o(e)}const[u]=String(Ui(t)?t.name:t).split(" ");let d,l=Ui(n)?n:{},p={},m=!1;if(Di(n)&&(d=n,m=!0),Di(r)?d=r:Ui(r)&&Object.keys(r).length&&(p=r),d){const e=eo(c.prefix||"data-elb",d).find(e=>e.entity===u);e&&(m&&(l=e.data),p=e.context)}"page"===u&&(l.id=l.id||window.location.pathname);const f=Yi(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:s,custom:i,trigger:Vi(a)?a:"",source:vo()})}function vo(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var _o=[],bo="hover",ko="load",xo="pulse",wo="scroll",Zo="wait";function Ao(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",Bi(function(t){Po.call(this,e,t)})),n.addEventListener("submit",Bi(function(t){jo.call(this,e,t)})))}(e,t)}function So(e,t){t.scope&&function(e,t){const n=t.scope;_o=[];const a=n||document;go(a),function(e,t=1e3){po.has(e)||po.set(e,{observer:fo(e),timers:new WeakMap,duration:t})}(a,1e3);const r=Wi(t.prefix,Wn.Action,!1);a!==document&&To(e,a,r,t),a.querySelectorAll(`[${r}]`).forEach(n=>{To(e,n,r,t)}),_o.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const a=window.scrollY+window.innerHeight,r=e.offsetTop;if(a<r)return!0;const s=e.clientHeight;return!(100*(1-(r+s-a)/(s||1))>=n&&(Oo(t,e,wo),1))});co||(co=function(e,t=1e3){let n=null;return function(...a){if(null===n)return n=setTimeout(()=>{n=null},t),e(...a)}}(function(){_o=n.call(t,_o,e)}),t.addEventListener("scroll",co))}(e,a)}(e,t)}async function Oo(e,t,n){const a=Hi(t,n,e.settings.prefix);return Promise.all(a.map(t=>yo(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function To(e,t,n,a){const r=ra(t,n);r&&Object.values(Qi(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case bo:a=e,t.addEventListener("mouseenter",Bi(function(e){e.target instanceof Element&&Oo(a,e.target,bo)}));break;case ko:!function(e,t){Oo(e,t,ko)}(e,t);break;case xo:!function(e,t,n=""){setInterval(()=>{document.hidden||Oo(e,t,xo)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case wo:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||_o.push([e,n])}(t,n.triggerParams);break;case"impression":ho(e,t);break;case"visible":ho(e,t,{multiple:!0});break;case Zo:!function(e,t,n=""){setTimeout(()=>Oo(e,t,Zo),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var a}))}function Po(e,t){Oo(e,t.target,"click")}function jo(e,t){t.target&&Oo(e,t.target,"submit")}function No(e,t,n,a){const r=[];let s=!0;n.forEach(e=>{const t=Eo(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const i=t[0],o=!Ui(i)&&Vi(i)&&i.startsWith("walker ");if(Ui(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Vi(e[0])||""===e[0].trim())return;const n="walker run";s&&e[0]===n&&(s=!1)}(a&&o||!a&&!o)&&r.push(t)}),r.forEach(n=>{Co(e,t,n)})}function Co(e,t="data-elb",n){Bi(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Vi(a)&&""===a.trim())return;if(Vi(a)&&a.startsWith("walker "))return void e(a,r[0]);yo({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},a,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Eo(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function $o(e,t={}){return function(e={}){const{cb:t,consent:n,collector:a,storage:r}=e;if(!n)return oa((r?fa:ha)(e),a,t);{const r=function(e,t){let n;return(a,r)=>{if(Nn(n)&&n===(null==a?void 0:a.group))return;n=null==a?void 0:a.group;let s=()=>ha(e);return e.consent&&Mn((jn(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(s=()=>fa(e)),oa(s(),a,t)}}(e,t),s=(jn(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",s):sa("walker on","consent",s)}}({...t,collector:{push:e,group:void 0}})}ya({},{env:()=>Io});var Io={};ya(Io,{push:()=>Lo});var Ro=()=>{},Mo=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Lo={get push(){return Mo()},get command(){return Mo()},get elb(){return Mo()},get window(){return{addEventListener:Ro,removeEventListener:Ro,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ro,removeEventListener:Ro,querySelector:Ro,querySelectorAll:()=>[],getElementById:Ro,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ro,getAttribute:Ro,addEventListener:Ro,removeEventListener:Ro}),body:{appendChild:Ro,removeChild:Ro},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}},Fo=async(e,t)=>{const{elb:n,window:a,document:r}=t,s=(null==e?void 0:e.settings)||{},i=a||(void 0!==globalThis.window?globalThis.window:void 0),o=r||(void 0!==globalThis.document?globalThis.document:void 0),c=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,o),u={settings:c},d={elb:n,settings:c};if(i&&o){if(!1!==c.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",a=t.window||window;if(!a)return;const r=a;r[n]||(r[n]=[]);const s=r[n];s.push=function(...n){if(Eo(n[0])){const a=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[a]);return Co(e,t.prefix,a),r}const a=Array.prototype.push.apply(this,n);return n.forEach(n=>{Co(e,t.prefix,n)}),a},Array.isArray(s)&&s.length>0&&function(e,t="data-elb",n){No(e,t,n,!0),No(e,t,n,!1),n.length=0}(e,t.prefix,s)}(n,{name:Vi(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:i}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}await async function(e,t,n){const a=()=>{e(t,n)};"loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)}(Ao,d,c),(()=>{if(So(d,c),c.pageview){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}})(),Vi(c.elb)&&c.elb&&(i[c.elb]=(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)},destroy:async()=>{o&&go(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&i&&(So(d,c),c.pageview)){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}}}}},zo=Object.defineProperty,Do=(e,t)=>{for(var n in t)zo(e,n,{get:t[n],enumerable:!0})},Uo=!1;function Vo(e,t={},n){if(t.filter&&!0===Dn(()=>t.filter(n),()=>!1)())return;const a=function(e){if(Cn(e)&&En(e.event)){const{event:t,...n}=e;return{name:t,...n}}return jn(e)&&e.length>=2?qo(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?qo(Array.from(e)):null;var t}(n);if(!a)return;const r=`${t.prefix||"dataLayer"} ${a.name}`,{name:s,...i}=a,o={name:r,data:i};Dn(()=>e(o),()=>{})()}function qo(e){const[t,n,a]=e;if(!En(t))return null;let r,s={};switch(t){case"consent":if(!En(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!Cn(a)||null===a)return null;r=`${t} ${n}`,s={...a};break;case"event":if(!En(n))return null;r=n,Cn(a)&&(s={...a});break;case"config":if(!En(n))return null;r=`${t} ${n}`,Cn(a)&&(s={...a});break;case"set":if(En(n))r=`${t} ${n}`,Cn(a)&&(s={...a});else{if(!Cn(n))return null;r=`${t} custom`,s={...n}}break;default:return null}return{name:r,...s}}Do({},{push:()=>Wo});var Bo=()=>{},Ko=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Wo={get push(){return Ko()},get command(){return Ko()},get elb(){return Ko()},get window(){return{dataLayer:[],addEventListener:Bo,removeEventListener:Bo}}};function Xo(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function Jo(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function Ho(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function Yo(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function Go(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function Qo(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function ec(){return["set",{currency:"EUR",country:"DE"}]}function tc(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Do({},{add_to_cart:()=>Yo,config:()=>Qo,consentDefault:()=>Jo,consentUpdate:()=>Xo,directDataLayerEvent:()=>tc,purchase:()=>Ho,setCustom:()=>ec,view_item:()=>Go});Do({},{add_to_cart:()=>rc,config:()=>cc,configGA4:()=>ic,consentOnlyMapping:()=>uc,consentUpdate:()=>nc,customEvent:()=>oc,purchase:()=>ac,view_item:()=>sc});var nc={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},ac={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},rc={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},sc={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},ic={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},oc={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},cc={consent:{update:nc},purchase:ac,add_to_cart:rc,view_item:sc,"config G-XXXXXXXXXX":ic,custom_event:oc,"*":{data:{}}},uc={consent:{update:nc}},dc=async(e,t)=>{const{elb:n,window:a}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},s={settings:r};return a&&(function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer",r=window[a];if(Array.isArray(r)&&!Uo){Uo=!0;try{for(const t of r)Vo(e,n,t)}finally{Uo=!1}}}(n,s),function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer";window[a]||(window[a]=[]);const r=window[a];if(!Array.isArray(r))return;const s=r.push.bind(r);r.push=function(...t){if(Uo)return s(...t);Uo=!0;try{for(const a of t)Vo(e,n,a)}finally{Uo=!1}return s(...t)}}(n,s)),{type:"dataLayer",config:s,push:n,destroy:async()=>{const e=r.name||"dataLayer";a&&a[e]&&Array.isArray(a[e])}}};function lc(){window.dataLayer=window.dataLayer||[];const e=e=>{Cn(e)&&Cn(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var pc={};async function mc(e={}){const t=Pn({collector:{destinations:{dataLayer:{code:lc()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),n={...t.collector,sources:{browser:{code:Fo,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=Cn(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:dc,config:{settings:e}})}const a=await aa(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}var fc=mc;export{pc as Walkerjs,mc as createWalkerjs,fc as default,Ji as getAllEvents,Hi as getEvents,Yi as getGlobals};//# sourceMappingURL=index.mjs.map
1
+ var e,t,n,a=Object.defineProperty,r=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},i={};r(i,{BRAND:()=>De,DIRTY:()=>k,EMPTY_PATH:()=>g,INVALID:()=>S,NEVER:()=>$t,OK:()=>w,ParseStatus:()=>_,Schema:()=>E,ZodAny:()=>ue,ZodArray:()=>fe,ZodBigInt:()=>re,ZodBoolean:()=>ie,ZodBranded:()=>ze,ZodCatch:()=>Me,ZodDate:()=>se,ZodDefault:()=>Le,ZodDiscriminatedUnion:()=>be,ZodEffects:()=>$e,ZodEnum:()=>Te,ZodError:()=>u,ZodFirstPartyTypeKind:()=>Be,ZodFunction:()=>Ze,ZodIntersection:()=>Se,ZodIssueCode:()=>c,ZodLazy:()=>Pe,ZodLiteral:()=>Ae,ZodMap:()=>xe,ZodNaN:()=>Re,ZodNativeEnum:()=>Ce,ZodNever:()=>pe,ZodNull:()=>de,ZodNullable:()=>Ie,ZodNumber:()=>ae,ZodObject:()=>ge,ZodOptional:()=>Ne,ZodParsedType:()=>s,ZodPipeline:()=>Fe,ZodPromise:()=>Ee,ZodReadonly:()=>Ue,ZodRecord:()=>we,ZodSchema:()=>E,ZodSet:()=>je,ZodString:()=>te,ZodSymbol:()=>oe,ZodTransformer:()=>$e,ZodTuple:()=>ke,ZodType:()=>E,ZodUndefined:()=>ce,ZodUnion:()=>ye,ZodUnknown:()=>le,ZodVoid:()=>me,addIssueToContext:()=>y,any:()=>rt,array:()=>ct,bigint:()=>Ye,boolean:()=>Qe,coerce:()=>Et,custom:()=>Je,date:()=>et,datetimeRegex:()=>G,defaultErrorMap:()=>l,discriminatedUnion:()=>pt,effect:()=>xt,enum:()=>St,function:()=>vt,getErrorMap:()=>f,getParsedType:()=>o,instanceof:()=>Ke,intersection:()=>mt,isAborted:()=>x,isAsync:()=>P,isDirty:()=>j,isValid:()=>Z,late:()=>We,lazy:()=>bt,literal:()=>_t,makeIssue:()=>h,map:()=>gt,nan:()=>Ge,nativeEnum:()=>kt,never:()=>st,null:()=>at,nullable:()=>Zt,number:()=>Xe,object:()=>dt,objectUtil:()=>n,oboolean:()=>Ct,onumber:()=>Tt,optional:()=>jt,ostring:()=>Ot,pipeline:()=>At,preprocess:()=>Pt,promise:()=>wt,quotelessJson:()=>d,record:()=>ht,set:()=>yt,setErrorMap:()=>m,strictObject:()=>ut,string:()=>He,symbol:()=>tt,transformer:()=>xt,tuple:()=>ft,undefined:()=>nt,union:()=>lt,unknown:()=>it,util:()=>e,void:()=>ot}),(t=e||(e={})).assertEqual=e=>{},t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const t of n)a[t]=e[t];return t.objectValues(a)},t.objectValues=e=>t.objectKeys(e).map(function(t){return e[t]}),t.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},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});var s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),o=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},c=e.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"]),d=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),u=class t 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(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.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()}};u.create=e=>new u(e);var l=(t,n)=>{let a;switch(t.code){case c.invalid_type:a=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case c.invalid_union:a="Invalid input";break;case c.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case c.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.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 t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case c.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case c.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.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 ${t.multipleOf}`;break;case c.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}},p=l;function m(e){p=e}function f(){return p}var h=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}},g=[];function y(e,t){const n=f(),a=h({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l?void 0:l].filter(e=>!!e)});e.common.issues.push(a)}var v,b,_=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"}),k=e=>({status:"dirty",value:e}),w=e=>({status:"valid",value:e}),x=e=>"aborted"===e.status,j=e=>"dirty"===e.status,Z=e=>"valid"===e.status,P=e=>"undefined"!=typeof Promise&&e instanceof Promise;(b=v||(v={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},b.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var A=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}},O=(e,t)=>{if(Z(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 u(e.common.issues);return this._error=t,this._error}}};function T(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 C,E=class{get description(){return this._def.description}_getType(e){return o(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(P(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:o(e)},r=this._parseSync({data:e,path:a.path,parent:a});return O(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:o(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Z(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=>Z(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:o(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(P(a)?a:Promise.resolve(a));return O(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:c.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 $e({schema:this,typeName:Be.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 Ne.create(this,this._def)}nullable(){return Ie.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return Ee.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return Se.create(this,e,this._def)}transform(e){return new $e({...T(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Le({...T(this._def),innerType:this,defaultValue:t,typeName:Be.ZodDefault})}brand(){return new ze({typeName:Be.ZodBranded,type:this,...T(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Me({...T(this._def),innerType:this,catchValue:t,typeName:Be.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Fe.create(this,e)}readonly(){return Ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},$=/^c[^\s-]{8,}$/i,N=/^[0-9a-z]+$/,I=/^[0-9A-HJKMNP-TV-Z]{26}$/i,L=/^[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,M=/^[a-z0-9_-]{21}$/i,R=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D=/^[-+]?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)?)??$/,z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F=/^(?:(?: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])$/,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])\/(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]))$/,J=/^(([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])$/,B=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,W="((\\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])))",K=new RegExp(`^${W}$`);function H(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 X(e){return new RegExp(`^${H(e)}$`)}function G(e){let t=`${W}T${H(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 Y(e,t){return!("v4"!==t&&t||!F.test(e))||!("v6"!==t&&t||!q.test(e))}function Q(e,t){if(!R.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 ee(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!J.test(e))}var te=class t extends E{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:s.string,received:e.parsedType}),S}const n=new _;let a;for(const r of this._def.checks)if("min"===r.kind)t.data.length<r.value&&(a=this._getOrReturnCtx(t,a),y(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("max"===r.kind)t.data.length>r.value&&(a=this._getOrReturnCtx(t,a),y(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("length"===r.kind){const e=t.data.length>r.value,i=t.data.length<r.value;(e||i)&&(a=this._getOrReturnCtx(t,a),e?y(a,{code:c.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&y(a,{code:c.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if("email"===r.kind)z.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"email",code:c.invalid_string,message:r.message}),n.dirty());else if("emoji"===r.kind)C||(C=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),C.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"emoji",code:c.invalid_string,message:r.message}),n.dirty());else if("uuid"===r.kind)L.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"uuid",code:c.invalid_string,message:r.message}),n.dirty());else if("nanoid"===r.kind)M.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"nanoid",code:c.invalid_string,message:r.message}),n.dirty());else if("cuid"===r.kind)$.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"cuid",code:c.invalid_string,message:r.message}),n.dirty());else if("cuid2"===r.kind)N.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"cuid2",code:c.invalid_string,message:r.message}),n.dirty());else if("ulid"===r.kind)I.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"ulid",code:c.invalid_string,message:r.message}),n.dirty());else if("url"===r.kind)try{new URL(t.data)}catch(e){a=this._getOrReturnCtx(t,a),y(a,{validation:"url",code:c.invalid_string,message:r.message}),n.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"regex",code:c.invalid_string,message:r.message}),n.dirty())}else if("trim"===r.kind)t.data=t.data.trim();else if("includes"===r.kind)t.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty());else if("toLowerCase"===r.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===r.kind)t.data=t.data.toUpperCase();else if("startsWith"===r.kind)t.data.startsWith(r.value)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty());else if("endsWith"===r.kind)t.data.endsWith(r.value)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty());else if("datetime"===r.kind){G(r).test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:"datetime",message:r.message}),n.dirty())}else if("date"===r.kind){K.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:"date",message:r.message}),n.dirty())}else if("time"===r.kind){X(r).test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{code:c.invalid_string,validation:"time",message:r.message}),n.dirty())}else"duration"===r.kind?D.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"duration",code:c.invalid_string,message:r.message}),n.dirty()):"ip"===r.kind?Y(t.data,r.version)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"ip",code:c.invalid_string,message:r.message}),n.dirty()):"jwt"===r.kind?Q(t.data,r.alg)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"jwt",code:c.invalid_string,message:r.message}),n.dirty()):"cidr"===r.kind?ee(t.data,r.version)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"cidr",code:c.invalid_string,message:r.message}),n.dirty()):"base64"===r.kind?B.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"base64",code:c.invalid_string,message:r.message}),n.dirty()):"base64url"===r.kind?V.test(t.data)||(a=this._getOrReturnCtx(t,a),y(a,{validation:"base64url",code:c.invalid_string,message:r.message}),n.dirty()):e.assertNever(r);return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:c.invalid_string,...v.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.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,...v.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,...v.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...v.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"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 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}te.create=e=>{var t;return new te({checks:[],typeName:Be.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...T(e)})};var ae=class t extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:s.number,received:e.parsedType}),S}let n;const a=new _;for(const r of this._def.checks)if("int"===r.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),y(n,{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?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),y(n,{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(t.data,r.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_finite,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:v.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.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(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.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)}};ae.create=e=>new ae({checks:[],typeName:Be.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...T(e)});var re=class t extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(e){return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let n;const a=new _;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:v.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}};re.create=e=>{var t;return new re({checks:[],typeName:Be.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...T(e)})};var ie=class extends E{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.boolean,received:t.parsedType}),S}return w(e.data)}};ie.create=e=>new ie({typeName:Be.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...T(e)});var se=class t extends E{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:s.date,received:e.parsedType}),S}if(Number.isNaN(t.data.getTime())){return y(this._getOrReturnCtx(t),{code:c.invalid_date}),S}const n=new _;let a;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()<r.value&&(a=this._getOrReturnCtx(t,a),y(a,{code:c.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?t.data.getTime()>r.value&&(a=this._getOrReturnCtx(t,a),y(a,{code:c.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):e.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}};se.create=e=>new se({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Be.ZodDate,...T(e)});var oe=class extends E{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.symbol,received:t.parsedType}),S}return w(e.data)}};oe.create=e=>new oe({typeName:Be.ZodSymbol,...T(e)});var ce=class extends E{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.undefined,received:t.parsedType}),S}return w(e.data)}};ce.create=e=>new ce({typeName:Be.ZodUndefined,...T(e)});var de=class extends E{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.null,received:t.parsedType}),S}return w(e.data)}};de.create=e=>new de({typeName:Be.ZodNull,...T(e)});var ue=class extends E{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};ue.create=e=>new ue({typeName:Be.ZodAny,...T(e)});var le=class extends E{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};le.create=e=>new le({typeName:Be.ZodUnknown,...T(e)});var pe=class extends E{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.never,received:t.parsedType}),S}};pe.create=e=>new pe({typeName:Be.ZodNever,...T(e)});var me=class extends E{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.void,received:t.parsedType}),S}return w(e.data)}};me.create=e=>new me({typeName:Be.ZodVoid,...T(e)});var fe=class e extends E{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==s.array)return y(t,{code:c.invalid_type,expected:s.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)&&(y(t,{code:e?c.too_big:c.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&&(y(t,{code:c.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&&(y(t,{code:c.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 A(t,e,t.path,n)))).then(e=>_.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new A(t,e,t.path,n)));return _.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:v.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:v.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:v.toString(n)}})}nonempty(e){return this.min(1,e)}};function he(e){if(e instanceof ge){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Ne.create(he(a))}return new ge({...e._def,shape:()=>t})}return e instanceof fe?new fe({...e._def,type:he(e.element)}):e instanceof Ne?Ne.create(he(e.unwrap())):e instanceof Ie?Ie.create(he(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>he(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...T(t)});var ge=class t extends E{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.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 pe&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const o=[];for(const e of r){const t=a[e],r=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new A(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof pe){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(y(n,{code:c.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];o.push({key:{status:"valid",value:t},value:e._parse(new A(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new t({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,r,i,s;const o=null!=(i=null==(r=(a=this._def).errorMap)?void 0:r.call(a,t,n).message)?i:n.defaultError;return"unrecognized_keys"===t.code?{message:null!=(s=v.errToObj(e).message)?s:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Be.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const a={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}omit(n){const a={};for(const t of e.objectKeys(this.shape))n[t]||(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}deepPartial(){return he(this)}partial(n){const a={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?a[t]=e:a[t]=e.optional()}return new t({...this._def,shape:()=>a})}required(n){const a={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])a[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ne;)e=e._def.innerType;a[t]=e}return new t({...this._def,shape:()=>a})}keyof(){return Oe(e.objectKeys(this.shape))}};ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:Be.ZodObject,...T(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Be.ZodObject,...T(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Be.ZodObject,...T(t)});var ye=class extends E{_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 u(e.ctx.common.issues));return y(t,{code:c.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 u(e));return y(t,{code:c.invalid_union,unionErrors:r}),S}}get options(){return this._def.options}};ye.create=(e,t)=>new ye({options:e,typeName:Be.ZodUnion,...T(t)});var ve=t=>t instanceof Pe?ve(t.schema):t instanceof $e?ve(t.innerType()):t instanceof Ae?[t.value]:t instanceof Te?t.options:t instanceof Ce?e.objectValues(t.enum):t instanceof Le?ve(t._def.innerType):t instanceof ce?[void 0]:t instanceof de?[null]:t instanceof Ne?[void 0,...ve(t.unwrap())]:t instanceof Ie?[null,...ve(t.unwrap())]:t instanceof ze||t instanceof Ue?ve(t.unwrap()):t instanceof Me?ve(t._def.innerType):[],be=class e extends E{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return y(t,{code:c.invalid_type,expected:s.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}):(y(t,{code:c.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=ve(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:Be.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...T(a)})}};function _e(t,n){const a=o(t),r=o(n);if(t===n)return{valid:!0,data:t};if(a===s.object&&r===s.object){const a=e.objectKeys(n),r=e.objectKeys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...n};for(const e of r){const a=_e(t[e],n[e]);if(!a.valid)return{valid:!1};i[e]=a.data}return{valid:!0,data:i}}if(a===s.array&&r===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let a=0;a<t.length;a++){const r=_e(t[a],n[a]);if(!r.valid)return{valid:!1};e.push(r.data)}return{valid:!0,data:e}}return a===s.date&&r===s.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var Se=class extends E{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(x(e)||x(a))return S;const r=_e(e.value,a.value);return r.valid?((j(e)||j(a))&&t.dirty(),{status:t.value,value:r.data}):(y(n,{code:c.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:Be.ZodIntersection,...T(n)});var ke=class e extends E{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return y(n,{code:c.invalid_type,expected:s.array,received:n.parsedType}),S;if(n.data.length<this._def.items.length)return y(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&n.data.length>this._def.items.length&&(y(n,{code:c.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 A(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:Be.ZodTuple,rest:null,...T(t)})};var we=class e extends E{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!==s.object)return y(n,{code:c.invalid_type,expected:s.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 A(n,e,n.path,e)),value:i._parse(new A(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_.mergeObjectAsync(t,a):_.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof E?{keyType:t,valueType:n,typeName:Be.ZodRecord,...T(a)}:{keyType:te.create(),valueType:t,typeName:Be.ZodRecord,...T(n)})}},xe=class extends E{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!==s.map)return y(n,{code:c.invalid_type,expected:s.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 A(n,e,n.path,[i,"key"])),value:r._parse(new A(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}}}};xe.create=(e,t,n)=>new xe({valueType:t,keyType:e,typeName:Be.ZodMap,...T(n)});var je=class e extends E{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return y(n,{code:c.invalid_type,expected:s.set,received:n.parsedType}),S;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(y(n,{code:c.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&&(y(n,{code:c.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 o=[...n.data.values()].map((e,t)=>r._parse(new A(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>i(e)):i(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:v.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:v.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:Be.ZodSet,...T(t)});var Ze=class e extends E{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return y(t,{code:c.invalid_type,expected:s.function,received:t.parsedType}),S;function n(e,n){return h({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),l].filter(e=>!!e),issueData:{code:c.invalid_arguments,argumentsError:n}})}function a(e,n){return h({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),l].filter(e=>!!e),issueData:{code:c.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ee){const e=this;return w(async function(...t){const s=new u([]),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 u([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new u([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:ke.create(t).rest(le.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||ke.create([]).rest(le.create()),returns:n||le.create(),typeName:Be.ZodFunction,...T(a)})}},Pe=class extends E{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Pe.create=(e,t)=>new Pe({getter:e,typeName:Be.ZodLazy,...T(t)});var Ae=class extends E{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Oe(e,t){return new Te({values:e,typeName:Be.ZodEnum,...T(t)})}Ae.create=(e,t)=>new Ae({value:e,typeName:Be.ZodLiteral,...T(t)});var Te=class t extends E{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),a=this._def.values;return y(n,{expected:e.joinValues(a),received:n.parsedType,code:c.invalid_type}),S}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return y(e,{received:e.data,code:c.invalid_enum_value,options:n}),S}return w(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};Te.create=Oe;var Ce=class extends E{_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==s.string&&a.parsedType!==s.number){const t=e.objectValues(n);return y(a,{expected:e.joinValues(t),received:a.parsedType,code:c.invalid_type}),S}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return y(a,{received:a.data,code:c.invalid_enum_value,options:t}),S}return w(t.data)}get enum(){return this._def.values}};Ce.create=(e,t)=>new Ce({values:e,typeName:Be.ZodNativeEnum,...T(t)});var Ee=class extends E{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return y(t,{code:c.invalid_type,expected:s.promise,received:t.parsedType}),S;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return w(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ee.create=(e,t)=>new Ee({type:e,typeName:Be.ZodPromise,...T(t)});var $e=class extends E{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:a}=this._processInputParams(t),r=this._def.effect||null,i={addIssue:e=>{y(a,e),e.fatal?n.abort():n.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(a.data,i);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===n.value)return S;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?S:"dirty"===t.status||"dirty"===n.value?k(t.value):t});{if("aborted"===n.value)return S;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?S:"dirty"===t.status||"dirty"===n.value?k(t.value):t}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);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 t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?S:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"aborted"===t.status?S:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.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(!Z(e))return S;const t=r.transform(e.value,i);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Z(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:n.value,value:e})):S)}e.assertNever(r)}};$e.create=(e,t,n)=>new $e({schema:e,typeName:Be.ZodEffects,effect:t,...T(n)}),$e.createWithPreprocess=(e,t,n)=>new $e({schema:t,effect:{type:"preprocess",transform:e},typeName:Be.ZodEffects,...T(n)});var Ne=class extends E{_parse(e){return this._getType(e)===s.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ne.create=(e,t)=>new Ne({innerType:e,typeName:Be.ZodOptional,...T(t)});var Ie=class extends E{_parse(e){return this._getType(e)===s.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:Be.ZodNullable,...T(t)});var Le=class extends E{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Le.create=(e,t)=>new Le({innerType:e,typeName:Be.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...T(t)});var Me=class extends E{_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 P(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Me.create=(e,t)=>new Me({innerType:e,typeName:Be.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...T(t)});var Re=class extends E{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}};Re.create=e=>new Re({typeName:Be.ZodNaN,...T(e)});var De=Symbol("zod_brand"),ze=class extends E{_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}},Fe=class e extends E{_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(),k(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:Be.ZodPipeline})}},Ue=class extends E{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Z(e)&&(e.value=Object.freeze(e.value)),e);return P(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function qe(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Je(e,t={},n){return e?ue.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=qe(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=qe(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}Ue.create=(e,t)=>new Ue({innerType:e,typeName:Be.ZodReadonly,...T(t)});var Be,Ve,We={object:ge.lazycreate};(Ve=Be||(Be={})).ZodString="ZodString",Ve.ZodNumber="ZodNumber",Ve.ZodNaN="ZodNaN",Ve.ZodBigInt="ZodBigInt",Ve.ZodBoolean="ZodBoolean",Ve.ZodDate="ZodDate",Ve.ZodSymbol="ZodSymbol",Ve.ZodUndefined="ZodUndefined",Ve.ZodNull="ZodNull",Ve.ZodAny="ZodAny",Ve.ZodUnknown="ZodUnknown",Ve.ZodNever="ZodNever",Ve.ZodVoid="ZodVoid",Ve.ZodArray="ZodArray",Ve.ZodObject="ZodObject",Ve.ZodUnion="ZodUnion",Ve.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ve.ZodIntersection="ZodIntersection",Ve.ZodTuple="ZodTuple",Ve.ZodRecord="ZodRecord",Ve.ZodMap="ZodMap",Ve.ZodSet="ZodSet",Ve.ZodFunction="ZodFunction",Ve.ZodLazy="ZodLazy",Ve.ZodLiteral="ZodLiteral",Ve.ZodEnum="ZodEnum",Ve.ZodEffects="ZodEffects",Ve.ZodNativeEnum="ZodNativeEnum",Ve.ZodOptional="ZodOptional",Ve.ZodNullable="ZodNullable",Ve.ZodDefault="ZodDefault",Ve.ZodCatch="ZodCatch",Ve.ZodPromise="ZodPromise",Ve.ZodBranded="ZodBranded",Ve.ZodPipeline="ZodPipeline",Ve.ZodReadonly="ZodReadonly";var Ke=(e,t={message:`Input not instance of ${e.name}`})=>Je(t=>t instanceof e,t),He=te.create,Xe=ae.create,Ge=Re.create,Ye=re.create,Qe=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=fe.create,dt=ge.create,ut=ge.strictCreate,lt=ye.create,pt=be.create,mt=Se.create,ft=ke.create,ht=we.create,gt=xe.create,yt=je.create,vt=Ze.create,bt=Pe.create,_t=Ae.create,St=Te.create,kt=Ce.create,wt=Ee.create,xt=$e.create,jt=Ne.create,Zt=Ie.create,Pt=$e.createWithPreprocess,At=Fe.create,Ot=()=>He().optional(),Tt=()=>Xe().optional(),Ct=()=>Qe().optional(),Et={string:e=>te.create({...e,coerce:!0}),number:e=>ae.create({...e,coerce:!0}),boolean:e=>ie.create({...e,coerce:!0}),bigint:e=>re.create({...e,coerce:!0}),date:e=>se.create({...e,coerce:!0})},$t=S,Nt=Symbol("Let zodToJsonSchema decide on which parser to use"),It={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"},Lt=e=>{const t=(e=>"string"==typeof e?{...It,name:e}:{...It,...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 Mt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Rt(e,t,n,a,r){e[t]=n,Mt(e,t,a,r)}var Dt=(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 zt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Dt(t,e.currentPath):t.join("/")}}function Ft(e,t){return hn(e.type._def,t)}function Ut(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Ut(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 qt(e,t)}}var qt=(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":Rt(n,"minimum",a.value,a.message,t);break;case"max":Rt(n,"maximum",a.value,a.message,t)}return n};var Jt=void 0,Bt=/^[cC][^\s-]{8,}$/,Vt=/^[0-9a-z]+$/,Wt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Kt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Ht=()=>(void 0===Jt&&(Jt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Jt),Xt=/^(?:(?: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])$/,Gt=/^(([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])$/,Yt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,en=/^[a-zA-Z0-9_-]{21}$/,tn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function nn(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Rt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Rt(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":sn(n,"email",a.message,t);break;case"format:idn-email":sn(n,"idn-email",a.message,t);break;case"pattern:zod":on(n,Kt,a.message,t)}break;case"url":sn(n,"uri",a.message,t);break;case"uuid":sn(n,"uuid",a.message,t);break;case"regex":on(n,a.regex,a.message,t);break;case"cuid":on(n,Bt,a.message,t);break;case"cuid2":on(n,Vt,a.message,t);break;case"startsWith":on(n,RegExp(`^${an(a.value,t)}`),a.message,t);break;case"endsWith":on(n,RegExp(`${an(a.value,t)}$`),a.message,t);break;case"datetime":sn(n,"date-time",a.message,t);break;case"date":sn(n,"date",a.message,t);break;case"time":sn(n,"time",a.message,t);break;case"duration":sn(n,"duration",a.message,t);break;case"length":Rt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Rt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":on(n,RegExp(an(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&sn(n,"ipv4",a.message,t),"v4"!==a.version&&sn(n,"ipv6",a.message,t);break;case"base64url":on(n,Qt,a.message,t);break;case"jwt":on(n,tn,a.message,t);break;case"cidr":"v6"!==a.version&&on(n,Xt,a.message,t),"v4"!==a.version&&on(n,Gt,a.message,t);break;case"emoji":on(n,Ht(),a.message,t);break;case"ulid":on(n,Wt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":sn(n,"binary",a.message,t);break;case"contentEncoding:base64":Rt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":on(n,Yt,a.message,t)}break;case"nanoid":on(n,en,a.message,t)}return n}function an(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)rn.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var rn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sn(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}}})):Rt(e,"format",t,n,a)}function on(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:cn(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Rt(e,"pattern",cn(t,a),n,a)}function cn(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 dn(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)===Be.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=hn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:zt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=hn(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)===Be.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=nn(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Be.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Be.ZodBranded&&e.keyType._def.type._def.typeName===Be.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Ft(e.keyType._def,t);return{...d,propertyNames:a}}return d}var un={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var ln=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>hn(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 pn(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=mn(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=hn(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 hn(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 mn(e){try{return e.isOptional()}catch(e){return!0}}var fn=(e,t,n)=>{switch(t){case Be.ZodString:return nn(e,n);case Be.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",Mt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Rt(n,"minimum",a.value,a.message,t):Rt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Rt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Rt(n,"maximum",a.value,a.message,t):Rt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Rt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Rt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Be.ZodObject:return pn(e,n);case Be.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?Rt(n,"minimum",a.value,a.message,t):Rt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Rt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Rt(n,"maximum",a.value,a.message,t):Rt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Rt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Rt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Be.ZodBoolean:return{type:"boolean"};case Be.ZodDate:return Ut(e,n);case Be.ZodUndefined:return function(e){return{not:zt(e)}}(n);case Be.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Be.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)!==Be.ZodAny&&(i.items=hn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Rt(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Rt(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Rt(i,"minItems",e.exactLength.value,e.exactLength.message,t),Rt(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Be.ZodUnion:case Be.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return ln(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in un&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=un[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 ln(e,t)}(e,n);case Be.ZodIntersection:return function(e,t){const n=[hn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),hn(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 Be.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>hn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:hn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>hn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Be.ZodRecord:return dn(e,n);case Be.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 Be.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Be.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 Be.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:un[e.innerType._def.typeName],nullable:!0}:{type:[un[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=hn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=hn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Be.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return hn(e.innerType._def,t);const a=hn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:zt(t)},a]}:zt(t)})(e,n);case Be.ZodMap:return function(e,t){return"record"===t.mapStrategy?dn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[hn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||zt(t),hn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||zt(t)],minItems:2,maxItems:2}}}(e,n);case Be.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:hn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Rt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Rt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Be.ZodLazy:return()=>e.getter()._def;case Be.ZodPromise:return function(e,t){return hn(e.type._def,t)}(e,n);case Be.ZodNaN:case Be.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:zt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Be.ZodEffects:return function(e,t){return"input"===t.effectStrategy?hn(e.schema._def,t):zt(t)}(e,n);case Be.ZodAny:return zt(n);case Be.ZodUnknown:return function(e){return zt(e)}(n);case Be.ZodDefault:return function(e,t){return{...hn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Be.ZodBranded:return Ft(e,n);case Be.ZodReadonly:case Be.ZodCatch:return((e,t)=>hn(e.innerType._def,t))(e,n);case Be.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return hn(e.in._def,t);if("output"===t.pipeStrategy)return hn(e.out._def,t);const n=hn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,hn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Be.ZodFunction:case Be.ZodVoid:case Be.ZodSymbol:default:return}};function hn(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!==Nt)return i}if(r&&!n){const e=gn(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?hn(s(),t):s;if(o&&yn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var gn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Dt(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`),zt(t)):"seen"===t.$refStrategy?zt(t):void 0}},yn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),vn=(e,t)=>{var n;const a=Lt(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=hn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:zt(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=hn(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:zt(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},bn=Object.defineProperty,_n=(e,t)=>{for(var n in t)bn(e,n,{get:t[n],enumerable:!0})},Sn={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},kn=i.string(),wn=i.number(),xn=(i.boolean(),i.string().min(1)),jn=i.number().int().positive(),Zn=i.number().int().nonnegative(),Pn=i.number().describe("Tagging version number");i.union([i.string(),i.number(),i.boolean()]).optional();_n({},{ErrorHandlerSchema:()=>Tn,HandlerSchema:()=>En,LogHandlerSchema:()=>Cn,StorageSchema:()=>On,StorageTypeSchema:()=>An,errorHandlerJsonSchema:()=>In,handlerJsonSchema:()=>Mn,logHandlerJsonSchema:()=>Ln,storageJsonSchema:()=>Nn,storageTypeJsonSchema:()=>$n});var An=i.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),On=i.object({Local:i.literal("local"),Session:i.literal("session"),Cookie:i.literal("cookie")}).describe("Storage type constants for type-safe references"),Tn=i.any().describe("Error handler function: (error, state?) => void"),Cn=i.any().describe("Log handler function: (message, verbose?) => void"),En=i.object({Error:Tn.describe("Error handler function"),Log:Cn.describe("Log handler function")}).describe("Handler interface with error and log functions"),$n=vn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),Nn=vn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),In=vn(Tn,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Ln=vn(Cn,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Mn=vn(En,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});i.object({onError:Tn.optional().describe("Error handler function: (error, state?) => void"),onLog:Cn.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),i.object({verbose:i.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),i.object({queue:i.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),i.object({}).partial(),i.object({init:i.boolean().describe("Whether to initialize immediately").optional(),loadScript:i.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),i.object({disabled:i.boolean().describe("Set to true to disable").optional()}).partial(),i.object({primary:i.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),i.object({settings:i.any().optional().describe("Implementation-specific configuration")}).partial(),i.object({env:i.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),i.object({type:i.string().optional().describe("Instance type identifier"),config:i.any().describe("Instance configuration")}).partial(),i.object({collector:i.any().describe("Collector instance (runtime object)"),config:i.any().describe("Configuration"),env:i.any().describe("Environment dependencies")}).partial(),i.object({batch:i.number().optional().describe("Batch size: bundle N events for batch processing"),batched:i.any().optional().describe("Batch of events to be processed")}).partial(),i.object({ignore:i.boolean().describe("Set to true to skip processing").optional(),condition:i.string().optional().describe("Condition function: return true to process")}).partial(),i.object({sources:i.record(i.string(),i.any()).describe("Map of source instances")}).partial(),i.object({destinations:i.record(i.string(),i.any()).describe("Map of destination instances")}).partial();_n({},{ConsentSchema:()=>qn,DeepPartialEventSchema:()=>Gn,EntitiesSchema:()=>Kn,EntitySchema:()=>Wn,EventSchema:()=>Hn,OrderedPropertiesSchema:()=>Fn,PartialEventSchema:()=>Xn,PropertiesSchema:()=>zn,PropertySchema:()=>Dn,PropertyTypeSchema:()=>Rn,SourceSchema:()=>Vn,SourceTypeSchema:()=>Un,UserSchema:()=>Jn,VersionSchema:()=>Bn,consentJsonSchema:()=>ia,entityJsonSchema:()=>aa,eventJsonSchema:()=>Yn,orderedPropertiesJsonSchema:()=>na,partialEventJsonSchema:()=>Qn,propertiesJsonSchema:()=>ta,sourceTypeJsonSchema:()=>ra,userJsonSchema:()=>ea});var Rn=i.lazy(()=>i.union([i.boolean(),i.string(),i.number(),i.record(i.string(),Dn)])),Dn=i.lazy(()=>i.union([Rn,i.array(Rn)])),zn=i.record(i.string(),Dn.optional()).describe("Flexible property collection with optional values"),Fn=i.record(i.string(),i.tuple([Dn,i.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Un=i.union([i.enum(["web","server","app","other"]),i.string()]).describe("Source type: web, server, app, other, or custom"),qn=i.record(i.string(),i.boolean()).describe("Consent requirement mapping (group name → state)"),Jn=zn.and(i.object({id:i.string().optional().describe("User identifier"),device:i.string().optional().describe("Device identifier"),session:i.string().optional().describe("Session identifier"),hash:i.string().optional().describe("Hashed identifier"),address:i.string().optional().describe("User address"),email:i.string().email().optional().describe("User email address"),phone:i.string().optional().describe("User phone number"),userAgent:i.string().optional().describe("Browser user agent string"),browser:i.string().optional().describe("Browser name"),browserVersion:i.string().optional().describe("Browser version"),deviceType:i.string().optional().describe("Device type (mobile, desktop, tablet)"),os:i.string().optional().describe("Operating system"),osVersion:i.string().optional().describe("Operating system version"),screenSize:i.string().optional().describe("Screen dimensions"),language:i.string().optional().describe("User language"),country:i.string().optional().describe("User country"),region:i.string().optional().describe("User region/state"),city:i.string().optional().describe("User city"),zip:i.string().optional().describe("User postal code"),timezone:i.string().optional().describe("User timezone"),ip:i.string().optional().describe("User IP address"),internal:i.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Bn=zn.and(i.object({source:kn.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Pn})).describe("Walker version information"),Vn=zn.and(i.object({type:Un.describe("Source type identifier"),id:kn.describe("Source identifier (typically URL on web)"),previous_id:kn.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),Wn=i.lazy(()=>i.object({entity:i.string().describe("Entity name"),data:zn.describe("Entity-specific properties"),nested:i.array(Wn).describe("Nested child entities"),context:Fn.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),Kn=i.array(Wn).describe("Array of nested entities"),Hn=i.object({name:i.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:zn.describe("Event-specific properties"),context:Fn.describe("Ordered context properties with priorities"),globals:zn.describe("Global properties shared across events"),custom:zn.describe("Custom implementation-specific properties"),user:Jn.describe("User identification and attributes"),nested:Kn.describe("Related nested entities"),consent:qn.describe("Consent states at event time"),id:xn.describe("Unique event identifier (timestamp-based)"),trigger:kn.describe("Event trigger identifier"),entity:kn.describe("Parsed entity from event name"),action:kn.describe("Parsed action from event name"),timestamp:jn.describe("Unix timestamp in milliseconds since epoch"),timing:wn.describe("Event processing timing information"),group:kn.describe("Event grouping identifier"),count:Zn.describe("Event count in session"),version:Bn.describe("Walker version information"),source:Vn.describe("Event source information")}).describe("Complete walkerOS event structure"),Xn=Hn.partial().describe("Partial event structure with all fields optional"),Gn=i.lazy(()=>Hn.deepPartial()).describe("Deep partial event structure with all nested fields optional"),Yn=vn(Hn,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),Qn=vn(Xn,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),ea=vn(Jn,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),ta=vn(zn,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),na=vn(Fn,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),aa=vn(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),ra=vn(Un,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),ia=vn(qn,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});_n({},{ConfigSchema:()=>ha,LoopSchema:()=>ca,MapSchema:()=>ua,PolicySchema:()=>pa,ResultSchema:()=>ga,RuleSchema:()=>ma,RulesSchema:()=>fa,SetSchema:()=>da,ValueConfigSchema:()=>la,ValueSchema:()=>sa,ValuesSchema:()=>oa,configJsonSchema:()=>ja,loopJsonSchema:()=>ba,mapJsonSchema:()=>Sa,policyJsonSchema:()=>ka,ruleJsonSchema:()=>wa,rulesJsonSchema:()=>xa,setJsonSchema:()=>_a,valueConfigJsonSchema:()=>va,valueJsonSchema:()=>ya});var sa=i.lazy(()=>i.union([i.string().describe('String value or property path (e.g., "data.id")'),i.number().describe("Numeric value"),i.boolean().describe("Boolean value"),la,i.array(sa).describe("Array of values")])),oa=i.array(sa).describe("Array of transformation values"),ca=i.tuple([sa,sa]).describe("Loop transformation: [source, transform] tuple for array processing"),da=i.array(sa).describe("Set: Array of values for selection or combination"),ua=i.record(i.string(),sa).describe("Map: Object mapping keys to transformation values"),la=i.object({key:i.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:i.union([i.string(),i.number(),i.boolean()]).optional().describe("Static primitive value"),fn:i.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:i.string().optional().describe("Condition function as string: return true to include value"),validate:i.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=i.record(i.string(),sa).describe("Policy rules for event pre-processing (key → value mapping)"),ma=i.object({batch:i.number().optional().describe("Batch size: bundle N events for batch processing"),condition:i.string().optional().describe("Condition function as string: return true to process event"),consent:qn.optional().describe("Required consent states to process this event"),settings:i.any().optional().describe("Destination-specific settings for this event mapping"),data:i.union([sa,oa]).optional().describe("Data transformation rules for event"),ignore:i.boolean().optional().describe("Set to true to skip processing this event"),name:i.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"),fa=i.record(i.string(),i.record(i.string(),i.union([ma,i.array(ma)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),ha=i.object({consent:qn.optional().describe("Required consent states to process any events"),data:i.union([sa,oa]).optional().describe("Global data transformation applied to all events"),mapping:fa.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=i.object({eventMapping:ma.optional().describe("Resolved mapping rule for event"),mappingKey:i.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),ya=vn(sa,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),va=vn(la,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ba=vn(ca,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),_a=vn(da,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Sa=vn(ua,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),ka=vn(pa,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),wa=vn(ma,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),xa=vn(fa,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),ja=vn(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});_n({},{BatchSchema:()=>Na,ConfigSchema:()=>Za,ContextSchema:()=>Oa,DLQSchema:()=>qa,DataSchema:()=>Ia,DestinationPolicySchema:()=>Aa,DestinationsSchema:()=>Da,InitDestinationsSchema:()=>Ra,InitSchema:()=>Ma,InstanceSchema:()=>La,PartialConfigSchema:()=>Pa,PushBatchContextSchema:()=>Ca,PushContextSchema:()=>Ta,PushEventSchema:()=>Ea,PushEventsSchema:()=>$a,PushResultSchema:()=>Fa,RefSchema:()=>za,ResultSchema:()=>Ua,batchJsonSchema:()=>Ka,configJsonSchema:()=>Ja,contextJsonSchema:()=>Va,instanceJsonSchema:()=>Ha,partialConfigJsonSchema:()=>Ba,pushContextJsonSchema:()=>Wa,resultJsonSchema:()=>Xa});var Za=i.object({consent:qn.optional().describe("Required consent states to send events to this destination"),settings:i.any().describe("Implementation-specific configuration").optional(),data:i.union([sa,oa]).optional().describe("Global data transformation applied to all events for this destination"),env:i.any().describe("Environment dependencies (platform-specific)").optional(),id:xn.describe("Destination instance identifier (defaults to destination key)").optional(),init:i.boolean().describe("Whether to initialize immediately").optional(),loadScript:i.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:fa.optional().describe("Entity-action specific mapping rules for this destination"),policy:pa.optional().describe("Pre-processing policy rules applied before event mapping"),queue:i.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:i.boolean().describe("Enable verbose logging for debugging").optional(),onError:Tn.optional(),onLog:Cn.optional()}).describe("Destination configuration"),Pa=Za.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Aa=pa.describe("Destination policy rules for event pre-processing"),Oa=i.object({collector:i.any().describe("Collector instance (runtime object)"),config:Za.describe("Destination configuration"),data:i.union([i.any(),i.undefined(),i.array(i.union([i.any(),i.undefined()]))]).optional().describe("Transformed event data"),env:i.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ta=Oa.extend({mapping:ma.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ca=Ta.describe("Batch push context with event-specific mapping"),Ea=i.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"),$a=i.array(Ea).describe("Array of events with mappings"),Na=i.object({key:i.string().describe('Batch key (usually mapping key like "product.view")'),events:i.array(Hn).describe("Array of events in batch"),data:i.array(i.union([i.any(),i.undefined(),i.array(i.union([i.any(),i.undefined()]))])).describe("Transformed data for each event"),mapping:ma.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Ia=i.union([i.any(),i.undefined(),i.array(i.union([i.any(),i.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),La=i.object({config:Za.describe("Destination configuration"),queue:i.array(Hn).optional().describe("Queued events awaiting consent"),dlq:i.array(i.tuple([Hn,i.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:i.string().optional().describe("Destination type identifier"),env:i.any().optional().describe("Environment dependencies"),init:i.any().optional().describe("Initialization function"),push:i.any().describe("Push function for single events"),pushBatch:i.any().optional().describe("Batch push function"),on:i.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ma=i.object({code:La.describe("Destination instance with implementation"),config:Pa.optional().describe("Partial configuration overrides"),env:i.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Ra=i.record(i.string(),Ma).describe("Map of destination IDs to initialization configurations"),Da=i.record(i.string(),La).describe("Map of destination IDs to runtime instances"),za=i.object({id:i.string().describe("Destination ID"),destination:La.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Fa=i.object({queue:i.array(Hn).optional().describe("Events queued (awaiting consent)"),error:i.any().optional().describe("Error if push failed")}).describe("Push operation result"),Ua=i.object({successful:i.array(za).describe("Destinations that processed successfully"),queued:i.array(za).describe("Destinations that queued events"),failed:i.array(za).describe("Destinations that failed to process")}).describe("Overall destination processing result"),qa=i.array(i.tuple([Hn,i.any()])).describe("Dead letter queue: [(event, error), ...]"),Ja=vn(Za,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),Ba=vn(Pa,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),Va=vn(Oa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),Wa=vn(Ta,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),Ka=vn(Na,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),Ha=vn(La,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),Xa=vn(Ua,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});_n({},{CommandTypeSchema:()=>Ga,ConfigSchema:()=>Ya,DestinationsSchema:()=>ar,InitConfigSchema:()=>er,InstanceSchema:()=>rr,PushContextSchema:()=>tr,SessionDataSchema:()=>Qa,SourcesSchema:()=>nr,commandTypeJsonSchema:()=>ir,configJsonSchema:()=>sr,initConfigJsonSchema:()=>cr,instanceJsonSchema:()=>ur,pushContextJsonSchema:()=>dr,sessionDataJsonSchema:()=>or});var Ga=i.union([i.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),i.string()]).describe("Collector command type: standard commands or custom string for extensions"),Ya=i.object({run:i.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Pn,globalsStatic:zn.describe("Static global properties that persist across collector runs"),sessionStatic:i.record(i.any()).describe("Static session data that persists across collector runs"),verbose:i.boolean().describe("Enable verbose logging for debugging"),onError:Tn.optional(),onLog:Cn.optional()}).describe("Core collector configuration"),Qa=zn.and(i.object({isStart:i.boolean().describe("Whether this is a new session start"),storage:i.boolean().describe("Whether storage is available"),id:xn.describe("Session identifier").optional(),start:jn.describe("Session start timestamp").optional(),marketing:i.literal(!0).optional().describe("Marketing attribution flag"),updated:jn.describe("Last update timestamp").optional(),isNew:i.boolean().describe("Whether this is a new session").optional(),device:xn.describe("Device identifier").optional(),count:Zn.describe("Event count in session").optional(),runs:Zn.describe("Number of runs").optional()})).describe("Session state and tracking data"),er=Ya.partial().extend({consent:qn.optional().describe("Initial consent state"),user:Jn.optional().describe("Initial user data"),globals:zn.optional().describe("Initial global properties"),sources:i.any().optional().describe("Source configurations"),destinations:i.any().optional().describe("Destination configurations"),custom:zn.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),tr=i.object({mapping:ha.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),nr=i.record(i.string(),i.any()).describe("Map of source IDs to source instances"),ar=i.record(i.string(),i.any()).describe("Map of destination IDs to destination instances"),rr=i.object({push:i.any().describe("Push function for processing events"),command:i.any().describe("Command function for walker commands"),allowed:i.boolean().describe("Whether event processing is allowed"),config:Ya.describe("Current collector configuration"),consent:qn.describe("Current consent state"),count:i.number().describe("Event count (increments with each event)"),custom:zn.describe("Custom implementation-specific properties"),sources:nr.describe("Registered source instances"),destinations:ar.describe("Registered destination instances"),globals:zn.describe("Current global properties"),group:i.string().describe("Event grouping identifier"),hooks:i.any().describe("Lifecycle hook functions"),on:i.any().describe("Event lifecycle configuration"),queue:i.array(Hn).describe("Queued events awaiting processing"),round:i.number().describe("Collector run count (increments with each run)"),session:i.union([i.undefined(),Qa]).describe("Current session state"),timing:i.number().describe("Event processing timing information"),user:Jn.describe("Current user data"),version:i.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),ir=vn(Ga,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),sr=vn(Ya,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),or=vn(Qa,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),cr=vn(er,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),dr=vn(tr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),ur=vn(rr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});_n({},{BaseEnvSchema:()=>lr,ConfigSchema:()=>pr,InitSchema:()=>hr,InitSourceSchema:()=>gr,InitSourcesSchema:()=>yr,InstanceSchema:()=>fr,PartialConfigSchema:()=>mr,baseEnvJsonSchema:()=>vr,configJsonSchema:()=>br,initSourceJsonSchema:()=>kr,initSourcesJsonSchema:()=>wr,instanceJsonSchema:()=>Sr,partialConfigJsonSchema:()=>_r});var lr=i.object({push:i.any().describe("Collector push function"),command:i.any().describe("Collector command function"),sources:i.any().optional().describe("Map of registered source instances"),elb:i.any().describe("Public API function (alias for collector.push)")}).catchall(i.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),pr=ha.extend({settings:i.any().describe("Implementation-specific configuration").optional(),env:lr.optional().describe("Environment dependencies (platform-specific)"),id:xn.describe("Source identifier (defaults to source key)").optional(),onError:Tn.optional(),disabled:i.boolean().describe("Set to true to disable").optional(),primary:i.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"),fr=i.object({type:i.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:pr.describe("Current source configuration"),push:i.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:i.any().optional().describe("Cleanup function called when source is removed"),on:i.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),hr=i.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),gr=i.object({code:hr.describe("Source initialization function"),config:mr.optional().describe("Partial configuration overrides"),env:lr.partial().optional().describe("Partial environment overrides"),primary:i.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),yr=i.record(i.string(),gr).describe("Map of source IDs to initialization configurations"),vr=vn(lr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),br=vn(pr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),_r=vn(mr,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),Sr=vn(fr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),kr=vn(gr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),wr=vn(yr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});var xr={merge:!0,shallow:!0,extend:!0};function jr(e,t={},n={}){n={...xr,...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)}function Zr(e){return Array.isArray(e)}function Pr(e){return void 0!==e}function Ar(e){return"object"==typeof e&&null!==e&&!Zr(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Or(e){return"string"==typeof e}function Tr(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=Tr(e[a],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(Tr(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function Cr(e,t="",n){const a=t.split(".");let r=e;for(let e=0;e<a.length;e++){const t=a[e];if("*"===t&&Zr(r)){const t=a.slice(e+1).join("."),i=[];for(const e of r){const a=Cr(e,t,n);i.push(a)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return Pr(r)?r:n}function Er(e,t,n){if(!Ar(e))return e;const a=Tr(e),r=t.split(".");let i=a;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return a}function $r(e,t={},n={}){const a={...t,...n},r={};let i=void 0===e;return Object.keys(a).forEach(t=>{a[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function Nr(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Ir(e){return function(e){return"boolean"==typeof e}(e)||Or(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!Pr(e)||Zr(e)&&e.every(Ir)||Ar(e)&&Object.values(e).every(Ir)}function Lr(e){return Ir(e)?e:void 0}function Mr(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Rr(e,t,n){return async function(...a){try{return await e(...a)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function Dr(e,t={},n={}){var a;if(!Pr(e))return;const r=Ar(e)&&e.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),i=Zr(t)?t:[t];for(const t of i){const a=await Rr(zr)(e,t,{...n,consent:r});if(Pr(a))return a}}async function zr(e,t,n={}){const{collector:a,consent:r}=n;return(Zr(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const o=Or(i)?{key:i}:i;if(!Object.keys(o).length)return;const{condition:c,consent:d,fn:u,key:l,loop:p,map:m,set:f,validate:h,value:g}=o;if(c&&!await Rr(c)(e,i,a))return;if(d&&!$r(d,r))return g;let y=Pr(g)?g:e;if(u&&(y=await Rr(u)(e,i,n)),l&&(y=Cr(e,l,g)),p){const[t,a]=p,r="this"===t?[e]:await Dr(e,t,n);Zr(r)&&(y=(await Promise.all(r.map(e=>Dr(e,a,n)))).filter(Pr))}else m?y=await Object.entries(m).reduce(async(t,[a,r])=>{const i=await t,s=await Dr(e,r,n);return Pr(s)&&(i[a]=s),i},Promise.resolve({})):f&&(y=await Promise.all(f.map(t=>zr(e,t,n))));h&&!await Rr(h)(y)&&(y=void 0);const v=Lr(y);return Pr(v)?v:Lr(g)},Promise.resolve(void 0))}async function Fr(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,a])=>{const r=await Dr(e,a,{collector:n});e=Er(e,t,r)}));const{eventMapping:a,mappingKey:r}=await async function(e,t){var n;const[a,r]=(e.name||"").split(" ");if(!t||!a||!r)return{};let i,s="",o=a,c=r;const d=t=>{if(t)return(t=Zr(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[o]||(o="*");const u=t[o];return u&&(u[c]||(c="*"),i=d(u[c])),i||(o="*",c="*",i=d(null==(n=t[o])?void 0:n[c])),i&&(s=`${o} ${c}`),{eventMapping:i,mappingKey:s}}(e,t.mapping);(null==a?void 0:a.policy)&&await Promise.all(Object.entries(a.policy).map(async([t,a])=>{const r=await Dr(e,a,{collector:n});e=Er(e,t,r)}));let i=t.data&&await Dr(e,t.data,{collector:n});if(a){if(a.ignore)return{event:e,data:i,mapping:a,mappingKey:r,ignore:!0};if(a.name&&(e.name=a.name),a.data){const t=a.data&&await Dr(e,a.data,{collector:n});i=Ar(i)&&Ar(t)?jr(i,t):t}}return{event:e,data:i,mapping:a,mappingKey:r,ignore:!1}}function Ur(e,t,n){return function(...a){let r;const i="post"+t,s=n["pre"+t],o=n[i];return r=s?s({fn:e},...a):e(...a),o&&(r=o({fn:e,result:r},...a)),r}}var qr=Object.defineProperty,Jr={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"};((e,t)=>{for(var n in t)qr(e,n,{get:t[n],enumerable:!0})})({},{schemas:()=>Vr,settingsSchema:()=>Br});var Br={type:"object",properties:{run:{type:"boolean",description:"Automatically start the collector pipeline on initialization"},sources:{type:"object",description:"Configurations for sources providing events to the collector"},destinations:{type:"object",description:"Configurations for destinations receiving processed events"},consent:{type:"object",description:"Initial consent state to control routing of events"},verbose:{type:"boolean",description:"Enable verbose logging for debugging"},onError:{type:"string",description:"Error handler triggered when the collector encounters failures"},onLog:{type:"string",description:"Custom log handler for collector messages"}}},Vr={settings:Br};async function Wr(e,t,n){const{allowed:a,consent:r,globals:i,user:s}=e;if(!a)return Xr({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const o=await Promise.all(Object.entries(n||{}).map(async([n,a])=>{let o=(a.queue||[]).map(e=>({...e,consent:r}));if(a.queue=[],t){const e=Tr(t);o.push(e)}if(!o.length)return{id:n,destination:a,skipped:!0};const c=[],d=o.filter(e=>{const t=$r(a.config.consent,r,e.consent);return!t||(e.consent=t,c.push(e),!1)});if(a.queue.concat(d),!c.length)return{id:n,destination:a,queue:o};if(!await Rr(Kr)(e,a))return{id:n,destination:a,queue:o};let u=!1;return a.dlq||(a.dlq=[]),await Promise.all(c.map(async t=>(t.globals=jr(i,t.globals),t.user=jr(s,t.user),await Rr(Hr,n=>(e.config.onError&&e.config.onError(n,e),u=!0,a.dlq.push([t,n]),!1))(e,a,t),t))),{id:n,destination:a,error:u}})),c=[],d=[],u=[];for(const e of o){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?u.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):c.push(n)}return Xr({ok:!u.length,event:t,successful:c,queued:d,failed:u})}async function Kr(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:Gr(t.env,t.config.env)},a=await Ur(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function Hr(e,t,n){var a;const{config:r}=t,i=await Fr(n,r,e);if(i.ignore)return!1;const s={collector:e,config:r,data:i.data,mapping:i.mapping,env:Gr(t.env,r.env)},o=i.mapping;if((null==o?void 0:o.batch)&&t.pushBatch){const n=o.batched||{key:i.mappingKey||"",events:[],data:[]};n.events.push(i.event),Pr(i.data)&&n.data.push(i.data),o.batchFn=o.batchFn||function(e,t=1e3,n=!1){let a,r=null,i=!1;return(...s)=>new Promise(o=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(a=e(...s),o(a))},t),c&&(i=!0,a=e(...s),o(a))})}((e,t)=>{const a={collector:t,config:r,data:i.data,mapping:o,env:Gr(e.env,r.env)};Ur(e.pushBatch,"DestinationPushBatch",t.hooks)(n,a),n.events=[],n.data=[]},o.batch),o.batched=n,null==(a=o.batchFn)||a.call(o,t,e)}else await Ur(t.push,"DestinationPush",e.hooks)(i.event,s);return!0}function Xr(e){var t;return jr({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function Gr(e,t){return e||t?t?e&&Ar(e)&&Ar(t)?{...e,...t}:t:e:{}}function Yr(e,t,n,a){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case Jr.Consent:r=a||e.consent;break;case Jr.Session:r=e.session;break;case Jr.Ready:case Jr.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&Mr(e.on)(t,r)}),Object.values(e.destinations).forEach(e=>{if(e.on){Mr(e.on)(t,r)}}),i.length)switch(t){case Jr.Consent:!function(e,t,n){const a=n||e.consent;t.forEach(t=>{Object.keys(a).filter(e=>e in t).forEach(n=>{Mr(t[n])(e,a)})})}(e,i,a);break;case Jr.Ready:case Jr.Run:o=i,(s=e).allowed&&o.forEach(e=>{Mr(e)(s)});break;case Jr.Session:!function(e,t){e.session&&t.forEach(t=>{Mr(t)(e,e.session)})}(e,i)}var s,o}async function Qr(e,t,n,a){let r;switch(t){case Jr.Config:Ar(n)&&jr(e.config,n,{shallow:!1});break;case Jr.Consent:Ar(n)&&(r=await async function(e,t){const{consent:n}=e;let a=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,a=a||n}),e.consent=jr(n,r),Yr(e,"consent",void 0,r),a?Wr(e):Xr({ok:!0})}(e,n));break;case Jr.Custom:Ar(n)&&(e.custom=jr(e.custom,n));break;case Jr.Destination:Ar(n)&&function(e){return"function"==typeof e}(n.push)&&(r=await async function(e,t,n){const{code:a,config:r={},env:i={}}=t,s=n||r||{init:!1},o={...a,config:s,env:Gr(a.env,i)};let c=o.config.id;if(!c)do{c=Nr(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),Wr(e,void 0,{[c]:o})}(e,{code:n},a));break;case Jr.Globals:Ar(n)&&(e.globals=jr(e.globals,n));break;case Jr.On:Or(n)&&function(e,t,n){const a=e.on,r=a[t]||[],i=Zr(n)?n:[n];i.forEach(e=>{r.push(e)}),a[t]=r,Yr(e,t,i)}(e,n,a);break;case Jr.Ready:Yr(e,"ready");break;case Jr.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Nr(),e.timing=Date.now(),t&&(t.consent&&(e.consent=jr(e.consent,t.consent)),t.user&&(e.user=jr(e.user,t.user)),t.globals&&(e.globals=jr(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=jr(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await Wr(e);return Yr(e,"run"),n}(e,n);break;case Jr.Session:Yr(e,"session");break;case Jr.User:Ar(n)&&jr(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ei(e,t){return Ur(async(n,a={})=>await Rr(async()=>{let r=n;if(a.mapping){const t=await Fr(r,a.mapping,e);if(t.ignore)return Xr({ok:!0});if(a.mapping.consent&&!$r(a.mapping.consent,e.consent,t.event.consent))return Xr({ok:!0});r=t.event}const i=t(r),s=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,a]=t.name.split(" ");if(!n||!a)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:i=e.group,count:s=e.count}=t,{name:o=`${n} ${a}`,data:c={},context:d={},globals:u=e.globals,custom:l={},user:p=e.user,nested:m=[],consent:f=e.consent,id:h=`${r}-${i}-${s}`,trigger:g="",entity:y=n,action:v=a,timing:b=0,version:_={source:e.version,tagging:e.config.tagging||0},source:S={type:"collector",id:"",previous_id:""}}=t;return{name:o,data:c,context:d,globals:u,custom:l,user:p,nested:m,consent:f,id:h,trigger:g,entity:y,action:v,timestamp:r,timing:b,group:i,count:s,version:_,source:S}}(e,i);return await Wr(e,s)},()=>Xr({ok:!1}))(),"Push",e.hooks)}async function ti(e){const t=jr({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:n,run:!0},e,{merge:!1,extend:!1});function n(e,n){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},n||t.verbose)}t.onLog=n;const a={...t.globalsStatic,...e.globals},r={allowed:!1,config:t,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:a,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.3.0",sources:{},push:void 0,command:void 0};return r.push=ei(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(s=Qr,Ur(async(e,t,n)=>await Rr(async()=>await s(i,e,t,n),()=>Xr({ok:!1}))(),"Command",(i=r).hooks)),r.destinations=await async function(e,t={}){const n={};for(const[e,a]of Object.entries(t)){const{code:t,config:r={},env:i={}}=a,s={...t.config,...r},o=Gr(t.env,i);n[e]={...t,config:s,env:o}}return n}(0,e.destinations||{}),r;var i,s}async function ni(e){e=e||{};const t=await ti(e),n=(a=t,{type:"elb",config:{},push:async(e,t,n,r,i,s)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return a.command(r,t,n)}let o;if("string"==typeof e)o={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(o.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};o=e,t&&"object"==typeof t&&!Array.isArray(t)&&(o.data={...o.data||{},...t})}return r&&"object"==typeof r&&(o.context=r),i&&Array.isArray(i)&&(o.nested=i),s&&"object"==typeof s&&(o.custom=s),a.push(o)}});var a;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[a,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:o}=r,c={push:(t,n={})=>e.push(t,{...n,mapping:i}),command:e.command,sources:e.sources,elb:e.sources.elb.push,...s},d=await Rr(t)(i,c);d&&(o&&(d.config={...d.config,primary:o}),n[a]=d)}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:i,user:s,globals:o,custom:c}=e;i&&await t.command("consent",i),s&&await t.command("user",s),o&&Object.assign(t.globals,o),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let d=n.push;const u=Object.values(t.sources).filter(e=>"elb"!==e.type),l=u.find(e=>e.config.primary);return l?d=l.push:u.length>0&&(d=u[0].push),{collector:t,elb:d}}function ai(e,t){return(e.getAttribute(t)||"").trim()}var ri=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function ii(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const a=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,o=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=a){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=a/2;if(s<0&&o<e)return!1;if(o>a&&s>e)return!1;n=document.elementFromPoint(c.x,a/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function si(e,t,n){return!1===n?e:(n||(n=ui),n(e,t,ui))}var oi,ci,di,ui=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):ri("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):ri({name:"session start",data:e})),e};function li(e,t=Sn.Storage.Session){var n;function a(e){try{return JSON.parse(e||"")}catch(t){let n=1,a="";return e&&(n=0,a=e),{e:n,v:a}}}let r,i;switch(t){case Sn.Storage.Cookie:r=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case Sn.Storage.Local:i=a(window.localStorage.getItem(e));break;case Sn.Storage.Session:i=a(window.sessionStorage.getItem(e))}return i&&(r=i.v,0!=i.e&&i.e<Date.now()&&(function(e,t=Sn.Storage.Session){switch(t){case Sn.Storage.Cookie:pi(e,"",0,t);break;case Sn.Storage.Local:window.localStorage.removeItem(e);break;case Sn.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),r="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(r||"")}function pi(e,t,n=30,a=Sn.Storage.Session,r){const i={e:Date.now()+6e4*n,v:String(t)},s=JSON.stringify(i);switch(a){case Sn.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let a=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;r&&(a+="; domain="+r),document.cookie=a;break}case Sn.Storage.Local:window.localStorage.setItem(e,s);break;case Sn.Storage.Session:window.sessionStorage.setItem(e,s)}return li(e,a)}function mi(e={}){const t=Date.now(),{length:n=30,deviceKey:a="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:o="local",pulse:c=!1}=e,d=fi(e);let u=!1;const l=Mr((e,t,n)=>{let a=li(e,n);return a||(a=Nr(8),pi(e,a,1440*t,n)),String(a)})(a,i,r),p=Mr((e,a)=>{const r=JSON.parse(String(li(e,a)));return c||(r.isNew=!1,d.marketing&&(Object.assign(r,d),u=!0),u||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,u=!0):r.runs++),r},()=>{u=!0})(s,o)||{},m={id:Nr(12),start:t,isNew:!0,count:1,runs:1},f=Object.assign(m,d,p,{device:l},{isStart:u,storage:!0,updated:t},e.data);return pi(s,JSON.stringify(f),2*n,o),f}function fi(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const a=new URL(e.url||window.location.href),r=e.referrer||document.referrer,i=r&&new URL(r).hostname,s=function(e,t={}){const n="clickId",a={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(jr(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,a[n]=t),a[r]=i)}),a}(a,e.parameters);if(Object.keys(s).length&&(s.marketing||(s.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(a.hostname),t=!n.includes(i)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:Nr(12),referrer:i},s,e.data):n}var hi=Object.defineProperty,gi=(e,t)=>{for(var n in t)hi(e,n,{get:t[n],enumerable:!0})},yi={};gi(yi,{BRAND:()=>Qs,DIRTY:()=>Ni,EMPTY_PATH:()=>Ti,INVALID:()=>$i,NEVER:()=>Vo,OK:()=>Ii,ParseStatus:()=>Ei,Schema:()=>Ji,ZodAny:()=>ks,ZodArray:()=>Zs,ZodBigInt:()=>gs,ZodBoolean:()=>ys,ZodBranded:()=>eo,ZodCatch:()=>Hs,ZodDate:()=>vs,ZodDefault:()=>Ks,ZodDiscriminatedUnion:()=>Cs,ZodEffects:()=>Bs,ZodEnum:()=>Us,ZodError:()=>ki,ZodFirstPartyTypeKind:()=>Gs,ZodFunction:()=>Rs,ZodIntersection:()=>$s,ZodIssueCode:()=>_i,ZodLazy:()=>Ds,ZodLiteral:()=>zs,ZodMap:()=>Ls,ZodNaN:()=>Xs,ZodNativeEnum:()=>qs,ZodNever:()=>xs,ZodNull:()=>Ss,ZodNullable:()=>Ws,ZodNumber:()=>hs,ZodObject:()=>As,ZodOptional:()=>Vs,ZodParsedType:()=>vi,ZodPipeline:()=>to,ZodPromise:()=>Js,ZodReadonly:()=>no,ZodRecord:()=>Is,ZodSchema:()=>Ji,ZodSet:()=>Ms,ZodString:()=>ms,ZodSymbol:()=>bs,ZodTransformer:()=>Bs,ZodTuple:()=>Ns,ZodType:()=>Ji,ZodUndefined:()=>_s,ZodUnion:()=>Os,ZodUnknown:()=>ws,ZodVoid:()=>js,addIssueToContext:()=>Ci,any:()=>yo,array:()=>So,bigint:()=>lo,boolean:()=>po,coerce:()=>Bo,custom:()=>ro,date:()=>mo,datetimeRegex:()=>ds,defaultErrorMap:()=>wi,discriminatedUnion:()=>jo,effect:()=>Mo,enum:()=>No,function:()=>Co,getErrorMap:()=>Zi,getParsedType:()=>bi,instanceof:()=>so,intersection:()=>Zo,isAborted:()=>Li,isAsync:()=>Di,isDirty:()=>Mi,isValid:()=>Ri,late:()=>io,lazy:()=>Eo,literal:()=>$o,makeIssue:()=>Oi,map:()=>Oo,nan:()=>uo,nativeEnum:()=>Io,never:()=>bo,null:()=>go,nullable:()=>Do,number:()=>co,object:()=>ko,objectUtil:()=>di,oboolean:()=>Jo,onumber:()=>qo,optional:()=>Ro,ostring:()=>Uo,pipeline:()=>Fo,preprocess:()=>zo,promise:()=>Lo,quotelessJson:()=>Si,record:()=>Ao,set:()=>To,setErrorMap:()=>ji,strictObject:()=>wo,string:()=>oo,symbol:()=>fo,transformer:()=>Mo,tuple:()=>Po,undefined:()=>ho,union:()=>xo,unknown:()=>vo,util:()=>oi,void:()=>_o}),(ci=oi||(oi={})).assertEqual=e=>{},ci.assertIs=function(e){},ci.assertNever=function(e){throw new Error},ci.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},ci.getValidEnumValues=e=>{const t=ci.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return ci.objectValues(n)},ci.objectValues=e=>ci.objectKeys(e).map(function(t){return e[t]}),ci.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},ci.find=(e,t)=>{for(const n of e)if(t(n))return n},ci.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,ci.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ci.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(di||(di={})).mergeShapes=(e,t)=>({...e,...t});var vi=oi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bi=e=>{switch(typeof e){case"undefined":return vi.undefined;case"string":return vi.string;case"number":return Number.isNaN(e)?vi.nan:vi.number;case"boolean":return vi.boolean;case"function":return vi.function;case"bigint":return vi.bigint;case"symbol":return vi.symbol;case"object":return Array.isArray(e)?vi.array:null===e?vi.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?vi.promise:"undefined"!=typeof Map&&e instanceof Map?vi.map:"undefined"!=typeof Set&&e instanceof Set?vi.set:"undefined"!=typeof Date&&e instanceof Date?vi.date:vi.object;default:return vi.unknown}},_i=oi.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"]),Si=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ki=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,oi.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()}};ki.create=e=>new ki(e);var wi=(e,t)=>{let n;switch(e.code){case _i.invalid_type:n=e.received===vi.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case _i.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,oi.jsonStringifyReplacer)}`;break;case _i.unrecognized_keys:n=`Unrecognized key(s) in object: ${oi.joinValues(e.keys,", ")}`;break;case _i.invalid_union:n="Invalid input";break;case _i.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${oi.joinValues(e.options)}`;break;case _i.invalid_enum_value:n=`Invalid enum value. Expected ${oi.joinValues(e.options)}, received '${e.received}'`;break;case _i.invalid_arguments:n="Invalid function arguments";break;case _i.invalid_return_type:n="Invalid function return type";break;case _i.invalid_date:n="Invalid date";break;case _i.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}"`:oi.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case _i.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 _i.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 _i.custom:n="Invalid input";break;case _i.invalid_intersection_types:n="Intersection results could not be merged";break;case _i.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case _i.not_finite:n="Number must be finite";break;default:n=t.defaultError,oi.assertNever(e)}return{message:n}},xi=wi;function ji(e){xi=e}function Zi(){return xi}var Pi,Ai,Oi=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}},Ti=[];function Ci(e,t){const n=Zi(),a=Oi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===wi?void 0:wi].filter(e=>!!e)});e.common.issues.push(a)}var Ei=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 $i;"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 $i;if("aborted"===r.status)return $i;"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}}},$i=Object.freeze({status:"aborted"}),Ni=e=>({status:"dirty",value:e}),Ii=e=>({status:"valid",value:e}),Li=e=>"aborted"===e.status,Mi=e=>"dirty"===e.status,Ri=e=>"valid"===e.status,Di=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Ai=Pi||(Pi={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Ai.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var zi,Fi=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}},Ui=(e,t)=>{if(Ri(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 ki(e.common.issues);return this._error=t,this._error}}};function qi(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.');return t?{errorMap:t,description:r}:{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 Ji=class{get description(){return this._def.description}_getType(e){return bi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ei,ctx:{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Di(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:bi(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ui(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:bi(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Ri(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=>Ri(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:bi(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Di(a)?a:Promise.resolve(a));return Ui(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),i=()=>{return a.addIssue({code:_i.custom,...(e=n,"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t)});var e};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 Bs({schema:this,typeName:Gs.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 Vs.create(this,this._def)}nullable(){return Ws.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zs.create(this)}promise(){return Js.create(this,this._def)}or(e){return Os.create([this,e],this._def)}and(e){return $s.create(this,e,this._def)}transform(e){return new Bs({...qi(this._def),schema:this,typeName:Gs.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ks({...qi(this._def),innerType:this,defaultValue:t,typeName:Gs.ZodDefault})}brand(){return new eo({typeName:Gs.ZodBranded,type:this,...qi(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Hs({...qi(this._def),innerType:this,catchValue:t,typeName:Gs.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return no.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bi=/^c[^\s-]{8,}$/i,Vi=/^[0-9a-z]+$/,Wi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ki=/^[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,Hi=/^[a-z0-9_-]{21}$/i,Xi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gi=/^[-+]?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)?)??$/,Yi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qi=/^(?:(?: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])$/,es=/^(?:(?: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])$/,ts=/^(([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]))$/,ns=/^(([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])$/,as=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,is="((\\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])))",ss=new RegExp(`^${is}$`);function os(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function cs(e){return new RegExp(`^${os(e)}$`)}function ds(e){let t=`${is}T${os(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 us(e,t){return!("v4"!==t&&t||!Qi.test(e))||!("v6"!==t&&t||!ts.test(e))}function ls(e,t){if(!Xi.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 ps(e,t){return!("v4"!==t&&t||!es.test(e))||!("v6"!==t&&t||!ns.test(e))}var ms=class e extends Ji{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==vi.string){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.string,received:t.parsedType}),$i}const t=new Ei;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,i=e.data.length<a.value;(r||i)&&(n=this._getOrReturnCtx(e,n),r?Ci(n,{code:_i.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&Ci(n,{code:_i.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Yi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"email",code:_i.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)zi||(zi=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"emoji",code:_i.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ki.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"uuid",code:_i.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Hi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"nanoid",code:_i.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Bi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"cuid",code:_i.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Vi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"cuid2",code:_i.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Wi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"ulid",code:_i.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),Ci(n,{validation:"url",code:_i.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"regex",code:_i.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?ds(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?ss.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?cs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?Gi.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"duration",code:_i.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?us(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"ip",code:_i.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?ls(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"jwt",code:_i.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?ps(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"cidr",code:_i.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?as.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"base64",code:_i.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?rs.test(e.data)||(n=this._getOrReturnCtx(e,n),Ci(n,{validation:"base64url",code:_i.invalid_string,message:a.message}),t.dirty()):oi.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:_i.invalid_string,...Pi.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Pi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Pi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Pi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Pi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Pi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Pi.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,...Pi.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,...Pi.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Pi.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Pi.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Pi.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Pi.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Pi.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Pi.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Pi.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Pi.errToObj(t)})}nonempty(e){return this.min(1,Pi.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 fs(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}ms.create=e=>{var t;return new ms({checks:[],typeName:Gs.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qi(e)})};var hs=class e extends Ji{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==vi.number){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.number,received:t.parsedType}),$i}let t;const n=new Ei;for(const a of this._def.checks)"int"===a.kind?oi.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==fs(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.not_finite,message:a.message}),n.dirty()):oi.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pi.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Pi.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Pi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pi.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Pi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pi.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&&oi.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)}};hs.create=e=>new hs({checks:[],typeName:Gs.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...qi(e)});var gs=class e extends Ji{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)!==vi.bigint)return this._getInvalidInput(e);let t;const n=new Ei;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ci(t,{code:_i.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):oi.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.bigint,received:t.parsedType}),$i}gte(e,t){return this.setLimit("min",e,!0,Pi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pi.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Pi.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:Pi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pi.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}};gs.create=e=>{var t;return new gs({checks:[],typeName:Gs.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qi(e)})};var ys=class extends Ji{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==vi.boolean){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.boolean,received:t.parsedType}),$i}return Ii(e.data)}};ys.create=e=>new ys({typeName:Gs.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...qi(e)});var vs=class e extends Ji{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==vi.date){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.date,received:t.parsedType}),$i}if(Number.isNaN(e.data.getTime()))return Ci(this._getOrReturnCtx(e),{code:_i.invalid_date}),$i;const t=new Ei;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Ci(n,{code:_i.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):oi.assertNever(a);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:Pi.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Pi.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}};vs.create=e=>new vs({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Gs.ZodDate,...qi(e)});var bs=class extends Ji{_parse(e){if(this._getType(e)!==vi.symbol){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.symbol,received:t.parsedType}),$i}return Ii(e.data)}};bs.create=e=>new bs({typeName:Gs.ZodSymbol,...qi(e)});var _s=class extends Ji{_parse(e){if(this._getType(e)!==vi.undefined){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.undefined,received:t.parsedType}),$i}return Ii(e.data)}};_s.create=e=>new _s({typeName:Gs.ZodUndefined,...qi(e)});var Ss=class extends Ji{_parse(e){if(this._getType(e)!==vi.null){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.null,received:t.parsedType}),$i}return Ii(e.data)}};Ss.create=e=>new Ss({typeName:Gs.ZodNull,...qi(e)});var ks=class extends Ji{constructor(){super(...arguments),this._any=!0}_parse(e){return Ii(e.data)}};ks.create=e=>new ks({typeName:Gs.ZodAny,...qi(e)});var ws=class extends Ji{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ii(e.data)}};ws.create=e=>new ws({typeName:Gs.ZodUnknown,...qi(e)});var xs=class extends Ji{_parse(e){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.never,received:t.parsedType}),$i}};xs.create=e=>new xs({typeName:Gs.ZodNever,...qi(e)});var js=class extends Ji{_parse(e){if(this._getType(e)!==vi.undefined){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.void,received:t.parsedType}),$i}return Ii(e.data)}};js.create=e=>new js({typeName:Gs.ZodVoid,...qi(e)});var Zs=class e extends Ji{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==vi.array)return Ci(t,{code:_i.invalid_type,expected:vi.array,received:t.parsedType}),$i;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(Ci(t,{code:e?_i.too_big:_i.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&&(Ci(t,{code:_i.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&&(Ci(t,{code:_i.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 Fi(t,e,t.path,n)))).then(e=>Ei.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new Fi(t,e,t.path,n)));return Ei.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Pi.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Pi.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Pi.toString(n)}})}nonempty(e){return this.min(1,e)}};function Ps(e){if(e instanceof As){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Vs.create(Ps(a))}return new As({...e._def,shape:()=>t})}return e instanceof Zs?new Zs({...e._def,type:Ps(e.element)}):e instanceof Vs?Vs.create(Ps(e.unwrap())):e instanceof Ws?Ws.create(Ps(e.unwrap())):e instanceof Ns?Ns.create(e.items.map(e=>Ps(e))):e}Zs.create=(e,t)=>new Zs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Gs.ZodArray,...qi(t)});var As=class e extends Ji{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=oi.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==vi.object){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.object,received:t.parsedType}),$i}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof xs&&"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 Fi(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof xs){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&&(Ci(n,{code:_i.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 Fi(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=>Ei.mergeObjectSync(t,e)):Ei.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return Pi.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=Pi.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:Gs.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 oi.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 oi.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ps(this)}partial(t){const n={};for(const e of oi.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 oi.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Vs;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Fs(oi.objectKeys(this.shape))}};As.create=(e,t)=>new As({shape:()=>e,unknownKeys:"strip",catchall:xs.create(),typeName:Gs.ZodObject,...qi(t)}),As.strictCreate=(e,t)=>new As({shape:()=>e,unknownKeys:"strict",catchall:xs.create(),typeName:Gs.ZodObject,...qi(t)}),As.lazycreate=(e,t)=>new As({shape:e,unknownKeys:"strip",catchall:xs.create(),typeName:Gs.ZodObject,...qi(t)});var Os=class extends Ji{_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 ki(e.ctx.common.issues));return Ci(t,{code:_i.invalid_union,unionErrors:n}),$i});{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 ki(e));return Ci(t,{code:_i.invalid_union,unionErrors:r}),$i}}get options(){return this._def.options}};Os.create=(e,t)=>new Os({options:e,typeName:Gs.ZodUnion,...qi(t)});var Ts=e=>e instanceof Ds?Ts(e.schema):e instanceof Bs?Ts(e.innerType()):e instanceof zs?[e.value]:e instanceof Us?e.options:e instanceof qs?oi.objectValues(e.enum):e instanceof Ks?Ts(e._def.innerType):e instanceof _s?[void 0]:e instanceof Ss?[null]:e instanceof Vs?[void 0,...Ts(e.unwrap())]:e instanceof Ws?[null,...Ts(e.unwrap())]:e instanceof eo||e instanceof no?Ts(e.unwrap()):e instanceof Hs?Ts(e._def.innerType):[],Cs=class e extends Ji{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vi.object)return Ci(t,{code:_i.invalid_type,expected:vi.object,received:t.parsedType}),$i;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}):(Ci(t,{code:_i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$i)}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=Ts(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:Gs.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...qi(a)})}};function Es(e,t){const n=bi(e),a=bi(t);if(e===t)return{valid:!0,data:e};if(n===vi.object&&a===vi.object){const n=oi.objectKeys(t),a=oi.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Es(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===vi.array&&a===vi.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Es(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===vi.date&&a===vi.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var $s=class extends Ji{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Li(e)||Li(a))return $i;const r=Es(e.value,a.value);return r.valid?((Mi(e)||Mi(a))&&t.dirty(),{status:t.value,value:r.data}):(Ci(n,{code:_i.invalid_intersection_types}),$i)};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}))}};$s.create=(e,t,n)=>new $s({left:e,right:t,typeName:Gs.ZodIntersection,...qi(n)});var Ns=class e extends Ji{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==vi.array)return Ci(n,{code:_i.invalid_type,expected:vi.array,received:n.parsedType}),$i;if(n.data.length<this._def.items.length)return Ci(n,{code:_i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$i;!this._def.rest&&n.data.length>this._def.items.length&&(Ci(n,{code:_i.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 Fi(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ei.mergeArray(t,e)):Ei.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ns.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ns({items:e,typeName:Gs.ZodTuple,rest:null,...qi(t)})};var Is=class e extends Ji{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!==vi.object)return Ci(n,{code:_i.invalid_type,expected:vi.object,received:n.parsedType}),$i;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new Fi(n,e,n.path,e)),value:i._parse(new Fi(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ei.mergeObjectAsync(t,a):Ei.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Ji?{keyType:t,valueType:n,typeName:Gs.ZodRecord,...qi(a)}:{keyType:ms.create(),valueType:t,typeName:Gs.ZodRecord,...qi(n)})}},Ls=class extends Ji{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!==vi.map)return Ci(n,{code:_i.invalid_type,expected:vi.map,received:n.parsedType}),$i;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:a._parse(new Fi(n,e,n.path,[i,"key"])),value:r._parse(new Fi(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 $i;"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 $i;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Ls.create=(e,t,n)=>new Ls({valueType:t,keyType:e,typeName:Gs.ZodMap,...qi(n)});var Ms=class e extends Ji{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==vi.set)return Ci(n,{code:_i.invalid_type,expected:vi.set,received:n.parsedType}),$i;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(Ci(n,{code:_i.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&&(Ci(n,{code:_i.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 $i;"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 Fi(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:Pi.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Pi.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ms.create=(e,t)=>new Ms({valueType:e,minSize:null,maxSize:null,typeName:Gs.ZodSet,...qi(t)});var Rs=class e extends Ji{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vi.function)return Ci(t,{code:_i.invalid_type,expected:vi.function,received:t.parsedType}),$i;function n(e,n){return Oi({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zi(),wi].filter(e=>!!e),issueData:{code:_i.invalid_arguments,argumentsError:n}})}function a(e,n){return Oi({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zi(),wi].filter(e=>!!e),issueData:{code:_i.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Js){const e=this;return Ii(async function(...t){const s=new ki([]),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 Ii(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new ki([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new ki([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:Ns.create(t).rest(ws.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||Ns.create([]).rest(ws.create()),returns:n||ws.create(),typeName:Gs.ZodFunction,...qi(a)})}},Ds=class extends Ji{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})}};Ds.create=(e,t)=>new Ds({getter:e,typeName:Gs.ZodLazy,...qi(t)});var zs=class extends Ji{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ci(t,{received:t.data,code:_i.invalid_literal,expected:this._def.value}),$i}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Fs(e,t){return new Us({values:e,typeName:Gs.ZodEnum,...qi(t)})}zs.create=(e,t)=>new zs({value:e,typeName:Gs.ZodLiteral,...qi(t)});var Us=class e extends Ji{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Ci(t,{expected:oi.joinValues(n),received:t.parsedType,code:_i.invalid_type}),$i}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 Ci(t,{received:t.data,code:_i.invalid_enum_value,options:n}),$i}return Ii(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})}};Us.create=Fs;var qs=class extends Ji{_parse(e){const t=oi.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==vi.string&&n.parsedType!==vi.number){const e=oi.objectValues(t);return Ci(n,{expected:oi.joinValues(e),received:n.parsedType,code:_i.invalid_type}),$i}if(this._cache||(this._cache=new Set(oi.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=oi.objectValues(t);return Ci(n,{received:n.data,code:_i.invalid_enum_value,options:e}),$i}return Ii(e.data)}get enum(){return this._def.values}};qs.create=(e,t)=>new qs({values:e,typeName:Gs.ZodNativeEnum,...qi(t)});var Js=class extends Ji{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vi.promise&&!1===t.common.async)return Ci(t,{code:_i.invalid_type,expected:vi.promise,received:t.parsedType}),$i;const n=t.parsedType===vi.promise?t.data:Promise.resolve(t.data);return Ii(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Js.create=(e,t)=>new Js({type:e,typeName:Gs.ZodPromise,...qi(t)});var Bs=class extends Ji{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gs.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{Ci(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return $i;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?$i:"dirty"===a.status||"dirty"===t.value?Ni(a.value):a});{if("aborted"===t.value)return $i;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?$i:"dirty"===a.status||"dirty"===t.value?Ni(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);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?$i:("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?$i:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ri(e))return $i;const i=a.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Ri(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):$i)}oi.assertNever(a)}};Bs.create=(e,t,n)=>new Bs({schema:e,typeName:Gs.ZodEffects,effect:t,...qi(n)}),Bs.createWithPreprocess=(e,t,n)=>new Bs({schema:t,effect:{type:"preprocess",transform:e},typeName:Gs.ZodEffects,...qi(n)});var Vs=class extends Ji{_parse(e){return this._getType(e)===vi.undefined?Ii(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vs.create=(e,t)=>new Vs({innerType:e,typeName:Gs.ZodOptional,...qi(t)});var Ws=class extends Ji{_parse(e){return this._getType(e)===vi.null?Ii(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ws.create=(e,t)=>new Ws({innerType:e,typeName:Gs.ZodNullable,...qi(t)});var Ks=class extends Ji{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===vi.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ks.create=(e,t)=>new Ks({innerType:e,typeName:Gs.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...qi(t)});var Hs=class extends Ji{_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 Di(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ki(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new ki(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Hs.create=(e,t)=>new Hs({innerType:e,typeName:Gs.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...qi(t)});var Xs=class extends Ji{_parse(e){if(this._getType(e)!==vi.nan){const t=this._getOrReturnCtx(e);return Ci(t,{code:_i.invalid_type,expected:vi.nan,received:t.parsedType}),$i}return{status:"valid",value:e.data}}};Xs.create=e=>new Xs({typeName:Gs.ZodNaN,...qi(e)});var Gs,Ys,Qs=Symbol("zod_brand"),eo=class extends Ji{_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}},to=class e extends Ji{_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?$i:"dirty"===e.status?(t.dirty(),Ni(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?$i:"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:Gs.ZodPipeline})}},no=class extends Ji{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Ri(e)&&(e.value=Object.freeze(e.value)),e);return Di(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function ao(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function ro(e,t={},n){return e?ks.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=ao(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=ao(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):ks.create()}no.create=(e,t)=>new no({innerType:e,typeName:Gs.ZodReadonly,...qi(t)});var io={object:As.lazycreate};(Ys=Gs||(Gs={})).ZodString="ZodString",Ys.ZodNumber="ZodNumber",Ys.ZodNaN="ZodNaN",Ys.ZodBigInt="ZodBigInt",Ys.ZodBoolean="ZodBoolean",Ys.ZodDate="ZodDate",Ys.ZodSymbol="ZodSymbol",Ys.ZodUndefined="ZodUndefined",Ys.ZodNull="ZodNull",Ys.ZodAny="ZodAny",Ys.ZodUnknown="ZodUnknown",Ys.ZodNever="ZodNever",Ys.ZodVoid="ZodVoid",Ys.ZodArray="ZodArray",Ys.ZodObject="ZodObject",Ys.ZodUnion="ZodUnion",Ys.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ys.ZodIntersection="ZodIntersection",Ys.ZodTuple="ZodTuple",Ys.ZodRecord="ZodRecord",Ys.ZodMap="ZodMap",Ys.ZodSet="ZodSet",Ys.ZodFunction="ZodFunction",Ys.ZodLazy="ZodLazy",Ys.ZodLiteral="ZodLiteral",Ys.ZodEnum="ZodEnum",Ys.ZodEffects="ZodEffects",Ys.ZodNativeEnum="ZodNativeEnum",Ys.ZodOptional="ZodOptional",Ys.ZodNullable="ZodNullable",Ys.ZodDefault="ZodDefault",Ys.ZodCatch="ZodCatch",Ys.ZodPromise="ZodPromise",Ys.ZodBranded="ZodBranded",Ys.ZodPipeline="ZodPipeline",Ys.ZodReadonly="ZodReadonly";var so=(e,t={message:`Input not instance of ${e.name}`})=>ro(t=>t instanceof e,t),oo=ms.create,co=hs.create,uo=Xs.create,lo=gs.create,po=ys.create,mo=vs.create,fo=bs.create,ho=_s.create,go=Ss.create,yo=ks.create,vo=ws.create,bo=xs.create,_o=js.create,So=Zs.create,ko=As.create,wo=As.strictCreate,xo=Os.create,jo=Cs.create,Zo=$s.create,Po=Ns.create,Ao=Is.create,Oo=Ls.create,To=Ms.create,Co=Rs.create,Eo=Ds.create,$o=zs.create,No=Us.create,Io=qs.create,Lo=Js.create,Mo=Bs.create,Ro=Vs.create,Do=Ws.create,zo=Bs.createWithPreprocess,Fo=to.create,Uo=()=>oo().optional(),qo=()=>co().optional(),Jo=()=>po().optional(),Bo={string:e=>ms.create({...e,coerce:!0}),number:e=>hs.create({...e,coerce:!0}),boolean:e=>ys.create({...e,coerce:!0}),bigint:e=>gs.create({...e,coerce:!0}),date:e=>vs.create({...e,coerce:!0})},Vo=$i,Wo=Symbol("Let zodToJsonSchema decide on which parser to use"),Ko={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"};function Ho(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Xo(e,t,n,a,r){e[t]=n,Ho(e,t,a,r)}var Go=(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 Yo(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Go(t,e.currentPath):t.join("/")}}function Qo(e,t){return jc(e.type._def,t)}function ec(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ec(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 tc(e,t)}}var tc=(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":Xo(n,"minimum",a.value,a.message,t);break;case"max":Xo(n,"maximum",a.value,a.message,t)}return n},nc=void 0,ac=/^[cC][^\s-]{8,}$/,rc=/^[0-9a-z]+$/,ic=/^[0-9A-HJKMNP-TV-Z]{26}$/,sc=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,oc=()=>(void 0===nc&&(nc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nc),cc=/^(?:(?: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])$/,dc=/^(([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])$/,uc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pc=/^[a-zA-Z0-9_-]{21}$/,mc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function fc(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Xo(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Xo(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":yc(n,"email",a.message,t);break;case"format:idn-email":yc(n,"idn-email",a.message,t);break;case"pattern:zod":vc(n,sc,a.message,t)}break;case"url":yc(n,"uri",a.message,t);break;case"uuid":yc(n,"uuid",a.message,t);break;case"regex":vc(n,a.regex,a.message,t);break;case"cuid":vc(n,ac,a.message,t);break;case"cuid2":vc(n,rc,a.message,t);break;case"startsWith":vc(n,RegExp(`^${hc(a.value,t)}`),a.message,t);break;case"endsWith":vc(n,RegExp(`${hc(a.value,t)}$`),a.message,t);break;case"datetime":yc(n,"date-time",a.message,t);break;case"date":yc(n,"date",a.message,t);break;case"time":yc(n,"time",a.message,t);break;case"duration":yc(n,"duration",a.message,t);break;case"length":Xo(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Xo(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":vc(n,RegExp(hc(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&yc(n,"ipv4",a.message,t),"v4"!==a.version&&yc(n,"ipv6",a.message,t);break;case"base64url":vc(n,lc,a.message,t);break;case"jwt":vc(n,mc,a.message,t);break;case"cidr":"v6"!==a.version&&vc(n,cc,a.message,t),"v4"!==a.version&&vc(n,dc,a.message,t);break;case"emoji":vc(n,oc(),a.message,t);break;case"ulid":vc(n,ic,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":yc(n,"binary",a.message,t);break;case"contentEncoding:base64":Xo(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":vc(n,uc,a.message,t)}break;case"nanoid":vc(n,pc,a.message,t)}return n}function hc(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)gc.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var gc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yc(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}}})):Xo(e,"format",t,n,a)}function vc(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:bc(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Xo(e,"pattern",bc(t,a),n,a)}function bc(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 _c(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)===Gs.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=jc(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Yo(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=jc(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)===Gs.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=fc(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Gs.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Gs.ZodBranded&&e.keyType._def.type._def.typeName===Gs.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Qo(e.keyType._def,t);return{...d,propertyNames:a}}return d}var Sc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},kc=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>jc(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 wc(e){try{return e.isOptional()}catch(e){return!0}}var xc=(e,t,n)=>{switch(t){case Gs.ZodString:return fc(e,n);case Gs.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",Ho(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Xo(n,"minimum",a.value,a.message,t):Xo(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Xo(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Xo(n,"maximum",a.value,a.message,t):Xo(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Xo(n,"maximum",a.value,a.message,t));break;case"multipleOf":Xo(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gs.ZodObject:return function(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=wc(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=jc(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 jc(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}(e,n);case Gs.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?Xo(n,"minimum",a.value,a.message,t):Xo(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Xo(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Xo(n,"maximum",a.value,a.message,t):Xo(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Xo(n,"maximum",a.value,a.message,t));break;case"multipleOf":Xo(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gs.ZodBoolean:return{type:"boolean"};case Gs.ZodDate:return ec(e,n);case Gs.ZodUndefined:return{not:Yo(n)};case Gs.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Gs.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)!==Gs.ZodAny&&(i.items=jc(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Xo(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Xo(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Xo(i,"minItems",e.exactLength.value,e.exactLength.message,t),Xo(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Gs.ZodUnion:case Gs.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return kc(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Sc&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=Sc[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 kc(e,t)}(e,n);case Gs.ZodIntersection:return function(e,t){const n=[jc(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),jc(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 Gs.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>jc(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:jc(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>jc(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Gs.ZodRecord:return _c(e,n);case Gs.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 Gs.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Gs.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 Gs.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:Sc[e.innerType._def.typeName],nullable:!0}:{type:[Sc[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=jc(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=jc(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Gs.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return jc(e.innerType._def,t);const a=jc(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Yo(t)},a]}:Yo(t)})(e,n);case Gs.ZodMap:return function(e,t){return"record"===t.mapStrategy?_c(e,t):{type:"array",maxItems:125,items:{type:"array",items:[jc(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Yo(t),jc(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Yo(t)],minItems:2,maxItems:2}}}(e,n);case Gs.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:jc(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Xo(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Xo(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Gs.ZodLazy:return()=>e.getter()._def;case Gs.ZodPromise:return function(e,t){return jc(e.type._def,t)}(e,n);case Gs.ZodNaN:case Gs.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Yo({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Gs.ZodEffects:return function(e,t){return"input"===t.effectStrategy?jc(e.schema._def,t):Yo(t)}(e,n);case Gs.ZodAny:return Yo(n);case Gs.ZodUnknown:return function(e){return Yo(e)}(n);case Gs.ZodDefault:return function(e,t){return{...jc(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Gs.ZodBranded:return Qo(e,n);case Gs.ZodReadonly:case Gs.ZodCatch:return((e,t)=>jc(e.innerType._def,t))(e,n);case Gs.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return jc(e.in._def,t);if("output"===t.pipeStrategy)return jc(e.out._def,t);const n=jc(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,jc(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Gs.ZodFunction:case Gs.ZodVoid:case Gs.ZodSymbol:default:return}};function jc(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!==Wo)return i}if(r&&!n){const e=Zc(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=xc(e,e.typeName,t),o="function"==typeof s?jc(s(),t):s;if(o&&Pc(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var Zc=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Go(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`),Yo(t)):"seen"===t.$refStrategy?Yo(t):void 0}},Pc=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),Ac=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Ko,name:a}:{...Ko,...a},n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;var a;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}]))}})(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=jc(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Yo(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=jc(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:Yo(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},Oc=Object.defineProperty,Tc=(e,t)=>{for(var n in t)Oc(e,n,{get:t[n],enumerable:!0})},Cc=yi.string(),Ec=yi.number(),$c=(yi.boolean(),yi.string().min(1)),Nc=yi.number().int().positive(),Ic=yi.number().int().nonnegative(),Lc=yi.number().describe("Tagging version number");yi.union([yi.string(),yi.number(),yi.boolean()]).optional(),Tc({},{ErrorHandlerSchema:()=>Dc,HandlerSchema:()=>Fc,LogHandlerSchema:()=>zc,StorageSchema:()=>Rc,StorageTypeSchema:()=>Mc,errorHandlerJsonSchema:()=>Jc,handlerJsonSchema:()=>Vc,logHandlerJsonSchema:()=>Bc,storageJsonSchema:()=>qc,storageTypeJsonSchema:()=>Uc});var Mc=yi.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),Rc=yi.object({Local:yi.literal("local"),Session:yi.literal("session"),Cookie:yi.literal("cookie")}).describe("Storage type constants for type-safe references"),Dc=yi.any().describe("Error handler function: (error, state?) => void"),zc=yi.any().describe("Log handler function: (message, verbose?) => void"),Fc=yi.object({Error:Dc.describe("Error handler function"),Log:zc.describe("Log handler function")}).describe("Handler interface with error and log functions"),Uc=Ac(Mc,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),qc=Ac(Rc,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Jc=Ac(Dc,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Bc=Ac(zc,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Vc=Ac(Fc,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});yi.object({onError:Dc.optional().describe("Error handler function: (error, state?) => void"),onLog:zc.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),yi.object({verbose:yi.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),yi.object({queue:yi.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),yi.object({}).partial(),yi.object({init:yi.boolean().describe("Whether to initialize immediately").optional(),loadScript:yi.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),yi.object({disabled:yi.boolean().describe("Set to true to disable").optional()}).partial(),yi.object({primary:yi.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),yi.object({settings:yi.any().optional().describe("Implementation-specific configuration")}).partial(),yi.object({env:yi.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),yi.object({type:yi.string().optional().describe("Instance type identifier"),config:yi.any().describe("Instance configuration")}).partial(),yi.object({collector:yi.any().describe("Collector instance (runtime object)"),config:yi.any().describe("Configuration"),env:yi.any().describe("Environment dependencies")}).partial(),yi.object({batch:yi.number().optional().describe("Batch size: bundle N events for batch processing"),batched:yi.any().optional().describe("Batch of events to be processed")}).partial(),yi.object({ignore:yi.boolean().describe("Set to true to skip processing").optional(),condition:yi.string().optional().describe("Condition function: return true to process")}).partial(),yi.object({sources:yi.record(yi.string(),yi.any()).describe("Map of source instances")}).partial(),yi.object({destinations:yi.record(yi.string(),yi.any()).describe("Map of destination instances")}).partial(),Tc({},{ConsentSchema:()=>Yc,DeepPartialEventSchema:()=>sd,EntitiesSchema:()=>ad,EntitySchema:()=>nd,EventSchema:()=>rd,OrderedPropertiesSchema:()=>Xc,PartialEventSchema:()=>id,PropertiesSchema:()=>Hc,PropertySchema:()=>Kc,PropertyTypeSchema:()=>Wc,SourceSchema:()=>td,SourceTypeSchema:()=>Gc,UserSchema:()=>Qc,VersionSchema:()=>ed,consentJsonSchema:()=>fd,entityJsonSchema:()=>pd,eventJsonSchema:()=>od,orderedPropertiesJsonSchema:()=>ld,partialEventJsonSchema:()=>cd,propertiesJsonSchema:()=>ud,sourceTypeJsonSchema:()=>md,userJsonSchema:()=>dd});var Wc=yi.lazy(()=>yi.union([yi.boolean(),yi.string(),yi.number(),yi.record(yi.string(),Kc)])),Kc=yi.lazy(()=>yi.union([Wc,yi.array(Wc)])),Hc=yi.record(yi.string(),Kc.optional()).describe("Flexible property collection with optional values"),Xc=yi.record(yi.string(),yi.tuple([Kc,yi.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Gc=yi.union([yi.enum(["web","server","app","other"]),yi.string()]).describe("Source type: web, server, app, other, or custom"),Yc=yi.record(yi.string(),yi.boolean()).describe("Consent requirement mapping (group name → state)"),Qc=Hc.and(yi.object({id:yi.string().optional().describe("User identifier"),device:yi.string().optional().describe("Device identifier"),session:yi.string().optional().describe("Session identifier"),hash:yi.string().optional().describe("Hashed identifier"),address:yi.string().optional().describe("User address"),email:yi.string().email().optional().describe("User email address"),phone:yi.string().optional().describe("User phone number"),userAgent:yi.string().optional().describe("Browser user agent string"),browser:yi.string().optional().describe("Browser name"),browserVersion:yi.string().optional().describe("Browser version"),deviceType:yi.string().optional().describe("Device type (mobile, desktop, tablet)"),os:yi.string().optional().describe("Operating system"),osVersion:yi.string().optional().describe("Operating system version"),screenSize:yi.string().optional().describe("Screen dimensions"),language:yi.string().optional().describe("User language"),country:yi.string().optional().describe("User country"),region:yi.string().optional().describe("User region/state"),city:yi.string().optional().describe("User city"),zip:yi.string().optional().describe("User postal code"),timezone:yi.string().optional().describe("User timezone"),ip:yi.string().optional().describe("User IP address"),internal:yi.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),ed=Hc.and(yi.object({source:Cc.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Lc})).describe("Walker version information"),td=Hc.and(yi.object({type:Gc.describe("Source type identifier"),id:Cc.describe("Source identifier (typically URL on web)"),previous_id:Cc.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),nd=yi.lazy(()=>yi.object({entity:yi.string().describe("Entity name"),data:Hc.describe("Entity-specific properties"),nested:yi.array(nd).describe("Nested child entities"),context:Xc.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),ad=yi.array(nd).describe("Array of nested entities"),rd=yi.object({name:yi.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Hc.describe("Event-specific properties"),context:Xc.describe("Ordered context properties with priorities"),globals:Hc.describe("Global properties shared across events"),custom:Hc.describe("Custom implementation-specific properties"),user:Qc.describe("User identification and attributes"),nested:ad.describe("Related nested entities"),consent:Yc.describe("Consent states at event time"),id:$c.describe("Unique event identifier (timestamp-based)"),trigger:Cc.describe("Event trigger identifier"),entity:Cc.describe("Parsed entity from event name"),action:Cc.describe("Parsed action from event name"),timestamp:Nc.describe("Unix timestamp in milliseconds since epoch"),timing:Ec.describe("Event processing timing information"),group:Cc.describe("Event grouping identifier"),count:Ic.describe("Event count in session"),version:ed.describe("Walker version information"),source:td.describe("Event source information")}).describe("Complete walkerOS event structure"),id=rd.partial().describe("Partial event structure with all fields optional"),sd=yi.lazy(()=>rd.deepPartial()).describe("Deep partial event structure with all nested fields optional"),od=Ac(rd,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),cd=Ac(id,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),dd=Ac(Qc,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),ud=Ac(Hc,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),ld=Ac(Xc,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),pd=Ac(nd,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),md=Ac(Gc,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),fd=Ac(Yc,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});Tc({},{ConfigSchema:()=>xd,LoopSchema:()=>yd,MapSchema:()=>bd,PolicySchema:()=>Sd,ResultSchema:()=>jd,RuleSchema:()=>kd,RulesSchema:()=>wd,SetSchema:()=>vd,ValueConfigSchema:()=>_d,ValueSchema:()=>hd,ValuesSchema:()=>gd,configJsonSchema:()=>Nd,loopJsonSchema:()=>Ad,mapJsonSchema:()=>Td,policyJsonSchema:()=>Cd,ruleJsonSchema:()=>Ed,rulesJsonSchema:()=>$d,setJsonSchema:()=>Od,valueConfigJsonSchema:()=>Pd,valueJsonSchema:()=>Zd});var hd=yi.lazy(()=>yi.union([yi.string().describe('String value or property path (e.g., "data.id")'),yi.number().describe("Numeric value"),yi.boolean().describe("Boolean value"),_d,yi.array(hd).describe("Array of values")])),gd=yi.array(hd).describe("Array of transformation values"),yd=yi.tuple([hd,hd]).describe("Loop transformation: [source, transform] tuple for array processing"),vd=yi.array(hd).describe("Set: Array of values for selection or combination"),bd=yi.record(yi.string(),hd).describe("Map: Object mapping keys to transformation values"),_d=yi.object({key:yi.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:yi.union([yi.string(),yi.number(),yi.boolean()]).optional().describe("Static primitive value"),fn:yi.string().optional().describe("Custom transformation function as string (serialized)"),map:bd.optional().describe("Object mapping: transform event data to structured output"),loop:yd.optional().describe("Loop transformation: [source, transform] for array processing"),set:vd.optional().describe("Set of values: combine or select from multiple values"),consent:Yc.optional().describe("Required consent states to include this value"),condition:yi.string().optional().describe("Condition function as string: return true to include value"),validate:yi.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"),Sd=yi.record(yi.string(),hd).describe("Policy rules for event pre-processing (key → value mapping)"),kd=yi.object({batch:yi.number().optional().describe("Batch size: bundle N events for batch processing"),condition:yi.string().optional().describe("Condition function as string: return true to process event"),consent:Yc.optional().describe("Required consent states to process this event"),settings:yi.any().optional().describe("Destination-specific settings for this event mapping"),data:yi.union([hd,gd]).optional().describe("Data transformation rules for event"),ignore:yi.boolean().optional().describe("Set to true to skip processing this event"),name:yi.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:Sd.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),wd=yi.record(yi.string(),yi.record(yi.string(),yi.union([kd,yi.array(kd)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),xd=yi.object({consent:Yc.optional().describe("Required consent states to process any events"),data:yi.union([hd,gd]).optional().describe("Global data transformation applied to all events"),mapping:wd.optional().describe("Entity-action specific mapping rules"),policy:Sd.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),jd=yi.object({eventMapping:kd.optional().describe("Resolved mapping rule for event"),mappingKey:yi.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Zd=Ac(hd,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),Pd=Ac(_d,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Ad=Ac(yd,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Od=Ac(vd,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Td=Ac(bd,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Cd=Ac(Sd,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Ed=Ac(kd,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),$d=Ac(wd,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Nd=Ac(xd,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});Tc({},{BatchSchema:()=>qd,ConfigSchema:()=>Id,ContextSchema:()=>Rd,DLQSchema:()=>Yd,DataSchema:()=>Jd,DestinationPolicySchema:()=>Md,DestinationsSchema:()=>Kd,InitDestinationsSchema:()=>Wd,InitSchema:()=>Vd,InstanceSchema:()=>Bd,PartialConfigSchema:()=>Ld,PushBatchContextSchema:()=>zd,PushContextSchema:()=>Dd,PushEventSchema:()=>Fd,PushEventsSchema:()=>Ud,PushResultSchema:()=>Xd,RefSchema:()=>Hd,ResultSchema:()=>Gd,batchJsonSchema:()=>au,configJsonSchema:()=>Qd,contextJsonSchema:()=>tu,instanceJsonSchema:()=>ru,partialConfigJsonSchema:()=>eu,pushContextJsonSchema:()=>nu,resultJsonSchema:()=>iu});var Id=yi.object({consent:Yc.optional().describe("Required consent states to send events to this destination"),settings:yi.any().describe("Implementation-specific configuration").optional(),data:yi.union([hd,gd]).optional().describe("Global data transformation applied to all events for this destination"),env:yi.any().describe("Environment dependencies (platform-specific)").optional(),id:$c.describe("Destination instance identifier (defaults to destination key)").optional(),init:yi.boolean().describe("Whether to initialize immediately").optional(),loadScript:yi.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:wd.optional().describe("Entity-action specific mapping rules for this destination"),policy:Sd.optional().describe("Pre-processing policy rules applied before event mapping"),queue:yi.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:yi.boolean().describe("Enable verbose logging for debugging").optional(),onError:Dc.optional(),onLog:zc.optional()}).describe("Destination configuration"),Ld=Id.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Md=Sd.describe("Destination policy rules for event pre-processing"),Rd=yi.object({collector:yi.any().describe("Collector instance (runtime object)"),config:Id.describe("Destination configuration"),data:yi.union([yi.any(),yi.undefined(),yi.array(yi.union([yi.any(),yi.undefined()]))]).optional().describe("Transformed event data"),env:yi.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Dd=Rd.extend({mapping:kd.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),zd=Dd.describe("Batch push context with event-specific mapping"),Fd=yi.object({event:rd.describe("The event to process"),mapping:kd.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Ud=yi.array(Fd).describe("Array of events with mappings"),qd=yi.object({key:yi.string().describe('Batch key (usually mapping key like "product.view")'),events:yi.array(rd).describe("Array of events in batch"),data:yi.array(yi.union([yi.any(),yi.undefined(),yi.array(yi.union([yi.any(),yi.undefined()]))])).describe("Transformed data for each event"),mapping:kd.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Jd=yi.union([yi.any(),yi.undefined(),yi.array(yi.union([yi.any(),yi.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Bd=yi.object({config:Id.describe("Destination configuration"),queue:yi.array(rd).optional().describe("Queued events awaiting consent"),dlq:yi.array(yi.tuple([rd,yi.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:yi.string().optional().describe("Destination type identifier"),env:yi.any().optional().describe("Environment dependencies"),init:yi.any().optional().describe("Initialization function"),push:yi.any().describe("Push function for single events"),pushBatch:yi.any().optional().describe("Batch push function"),on:yi.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Vd=yi.object({code:Bd.describe("Destination instance with implementation"),config:Ld.optional().describe("Partial configuration overrides"),env:yi.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Wd=yi.record(yi.string(),Vd).describe("Map of destination IDs to initialization configurations"),Kd=yi.record(yi.string(),Bd).describe("Map of destination IDs to runtime instances"),Hd=yi.object({id:yi.string().describe("Destination ID"),destination:Bd.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Xd=yi.object({queue:yi.array(rd).optional().describe("Events queued (awaiting consent)"),error:yi.any().optional().describe("Error if push failed")}).describe("Push operation result"),Gd=yi.object({successful:yi.array(Hd).describe("Destinations that processed successfully"),queued:yi.array(Hd).describe("Destinations that queued events"),failed:yi.array(Hd).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Yd=yi.array(yi.tuple([rd,yi.any()])).describe("Dead letter queue: [(event, error), ...]"),Qd=Ac(Id,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),eu=Ac(Ld,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),tu=Ac(Rd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),nu=Ac(Dd,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),au=Ac(qd,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),ru=Ac(Bd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),iu=Ac(Gd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});Tc({},{CommandTypeSchema:()=>su,ConfigSchema:()=>ou,DestinationsSchema:()=>pu,InitConfigSchema:()=>du,InstanceSchema:()=>mu,PushContextSchema:()=>uu,SessionDataSchema:()=>cu,SourcesSchema:()=>lu,commandTypeJsonSchema:()=>fu,configJsonSchema:()=>hu,initConfigJsonSchema:()=>yu,instanceJsonSchema:()=>bu,pushContextJsonSchema:()=>vu,sessionDataJsonSchema:()=>gu});var su=yi.union([yi.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),yi.string()]).describe("Collector command type: standard commands or custom string for extensions"),ou=yi.object({run:yi.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Lc,globalsStatic:Hc.describe("Static global properties that persist across collector runs"),sessionStatic:yi.record(yi.any()).describe("Static session data that persists across collector runs"),verbose:yi.boolean().describe("Enable verbose logging for debugging"),onError:Dc.optional(),onLog:zc.optional()}).describe("Core collector configuration"),cu=Hc.and(yi.object({isStart:yi.boolean().describe("Whether this is a new session start"),storage:yi.boolean().describe("Whether storage is available"),id:$c.describe("Session identifier").optional(),start:Nc.describe("Session start timestamp").optional(),marketing:yi.literal(!0).optional().describe("Marketing attribution flag"),updated:Nc.describe("Last update timestamp").optional(),isNew:yi.boolean().describe("Whether this is a new session").optional(),device:$c.describe("Device identifier").optional(),count:Ic.describe("Event count in session").optional(),runs:Ic.describe("Number of runs").optional()})).describe("Session state and tracking data"),du=ou.partial().extend({consent:Yc.optional().describe("Initial consent state"),user:Qc.optional().describe("Initial user data"),globals:Hc.optional().describe("Initial global properties"),sources:yi.any().optional().describe("Source configurations"),destinations:yi.any().optional().describe("Destination configurations"),custom:Hc.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),uu=yi.object({mapping:xd.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),lu=yi.record(yi.string(),yi.any()).describe("Map of source IDs to source instances"),pu=yi.record(yi.string(),yi.any()).describe("Map of destination IDs to destination instances"),mu=yi.object({push:yi.any().describe("Push function for processing events"),command:yi.any().describe("Command function for walker commands"),allowed:yi.boolean().describe("Whether event processing is allowed"),config:ou.describe("Current collector configuration"),consent:Yc.describe("Current consent state"),count:yi.number().describe("Event count (increments with each event)"),custom:Hc.describe("Custom implementation-specific properties"),sources:lu.describe("Registered source instances"),destinations:pu.describe("Registered destination instances"),globals:Hc.describe("Current global properties"),group:yi.string().describe("Event grouping identifier"),hooks:yi.any().describe("Lifecycle hook functions"),on:yi.any().describe("Event lifecycle configuration"),queue:yi.array(rd).describe("Queued events awaiting processing"),round:yi.number().describe("Collector run count (increments with each run)"),session:yi.union([yi.undefined(),cu]).describe("Current session state"),timing:yi.number().describe("Event processing timing information"),user:Qc.describe("Current user data"),version:yi.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),fu=Ac(su,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),hu=Ac(ou,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),gu=Ac(cu,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),yu=Ac(du,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),vu=Ac(uu,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),bu=Ac(mu,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});Tc({},{BaseEnvSchema:()=>_u,ConfigSchema:()=>Su,InitSchema:()=>xu,InitSourceSchema:()=>ju,InitSourcesSchema:()=>Zu,InstanceSchema:()=>wu,PartialConfigSchema:()=>ku,baseEnvJsonSchema:()=>Pu,configJsonSchema:()=>Au,initSourceJsonSchema:()=>Cu,initSourcesJsonSchema:()=>Eu,instanceJsonSchema:()=>Tu,partialConfigJsonSchema:()=>Ou});var _u=yi.object({push:yi.any().describe("Collector push function"),command:yi.any().describe("Collector command function"),sources:yi.any().optional().describe("Map of registered source instances"),elb:yi.any().describe("Public API function (alias for collector.push)")}).catchall(yi.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),Su=xd.extend({settings:yi.any().describe("Implementation-specific configuration").optional(),env:_u.optional().describe("Environment dependencies (platform-specific)"),id:$c.describe("Source identifier (defaults to source key)").optional(),onError:Dc.optional(),disabled:yi.boolean().describe("Set to true to disable").optional(),primary:yi.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),ku=Su.deepPartial().describe("Partial source configuration with all fields deeply optional"),wu=yi.object({type:yi.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Su.describe("Current source configuration"),push:yi.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:yi.any().optional().describe("Cleanup function called when source is removed"),on:yi.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),xu=yi.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),ju=yi.object({code:xu.describe("Source initialization function"),config:ku.optional().describe("Partial configuration overrides"),env:_u.partial().optional().describe("Partial environment overrides"),primary:yi.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),Zu=yi.record(yi.string(),ju).describe("Map of source IDs to initialization configurations"),Pu=Ac(_u,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),Au=Ac(Su,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),Ou=Ac(ku,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),Tu=Ac(wu,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),Cu=Ac(ju,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Eu=Ac(Zu,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function $u(e){return Ac(e,{target:"jsonSchema7",$refStrategy:"none"})}var Nu={merge:!0,shallow:!0,extend:!0};function Iu(e,t={},n={}){n={...Nu,...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)}function Lu(e){return Array.isArray(e)}function Mu(e){return e===document||e instanceof Element}function Ru(e){return"object"==typeof e&&null!==e&&!Lu(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Du(e){return"string"==typeof e}function zu(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Fu(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Uu(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function qu(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Ju(e,t,n,a=!0){return tl(ai(t,qu(e,n,a))||"").reduce((e,n)=>{let[a,r]=nl(n);if(!a)return e;if(r||(a.endsWith(":")&&(a=a.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return a.endsWith("[]")?(a=a.slice(0,-2),Lu(e[a])||(e[a]=[]),e[a].push(zu(r))):e[a]=zu(r),e},{})}function Bu(e,t=Jr.Prefix){var n;const a=e||document.body;if(!a)return[];let r=[];const i=Jr.Action,s=`[${qu(t,i,!1)}]`,o=e=>{Object.keys(Ju(t,e,i,!1)).forEach(n=>{r=r.concat(Vu(e,n,t))})};return a!==document&&(null==(n=a.matches)?void 0:n.call(a,s))&&o(a),el(a,s,o),r}function Vu(e,t,n=Jr.Prefix){const a=[],{actions:r,nearestOnly:i}=function(e,t,n){let a=t;for(;a;){const t=ai(a,qu(e,Jr.Actions,!1));if(t){const e=Hu(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=ai(a,qu(e,Jr.Action,!1));if(r){const e=Hu(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}a=Yu(e,a)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=tl(r.actionParams||"",",").reduce((e,t)=>(e[Uu(t)]=!0,e),{}),o=Xu(n,e,s,i);if(!o.length){const t="page",a=`[${qu(n,t)}]`,[r,i]=Qu(e,a,n,t);o.push({entity:t,data:r,nested:[],context:i})}o.forEach(e=>{a.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),a):a}function Wu(e=Jr.Prefix,t=document){const n=qu(e,Jr.Globals,!1);let a={};return el(t,`[${n}]`,t=>{a=Iu(a,Ju(e,t,Jr.Globals,!1))}),a}function Ku(e,t){const n=window.location,a="page",r=t===document?document.body:t,[i,s]=Qu(r,`[${qu(e,a)}]`,e,a);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function Hu(e){const t={};return tl(e).forEach(e=>{const[n,a]=nl(e),[r,i]=al(n);if(!r)return;let[s,o]=al(a||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:o})}),t}function Xu(e,t,n,a=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=Gu(e,i,t,n);if(s&&(r.push(s),a))break;i=Yu(e,i)}return r}function Gu(e,t,n,a){const r=ai(t,qu(e));if(!r||a&&!a[r])return null;const i=[t],s=`[${qu(e,r)}],[${qu(e,"")}]`,o=qu(e,Jr.Link,!1);let c={};const d=[],[u,l]=Qu(n||t,s,e,r);el(t,`[${o}]`,t=>{const[n,a]=nl(ai(t,o));"parent"===a&&el(document.body,`[${o}="${n}:child"]`,t=>{i.push(t);const n=Gu(e,t);n&&d.push(n)})});const p=[];i.forEach(e=>{e.matches(s)&&p.push(e),el(e,s,e=>p.push(e))});let m={};return p.forEach(t=>{m=Iu(m,Ju(e,t,"")),c=Iu(c,Ju(e,t,r))}),c=Iu(Iu(m,c),u),i.forEach(t=>{el(t,`[${qu(e)}]`,t=>{const n=Gu(e,t);n&&d.push(n)})}),{entity:r,data:c,context:l,nested:d}}function Yu(e,t){const n=qu(e,Jr.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=nl(ai(t,n));if("child"===a)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function Qu(e,t,n,a){let r={};const i={};let s=e;const o=`[${qu(n,Jr.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=Iu(Ju(n,s,""),r),r=Iu(Ju(n,s,a),r)),s.matches(o)&&(Object.entries(Ju(n,s,Jr.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=Yu(n,s);return[r,i]}function el(e,t,n){e.querySelectorAll(t).forEach(n)}function tl(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function nl(e){const[t,n]=e.split(/:(.+)/,2);return[Uu(t),Uu(n)]}function al(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var rl,il=new WeakMap,sl=new WeakMap,ol=new WeakMap;function cl(e){const t=Date.now();let n=sl.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:ii(e),lastChecked:t},sl.set(e,n)),n.isVisible}function dl(e){if(window.IntersectionObserver)return Fu(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,a;const r=t.target,i=ol.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const a=Date.now();let o=il.get(r);if((!o||a-o.lastChecked>1e3)&&(o={isLarge:r.offsetHeight>window.innerHeight,lastChecked:a},il.set(r,o)),t.intersectionRatio>=.5||o.isLarge&&cl(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(cl(r)){const a=null==(t=i.elementConfigs)?void 0:t.get(r);(null==a?void 0:a.context)&&await kl(a.context,r,a.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=ol.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const a=n.timers.get(t);a&&(clearTimeout(a),n.timers.delete(t)),il.delete(t),sl.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const o=null==(a=i.elementConfigs)?void 0:a.get(r);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function ul(e,t,n={multiple:!1}){var a;const r=e.settings.scope||document,i=ol.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(a=n.multiple)&&a,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function ll(e){if(!e)return;const t=ol.get(e);t&&(t.observer&&t.observer.disconnect(),ol.delete(e))}function pl(e,t,n,a,r,i,s){const{elb:o,settings:c}=e;if(Du(t)&&t.startsWith("walker "))return o(t,n);if(Ru(t)){const e=t;return e.source||(e.source=ml()),e.globals||(e.globals=Wu(c.prefix,c.scope||document)),o(e)}const[d]=String(Ru(t)?t.name:t).split(" ");let u,l=Ru(n)?n:{},p={},m=!1;if(Mu(n)&&(u=n,m=!0),Mu(r)?u=r:Ru(r)&&Object.keys(r).length&&(p=r),u){const e=Xu(c.prefix||"data-elb",u).find(e=>e.entity===d);e&&(m&&(l=e.data),p=e.context)}"page"===d&&(l.id=l.id||window.location.pathname);const f=Wu(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:i,custom:s,trigger:Du(a)?a:"",source:ml()})}function ml(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var fl=[],hl="hover",gl="load",yl="pulse",vl="scroll",bl="wait";function _l(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",Fu(function(t){xl.call(this,e,t)})),n.addEventListener("submit",Fu(function(t){jl.call(this,e,t)})))}(e,t)}function Sl(e,t){t.scope&&function(e,t){const n=t.scope;fl=[];const a=n||document;ll(a),function(e,t=1e3){ol.has(e)||ol.set(e,{observer:dl(e),timers:new WeakMap,duration:t})}(a,1e3);const r=qu(t.prefix,Jr.Action,!1);a!==document&&wl(e,a,r,t),a.querySelectorAll(`[${r}]`).forEach(n=>{wl(e,n,r,t)}),fl.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const a=window.scrollY+window.innerHeight,r=e.offsetTop;if(a<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-a)/(i||1))>=n&&(kl(t,e,vl),1))});rl||(rl=function(e,t=1e3){let n=null;return function(...a){if(null===n)return n=setTimeout(()=>{n=null},t),e(...a)}}(function(){fl=n.call(t,fl,e)}),t.addEventListener("scroll",rl))}(e,a)}(e,t)}async function kl(e,t,n){const a=Vu(t,n,e.settings.prefix);return Promise.all(a.map(t=>pl(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function wl(e,t,n,a){const r=ai(t,n);r&&Object.values(Hu(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case hl:a=e,t.addEventListener("mouseenter",Fu(function(e){e.target instanceof Element&&kl(a,e.target,hl)}));break;case gl:!function(e,t){kl(e,t,gl)}(e,t);break;case yl:!function(e,t,n=""){setInterval(()=>{document.hidden||kl(e,t,yl)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case vl:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||fl.push([e,n])}(t,n.triggerParams);break;case"impression":ul(e,t);break;case"visible":ul(e,t,{multiple:!0});break;case bl:!function(e,t,n=""){setTimeout(()=>kl(e,t,bl),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var a}))}function xl(e,t){kl(e,t.target,"click")}function jl(e,t){t.target&&kl(e,t.target,"submit")}function Zl(e,t,n,a){const r=[];let i=!0;n.forEach(e=>{const t=Al(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],o=!Ru(s)&&Du(s)&&s.startsWith("walker ");if(Ru(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!Du(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(a&&o||!a&&!o)&&r.push(t)}),r.forEach(n=>{Pl(e,t,n)})}function Pl(e,t="data-elb",n){Fu(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Du(a)&&""===a.trim())return;if(Du(a)&&a.startsWith("walker "))return void e(a,r[0]);pl({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},a,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Al(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Ol(e,t={}){return function(e={}){const{cb:t,consent:n,collector:a,storage:r}=e;if(!n)return si((r?mi:fi)(e),a,t);{const r=function(e,t){let n;return(a,r)=>{if(Pr(n)&&n===(null==a?void 0:a.group))return;n=null==a?void 0:a.group;let i=()=>fi(e);return e.consent&&$r((Zr(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>mi(e)),si(i(),a,t)}}(e,t),i=(Zr(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",i):ri("walker on","consent",i)}}({...t,collector:{push:e,group:void 0}})}gi({},{env:()=>Tl});var Tl={};gi(Tl,{push:()=>$l});var Cl=()=>{},El=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),$l={get push(){return El()},get command(){return El()},get elb(){return El()},get window(){return{addEventListener:Cl,removeEventListener:Cl,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Cl,removeEventListener:Cl,querySelector:Cl,querySelectorAll:()=>[],getElementById:Cl,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Cl,getAttribute:Cl,addEventListener:Cl,removeEventListener:Cl}),body:{appendChild:Cl,removeChild:Cl},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}};gi({},{DataAttributePrefix:()=>Nl,JavaScriptVarName:()=>Il,ScopeSelector:()=>Ll,SettingsSchema:()=>Dl,TaggerSchema:()=>zl,settings:()=>Fl,tagger:()=>Ul});var Nl=yi.string().min(1).regex(/^[a-z][a-z0-9-]*$/,"Must be lowercase kebab-case").describe("Prefix for data attributes on DOM elements"),Il=yi.string().min(1).regex(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,"Must be a valid JavaScript identifier").describe("JavaScript variable name"),Ll=yi.string().describe('DOM scope for event tracking (CSS selector or "document")').optional(),Ml=yi.union([yi.boolean(),yi.any().describe("SessionConfig object from @walkeros/web-core with tracking settings")]),Rl=yi.union([yi.boolean(),yi.string(),yi.any().describe("Elb.Layer array for async command queuing")]),Dl=yi.object({prefix:Nl.default("data-elb").describe("Prefix for data attributes (default: data-elb)"),scope:Ll.describe("DOM scope for event tracking (default: document)"),pageview:yi.boolean().default(!0).describe("Enable automatic pageview tracking"),session:Ml.default(!0).describe("Enable session tracking (boolean or SessionConfig object)"),elb:Il.default("elb").describe("Name for global elb function"),name:yi.string().describe("Custom name for source instance").optional(),elbLayer:Rl.default("elbLayer").describe("Enable elbLayer for async command queuing (boolean, string, or Elb.Layer)")}),zl=yi.object({prefix:Nl.default("data-elb").describe("Custom prefix for generated data attributes")}),Fl=$u(Dl),Ul=$u(zl),ql=async(e,t)=>{const{elb:n,window:a,document:r}=t,i=(null==e?void 0:e.settings)||{},s=a||(void 0!==globalThis.window?globalThis.window:void 0),o=r||(void 0!==globalThis.document?globalThis.document:void 0),c=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(i,o),d={settings:c},u={elb:n,settings:c};if(s&&o){if(!1!==c.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",a=t.window||window;if(!a)return;const r=a;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Al(n[0])){const a=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[a]);return Pl(e,t.prefix,a),r}const a=Array.prototype.push.apply(this,n);return n.forEach(n=>{Pl(e,t.prefix,n)}),a},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Zl(e,t,n,!0),Zl(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:Du(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:s}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;Ol(n,e)}await async function(e,t,n){const a=()=>{e(t,n)};"loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)}(_l,u,c),(()=>{if(Sl(u,c),c.pageview){const[e,t]=Ku(c.prefix||"data-elb",c.scope);pl(u,"page view",e,"load",t)}})(),Du(c.elb)&&c.elb&&(s[c.elb]=(...e)=>{const[t,n,a,r,i,s]=e;return pl(u,t,n,a,r,i,s)})}return{type:"browser",config:d,push:(...e)=>{const[t,n,a,r,i,s]=e;return pl(u,t,n,a,r,i,s)},destroy:async()=>{o&&ll(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;Ol(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&s&&(Sl(u,c),c.pageview)){const[e,t]=Ku(c.prefix||"data-elb",c.scope);pl(u,"page view",e,"load",t)}}}}},Jl=Object.defineProperty,Bl=(e,t)=>{for(var n in t)Jl(e,n,{get:t[n],enumerable:!0})},Vl=!1;function Wl(e,t={},n){if(t.filter&&!0===Mr(()=>t.filter(n),()=>!1)())return;const a=function(e){if(Ar(e)&&Or(e.event)){const{event:t,...n}=e;return{name:t,...n}}return Zr(e)&&e.length>=2?Kl(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?Kl(Array.from(e)):null;var t}(n);if(!a)return;const r=`${t.prefix||"dataLayer"} ${a.name}`,{name:i,...s}=a,o={name:r,data:s};Mr(()=>e(o),()=>{})()}function Kl(e){const[t,n,a]=e;if(!Or(t))return null;let r,i={};switch(t){case"consent":if(!Or(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!Ar(a)||null===a)return null;r=`${t} ${n}`,i={...a};break;case"event":if(!Or(n))return null;r=n,Ar(a)&&(i={...a});break;case"config":if(!Or(n))return null;r=`${t} ${n}`,Ar(a)&&(i={...a});break;case"set":if(Or(n))r=`${t} ${n}`,Ar(a)&&(i={...a});else{if(!Ar(n))return null;r=`${t} custom`,i={...n}}break;default:return null}return{name:r,...i}}Bl({},{EventPrefix:()=>Xl,JavaScriptVarName:()=>Hl,SettingsSchema:()=>Gl,settings:()=>Yl});var Hl=i.string().min(1).regex(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,"Must be a valid JavaScript identifier").describe("JavaScript variable name"),Xl=i.string().min(1).describe("Prefix for filtering dataLayer events"),Gl=i.object({name:Hl.default("dataLayer").describe("DataLayer variable name (default: dataLayer)").optional(),prefix:Xl.default("dataLayer").describe("Event prefix for filtering which events to process").optional(),filter:i.any().describe("Custom filter function: (event: unknown) => boolean | Promise<boolean>").optional()}),Yl=vn(Gl,{target:"jsonSchema7",$refStrategy:"none"});Bl({},{push:()=>tp});var Ql=()=>{},ep=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),tp={get push(){return ep()},get command(){return ep()},get elb(){return ep()},get window(){return{dataLayer:[],addEventListener:Ql,removeEventListener:Ql}}};function np(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function ap(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function rp(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ip(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function sp(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function op(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function cp(){return["set",{currency:"EUR",country:"DE"}]}function dp(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Bl({},{add_to_cart:()=>ip,config:()=>op,consentDefault:()=>ap,consentUpdate:()=>np,directDataLayerEvent:()=>dp,purchase:()=>rp,setCustom:()=>cp,view_item:()=>sp});Bl({},{add_to_cart:()=>pp,config:()=>gp,configGA4:()=>fp,consentOnlyMapping:()=>yp,consentUpdate:()=>up,customEvent:()=>hp,purchase:()=>lp,view_item:()=>mp});var up={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},lp={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},pp={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},mp={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},fp={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},hp={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},gp={consent:{update:up},purchase:lp,add_to_cart:pp,view_item:mp,"config G-XXXXXXXXXX":fp,custom_event:hp,"*":{data:{}}},yp={consent:{update:up}},vp=async(e,t)=>{const{elb:n,window:a}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return a&&(function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer",r=window[a];if(Array.isArray(r)&&!Vl){Vl=!0;try{for(const t of r)Wl(e,n,t)}finally{Vl=!1}}}(n,i),function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer";window[a]||(window[a]=[]);const r=window[a];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(Vl)return i(...t);Vl=!0;try{for(const a of t)Wl(e,n,a)}finally{Vl=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";a&&a[e]&&Array.isArray(a[e])}}};function bp(){window.dataLayer=window.dataLayer||[];const e=e=>{Ar(e)&&Ar(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var _p={},Sp={};r(Sp,{browserConfig:()=>wp,collectorConfig:()=>jp,dataLayerConfig:()=>xp,settings:()=>kp});var kp={type:"object",properties:{elb:{type:"string",default:"elb",description:"Global function name for event tracking"},name:{type:"string",default:"walkerjs",description:"Global instance name"},run:{type:"boolean",default:!0,description:"Auto-initialize walker.js on load"},browser:{type:"object",default:{run:!0,session:!0,scope:"document.body",pageview:!0},description:"Browser source configuration. Set to false to disable. See browser configuration section below for details."},dataLayer:{type:"object",default:!1,description:"DataLayer source configuration. Set to true for defaults or object for custom config. See dataLayer configuration section below."},collector:{type:"object",default:{},description:"Collector configuration including destinations and consent settings. See collector configuration section below."}}},wp={type:"object",properties:{"browser.run":{type:"boolean",default:!0,description:"Auto-start DOM tracking"},"browser.session":{type:"boolean",default:!0,description:"Enable session tracking"},"browser.scope":{type:"string",default:"document.body",description:"DOM element scope for tracking"},"browser.pageview":{type:"boolean",default:!0,description:"Enable automatic page view events"}}},xp={type:"object",properties:{dataLayer:{type:"boolean",default:!1,description:"Enable dataLayer integration with defaults"},"dataLayer.name":{type:"string",default:"dataLayer",description:"DataLayer variable name"},"dataLayer.prefix":{type:"string",default:"dataLayer",description:"Event prefix for dataLayer events"}}},jp={type:"object",properties:{"collector.consent":{type:"object",default:{functional:!0},description:"Default consent state"},"collector.destinations":{type:"object",default:{},description:"Destination configurations. See destinations documentation for available options."}}};async function Zp(e={}){const t=jr({collector:{destinations:{dataLayer:{code:bp()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},e),n={...t.collector,sources:{browser:{code:ql,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=Ar(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:vp,config:{settings:e}})}const a=await ni(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}var Pp=Zp;export{_p as Walkerjs,Zp as createWalkerjs,Pp as default,Bu as getAllEvents,Vu as getEvents,Wu as getGlobals,Sp as schemas};//# sourceMappingURL=index.mjs.map