@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/CHANGELOG.md +15 -0
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walker.js +1 -1
- package/package.json +9 -7
- package/src/schemas.ts +109 -0
package/dist/walker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{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:()=>Me,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:()=>Le,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,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M=/^[-+]?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(!L.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?M.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 Le=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}}};Le.create=e=>new Le({typeName:qe.ZodNaN,...P(e)});var Me=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=Le.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 Lt(e,t,n,a,r){e[t]=n,Rt(e,t,a,r)}var Mt=(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?Mt(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":Lt(n,"minimum",a.value,a.message,t);break;case"max":Lt(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":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Lt(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":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Lt(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":Lt(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}}})):Lt(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}}})):Lt(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?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(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?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(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&&Lt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Lt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Lt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Lt(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&&Lt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Lt(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:Mt(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 Ln(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 Mn(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&&!Ln(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){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Wn(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}}function Xn(e,t){return(e.getAttribute(t)||"").trim()}function Jn(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,a]=function(e){const[t,n]=e.split(/:(.+)/,2);return[Kn(t||""),Kn(n||"")]}(e);n&&("true"===a?t[n]=!0:"false"===a?t[n]=!1:a&&/^\d+$/.test(a)?t[n]=parseInt(a,10):a&&/^\d+\.\d+$/.test(a)?t[n]=parseFloat(a):t[n]=a||!0)}),t}var Hn=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function Yn(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 Gn(e,t,n){return!1===n?e:(n||(n=Qn),n(e,t,Qn))}var Qn=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):Hn("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):Hn({name:"session start",data:e})),e};function ea(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:ta(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 ta(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 ea(e,a)}function na(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=aa(e);let d=!1;const l=Dn((e,t,n)=>{let a=ea(e,n);return a||(a=Mn(8),ta(e,a,1440*t,n)),String(a)})(a,s,r),p=Dn((e,a)=>{const r=JSON.parse(String(ea(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:Mn(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 ta(i,JSON.stringify(f),2*n,o),f}function aa(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:Mn(12),referrer:s},i,e.data):n}var ra,sa,ia,oa={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 ca(e,t,n){const{allowed:a,consent:r,globals:s,user:i}=e;if(!a)return la({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=Ln(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(ua)(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(da,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 la({ok:!d.length,event:t,successful:c,queued:u,failed:d})}async function ua(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:pa(t.env,t.config.env)},a=await Wn(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function da(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:pa(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:pa(e.env,r.env)};Wn(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 Wn(t.push,"DestinationPush",e.hooks)(s.event,i);return!0}function la(e){var t;return Pn({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function pa(e,t){return e||t?t?e&&Cn(e)&&Cn(t)?{...e,...t}:t:e:{}}function ma(e,t,n,a){let r,s=n||[];switch(n||(s=e.on[t]||[]),t){case oa.Consent:r=a||e.consent;break;case oa.Session:r=e.session;break;case oa.Ready:case oa.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 oa.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 oa.Ready:case oa.Run:o=s,(i=e).allowed&&o.forEach(e=>{Dn(e)(i)});break;case oa.Session:!function(e,t){e.session&&t.forEach(t=>{Dn(t)(e,e.session)})}(e,s)}var i,o}async function fa(e,t,n,a){let r;switch(t){case oa.Config:Cn(n)&&Pn(e.config,n,{shallow:!1});break;case oa.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),ma(e,"consent",void 0,r),a?ca(e):la({ok:!0})}(e,n));break;case oa.Custom:Cn(n)&&(e.custom=Pn(e.custom,n));break;case oa.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:pa(a.env,s)};let c=o.config.id;if(!c)do{c=Mn(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),ca(e,void 0,{[c]:o})}(e,{code:n},a));break;case oa.Globals:Cn(n)&&(e.globals=Pn(e.globals,n));break;case oa.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,ma(e,t,s)}(e,n,a);break;case oa.Ready:ma(e,"ready");break;case oa.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Mn(),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 ca(e);return ma(e,"run"),n}(e,n);break;case oa.Session:ma(e,"session");break;case oa.User:Cn(n)&&Pn(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ha(e,t){return Wn(async(n,a={})=>await Un(async()=>{let r=n;if(a.mapping){const t=await Bn(r,a.mapping,e);if(t.ignore)return la({ok:!0});if(a.mapping.consent&&!Ln(a.mapping.consent,e.consent,t.event.consent))return la({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 ca(e,i)},()=>la({ok:!1}))(),"Push",e.hooks)}async function ga(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=ha(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(i=fa,Wn(async(e,t,n)=>await Un(async()=>await i(s,e,t,n),()=>la({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=pa(t.env,s);n[e]={...t,config:i,env:o}}return n}(0,e.destinations||{}),r;var s,i}async function ya(e){e=e||{};const t=await ga(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}}var va=Object.defineProperty,_a=(e,t)=>{for(var n in t)va(e,n,{get:t[n],enumerable:!0})},ba={};_a(ba,{BRAND:()=>ns,DIRTY:()=>La,EMPTY_PATH:()=>Ea,INVALID:()=>Ra,NEVER:()=>Xs,OK:()=>Ma,ParseStatus:()=>Ia,Schema:()=>Wa,ZodAny:()=>Ar,ZodArray:()=>Pr,ZodBigInt:()=>_r,ZodBoolean:()=>br,ZodBranded:()=>as,ZodCatch:()=>Gr,ZodDate:()=>kr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>$r,ZodEffects:()=>Xr,ZodEnum:()=>Br,ZodError:()=>Aa,ZodFirstPartyTypeKind:()=>es,ZodFunction:()=>Dr,ZodIntersection:()=>Rr,ZodIssueCode:()=>wa,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>Fr,ZodNaN:()=>Qr,ZodNativeEnum:()=>Kr,ZodNever:()=>Or,ZodNull:()=>Zr,ZodNullable:()=>Hr,ZodNumber:()=>vr,ZodObject:()=>Nr,ZodOptional:()=>Jr,ZodParsedType:()=>ka,ZodPipeline:()=>rs,ZodPromise:()=>Wr,ZodReadonly:()=>ss,ZodRecord:()=>Mr,ZodSchema:()=>Wa,ZodSet:()=>zr,ZodString:()=>gr,ZodSymbol:()=>xr,ZodTransformer:()=>Xr,ZodTuple:()=>Lr,ZodType:()=>Wa,ZodUndefined:()=>wr,ZodUnion:()=>Cr,ZodUnknown:()=>Sr,ZodVoid:()=>Tr,addIssueToContext:()=>$a,any:()=>_s,array:()=>ws,bigint:()=>ms,boolean:()=>fs,coerce:()=>Ws,custom:()=>os,date:()=>hs,datetimeRegex:()=>pr,defaultErrorMap:()=>Sa,discriminatedUnion:()=>Os,effect:()=>Fs,enum:()=>Rs,function:()=>Es,getErrorMap:()=>Pa,getParsedType:()=>xa,instanceof:()=>us,intersection:()=>Ts,isAborted:()=>Fa,isAsync:()=>Ua,isDirty:()=>za,isValid:()=>Da,late:()=>cs,lazy:()=>$s,literal:()=>Is,makeIssue:()=>Ca,map:()=>Ns,nan:()=>ps,nativeEnum:()=>Ls,never:()=>ks,null:()=>vs,nullable:()=>Ds,number:()=>ls,object:()=>Zs,objectUtil:()=>ia,oboolean:()=>Ks,onumber:()=>Bs,optional:()=>zs,ostring:()=>qs,pipeline:()=>Vs,preprocess:()=>Us,promise:()=>Ms,quotelessJson:()=>Za,record:()=>js,set:()=>Cs,setErrorMap:()=>Ta,strictObject:()=>As,string:()=>ds,symbol:()=>gs,transformer:()=>Fs,tuple:()=>Ps,undefined:()=>ys,union:()=>Ss,unknown:()=>bs,util:()=>ra,void:()=>xs}),(sa=ra||(ra={})).assertEqual=e=>{},sa.assertIs=function(e){},sa.assertNever=function(e){throw new Error},sa.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},sa.getValidEnumValues=e=>{const t=sa.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return sa.objectValues(n)},sa.objectValues=e=>sa.objectKeys(e).map(function(t){return e[t]}),sa.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},sa.find=(e,t)=>{for(const n of e)if(t(n))return n},sa.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,sa.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},sa.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ia||(ia={})).mergeShapes=(e,t)=>({...e,...t});var ka=ra.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xa=e=>{switch(typeof e){case"undefined":return ka.undefined;case"string":return ka.string;case"number":return Number.isNaN(e)?ka.nan:ka.number;case"boolean":return ka.boolean;case"function":return ka.function;case"bigint":return ka.bigint;case"symbol":return ka.symbol;case"object":return Array.isArray(e)?ka.array:null===e?ka.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ka.promise:"undefined"!=typeof Map&&e instanceof Map?ka.map:"undefined"!=typeof Set&&e instanceof Set?ka.set:"undefined"!=typeof Date&&e instanceof Date?ka.date:ka.object;default:return ka.unknown}},wa=ra.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"]),Za=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Aa=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,ra.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()}};Aa.create=e=>new Aa(e);var Sa=(e,t)=>{let n;switch(e.code){case wa.invalid_type:n=e.received===ka.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case wa.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ra.jsonStringifyReplacer)}`;break;case wa.unrecognized_keys:n=`Unrecognized key(s) in object: ${ra.joinValues(e.keys,", ")}`;break;case wa.invalid_union:n="Invalid input";break;case wa.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ra.joinValues(e.options)}`;break;case wa.invalid_enum_value:n=`Invalid enum value. Expected ${ra.joinValues(e.options)}, received '${e.received}'`;break;case wa.invalid_arguments:n="Invalid function arguments";break;case wa.invalid_return_type:n="Invalid function return type";break;case wa.invalid_date:n="Invalid date";break;case wa.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}"`:ra.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case wa.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 wa.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 wa.custom:n="Invalid input";break;case wa.invalid_intersection_types:n="Intersection results could not be merged";break;case wa.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case wa.not_finite:n="Number must be finite";break;default:n=t.defaultError,ra.assertNever(e)}return{message:n}},Oa=Sa;function Ta(e){Oa=e}function Pa(){return Oa}var ja,Na,Ca=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}},Ea=[];function $a(e,t){const n=Pa(),a=Ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Sa?void 0:Sa].filter(e=>!!e)});e.common.issues.push(a)}var Ia=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 Ra;"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 Ra;if("aborted"===r.status)return Ra;"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}}},Ra=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),Ma=e=>({status:"valid",value:e}),Fa=e=>"aborted"===e.status,za=e=>"dirty"===e.status,Da=e=>"valid"===e.status,Ua=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Na=ja||(ja={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Na.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Va,qa=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}},Ba=(e,t)=>{if(Da(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 Aa(e.common.issues);return this._error=t,this._error}}};function Ka(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 Wa=class{get description(){return this._def.description}_getType(e){return xa(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ua(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:xa(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ba(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:xa(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Da(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=>Da(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:xa(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Ua(a)?a:Promise.resolve(a));return Ba(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),s=()=>{return a.addIssue({code:wa.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 Xr({schema:this,typeName:es.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 Jr.create(this,this._def)}nullable(){return Hr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return Wr.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Rr.create(this,e,this._def)}transform(e){return new Xr({...Ka(this._def),schema:this,typeName:es.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Yr({...Ka(this._def),innerType:this,defaultValue:t,typeName:es.ZodDefault})}brand(){return new as({typeName:es.ZodBranded,type:this,...Ka(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Gr({...Ka(this._def),innerType:this,catchValue:t,typeName:es.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return rs.create(this,e)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xa=/^c[^\s-]{8,}$/i,Ja=/^[0-9a-z]+$/,Ha=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ya=/^[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,Ga=/^[a-z0-9_-]{21}$/i,Qa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,er=/^[-+]?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)?)??$/,tr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nr=/^(?:(?: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])$/,ar=/^(?:(?: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])$/,rr=/^(([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]))$/,sr=/^(([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])$/,ir=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,or=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cr="((\\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])))",ur=new RegExp(`^${cr}$`);function dr(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 lr(e){return new RegExp(`^${dr(e)}$`)}function pr(e){let t=`${cr}T${dr(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 mr(e,t){return!("v4"!==t&&t||!nr.test(e))||!("v6"!==t&&t||!rr.test(e))}function fr(e,t){if(!Qa.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 hr(e,t){return!("v4"!==t&&t||!ar.test(e))||!("v6"!==t&&t||!sr.test(e))}var gr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ka.string){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.string,received:t.parsedType}),Ra}const t=new Ia;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.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?$a(n,{code:wa.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&$a(n,{code:wa.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)tr.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"email",code:wa.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Va||(Va=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Va.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"emoji",code:wa.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ya.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"uuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"nanoid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Xa.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid2",code:wa.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ulid",code:wa.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),$a(n,{validation:"url",code:wa.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),$a(n,{validation:"regex",code:wa.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),$a(n,{code:wa.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),$a(n,{code:wa.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?pr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?ur.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?lr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?er.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"duration",code:wa.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?mr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ip",code:wa.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?fr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"jwt",code:wa.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?hr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cidr",code:wa.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?ir.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64",code:wa.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?or.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64url",code:wa.invalid_string,message:a.message}),t.dirty()):ra.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:wa.invalid_string,...ja.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...ja.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ja.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ja.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ja.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ja.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ja.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ja.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ja.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ja.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ja.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ja.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ja.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ja.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,...ja.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,...ja.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ja.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ja.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ja.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ja.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ja.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ja.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ja.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ja.errToObj(t)})}nonempty(e){return this.min(1,ja.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 yr(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}gr.create=e=>{var t;return new gr({checks:[],typeName:es.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var vr=class e extends Wa{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)!==ka.number){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.number,received:t.parsedType}),Ra}let t;const n=new Ia;for(const a of this._def.checks)"int"===a.kind?ra.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.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),$a(t,{code:wa.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),$a(t,{code:wa.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==yr(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_finite,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:ja.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ja.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ja.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ja.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&&ra.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)}};vr.create=e=>new vr({checks:[],typeName:es.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var _r=class e extends Wa{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)!==ka.bigint)return this._getInvalidInput(e);let t;const n=new Ia;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),$a(t,{code:wa.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),$a(t,{code:wa.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),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.bigint,received:t.parsedType}),Ra}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.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:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.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}};_r.create=e=>{var t;return new _r({checks:[],typeName:es.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var br=class extends Wa{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ka.boolean){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.boolean,received:t.parsedType}),Ra}return Ma(e.data)}};br.create=e=>new br({typeName:es.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var kr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ka.date){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.date,received:t.parsedType}),Ra}if(Number.isNaN(e.data.getTime()))return $a(this._getOrReturnCtx(e),{code:wa.invalid_date}),Ra;const t=new Ia;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ra.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:ja.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ja.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}};kr.create=e=>new kr({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:es.ZodDate,...Ka(e)});var xr=class extends Wa{_parse(e){if(this._getType(e)!==ka.symbol){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.symbol,received:t.parsedType}),Ra}return Ma(e.data)}};xr.create=e=>new xr({typeName:es.ZodSymbol,...Ka(e)});var wr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.undefined,received:t.parsedType}),Ra}return Ma(e.data)}};wr.create=e=>new wr({typeName:es.ZodUndefined,...Ka(e)});var Zr=class extends Wa{_parse(e){if(this._getType(e)!==ka.null){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.null,received:t.parsedType}),Ra}return Ma(e.data)}};Zr.create=e=>new Zr({typeName:es.ZodNull,...Ka(e)});var Ar=class extends Wa{constructor(){super(...arguments),this._any=!0}_parse(e){return Ma(e.data)}};Ar.create=e=>new Ar({typeName:es.ZodAny,...Ka(e)});var Sr=class extends Wa{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ma(e.data)}};Sr.create=e=>new Sr({typeName:es.ZodUnknown,...Ka(e)});var Or=class extends Wa{_parse(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.never,received:t.parsedType}),Ra}};Or.create=e=>new Or({typeName:es.ZodNever,...Ka(e)});var Tr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.void,received:t.parsedType}),Ra}return Ma(e.data)}};Tr.create=e=>new Tr({typeName:es.ZodVoid,...Ka(e)});var Pr=class e extends Wa{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==ka.array)return $a(t,{code:wa.invalid_type,expected:ka.array,received:t.parsedType}),Ra;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&($a(t,{code:e?wa.too_big:wa.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&&($a(t,{code:wa.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&&($a(t,{code:wa.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 qa(t,e,t.path,n)))).then(e=>Ia.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new qa(t,e,t.path,n)));return Ia.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ja.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ja.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:ja.toString(n)}})}nonempty(e){return this.min(1,e)}};function jr(e){if(e instanceof Nr){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Jr.create(jr(a))}return new Nr({...e._def,shape:()=>t})}return e instanceof Pr?new Pr({...e._def,type:jr(e.element)}):e instanceof Jr?Jr.create(jr(e.unwrap())):e instanceof Hr?Hr.create(jr(e.unwrap())):e instanceof Lr?Lr.create(e.items.map(e=>jr(e))):e}Pr.create=(e,t)=>new Pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:es.ZodArray,...Ka(t)});var Nr=class e extends Wa{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=ra.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ka.object){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Or&&"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 qa(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Or){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&&($a(n,{code:wa.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 qa(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=>Ia.mergeObjectSync(t,e)):Ia.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return ja.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=ja.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:es.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 ra.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 ra.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return jr(this)}partial(t){const n={};for(const e of ra.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 ra.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Jr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qr(ra.objectKeys(this.shape))}};Nr.create=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.strictCreate=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.lazycreate=(e,t)=>new Nr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)});var Cr=class extends Wa{_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 Aa(e.ctx.common.issues));return $a(t,{code:wa.invalid_union,unionErrors:n}),Ra});{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 Aa(e));return $a(t,{code:wa.invalid_union,unionErrors:r}),Ra}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:es.ZodUnion,...Ka(t)});var Er=e=>e instanceof Ur?Er(e.schema):e instanceof Xr?Er(e.innerType()):e instanceof Vr?[e.value]:e instanceof Br?e.options:e instanceof Kr?ra.objectValues(e.enum):e instanceof Yr?Er(e._def.innerType):e instanceof wr?[void 0]:e instanceof Zr?[null]:e instanceof Jr?[void 0,...Er(e.unwrap())]:e instanceof Hr?[null,...Er(e.unwrap())]:e instanceof as||e instanceof ss?Er(e.unwrap()):e instanceof Gr?Er(e._def.innerType):[],$r=class e extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.object)return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra;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}):($a(t,{code:wa.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ra)}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=Er(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:es.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ka(a)})}};function Ir(e,t){const n=xa(e),a=xa(t);if(e===t)return{valid:!0,data:e};if(n===ka.object&&a===ka.object){const n=ra.objectKeys(t),a=ra.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Ir(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===ka.array&&a===ka.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Ir(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===ka.date&&a===ka.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Rr=class extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Fa(e)||Fa(a))return Ra;const r=Ir(e.value,a.value);return r.valid?((za(e)||za(a))&&t.dirty(),{status:t.value,value:r.data}):($a(n,{code:wa.invalid_intersection_types}),Ra)};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}))}};Rr.create=(e,t,n)=>new Rr({left:e,right:t,typeName:es.ZodIntersection,...Ka(n)});var Lr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.array)return $a(n,{code:wa.invalid_type,expected:ka.array,received:n.parsedType}),Ra;if(n.data.length<this._def.items.length)return $a(n,{code:wa.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ra;!this._def.rest&&n.data.length>this._def.items.length&&($a(n,{code:wa.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 qa(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ia.mergeArray(t,e)):Ia.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Lr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lr({items:e,typeName:es.ZodTuple,rest:null,...Ka(t)})};var Mr=class e extends Wa{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!==ka.object)return $a(n,{code:wa.invalid_type,expected:ka.object,received:n.parsedType}),Ra;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new qa(n,e,n.path,e)),value:s._parse(new qa(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ia.mergeObjectAsync(t,a):Ia.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Wa?{keyType:t,valueType:n,typeName:es.ZodRecord,...Ka(a)}:{keyType:gr.create(),valueType:t,typeName:es.ZodRecord,...Ka(n)})}},Fr=class extends Wa{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!==ka.map)return $a(n,{code:wa.invalid_type,expected:ka.map,received:n.parsedType}),Ra;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new qa(n,e,n.path,[s,"key"])),value:r._parse(new qa(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 Ra;"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 Ra;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Fr.create=(e,t,n)=>new Fr({valueType:t,keyType:e,typeName:es.ZodMap,...Ka(n)});var zr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.set)return $a(n,{code:wa.invalid_type,expected:ka.set,received:n.parsedType}),Ra;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&($a(n,{code:wa.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&&($a(n,{code:wa.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 Ra;"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 qa(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:ja.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ja.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zr.create=(e,t)=>new zr({valueType:e,minSize:null,maxSize:null,typeName:es.ZodSet,...Ka(t)});var Dr=class e extends Wa{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.function)return $a(t,{code:wa.invalid_type,expected:ka.function,received:t.parsedType}),Ra;function n(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_arguments,argumentsError:n}})}function a(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Wr){const e=this;return Ma(async function(...t){const i=new Aa([]),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 Ma(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new Aa([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new Aa([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:Lr.create(t).rest(Sr.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||Lr.create([]).rest(Sr.create()),returns:n||Sr.create(),typeName:es.ZodFunction,...Ka(a)})}},Ur=class extends Wa{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})}};Ur.create=(e,t)=>new Ur({getter:e,typeName:es.ZodLazy,...Ka(t)});var Vr=class extends Wa{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return $a(t,{received:t.data,code:wa.invalid_literal,expected:this._def.value}),Ra}return{status:"valid",value:e.data}}get value(){return this._def.value}};function qr(e,t){return new Br({values:e,typeName:es.ZodEnum,...Ka(t)})}Vr.create=(e,t)=>new Vr({value:e,typeName:es.ZodLiteral,...Ka(t)});var Br=class e extends Wa{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return $a(t,{expected:ra.joinValues(n),received:t.parsedType,code:wa.invalid_type}),Ra}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 $a(t,{received:t.data,code:wa.invalid_enum_value,options:n}),Ra}return Ma(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})}};Br.create=qr;var Kr=class extends Wa{_parse(e){const t=ra.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ka.string&&n.parsedType!==ka.number){const e=ra.objectValues(t);return $a(n,{expected:ra.joinValues(e),received:n.parsedType,code:wa.invalid_type}),Ra}if(this._cache||(this._cache=new Set(ra.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ra.objectValues(t);return $a(n,{received:n.data,code:wa.invalid_enum_value,options:e}),Ra}return Ma(e.data)}get enum(){return this._def.values}};Kr.create=(e,t)=>new Kr({values:e,typeName:es.ZodNativeEnum,...Ka(t)});var Wr=class extends Wa{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.promise&&!1===t.common.async)return $a(t,{code:wa.invalid_type,expected:ka.promise,received:t.parsedType}),Ra;const n=t.parsedType===ka.promise?t.data:Promise.resolve(t.data);return Ma(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Wr.create=(e,t)=>new Wr({type:e,typeName:es.ZodPromise,...Ka(t)});var Xr=class extends Wa{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===es.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=>{$a(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 Ra;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(a.value):a});{if("aborted"===t.value)return Ra;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(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?Ra:("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?Ra:("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(!Da(e))return Ra;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=>Da(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):Ra)}ra.assertNever(a)}};Xr.create=(e,t,n)=>new Xr({schema:e,typeName:es.ZodEffects,effect:t,...Ka(n)}),Xr.createWithPreprocess=(e,t,n)=>new Xr({schema:t,effect:{type:"preprocess",transform:e},typeName:es.ZodEffects,...Ka(n)});var Jr=class extends Wa{_parse(e){return this._getType(e)===ka.undefined?Ma(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:es.ZodOptional,...Ka(t)});var Hr=class extends Wa{_parse(e){return this._getType(e)===ka.null?Ma(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:es.ZodNullable,...Ka(t)});var Yr=class extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ka.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:es.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Ka(t)});var Gr=class extends Wa{_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 Ua(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:es.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Ka(t)});var Qr=class extends Wa{_parse(e){if(this._getType(e)!==ka.nan){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.nan,received:t.parsedType}),Ra}return{status:"valid",value:e.data}}};Qr.create=e=>new Qr({typeName:es.ZodNaN,...Ka(e)});var es,ts,ns=Symbol("zod_brand"),as=class extends Wa{_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}},rs=class e extends Wa{_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?Ra:"dirty"===e.status?(t.dirty(),La(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?Ra:"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:es.ZodPipeline})}},ss=class extends Wa{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Da(e)&&(e.value=Object.freeze(e.value)),e);return Ua(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function is(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function os(e,t={},n){return e?Ar.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=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):Ar.create()}ss.create=(e,t)=>new ss({innerType:e,typeName:es.ZodReadonly,...Ka(t)});var cs={object:Nr.lazycreate};(ts=es||(es={})).ZodString="ZodString",ts.ZodNumber="ZodNumber",ts.ZodNaN="ZodNaN",ts.ZodBigInt="ZodBigInt",ts.ZodBoolean="ZodBoolean",ts.ZodDate="ZodDate",ts.ZodSymbol="ZodSymbol",ts.ZodUndefined="ZodUndefined",ts.ZodNull="ZodNull",ts.ZodAny="ZodAny",ts.ZodUnknown="ZodUnknown",ts.ZodNever="ZodNever",ts.ZodVoid="ZodVoid",ts.ZodArray="ZodArray",ts.ZodObject="ZodObject",ts.ZodUnion="ZodUnion",ts.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ts.ZodIntersection="ZodIntersection",ts.ZodTuple="ZodTuple",ts.ZodRecord="ZodRecord",ts.ZodMap="ZodMap",ts.ZodSet="ZodSet",ts.ZodFunction="ZodFunction",ts.ZodLazy="ZodLazy",ts.ZodLiteral="ZodLiteral",ts.ZodEnum="ZodEnum",ts.ZodEffects="ZodEffects",ts.ZodNativeEnum="ZodNativeEnum",ts.ZodOptional="ZodOptional",ts.ZodNullable="ZodNullable",ts.ZodDefault="ZodDefault",ts.ZodCatch="ZodCatch",ts.ZodPromise="ZodPromise",ts.ZodBranded="ZodBranded",ts.ZodPipeline="ZodPipeline",ts.ZodReadonly="ZodReadonly";var us=(e,t={message:`Input not instance of ${e.name}`})=>os(t=>t instanceof e,t),ds=gr.create,ls=vr.create,ps=Qr.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=Tr.create,ws=Pr.create,Zs=Nr.create,As=Nr.strictCreate,Ss=Cr.create,Os=$r.create,Ts=Rr.create,Ps=Lr.create,js=Mr.create,Ns=Fr.create,Cs=zr.create,Es=Dr.create,$s=Ur.create,Is=Vr.create,Rs=Br.create,Ls=Kr.create,Ms=Wr.create,Fs=Xr.create,zs=Jr.create,Ds=Hr.create,Us=Xr.createWithPreprocess,Vs=rs.create,qs=()=>ds().optional(),Bs=()=>ls().optional(),Ks=()=>fs().optional(),Ws={string:e=>gr.create({...e,coerce:!0}),number:e=>vr.create({...e,coerce:!0}),boolean:e=>br.create({...e,coerce:!0}),bigint:e=>_r.create({...e,coerce:!0}),date:e=>kr.create({...e,coerce:!0})},Xs=Ra,Js=Symbol("Let zodToJsonSchema decide on which parser to use"),Hs={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 Ys(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Gs(e,t,n,a,r){e[t]=n,Ys(e,t,a,r)}var Qs=(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 ei(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Qs(t,e.currentPath):t.join("/")}}function ti(e,t){return Oi(e.type._def,t)}function ni(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ni(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 ai(e,t)}}var ai=(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":Gs(n,"minimum",a.value,a.message,t);break;case"max":Gs(n,"maximum",a.value,a.message,t)}return n},ri=void 0,si=/^[cC][^\s-]{8,}$/,ii=/^[0-9a-z]+$/,oi=/^[0-9A-HJKMNP-TV-Z]{26}$/,ci=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ui=()=>(void 0===ri&&(ri=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ri),di=/^(?:(?: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])$/,li=/^(([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])$/,pi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fi=/^[a-zA-Z0-9_-]{21}$/,hi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function gi(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Gs(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":_i(n,"email",a.message,t);break;case"format:idn-email":_i(n,"idn-email",a.message,t);break;case"pattern:zod":bi(n,ci,a.message,t)}break;case"url":_i(n,"uri",a.message,t);break;case"uuid":_i(n,"uuid",a.message,t);break;case"regex":bi(n,a.regex,a.message,t);break;case"cuid":bi(n,si,a.message,t);break;case"cuid2":bi(n,ii,a.message,t);break;case"startsWith":bi(n,RegExp(`^${yi(a.value,t)}`),a.message,t);break;case"endsWith":bi(n,RegExp(`${yi(a.value,t)}$`),a.message,t);break;case"datetime":_i(n,"date-time",a.message,t);break;case"date":_i(n,"date",a.message,t);break;case"time":_i(n,"time",a.message,t);break;case"duration":_i(n,"duration",a.message,t);break;case"length":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Gs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":bi(n,RegExp(yi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&_i(n,"ipv4",a.message,t),"v4"!==a.version&&_i(n,"ipv6",a.message,t);break;case"base64url":bi(n,mi,a.message,t);break;case"jwt":bi(n,hi,a.message,t);break;case"cidr":"v6"!==a.version&&bi(n,di,a.message,t),"v4"!==a.version&&bi(n,li,a.message,t);break;case"emoji":bi(n,ui(),a.message,t);break;case"ulid":bi(n,oi,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":_i(n,"binary",a.message,t);break;case"contentEncoding:base64":Gs(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":bi(n,pi,a.message,t)}break;case"nanoid":bi(n,fi,a.message,t)}return n}function yi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)vi.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var vi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _i(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}}})):Gs(e,"format",t,n,a)}function bi(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:ki(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Gs(e,"pattern",ki(t,a),n,a)}function ki(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 xi(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)===es.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:ei(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=Oi(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)===es.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=gi(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===es.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===es.ZodBranded&&e.keyType._def.type._def.typeName===es.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=ti(e.keyType._def,t);return{...u,propertyNames:a}}return u}var wi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},Zi=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Oi(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 Ai(e){try{return e.isOptional()}catch(e){return!0}}var Si=(e,t,n)=>{switch(t){case es.ZodString:return gi(e,n);case es.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",Ys(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.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=Ai(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=Oi(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 Oi(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 es.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?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.ZodBoolean:return{type:"boolean"};case es.ZodDate:return ni(e,n);case es.ZodUndefined:return{not:ei(n)};case es.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case es.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)!==es.ZodAny&&(s.items=Oi(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Gs(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Gs(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Gs(s,"minItems",e.exactLength.value,e.exactLength.message,t),Gs(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case es.ZodUnion:case es.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return Zi(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in wi&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=wi[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 Zi(e,t)}(e,n);case es.ZodIntersection:return function(e,t){const n=[Oi(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Oi(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 es.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Oi(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case es.ZodRecord:return xi(e,n);case es.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 es.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case es.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 es.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:wi[e.innerType._def.typeName],nullable:!0}:{type:[wi[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case es.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Oi(e.innerType._def,t);const a=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ei(t)},a]}:ei(t)})(e,n);case es.ZodMap:return function(e,t){return"record"===t.mapStrategy?xi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Oi(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ei(t),Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ei(t)],minItems:2,maxItems:2}}}(e,n);case es.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Gs(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Gs(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case es.ZodLazy:return()=>e.getter()._def;case es.ZodPromise:return function(e,t){return Oi(e.type._def,t)}(e,n);case es.ZodNaN:case es.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:ei({...e,currentPath:[...e.currentPath,"not"]})}}(n);case es.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Oi(e.schema._def,t):ei(t)}(e,n);case es.ZodAny:return ei(n);case es.ZodUnknown:return function(e){return ei(e)}(n);case es.ZodDefault:return function(e,t){return{...Oi(e.innerType._def,t),default:e.defaultValue()}}(e,n);case es.ZodBranded:return ti(e,n);case es.ZodReadonly:case es.ZodCatch:return((e,t)=>Oi(e.innerType._def,t))(e,n);case es.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Oi(e.in._def,t);if("output"===t.pipeStrategy)return Oi(e.out._def,t);const n=Oi(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Oi(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case es.ZodFunction:case es.ZodVoid:case es.ZodSymbol:default:return}};function Oi(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!==Js)return s}if(r&&!n){const e=Ti(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=Si(e,e.typeName,t),o="function"==typeof i?Oi(i(),t):i;if(o&&Pi(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Ti=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Qs(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`),ei(t)):"seen"===t.$refStrategy?ei(t):void 0}},Pi=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),ji=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Hs,name:a}:{...Hs,...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=Oi(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:ei(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=Oi(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:ei(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},Ni=ba.record(ba.string(),ba.boolean()).describe("Consent requirement mapping"),Ci=ba.lazy(()=>ba.union([ba.string(),ba.number(),ba.boolean(),Ri,ba.array(Ci)])),Ei=ba.tuple([Ci,Ci]).describe("Loop: [source, transform] tuple for array transformations"),$i=ba.array(Ci).describe("Set: Array of values"),Ii=ba.record(ba.string(),Ci).describe("Map: Object mapping keys to values"),Ri=ba.object({key:ba.string().optional().describe('Property path (e.g., "data.id")'),value:ba.union([ba.string(),ba.number(),ba.boolean()]).optional().describe("Static primitive value"),fn:ba.string().optional().describe("Function string for custom transformation"),map:Ii.optional().describe("Object with key-value mappings"),loop:Ei.optional().describe("Tuple [source, transform]"),set:$i.optional().describe("Array of values"),consent:Ni.optional().describe("Required consent states"),condition:ba.string().optional().describe("Condition function string"),validate:ba.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"),Li=Ei,Mi=$i,Fi=Ii,zi=(ji(Ri,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ji(Li,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),ji(Mi,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ji(Fi,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Di(e,t={},n={}){n={...zi,...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 Ui(e){return Array.isArray(e)}function Vi(e){return e===document||e instanceof Element}function qi(e){return"object"==typeof e&&null!==e&&!Ui(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Bi(e){return"string"==typeof e}function Ki(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Wi(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Xi(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Ji(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Hi(e,t,n,a=!0){return so(Xn(t,Ji(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),Ui(e[a])||(e[a]=[]),e[a].push(Ki(r))):e[a]=Ki(r),e},{})}function Yi(e=oa.Prefix,t=document){const n=Ji(e,oa.Globals,!1);let a={};return ro(t,`[${n}]`,t=>{a=Di(a,Hi(e,t,oa.Globals,!1))}),a}function Gi(e,t){const n=window.location,a="page",r=t===document?document.body:t,[s,i]=ao(r,`[${Ji(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=Xn(t,Ji(e));if(!r||a&&!a[r])return null;const s=[t],i=`[${Ji(e,r)}],[${Ji(e,"")}]`,o=Ji(e,oa.Link,!1);let c={};const u=[],[d,l]=ao(n||t,i,e,r);ro(t,`[${o}]`,t=>{const[n,a]=io(Xn(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=Di(m,Hi(e,t,"")),c=Di(c,Hi(e,t,r))}),c=Di(Di(m,c),d),s.forEach(t=>{ro(t,`[${Ji(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=Ji(e,oa.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=io(Xn(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=`[${Ji(n,oa.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(r=Di(Hi(n,i,""),r),r=Di(Hi(n,i,a),r)),i.matches(o)&&(Object.entries(Hi(n,i,oa.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[Xi(t),Xi(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:Yn(e),lastChecked:t},lo.set(e,n)),n.isVisible}function fo(e){if(window.IntersectionObserver)return Wi(()=>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(Bi(t)&&t.startsWith("walker "))return o(t,n);if(qi(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(qi(t)?t.name:t).split(" ");let d,l=qi(n)?n:{},p={},m=!1;if(Vi(n)&&(d=n,m=!0),Vi(r)?d=r:qi(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:Bi(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",Wi(function(t){Po.call(this,e,t)})),n.addEventListener("submit",Wi(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=Ji(t.prefix,oa.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=function(e,t,n=oa.Prefix){const a=[],{actions:r,nearestOnly:s}=function(e,t,n){let a=t;for(;a;){const t=Xn(a,Ji(e,oa.Actions,!1));if(t){const e=Qi(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=Xn(a,Ji(e,oa.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[Xi(t)]=!0,e),{}),o=eo(n,e,i,s);if(!o.length){const t="page",a=`[${Ji(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}(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=Xn(t,n);r&&Object.values(Qi(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case bo:a=e,t.addEventListener("mouseenter",Wi(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=!qi(i)&&Bi(i)&&i.startsWith("walker ");if(qi(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Bi(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){Wi(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Bi(a)&&""===a.trim())return;if(Bi(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 Gn((r?na:aa)(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=()=>aa(e);return e.consent&&Ln((jn(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(s=()=>na(e)),Gn(s(),a,t)}}(e,t),s=(jn(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",s):Hn("walker on","consent",s)}}({...t,collector:{push:e,group:void 0}})}_a({},{env:()=>Io});var Io={};_a(Io,{push:()=>Mo});var Ro=()=>{},Lo=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Mo={get push(){return Lo()},get command(){return Lo()},get elb(){return Lo()},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:Bi(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)}})(),Bi(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})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=Jn(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(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 ya(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
|
|
1
|
+
"use strict";(()=>{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:()=>Ce,ZodError:()=>u,ZodFirstPartyTypeKind:()=>Be,ZodFunction:()=>Ze,ZodIntersection:()=>Se,ZodIssueCode:()=>c,ZodLazy:()=>Pe,ZodLiteral:()=>Ae,ZodMap:()=>xe,ZodNaN:()=>Re,ZodNativeEnum:()=>Te,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:()=>Tt,onumber:()=>Ct,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 C(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 T,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({...C(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Le({...C(this._def),innerType:this,defaultValue:t,typeName:Be.ZodDefault})}brand(){return new ze({typeName:Be.ZodBranded,type:this,...C(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Me({...C(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)T||(T=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),T.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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Be.ZodObject,...C(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Be.ZodObject,...C(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,...C(t)});var ve=t=>t instanceof Pe?ve(t.schema):t instanceof $e?ve(t.innerType()):t instanceof Ae?[t.value]:t instanceof Ce?t.options:t instanceof Te?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,...C(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,...C(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,...C(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,...C(a)}:{keyType:te.create(),valueType:t,typeName:Be.ZodRecord,...C(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,...C(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,...C(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,...C(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,...C(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 Ce({values:e,typeName:Be.ZodEnum,...C(t)})}Ae.create=(e,t)=>new Ae({value:e,typeName:Be.ZodLiteral,...C(t)});var Ce=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})}};Ce.create=Oe;var Te=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}};Te.create=(e,t)=>new Te({values:e,typeName:Be.ZodNativeEnum,...C(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,...C(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,...C(n)}),$e.createWithPreprocess=(e,t,n)=>new $e({schema:t,effect:{type:"preprocess",transform:e},typeName:Be.ZodEffects,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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,...C(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=Ce.create,kt=Te.create,wt=Ee.create,xt=$e.create,jt=Ne.create,Zt=Ie.create,Pt=$e.createWithPreprocess,At=Fe.create,Ot=()=>He().optional(),Ct=()=>Xe().optional(),Tt=()=>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:()=>Cn,HandlerSchema:()=>En,LogHandlerSchema:()=>Tn,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"),Cn=i.any().describe("Error handler function: (error, state?) => void"),Tn=i.any().describe("Log handler function: (message, verbose?) => void"),En=i.object({Error:Cn.describe("Error handler function"),Log:Tn.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(Cn,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Ln=vn(Tn,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Mn=vn(En,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});i.object({onError:Cn.optional().describe("Error handler function: (error, state?) => void"),onLog:Tn.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:()=>Ta,PushContextSchema:()=>Ca,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:Cn.optional(),onLog:Tn.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"),Ca=Oa.extend({mapping:ma.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ta=Ca.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(Ca,{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:Cn.optional(),onLog:Tn.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:Cn.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 Cr(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]=Cr(e[a],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(Cr(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 Tr(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=Tr(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=Cr(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=Tr(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){return e?e.trim().replace(/^'|'$/g,"").trim():""}function qr(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}}function Jr(e,t){return(e.getAttribute(t)||"").trim()}function Br(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,a]=function(e){const[t,n]=e.split(/:(.+)/,2);return[Ur(t||""),Ur(n||"")]}(e);n&&("true"===a?t[n]=!0:"false"===a?t[n]=!1:a&&/^\d+$/.test(a)?t[n]=parseInt(a,10):a&&/^\d+\.\d+$/.test(a)?t[n]=parseFloat(a):t[n]=a||!0)}),t}var Vr=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function Wr(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 Kr(e,t,n){return!1===n?e:(n||(n=Hr),n(e,t,Hr))}var Hr=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):Vr("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):Vr({name:"session start",data:e})),e};function Xr(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:Gr(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 Gr(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 Xr(e,a)}function Yr(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=Qr(e);let u=!1;const l=Mr((e,t,n)=>{let a=Xr(e,n);return a||(a=Nr(8),Gr(e,a,1440*t,n)),String(a)})(a,i,r),p=Mr((e,a)=>{const r=JSON.parse(String(Xr(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 Gr(s,JSON.stringify(f),2*n,o),f}function Qr(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 ei=Object.defineProperty,ti={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)ei(e,n,{get:t[n],enumerable:!0})})({},{schemas:()=>si,settingsSchema:()=>ii});var ni,ai,ri,ii={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"}}},si={settings:ii};async function oi(e,t,n){const{allowed:a,consent:r,globals:i,user:s}=e;if(!a)return ui({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=Cr(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(ci)(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(di,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 ui({ok:!u.length,event:t,successful:c,queued:d,failed:u})}async function ci(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:li(t.env,t.config.env)},a=await qr(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function di(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:li(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:li(e.env,r.env)};qr(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 qr(t.push,"DestinationPush",e.hooks)(i.event,s);return!0}function ui(e){var t;return jr({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function li(e,t){return e||t?t?e&&Ar(e)&&Ar(t)?{...e,...t}:t:e:{}}function pi(e,t,n,a){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case ti.Consent:r=a||e.consent;break;case ti.Session:r=e.session;break;case ti.Ready:case ti.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 ti.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 ti.Ready:case ti.Run:o=i,(s=e).allowed&&o.forEach(e=>{Mr(e)(s)});break;case ti.Session:!function(e,t){e.session&&t.forEach(t=>{Mr(t)(e,e.session)})}(e,i)}var s,o}async function mi(e,t,n,a){let r;switch(t){case ti.Config:Ar(n)&&jr(e.config,n,{shallow:!1});break;case ti.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),pi(e,"consent",void 0,r),a?oi(e):ui({ok:!0})}(e,n));break;case ti.Custom:Ar(n)&&(e.custom=jr(e.custom,n));break;case ti.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:li(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]),oi(e,void 0,{[c]:o})}(e,{code:n},a));break;case ti.Globals:Ar(n)&&(e.globals=jr(e.globals,n));break;case ti.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,pi(e,t,i)}(e,n,a);break;case ti.Ready:pi(e,"ready");break;case ti.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 oi(e);return pi(e,"run"),n}(e,n);break;case ti.Session:pi(e,"session");break;case ti.User:Ar(n)&&jr(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function fi(e,t){return qr(async(n,a={})=>await Rr(async()=>{let r=n;if(a.mapping){const t=await Fr(r,a.mapping,e);if(t.ignore)return ui({ok:!0});if(a.mapping.consent&&!$r(a.mapping.consent,e.consent,t.event.consent))return ui({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 oi(e,s)},()=>ui({ok:!1}))(),"Push",e.hooks)}async function hi(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=fi(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(s=mi,qr(async(e,t,n)=>await Rr(async()=>await s(i,e,t,n),()=>ui({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=li(t.env,i);n[e]={...t,config:s,env:o}}return n}(0,e.destinations||{}),r;var i,s}async function gi(e){e=e||{};const t=await hi(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}}var yi=Object.defineProperty,vi=(e,t)=>{for(var n in t)yi(e,n,{get:t[n],enumerable:!0})},bi={};vi(bi,{BRAND:()=>to,DIRTY:()=>Li,EMPTY_PATH:()=>Ei,INVALID:()=>Ii,NEVER:()=>Ko,OK:()=>Mi,ParseStatus:()=>Ni,Schema:()=>Vi,ZodAny:()=>xs,ZodArray:()=>As,ZodBigInt:()=>vs,ZodBoolean:()=>bs,ZodBranded:()=>no,ZodCatch:()=>Gs,ZodDate:()=>_s,ZodDefault:()=>Xs,ZodDiscriminatedUnion:()=>$s,ZodEffects:()=>Ws,ZodEnum:()=>Js,ZodError:()=>xi,ZodFirstPartyTypeKind:()=>Qs,ZodFunction:()=>zs,ZodIntersection:()=>Is,ZodIssueCode:()=>ki,ZodLazy:()=>Fs,ZodLiteral:()=>Us,ZodMap:()=>Rs,ZodNaN:()=>Ys,ZodNativeEnum:()=>Bs,ZodNever:()=>Zs,ZodNull:()=>ws,ZodNullable:()=>Hs,ZodNumber:()=>ys,ZodObject:()=>Cs,ZodOptional:()=>Ks,ZodParsedType:()=>_i,ZodPipeline:()=>ao,ZodPromise:()=>Vs,ZodReadonly:()=>ro,ZodRecord:()=>Ms,ZodSchema:()=>Vi,ZodSet:()=>Ds,ZodString:()=>hs,ZodSymbol:()=>Ss,ZodTransformer:()=>Ws,ZodTuple:()=>Ls,ZodType:()=>Vi,ZodUndefined:()=>ks,ZodUnion:()=>Ts,ZodUnknown:()=>js,ZodVoid:()=>Ps,addIssueToContext:()=>$i,any:()=>bo,array:()=>wo,bigint:()=>mo,boolean:()=>fo,coerce:()=>Wo,custom:()=>so,date:()=>ho,datetimeRegex:()=>ls,defaultErrorMap:()=>ji,discriminatedUnion:()=>Po,effect:()=>Do,enum:()=>Lo,function:()=>$o,getErrorMap:()=>Ai,getParsedType:()=>Si,instanceof:()=>co,intersection:()=>Ao,isAborted:()=>Ri,isAsync:()=>Fi,isDirty:()=>Di,isValid:()=>zi,late:()=>oo,lazy:()=>No,literal:()=>Io,makeIssue:()=>Ti,map:()=>To,nan:()=>po,nativeEnum:()=>Mo,never:()=>So,null:()=>vo,nullable:()=>Fo,number:()=>lo,object:()=>xo,objectUtil:()=>ri,oboolean:()=>Vo,onumber:()=>Bo,optional:()=>zo,ostring:()=>Jo,pipeline:()=>qo,preprocess:()=>Uo,promise:()=>Ro,quotelessJson:()=>wi,record:()=>Co,set:()=>Eo,setErrorMap:()=>Pi,strictObject:()=>jo,string:()=>uo,symbol:()=>go,transformer:()=>Do,tuple:()=>Oo,undefined:()=>yo,union:()=>Zo,unknown:()=>_o,util:()=>ni,void:()=>ko}),(ai=ni||(ni={})).assertEqual=e=>{},ai.assertIs=function(e){},ai.assertNever=function(e){throw new Error},ai.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},ai.getValidEnumValues=e=>{const t=ai.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return ai.objectValues(n)},ai.objectValues=e=>ai.objectKeys(e).map(function(t){return e[t]}),ai.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},ai.find=(e,t)=>{for(const n of e)if(t(n))return n},ai.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,ai.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ai.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ri||(ri={})).mergeShapes=(e,t)=>({...e,...t});var _i=ni.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Si=e=>{switch(typeof e){case"undefined":return _i.undefined;case"string":return _i.string;case"number":return Number.isNaN(e)?_i.nan:_i.number;case"boolean":return _i.boolean;case"function":return _i.function;case"bigint":return _i.bigint;case"symbol":return _i.symbol;case"object":return Array.isArray(e)?_i.array:null===e?_i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?_i.promise:"undefined"!=typeof Map&&e instanceof Map?_i.map:"undefined"!=typeof Set&&e instanceof Set?_i.set:"undefined"!=typeof Date&&e instanceof Date?_i.date:_i.object;default:return _i.unknown}},ki=ni.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"]),wi=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),xi=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,ni.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()}};xi.create=e=>new xi(e);var ji=(e,t)=>{let n;switch(e.code){case ki.invalid_type:n=e.received===_i.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ki.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ni.jsonStringifyReplacer)}`;break;case ki.unrecognized_keys:n=`Unrecognized key(s) in object: ${ni.joinValues(e.keys,", ")}`;break;case ki.invalid_union:n="Invalid input";break;case ki.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ni.joinValues(e.options)}`;break;case ki.invalid_enum_value:n=`Invalid enum value. Expected ${ni.joinValues(e.options)}, received '${e.received}'`;break;case ki.invalid_arguments:n="Invalid function arguments";break;case ki.invalid_return_type:n="Invalid function return type";break;case ki.invalid_date:n="Invalid date";break;case ki.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}"`:ni.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ki.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 ki.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 ki.custom:n="Invalid input";break;case ki.invalid_intersection_types:n="Intersection results could not be merged";break;case ki.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ki.not_finite:n="Number must be finite";break;default:n=t.defaultError,ni.assertNever(e)}return{message:n}},Zi=ji;function Pi(e){Zi=e}function Ai(){return Zi}var Oi,Ci,Ti=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}},Ei=[];function $i(e,t){const n=Ai(),a=Ti({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ji?void 0:ji].filter(e=>!!e)});e.common.issues.push(a)}var Ni=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 Ii;"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 Ii;if("aborted"===r.status)return Ii;"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}}},Ii=Object.freeze({status:"aborted"}),Li=e=>({status:"dirty",value:e}),Mi=e=>({status:"valid",value:e}),Ri=e=>"aborted"===e.status,Di=e=>"dirty"===e.status,zi=e=>"valid"===e.status,Fi=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Ci=Oi||(Oi={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Ci.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Ui,qi=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}},Ji=(e,t)=>{if(zi(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 xi(e.common.issues);return this._error=t,this._error}}};function Bi(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 Vi=class{get description(){return this._def.description}_getType(e){return Si(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Si(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ni,ctx:{common:e.parent.common,data:e.data,parsedType:Si(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Fi(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:Si(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ji(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:Si(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return zi(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=>zi(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:Si(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Fi(a)?a:Promise.resolve(a));return Ji(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),i=()=>{return a.addIssue({code:ki.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 Ws({schema:this,typeName:Qs.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 Ks.create(this,this._def)}nullable(){return Hs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return As.create(this)}promise(){return Vs.create(this,this._def)}or(e){return Ts.create([this,e],this._def)}and(e){return Is.create(this,e,this._def)}transform(e){return new Ws({...Bi(this._def),schema:this,typeName:Qs.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Xs({...Bi(this._def),innerType:this,defaultValue:t,typeName:Qs.ZodDefault})}brand(){return new no({typeName:Qs.ZodBranded,type:this,...Bi(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Gs({...Bi(this._def),innerType:this,catchValue:t,typeName:Qs.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ao.create(this,e)}readonly(){return ro.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wi=/^c[^\s-]{8,}$/i,Ki=/^[0-9a-z]+$/,Hi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xi=/^[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,Gi=/^[a-z0-9_-]{21}$/i,Yi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qi=/^[-+]?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)?)??$/,es=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ts=/^(?:(?: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])$/,ns=/^(?:(?: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])$/,as=/^(([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]))$/,rs=/^(([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])$/,is=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ss=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,os="((\\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])))",cs=new RegExp(`^${os}$`);function ds(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 us(e){return new RegExp(`^${ds(e)}$`)}function ls(e){let t=`${os}T${ds(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 ps(e,t){return!("v4"!==t&&t||!ts.test(e))||!("v6"!==t&&t||!as.test(e))}function ms(e,t){if(!Yi.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 fs(e,t){return!("v4"!==t&&t||!ns.test(e))||!("v6"!==t&&t||!rs.test(e))}var hs=class e extends Vi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_i.string){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.string,received:t.parsedType}),Ii}const t=new Ni;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.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),$i(n,{code:ki.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?$i(n,{code:ki.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&$i(n,{code:ki.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)es.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"email",code:ki.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Ui||(Ui=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ui.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"emoji",code:ki.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Xi.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"uuid",code:ki.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Gi.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"nanoid",code:ki.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Wi.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"cuid",code:ki.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Ki.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"cuid2",code:ki.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Hi.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"ulid",code:ki.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),$i(n,{validation:"url",code:ki.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),$i(n,{validation:"regex",code:ki.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),$i(n,{code:ki.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),$i(n,{code:ki.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?ls(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?cs.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?us(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?Qi.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"duration",code:ki.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?ps(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"ip",code:ki.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?ms(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"jwt",code:ki.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?fs(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"cidr",code:ki.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?is.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"base64",code:ki.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?ss.test(e.data)||(n=this._getOrReturnCtx(e,n),$i(n,{validation:"base64url",code:ki.invalid_string,message:a.message}),t.dirty()):ni.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:ki.invalid_string,...Oi.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Oi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Oi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Oi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Oi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Oi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Oi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Oi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Oi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Oi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Oi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Oi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Oi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Oi.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,...Oi.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,...Oi.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Oi.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Oi.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Oi.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Oi.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Oi.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Oi.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Oi.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Oi.errToObj(t)})}nonempty(e){return this.min(1,Oi.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 gs(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}hs.create=e=>{var t;return new hs({checks:[],typeName:Qs.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Bi(e)})};var ys=class e extends Vi{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)!==_i.number){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.number,received:t.parsedType}),Ii}let t;const n=new Ni;for(const a of this._def.checks)"int"===a.kind?ni.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),$i(t,{code:ki.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),$i(t,{code:ki.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),$i(t,{code:ki.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==gs(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),$i(t,{code:ki.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),$i(t,{code:ki.not_finite,message:a.message}),n.dirty()):ni.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Oi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Oi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Oi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Oi.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Oi.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Oi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Oi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Oi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Oi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Oi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Oi.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Oi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Oi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Oi.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&&ni.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)}};ys.create=e=>new ys({checks:[],typeName:Qs.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Bi(e)});var vs=class e extends Vi{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)!==_i.bigint)return this._getInvalidInput(e);let t;const n=new Ni;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),$i(t,{code:ki.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),$i(t,{code:ki.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),$i(t,{code:ki.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ni.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.bigint,received:t.parsedType}),Ii}gte(e,t){return this.setLimit("min",e,!0,Oi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Oi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Oi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Oi.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Oi.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:Oi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Oi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Oi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Oi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Oi.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}};vs.create=e=>{var t;return new vs({checks:[],typeName:Qs.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Bi(e)})};var bs=class extends Vi{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==_i.boolean){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.boolean,received:t.parsedType}),Ii}return Mi(e.data)}};bs.create=e=>new bs({typeName:Qs.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Bi(e)});var _s=class e extends Vi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_i.date){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.date,received:t.parsedType}),Ii}if(Number.isNaN(e.data.getTime()))return $i(this._getOrReturnCtx(e),{code:ki.invalid_date}),Ii;const t=new Ni;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),$i(n,{code:ki.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),$i(n,{code:ki.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ni.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:Oi.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Oi.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}};_s.create=e=>new _s({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qs.ZodDate,...Bi(e)});var Ss=class extends Vi{_parse(e){if(this._getType(e)!==_i.symbol){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.symbol,received:t.parsedType}),Ii}return Mi(e.data)}};Ss.create=e=>new Ss({typeName:Qs.ZodSymbol,...Bi(e)});var ks=class extends Vi{_parse(e){if(this._getType(e)!==_i.undefined){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.undefined,received:t.parsedType}),Ii}return Mi(e.data)}};ks.create=e=>new ks({typeName:Qs.ZodUndefined,...Bi(e)});var ws=class extends Vi{_parse(e){if(this._getType(e)!==_i.null){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.null,received:t.parsedType}),Ii}return Mi(e.data)}};ws.create=e=>new ws({typeName:Qs.ZodNull,...Bi(e)});var xs=class extends Vi{constructor(){super(...arguments),this._any=!0}_parse(e){return Mi(e.data)}};xs.create=e=>new xs({typeName:Qs.ZodAny,...Bi(e)});var js=class extends Vi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Mi(e.data)}};js.create=e=>new js({typeName:Qs.ZodUnknown,...Bi(e)});var Zs=class extends Vi{_parse(e){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.never,received:t.parsedType}),Ii}};Zs.create=e=>new Zs({typeName:Qs.ZodNever,...Bi(e)});var Ps=class extends Vi{_parse(e){if(this._getType(e)!==_i.undefined){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.void,received:t.parsedType}),Ii}return Mi(e.data)}};Ps.create=e=>new Ps({typeName:Qs.ZodVoid,...Bi(e)});var As=class e extends Vi{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==_i.array)return $i(t,{code:ki.invalid_type,expected:_i.array,received:t.parsedType}),Ii;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&($i(t,{code:e?ki.too_big:ki.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&&($i(t,{code:ki.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&&($i(t,{code:ki.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 qi(t,e,t.path,n)))).then(e=>Ni.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new qi(t,e,t.path,n)));return Ni.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Oi.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Oi.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Oi.toString(n)}})}nonempty(e){return this.min(1,e)}};function Os(e){if(e instanceof Cs){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Ks.create(Os(a))}return new Cs({...e._def,shape:()=>t})}return e instanceof As?new As({...e._def,type:Os(e.element)}):e instanceof Ks?Ks.create(Os(e.unwrap())):e instanceof Hs?Hs.create(Os(e.unwrap())):e instanceof Ls?Ls.create(e.items.map(e=>Os(e))):e}As.create=(e,t)=>new As({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qs.ZodArray,...Bi(t)});var Cs=class e extends Vi{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=ni.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_i.object){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.object,received:t.parsedType}),Ii}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof Zs&&"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 qi(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Zs){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&&($i(n,{code:ki.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 qi(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=>Ni.mergeObjectSync(t,e)):Ni.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return Oi.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=Oi.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:Qs.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 ni.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 ni.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Os(this)}partial(t){const n={};for(const e of ni.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 ni.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ks;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qs(ni.objectKeys(this.shape))}};Cs.create=(e,t)=>new Cs({shape:()=>e,unknownKeys:"strip",catchall:Zs.create(),typeName:Qs.ZodObject,...Bi(t)}),Cs.strictCreate=(e,t)=>new Cs({shape:()=>e,unknownKeys:"strict",catchall:Zs.create(),typeName:Qs.ZodObject,...Bi(t)}),Cs.lazycreate=(e,t)=>new Cs({shape:e,unknownKeys:"strip",catchall:Zs.create(),typeName:Qs.ZodObject,...Bi(t)});var Ts=class extends Vi{_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 xi(e.ctx.common.issues));return $i(t,{code:ki.invalid_union,unionErrors:n}),Ii});{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 xi(e));return $i(t,{code:ki.invalid_union,unionErrors:r}),Ii}}get options(){return this._def.options}};Ts.create=(e,t)=>new Ts({options:e,typeName:Qs.ZodUnion,...Bi(t)});var Es=e=>e instanceof Fs?Es(e.schema):e instanceof Ws?Es(e.innerType()):e instanceof Us?[e.value]:e instanceof Js?e.options:e instanceof Bs?ni.objectValues(e.enum):e instanceof Xs?Es(e._def.innerType):e instanceof ks?[void 0]:e instanceof ws?[null]:e instanceof Ks?[void 0,...Es(e.unwrap())]:e instanceof Hs?[null,...Es(e.unwrap())]:e instanceof no||e instanceof ro?Es(e.unwrap()):e instanceof Gs?Es(e._def.innerType):[],$s=class e extends Vi{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_i.object)return $i(t,{code:ki.invalid_type,expected:_i.object,received:t.parsedType}),Ii;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}):($i(t,{code:ki.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ii)}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=Es(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:Qs.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Bi(a)})}};function Ns(e,t){const n=Si(e),a=Si(t);if(e===t)return{valid:!0,data:e};if(n===_i.object&&a===_i.object){const n=ni.objectKeys(t),a=ni.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Ns(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===_i.array&&a===_i.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Ns(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===_i.date&&a===_i.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Is=class extends Vi{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Ri(e)||Ri(a))return Ii;const r=Ns(e.value,a.value);return r.valid?((Di(e)||Di(a))&&t.dirty(),{status:t.value,value:r.data}):($i(n,{code:ki.invalid_intersection_types}),Ii)};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}))}};Is.create=(e,t,n)=>new Is({left:e,right:t,typeName:Qs.ZodIntersection,...Bi(n)});var Ls=class e extends Vi{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_i.array)return $i(n,{code:ki.invalid_type,expected:_i.array,received:n.parsedType}),Ii;if(n.data.length<this._def.items.length)return $i(n,{code:ki.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ii;!this._def.rest&&n.data.length>this._def.items.length&&($i(n,{code:ki.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 qi(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ni.mergeArray(t,e)):Ni.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ls.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ls({items:e,typeName:Qs.ZodTuple,rest:null,...Bi(t)})};var Ms=class e extends Vi{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!==_i.object)return $i(n,{code:ki.invalid_type,expected:_i.object,received:n.parsedType}),Ii;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new qi(n,e,n.path,e)),value:i._parse(new qi(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ni.mergeObjectAsync(t,a):Ni.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Vi?{keyType:t,valueType:n,typeName:Qs.ZodRecord,...Bi(a)}:{keyType:hs.create(),valueType:t,typeName:Qs.ZodRecord,...Bi(n)})}},Rs=class extends Vi{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!==_i.map)return $i(n,{code:ki.invalid_type,expected:_i.map,received:n.parsedType}),Ii;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:a._parse(new qi(n,e,n.path,[i,"key"])),value:r._parse(new qi(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 Ii;"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 Ii;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Rs.create=(e,t,n)=>new Rs({valueType:t,keyType:e,typeName:Qs.ZodMap,...Bi(n)});var Ds=class e extends Vi{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_i.set)return $i(n,{code:ki.invalid_type,expected:_i.set,received:n.parsedType}),Ii;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&($i(n,{code:ki.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&&($i(n,{code:ki.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 Ii;"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 qi(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:Oi.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Oi.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ds.create=(e,t)=>new Ds({valueType:e,minSize:null,maxSize:null,typeName:Qs.ZodSet,...Bi(t)});var zs=class e extends Vi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_i.function)return $i(t,{code:ki.invalid_type,expected:_i.function,received:t.parsedType}),Ii;function n(e,n){return Ti({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),ji].filter(e=>!!e),issueData:{code:ki.invalid_arguments,argumentsError:n}})}function a(e,n){return Ti({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ai(),ji].filter(e=>!!e),issueData:{code:ki.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Vs){const e=this;return Mi(async function(...t){const s=new xi([]),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 Mi(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new xi([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new xi([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:Ls.create(t).rest(js.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||Ls.create([]).rest(js.create()),returns:n||js.create(),typeName:Qs.ZodFunction,...Bi(a)})}},Fs=class extends Vi{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})}};Fs.create=(e,t)=>new Fs({getter:e,typeName:Qs.ZodLazy,...Bi(t)});var Us=class extends Vi{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return $i(t,{received:t.data,code:ki.invalid_literal,expected:this._def.value}),Ii}return{status:"valid",value:e.data}}get value(){return this._def.value}};function qs(e,t){return new Js({values:e,typeName:Qs.ZodEnum,...Bi(t)})}Us.create=(e,t)=>new Us({value:e,typeName:Qs.ZodLiteral,...Bi(t)});var Js=class e extends Vi{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return $i(t,{expected:ni.joinValues(n),received:t.parsedType,code:ki.invalid_type}),Ii}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 $i(t,{received:t.data,code:ki.invalid_enum_value,options:n}),Ii}return Mi(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})}};Js.create=qs;var Bs=class extends Vi{_parse(e){const t=ni.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_i.string&&n.parsedType!==_i.number){const e=ni.objectValues(t);return $i(n,{expected:ni.joinValues(e),received:n.parsedType,code:ki.invalid_type}),Ii}if(this._cache||(this._cache=new Set(ni.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ni.objectValues(t);return $i(n,{received:n.data,code:ki.invalid_enum_value,options:e}),Ii}return Mi(e.data)}get enum(){return this._def.values}};Bs.create=(e,t)=>new Bs({values:e,typeName:Qs.ZodNativeEnum,...Bi(t)});var Vs=class extends Vi{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_i.promise&&!1===t.common.async)return $i(t,{code:ki.invalid_type,expected:_i.promise,received:t.parsedType}),Ii;const n=t.parsedType===_i.promise?t.data:Promise.resolve(t.data);return Mi(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Vs.create=(e,t)=>new Vs({type:e,typeName:Qs.ZodPromise,...Bi(t)});var Ws=class extends Vi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qs.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=>{$i(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 Ii;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ii:"dirty"===a.status||"dirty"===t.value?Li(a.value):a});{if("aborted"===t.value)return Ii;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ii:"dirty"===a.status||"dirty"===t.value?Li(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?Ii:("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?Ii:("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(!zi(e))return Ii;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=>zi(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):Ii)}ni.assertNever(a)}};Ws.create=(e,t,n)=>new Ws({schema:e,typeName:Qs.ZodEffects,effect:t,...Bi(n)}),Ws.createWithPreprocess=(e,t,n)=>new Ws({schema:t,effect:{type:"preprocess",transform:e},typeName:Qs.ZodEffects,...Bi(n)});var Ks=class extends Vi{_parse(e){return this._getType(e)===_i.undefined?Mi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ks.create=(e,t)=>new Ks({innerType:e,typeName:Qs.ZodOptional,...Bi(t)});var Hs=class extends Vi{_parse(e){return this._getType(e)===_i.null?Mi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hs.create=(e,t)=>new Hs({innerType:e,typeName:Qs.ZodNullable,...Bi(t)});var Xs=class extends Vi{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===_i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Xs.create=(e,t)=>new Xs({innerType:e,typeName:Qs.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Bi(t)});var Gs=class extends Vi{_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 Fi(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new xi(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new xi(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gs.create=(e,t)=>new Gs({innerType:e,typeName:Qs.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Bi(t)});var Ys=class extends Vi{_parse(e){if(this._getType(e)!==_i.nan){const t=this._getOrReturnCtx(e);return $i(t,{code:ki.invalid_type,expected:_i.nan,received:t.parsedType}),Ii}return{status:"valid",value:e.data}}};Ys.create=e=>new Ys({typeName:Qs.ZodNaN,...Bi(e)});var Qs,eo,to=Symbol("zod_brand"),no=class extends Vi{_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}},ao=class e extends Vi{_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?Ii:"dirty"===e.status?(t.dirty(),Li(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?Ii:"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:Qs.ZodPipeline})}},ro=class extends Vi{_parse(e){const t=this._def.innerType._parse(e),n=e=>(zi(e)&&(e.value=Object.freeze(e.value)),e);return Fi(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function io(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function so(e,t={},n){return e?xs.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=io(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=io(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):xs.create()}ro.create=(e,t)=>new ro({innerType:e,typeName:Qs.ZodReadonly,...Bi(t)});var oo={object:Cs.lazycreate};(eo=Qs||(Qs={})).ZodString="ZodString",eo.ZodNumber="ZodNumber",eo.ZodNaN="ZodNaN",eo.ZodBigInt="ZodBigInt",eo.ZodBoolean="ZodBoolean",eo.ZodDate="ZodDate",eo.ZodSymbol="ZodSymbol",eo.ZodUndefined="ZodUndefined",eo.ZodNull="ZodNull",eo.ZodAny="ZodAny",eo.ZodUnknown="ZodUnknown",eo.ZodNever="ZodNever",eo.ZodVoid="ZodVoid",eo.ZodArray="ZodArray",eo.ZodObject="ZodObject",eo.ZodUnion="ZodUnion",eo.ZodDiscriminatedUnion="ZodDiscriminatedUnion",eo.ZodIntersection="ZodIntersection",eo.ZodTuple="ZodTuple",eo.ZodRecord="ZodRecord",eo.ZodMap="ZodMap",eo.ZodSet="ZodSet",eo.ZodFunction="ZodFunction",eo.ZodLazy="ZodLazy",eo.ZodLiteral="ZodLiteral",eo.ZodEnum="ZodEnum",eo.ZodEffects="ZodEffects",eo.ZodNativeEnum="ZodNativeEnum",eo.ZodOptional="ZodOptional",eo.ZodNullable="ZodNullable",eo.ZodDefault="ZodDefault",eo.ZodCatch="ZodCatch",eo.ZodPromise="ZodPromise",eo.ZodBranded="ZodBranded",eo.ZodPipeline="ZodPipeline",eo.ZodReadonly="ZodReadonly";var co=(e,t={message:`Input not instance of ${e.name}`})=>so(t=>t instanceof e,t),uo=hs.create,lo=ys.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=Ps.create,wo=As.create,xo=Cs.create,jo=Cs.strictCreate,Zo=Ts.create,Po=$s.create,Ao=Is.create,Oo=Ls.create,Co=Ms.create,To=Rs.create,Eo=Ds.create,$o=zs.create,No=Fs.create,Io=Us.create,Lo=Js.create,Mo=Bs.create,Ro=Vs.create,Do=Ws.create,zo=Ks.create,Fo=Hs.create,Uo=Ws.createWithPreprocess,qo=ao.create,Jo=()=>uo().optional(),Bo=()=>lo().optional(),Vo=()=>fo().optional(),Wo={string:e=>hs.create({...e,coerce:!0}),number:e=>ys.create({...e,coerce:!0}),boolean:e=>bs.create({...e,coerce:!0}),bigint:e=>vs.create({...e,coerce:!0}),date:e=>_s.create({...e,coerce:!0})},Ko=Ii,Ho=Symbol("Let zodToJsonSchema decide on which parser to use"),Xo={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 Go(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Yo(e,t,n,a,r){e[t]=n,Go(e,t,a,r)}var Qo=(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 ec(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Qo(t,e.currentPath):t.join("/")}}function tc(e,t){return Pc(e.type._def,t)}function nc(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>nc(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 ac(e,t)}}var ac=(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":Yo(n,"minimum",a.value,a.message,t);break;case"max":Yo(n,"maximum",a.value,a.message,t)}return n},rc=void 0,ic=/^[cC][^\s-]{8,}$/,sc=/^[0-9a-z]+$/,oc=/^[0-9A-HJKMNP-TV-Z]{26}$/,cc=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,dc=()=>(void 0===rc&&(rc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rc),uc=/^(?:(?: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])$/,lc=/^(([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])$/,pc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fc=/^[a-zA-Z0-9_-]{21}$/,hc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function gc(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Yo(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Yo(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":bc(n,"email",a.message,t);break;case"format:idn-email":bc(n,"idn-email",a.message,t);break;case"pattern:zod":_c(n,cc,a.message,t)}break;case"url":bc(n,"uri",a.message,t);break;case"uuid":bc(n,"uuid",a.message,t);break;case"regex":_c(n,a.regex,a.message,t);break;case"cuid":_c(n,ic,a.message,t);break;case"cuid2":_c(n,sc,a.message,t);break;case"startsWith":_c(n,RegExp(`^${yc(a.value,t)}`),a.message,t);break;case"endsWith":_c(n,RegExp(`${yc(a.value,t)}$`),a.message,t);break;case"datetime":bc(n,"date-time",a.message,t);break;case"date":bc(n,"date",a.message,t);break;case"time":bc(n,"time",a.message,t);break;case"duration":bc(n,"duration",a.message,t);break;case"length":Yo(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Yo(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":_c(n,RegExp(yc(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&bc(n,"ipv4",a.message,t),"v4"!==a.version&&bc(n,"ipv6",a.message,t);break;case"base64url":_c(n,mc,a.message,t);break;case"jwt":_c(n,hc,a.message,t);break;case"cidr":"v6"!==a.version&&_c(n,uc,a.message,t),"v4"!==a.version&&_c(n,lc,a.message,t);break;case"emoji":_c(n,dc(),a.message,t);break;case"ulid":_c(n,oc,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":bc(n,"binary",a.message,t);break;case"contentEncoding:base64":Yo(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":_c(n,pc,a.message,t)}break;case"nanoid":_c(n,fc,a.message,t)}return n}function yc(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)vc.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var vc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function bc(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}}})):Yo(e,"format",t,n,a)}function _c(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:Sc(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Yo(e,"pattern",Sc(t,a),n,a)}function Sc(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 kc(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)===Qs.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Pc(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:ec(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=Pc(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)===Qs.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=gc(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Qs.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Qs.ZodBranded&&e.keyType._def.type._def.typeName===Qs.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=tc(e.keyType._def,t);return{...d,propertyNames:a}}return d}var wc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},xc=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Pc(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 jc(e){try{return e.isOptional()}catch(e){return!0}}var Zc=(e,t,n)=>{switch(t){case Qs.ZodString:return gc(e,n);case Qs.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",Go(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Yo(n,"minimum",a.value,a.message,t):Yo(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Yo(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Yo(n,"maximum",a.value,a.message,t):Yo(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Yo(n,"maximum",a.value,a.message,t));break;case"multipleOf":Yo(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Qs.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=jc(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=Pc(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 Pc(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 Qs.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?Yo(n,"minimum",a.value,a.message,t):Yo(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Yo(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Yo(n,"maximum",a.value,a.message,t):Yo(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Yo(n,"maximum",a.value,a.message,t));break;case"multipleOf":Yo(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Qs.ZodBoolean:return{type:"boolean"};case Qs.ZodDate:return nc(e,n);case Qs.ZodUndefined:return{not:ec(n)};case Qs.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Qs.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)!==Qs.ZodAny&&(i.items=Pc(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Yo(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Yo(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Yo(i,"minItems",e.exactLength.value,e.exactLength.message,t),Yo(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Qs.ZodUnion:case Qs.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return xc(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in wc&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=wc[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 xc(e,t)}(e,n);case Qs.ZodIntersection:return function(e,t){const n=[Pc(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Pc(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 Qs.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Pc(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Pc(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Pc(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Qs.ZodRecord:return kc(e,n);case Qs.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 Qs.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Qs.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 Qs.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:wc[e.innerType._def.typeName],nullable:!0}:{type:[wc[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Pc(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Pc(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Qs.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Pc(e.innerType._def,t);const a=Pc(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ec(t)},a]}:ec(t)})(e,n);case Qs.ZodMap:return function(e,t){return"record"===t.mapStrategy?kc(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Pc(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ec(t),Pc(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ec(t)],minItems:2,maxItems:2}}}(e,n);case Qs.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Pc(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Yo(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Yo(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Qs.ZodLazy:return()=>e.getter()._def;case Qs.ZodPromise:return function(e,t){return Pc(e.type._def,t)}(e,n);case Qs.ZodNaN:case Qs.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:ec({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Qs.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Pc(e.schema._def,t):ec(t)}(e,n);case Qs.ZodAny:return ec(n);case Qs.ZodUnknown:return function(e){return ec(e)}(n);case Qs.ZodDefault:return function(e,t){return{...Pc(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Qs.ZodBranded:return tc(e,n);case Qs.ZodReadonly:case Qs.ZodCatch:return((e,t)=>Pc(e.innerType._def,t))(e,n);case Qs.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Pc(e.in._def,t);if("output"===t.pipeStrategy)return Pc(e.out._def,t);const n=Pc(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Pc(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Qs.ZodFunction:case Qs.ZodVoid:case Qs.ZodSymbol:default:return}};function Pc(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!==Ho)return i}if(r&&!n){const e=Ac(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=Zc(e,e.typeName,t),o="function"==typeof s?Pc(s(),t):s;if(o&&Oc(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var Ac=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Qo(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`),ec(t)):"seen"===t.$refStrategy?ec(t):void 0}},Oc=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),Cc=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Xo,name:a}:{...Xo,...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=Pc(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:ec(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=Pc(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:ec(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},Tc=Object.defineProperty,Ec=(e,t)=>{for(var n in t)Tc(e,n,{get:t[n],enumerable:!0})},$c=bi.string(),Nc=bi.number(),Ic=(bi.boolean(),bi.string().min(1)),Lc=bi.number().int().positive(),Mc=bi.number().int().nonnegative(),Rc=bi.number().describe("Tagging version number");bi.union([bi.string(),bi.number(),bi.boolean()]).optional(),Ec({},{ErrorHandlerSchema:()=>Fc,HandlerSchema:()=>qc,LogHandlerSchema:()=>Uc,StorageSchema:()=>zc,StorageTypeSchema:()=>Dc,errorHandlerJsonSchema:()=>Vc,handlerJsonSchema:()=>Kc,logHandlerJsonSchema:()=>Wc,storageJsonSchema:()=>Bc,storageTypeJsonSchema:()=>Jc});var Dc=bi.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),zc=bi.object({Local:bi.literal("local"),Session:bi.literal("session"),Cookie:bi.literal("cookie")}).describe("Storage type constants for type-safe references"),Fc=bi.any().describe("Error handler function: (error, state?) => void"),Uc=bi.any().describe("Log handler function: (message, verbose?) => void"),qc=bi.object({Error:Fc.describe("Error handler function"),Log:Uc.describe("Log handler function")}).describe("Handler interface with error and log functions"),Jc=Cc(Dc,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),Bc=Cc(zc,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Vc=Cc(Fc,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Wc=Cc(Uc,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Kc=Cc(qc,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});bi.object({onError:Fc.optional().describe("Error handler function: (error, state?) => void"),onLog:Uc.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),bi.object({verbose:bi.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),bi.object({queue:bi.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),bi.object({}).partial(),bi.object({init:bi.boolean().describe("Whether to initialize immediately").optional(),loadScript:bi.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),bi.object({disabled:bi.boolean().describe("Set to true to disable").optional()}).partial(),bi.object({primary:bi.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),bi.object({settings:bi.any().optional().describe("Implementation-specific configuration")}).partial(),bi.object({env:bi.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),bi.object({type:bi.string().optional().describe("Instance type identifier"),config:bi.any().describe("Instance configuration")}).partial(),bi.object({collector:bi.any().describe("Collector instance (runtime object)"),config:bi.any().describe("Configuration"),env:bi.any().describe("Environment dependencies")}).partial(),bi.object({batch:bi.number().optional().describe("Batch size: bundle N events for batch processing"),batched:bi.any().optional().describe("Batch of events to be processed")}).partial(),bi.object({ignore:bi.boolean().describe("Set to true to skip processing").optional(),condition:bi.string().optional().describe("Condition function: return true to process")}).partial(),bi.object({sources:bi.record(bi.string(),bi.any()).describe("Map of source instances")}).partial(),bi.object({destinations:bi.record(bi.string(),bi.any()).describe("Map of destination instances")}).partial(),Ec({},{ConsentSchema:()=>ed,DeepPartialEventSchema:()=>cd,EntitiesSchema:()=>id,EntitySchema:()=>rd,EventSchema:()=>sd,OrderedPropertiesSchema:()=>Yc,PartialEventSchema:()=>od,PropertiesSchema:()=>Gc,PropertySchema:()=>Xc,PropertyTypeSchema:()=>Hc,SourceSchema:()=>ad,SourceTypeSchema:()=>Qc,UserSchema:()=>td,VersionSchema:()=>nd,consentJsonSchema:()=>gd,entityJsonSchema:()=>fd,eventJsonSchema:()=>dd,orderedPropertiesJsonSchema:()=>md,partialEventJsonSchema:()=>ud,propertiesJsonSchema:()=>pd,sourceTypeJsonSchema:()=>hd,userJsonSchema:()=>ld});var Hc=bi.lazy(()=>bi.union([bi.boolean(),bi.string(),bi.number(),bi.record(bi.string(),Xc)])),Xc=bi.lazy(()=>bi.union([Hc,bi.array(Hc)])),Gc=bi.record(bi.string(),Xc.optional()).describe("Flexible property collection with optional values"),Yc=bi.record(bi.string(),bi.tuple([Xc,bi.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Qc=bi.union([bi.enum(["web","server","app","other"]),bi.string()]).describe("Source type: web, server, app, other, or custom"),ed=bi.record(bi.string(),bi.boolean()).describe("Consent requirement mapping (group name → state)"),td=Gc.and(bi.object({id:bi.string().optional().describe("User identifier"),device:bi.string().optional().describe("Device identifier"),session:bi.string().optional().describe("Session identifier"),hash:bi.string().optional().describe("Hashed identifier"),address:bi.string().optional().describe("User address"),email:bi.string().email().optional().describe("User email address"),phone:bi.string().optional().describe("User phone number"),userAgent:bi.string().optional().describe("Browser user agent string"),browser:bi.string().optional().describe("Browser name"),browserVersion:bi.string().optional().describe("Browser version"),deviceType:bi.string().optional().describe("Device type (mobile, desktop, tablet)"),os:bi.string().optional().describe("Operating system"),osVersion:bi.string().optional().describe("Operating system version"),screenSize:bi.string().optional().describe("Screen dimensions"),language:bi.string().optional().describe("User language"),country:bi.string().optional().describe("User country"),region:bi.string().optional().describe("User region/state"),city:bi.string().optional().describe("User city"),zip:bi.string().optional().describe("User postal code"),timezone:bi.string().optional().describe("User timezone"),ip:bi.string().optional().describe("User IP address"),internal:bi.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),nd=Gc.and(bi.object({source:$c.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Rc})).describe("Walker version information"),ad=Gc.and(bi.object({type:Qc.describe("Source type identifier"),id:$c.describe("Source identifier (typically URL on web)"),previous_id:$c.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),rd=bi.lazy(()=>bi.object({entity:bi.string().describe("Entity name"),data:Gc.describe("Entity-specific properties"),nested:bi.array(rd).describe("Nested child entities"),context:Yc.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),id=bi.array(rd).describe("Array of nested entities"),sd=bi.object({name:bi.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Gc.describe("Event-specific properties"),context:Yc.describe("Ordered context properties with priorities"),globals:Gc.describe("Global properties shared across events"),custom:Gc.describe("Custom implementation-specific properties"),user:td.describe("User identification and attributes"),nested:id.describe("Related nested entities"),consent:ed.describe("Consent states at event time"),id:Ic.describe("Unique event identifier (timestamp-based)"),trigger:$c.describe("Event trigger identifier"),entity:$c.describe("Parsed entity from event name"),action:$c.describe("Parsed action from event name"),timestamp:Lc.describe("Unix timestamp in milliseconds since epoch"),timing:Nc.describe("Event processing timing information"),group:$c.describe("Event grouping identifier"),count:Mc.describe("Event count in session"),version:nd.describe("Walker version information"),source:ad.describe("Event source information")}).describe("Complete walkerOS event structure"),od=sd.partial().describe("Partial event structure with all fields optional"),cd=bi.lazy(()=>sd.deepPartial()).describe("Deep partial event structure with all nested fields optional"),dd=Cc(sd,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),ud=Cc(od,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),ld=Cc(td,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),pd=Cc(Gc,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),md=Cc(Yc,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),fd=Cc(rd,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),hd=Cc(Qc,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),gd=Cc(ed,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});Ec({},{ConfigSchema:()=>Zd,LoopSchema:()=>bd,MapSchema:()=>Sd,PolicySchema:()=>wd,ResultSchema:()=>Pd,RuleSchema:()=>xd,RulesSchema:()=>jd,SetSchema:()=>_d,ValueConfigSchema:()=>kd,ValueSchema:()=>yd,ValuesSchema:()=>vd,configJsonSchema:()=>Ld,loopJsonSchema:()=>Cd,mapJsonSchema:()=>Ed,policyJsonSchema:()=>$d,ruleJsonSchema:()=>Nd,rulesJsonSchema:()=>Id,setJsonSchema:()=>Td,valueConfigJsonSchema:()=>Od,valueJsonSchema:()=>Ad});var yd=bi.lazy(()=>bi.union([bi.string().describe('String value or property path (e.g., "data.id")'),bi.number().describe("Numeric value"),bi.boolean().describe("Boolean value"),kd,bi.array(yd).describe("Array of values")])),vd=bi.array(yd).describe("Array of transformation values"),bd=bi.tuple([yd,yd]).describe("Loop transformation: [source, transform] tuple for array processing"),_d=bi.array(yd).describe("Set: Array of values for selection or combination"),Sd=bi.record(bi.string(),yd).describe("Map: Object mapping keys to transformation values"),kd=bi.object({key:bi.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:bi.union([bi.string(),bi.number(),bi.boolean()]).optional().describe("Static primitive value"),fn:bi.string().optional().describe("Custom transformation function as string (serialized)"),map:Sd.optional().describe("Object mapping: transform event data to structured output"),loop:bd.optional().describe("Loop transformation: [source, transform] for array processing"),set:_d.optional().describe("Set of values: combine or select from multiple values"),consent:ed.optional().describe("Required consent states to include this value"),condition:bi.string().optional().describe("Condition function as string: return true to include value"),validate:bi.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"),wd=bi.record(bi.string(),yd).describe("Policy rules for event pre-processing (key → value mapping)"),xd=bi.object({batch:bi.number().optional().describe("Batch size: bundle N events for batch processing"),condition:bi.string().optional().describe("Condition function as string: return true to process event"),consent:ed.optional().describe("Required consent states to process this event"),settings:bi.any().optional().describe("Destination-specific settings for this event mapping"),data:bi.union([yd,vd]).optional().describe("Data transformation rules for event"),ignore:bi.boolean().optional().describe("Set to true to skip processing this event"),name:bi.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:wd.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),jd=bi.record(bi.string(),bi.record(bi.string(),bi.union([xd,bi.array(xd)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),Zd=bi.object({consent:ed.optional().describe("Required consent states to process any events"),data:bi.union([yd,vd]).optional().describe("Global data transformation applied to all events"),mapping:jd.optional().describe("Entity-action specific mapping rules"),policy:wd.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),Pd=bi.object({eventMapping:xd.optional().describe("Resolved mapping rule for event"),mappingKey:bi.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Ad=Cc(yd,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),Od=Cc(kd,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Cd=Cc(bd,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Td=Cc(_d,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Ed=Cc(Sd,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),$d=Cc(wd,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Nd=Cc(xd,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),Id=Cc(jd,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Ld=Cc(Zd,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});Ec({},{BatchSchema:()=>Bd,ConfigSchema:()=>Md,ContextSchema:()=>zd,DLQSchema:()=>eu,DataSchema:()=>Vd,DestinationPolicySchema:()=>Dd,DestinationsSchema:()=>Xd,InitDestinationsSchema:()=>Hd,InitSchema:()=>Kd,InstanceSchema:()=>Wd,PartialConfigSchema:()=>Rd,PushBatchContextSchema:()=>Ud,PushContextSchema:()=>Fd,PushEventSchema:()=>qd,PushEventsSchema:()=>Jd,PushResultSchema:()=>Yd,RefSchema:()=>Gd,ResultSchema:()=>Qd,batchJsonSchema:()=>iu,configJsonSchema:()=>tu,contextJsonSchema:()=>au,instanceJsonSchema:()=>su,partialConfigJsonSchema:()=>nu,pushContextJsonSchema:()=>ru,resultJsonSchema:()=>ou});var Md=bi.object({consent:ed.optional().describe("Required consent states to send events to this destination"),settings:bi.any().describe("Implementation-specific configuration").optional(),data:bi.union([yd,vd]).optional().describe("Global data transformation applied to all events for this destination"),env:bi.any().describe("Environment dependencies (platform-specific)").optional(),id:Ic.describe("Destination instance identifier (defaults to destination key)").optional(),init:bi.boolean().describe("Whether to initialize immediately").optional(),loadScript:bi.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:jd.optional().describe("Entity-action specific mapping rules for this destination"),policy:wd.optional().describe("Pre-processing policy rules applied before event mapping"),queue:bi.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:bi.boolean().describe("Enable verbose logging for debugging").optional(),onError:Fc.optional(),onLog:Uc.optional()}).describe("Destination configuration"),Rd=Md.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Dd=wd.describe("Destination policy rules for event pre-processing"),zd=bi.object({collector:bi.any().describe("Collector instance (runtime object)"),config:Md.describe("Destination configuration"),data:bi.union([bi.any(),bi.undefined(),bi.array(bi.union([bi.any(),bi.undefined()]))]).optional().describe("Transformed event data"),env:bi.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Fd=zd.extend({mapping:xd.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ud=Fd.describe("Batch push context with event-specific mapping"),qd=bi.object({event:sd.describe("The event to process"),mapping:xd.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Jd=bi.array(qd).describe("Array of events with mappings"),Bd=bi.object({key:bi.string().describe('Batch key (usually mapping key like "product.view")'),events:bi.array(sd).describe("Array of events in batch"),data:bi.array(bi.union([bi.any(),bi.undefined(),bi.array(bi.union([bi.any(),bi.undefined()]))])).describe("Transformed data for each event"),mapping:xd.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Vd=bi.union([bi.any(),bi.undefined(),bi.array(bi.union([bi.any(),bi.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Wd=bi.object({config:Md.describe("Destination configuration"),queue:bi.array(sd).optional().describe("Queued events awaiting consent"),dlq:bi.array(bi.tuple([sd,bi.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:bi.string().optional().describe("Destination type identifier"),env:bi.any().optional().describe("Environment dependencies"),init:bi.any().optional().describe("Initialization function"),push:bi.any().describe("Push function for single events"),pushBatch:bi.any().optional().describe("Batch push function"),on:bi.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Kd=bi.object({code:Wd.describe("Destination instance with implementation"),config:Rd.optional().describe("Partial configuration overrides"),env:bi.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Hd=bi.record(bi.string(),Kd).describe("Map of destination IDs to initialization configurations"),Xd=bi.record(bi.string(),Wd).describe("Map of destination IDs to runtime instances"),Gd=bi.object({id:bi.string().describe("Destination ID"),destination:Wd.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Yd=bi.object({queue:bi.array(sd).optional().describe("Events queued (awaiting consent)"),error:bi.any().optional().describe("Error if push failed")}).describe("Push operation result"),Qd=bi.object({successful:bi.array(Gd).describe("Destinations that processed successfully"),queued:bi.array(Gd).describe("Destinations that queued events"),failed:bi.array(Gd).describe("Destinations that failed to process")}).describe("Overall destination processing result"),eu=bi.array(bi.tuple([sd,bi.any()])).describe("Dead letter queue: [(event, error), ...]"),tu=Cc(Md,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),nu=Cc(Rd,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),au=Cc(zd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),ru=Cc(Fd,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),iu=Cc(Bd,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),su=Cc(Wd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),ou=Cc(Qd,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});Ec({},{CommandTypeSchema:()=>cu,ConfigSchema:()=>du,DestinationsSchema:()=>fu,InitConfigSchema:()=>lu,InstanceSchema:()=>hu,PushContextSchema:()=>pu,SessionDataSchema:()=>uu,SourcesSchema:()=>mu,commandTypeJsonSchema:()=>gu,configJsonSchema:()=>yu,initConfigJsonSchema:()=>bu,instanceJsonSchema:()=>Su,pushContextJsonSchema:()=>_u,sessionDataJsonSchema:()=>vu});var cu=bi.union([bi.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),bi.string()]).describe("Collector command type: standard commands or custom string for extensions"),du=bi.object({run:bi.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Rc,globalsStatic:Gc.describe("Static global properties that persist across collector runs"),sessionStatic:bi.record(bi.any()).describe("Static session data that persists across collector runs"),verbose:bi.boolean().describe("Enable verbose logging for debugging"),onError:Fc.optional(),onLog:Uc.optional()}).describe("Core collector configuration"),uu=Gc.and(bi.object({isStart:bi.boolean().describe("Whether this is a new session start"),storage:bi.boolean().describe("Whether storage is available"),id:Ic.describe("Session identifier").optional(),start:Lc.describe("Session start timestamp").optional(),marketing:bi.literal(!0).optional().describe("Marketing attribution flag"),updated:Lc.describe("Last update timestamp").optional(),isNew:bi.boolean().describe("Whether this is a new session").optional(),device:Ic.describe("Device identifier").optional(),count:Mc.describe("Event count in session").optional(),runs:Mc.describe("Number of runs").optional()})).describe("Session state and tracking data"),lu=du.partial().extend({consent:ed.optional().describe("Initial consent state"),user:td.optional().describe("Initial user data"),globals:Gc.optional().describe("Initial global properties"),sources:bi.any().optional().describe("Source configurations"),destinations:bi.any().optional().describe("Destination configurations"),custom:Gc.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),pu=bi.object({mapping:Zd.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),mu=bi.record(bi.string(),bi.any()).describe("Map of source IDs to source instances"),fu=bi.record(bi.string(),bi.any()).describe("Map of destination IDs to destination instances"),hu=bi.object({push:bi.any().describe("Push function for processing events"),command:bi.any().describe("Command function for walker commands"),allowed:bi.boolean().describe("Whether event processing is allowed"),config:du.describe("Current collector configuration"),consent:ed.describe("Current consent state"),count:bi.number().describe("Event count (increments with each event)"),custom:Gc.describe("Custom implementation-specific properties"),sources:mu.describe("Registered source instances"),destinations:fu.describe("Registered destination instances"),globals:Gc.describe("Current global properties"),group:bi.string().describe("Event grouping identifier"),hooks:bi.any().describe("Lifecycle hook functions"),on:bi.any().describe("Event lifecycle configuration"),queue:bi.array(sd).describe("Queued events awaiting processing"),round:bi.number().describe("Collector run count (increments with each run)"),session:bi.union([bi.undefined(),uu]).describe("Current session state"),timing:bi.number().describe("Event processing timing information"),user:td.describe("Current user data"),version:bi.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),gu=Cc(cu,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),yu=Cc(du,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),vu=Cc(uu,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),bu=Cc(lu,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),_u=Cc(pu,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),Su=Cc(hu,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});Ec({},{BaseEnvSchema:()=>ku,ConfigSchema:()=>wu,InitSchema:()=>Zu,InitSourceSchema:()=>Pu,InitSourcesSchema:()=>Au,InstanceSchema:()=>ju,PartialConfigSchema:()=>xu,baseEnvJsonSchema:()=>Ou,configJsonSchema:()=>Cu,initSourceJsonSchema:()=>$u,initSourcesJsonSchema:()=>Nu,instanceJsonSchema:()=>Eu,partialConfigJsonSchema:()=>Tu});var ku=bi.object({push:bi.any().describe("Collector push function"),command:bi.any().describe("Collector command function"),sources:bi.any().optional().describe("Map of registered source instances"),elb:bi.any().describe("Public API function (alias for collector.push)")}).catchall(bi.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),wu=Zd.extend({settings:bi.any().describe("Implementation-specific configuration").optional(),env:ku.optional().describe("Environment dependencies (platform-specific)"),id:Ic.describe("Source identifier (defaults to source key)").optional(),onError:Fc.optional(),disabled:bi.boolean().describe("Set to true to disable").optional(),primary:bi.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),xu=wu.deepPartial().describe("Partial source configuration with all fields deeply optional"),ju=bi.object({type:bi.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:wu.describe("Current source configuration"),push:bi.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:bi.any().optional().describe("Cleanup function called when source is removed"),on:bi.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Zu=bi.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Pu=bi.object({code:Zu.describe("Source initialization function"),config:xu.optional().describe("Partial configuration overrides"),env:ku.partial().optional().describe("Partial environment overrides"),primary:bi.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),Au=bi.record(bi.string(),Pu).describe("Map of source IDs to initialization configurations"),Ou=Cc(ku,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),Cu=Cc(wu,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),Tu=Cc(xu,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),Eu=Cc(ju,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),$u=Cc(Pu,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Nu=Cc(Au,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function Iu(e){return Cc(e,{target:"jsonSchema7",$refStrategy:"none"})}var Lu={merge:!0,shallow:!0,extend:!0};function Mu(e,t={},n={}){n={...Lu,...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 Ru(e){return Array.isArray(e)}function Du(e){return e===document||e instanceof Element}function zu(e){return"object"==typeof e&&null!==e&&!Ru(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Fu(e){return"string"==typeof e}function Uu(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function qu(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Ju(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Bu(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Vu(e,t,n,a=!0){return tl(Jr(t,Bu(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),Ru(e[a])||(e[a]=[]),e[a].push(Uu(r))):e[a]=Uu(r),e},{})}function Wu(e=ti.Prefix,t=document){const n=Bu(e,ti.Globals,!1);let a={};return el(t,`[${n}]`,t=>{a=Mu(a,Vu(e,t,ti.Globals,!1))}),a}function Ku(e,t){const n=window.location,a="page",r=t===document?document.body:t,[i,s]=Qu(r,`[${Bu(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=Jr(t,Bu(e));if(!r||a&&!a[r])return null;const i=[t],s=`[${Bu(e,r)}],[${Bu(e,"")}]`,o=Bu(e,ti.Link,!1);let c={};const d=[],[u,l]=Qu(n||t,s,e,r);el(t,`[${o}]`,t=>{const[n,a]=nl(Jr(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=Mu(m,Vu(e,t,"")),c=Mu(c,Vu(e,t,r))}),c=Mu(Mu(m,c),u),i.forEach(t=>{el(t,`[${Bu(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=Bu(e,ti.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=nl(Jr(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=`[${Bu(n,ti.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=Mu(Vu(n,s,""),r),r=Mu(Vu(n,s,a),r)),s.matches(o)&&(Object.entries(Vu(n,s,ti.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[Ju(t),Ju(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:Wr(e),lastChecked:t},sl.set(e,n)),n.isVisible}function dl(e){if(window.IntersectionObserver)return qu(()=>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(Fu(t)&&t.startsWith("walker "))return o(t,n);if(zu(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(zu(t)?t.name:t).split(" ");let u,l=zu(n)?n:{},p={},m=!1;if(Du(n)&&(u=n,m=!0),Du(r)?u=r:zu(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:Fu(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",qu(function(t){xl.call(this,e,t)})),n.addEventListener("submit",qu(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=Bu(t.prefix,ti.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=function(e,t,n=ti.Prefix){const a=[],{actions:r,nearestOnly:i}=function(e,t,n){let a=t;for(;a;){const t=Jr(a,Bu(e,ti.Actions,!1));if(t){const e=Hu(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=Jr(a,Bu(e,ti.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[Ju(t)]=!0,e),{}),o=Xu(n,e,s,i);if(!o.length){const t="page",a=`[${Bu(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}(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=Jr(t,n);r&&Object.values(Hu(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case hl:a=e,t.addEventListener("mouseenter",qu(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=!zu(s)&&Fu(s)&&s.startsWith("walker ");if(zu(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!Fu(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){qu(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Fu(a)&&""===a.trim())return;if(Fu(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 Kr((r?Yr:Qr)(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=()=>Qr(e);return e.consent&&$r((Zr(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>Yr(e)),Kr(i(),a,t)}}(e,t),i=(Zr(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",i):Vr("walker on","consent",i)}}({...t,collector:{push:e,group:void 0}})}vi({},{env:()=>Cl});var Cl={};vi(Cl,{push:()=>$l});var Tl=()=>{},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:Tl,removeEventListener:Tl,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:Tl,removeEventListener:Tl,querySelector:Tl,querySelectorAll:()=>[],getElementById:Tl,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Tl,getAttribute:Tl,addEventListener:Tl,removeEventListener:Tl}),body:{appendChild:Tl,removeChild:Tl},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}};vi({},{DataAttributePrefix:()=>Nl,JavaScriptVarName:()=>Il,ScopeSelector:()=>Ll,SettingsSchema:()=>Dl,TaggerSchema:()=>zl,settings:()=>Fl,tagger:()=>Ul});var Nl=bi.string().min(1).regex(/^[a-z][a-z0-9-]*$/,"Must be lowercase kebab-case").describe("Prefix for data attributes on DOM elements"),Il=bi.string().min(1).regex(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,"Must be a valid JavaScript identifier").describe("JavaScript variable name"),Ll=bi.string().describe('DOM scope for event tracking (CSS selector or "document")').optional(),Ml=bi.union([bi.boolean(),bi.any().describe("SessionConfig object from @walkeros/web-core with tracking settings")]),Rl=bi.union([bi.boolean(),bi.string(),bi.any().describe("Elb.Layer array for async command queuing")]),Dl=bi.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:bi.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:bi.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=bi.object({prefix:Nl.default("data-elb").describe("Custom prefix for generated data attributes")}),Fl=Iu(Dl),Ul=Iu(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:Fu(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)}})(),Fu(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})}}}r({},{browserConfig:()=>Sp,collectorConfig:()=>wp,dataLayerConfig:()=>kp,settings:()=>_p});var _p={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."}}},Sp={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"}}},kp={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"}}},wp={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."}}};if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=Br(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(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 gi(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
|