@walkeros/web-source-browser 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +89 -10
- package/dist/index.d.ts +89 -10
- 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/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t,n,r=Object.defineProperty,a=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},s={};a(s,{BRAND:()=>Fe,DIRTY:()=>x,EMPTY_PATH:()=>g,INVALID:()=>k,NEVER:()=>Et,OK:()=>w,ParseStatus:()=>b,Schema:()=>N,ZodAny:()=>de,ZodArray:()=>he,ZodBigInt:()=>ae,ZodBoolean:()=>se,ZodBranded:()=>ze,ZodCatch:()=>Re,ZodDate:()=>ie,ZodDefault:()=>Me,ZodDiscriminatedUnion:()=>_e,ZodEffects:()=>Ee,ZodEnum:()=>Pe,ZodError:()=>d,ZodFirstPartyTypeKind:()=>We,ZodFunction:()=>Oe,ZodIntersection:()=>ke,ZodIssueCode:()=>c,ZodLazy:()=>Te,ZodLiteral:()=>Se,ZodMap:()=>Ze,ZodNaN:()=>Le,ZodNativeEnum:()=>Ce,ZodNever:()=>pe,ZodNull:()=>ue,ZodNullable:()=>Ie,ZodNumber:()=>re,ZodObject:()=>ge,ZodOptional:()=>$e,ZodParsedType:()=>i,ZodPipeline:()=>De,ZodPromise:()=>Ne,ZodReadonly:()=>Ve,ZodRecord:()=>we,ZodSchema:()=>N,ZodSet:()=>Ae,ZodString:()=>te,ZodSymbol:()=>oe,ZodTransformer:()=>Ee,ZodTuple:()=>xe,ZodType:()=>N,ZodUndefined:()=>ce,ZodUnion:()=>ye,ZodUnknown:()=>le,ZodVoid:()=>me,addIssueToContext:()=>y,any:()=>at,array:()=>ct,bigint:()=>Xe,boolean:()=>Qe,coerce:()=>Nt,custom:()=>Be,date:()=>et,datetimeRegex:()=>G,defaultErrorMap:()=>l,discriminatedUnion:()=>pt,effect:()=>Zt,enum:()=>kt,function:()=>vt,getErrorMap:()=>h,getParsedType:()=>o,instanceof:()=>He,intersection:()=>mt,isAborted:()=>Z,isAsync:()=>T,isDirty:()=>A,isValid:()=>O,late:()=>qe,lazy:()=>_t,literal:()=>bt,makeIssue:()=>f,map:()=>gt,nan:()=>Ge,nativeEnum:()=>xt,never:()=>it,null:()=>rt,nullable:()=>Ot,number:()=>Ye,object:()=>ut,objectUtil:()=>n,oboolean:()=>Ct,onumber:()=>Pt,optional:()=>At,ostring:()=>jt,pipeline:()=>St,preprocess:()=>Tt,promise:()=>wt,quotelessJson:()=>u,record:()=>ft,set:()=>yt,setErrorMap:()=>m,strictObject:()=>dt,string:()=>Je,symbol:()=>tt,transformer:()=>Zt,tuple:()=>ht,undefined:()=>nt,union:()=>lt,unknown:()=>st,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]]),r={};for(const t of n)r[t]=e[t];return t.objectValues(r)},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 i=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 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}},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"]),u=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),d=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:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(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 r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};d.create=e=>new d(e);var l=(t,n)=>{let r;switch(t.code){case c.invalid_type:r=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case c.too_small:r="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:r="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:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=n.defaultError,e.assertNever(t)}return{message:r}},p=l;function m(e){p=e}function h(){return p}var f=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const c=r.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}},g=[];function y(e,t){const n=h(),r=f({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(r)}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 r of t){if("aborted"===r.status)return k;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const r=[];for(const e of n){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return k;if("aborted"===a.status)return k;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}},k=Object.freeze({status:"aborted"}),x=e=>({status:"dirty",value:e}),w=e=>({status:"valid",value:e}),Z=e=>"aborted"===e.status,A=e=>"dirty"===e.status,O=e=>"valid"===e.status,T=e=>"undefined"!=typeof Promise&&e instanceof Promise;(_=v||(v={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},_.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var S=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},j=(e,t)=>{if(O(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 d(e.common.issues);return this._error=t,this._error}}};function P(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!=(s=null!=o?o:r)?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!=(i=null!=o?o:n)?i:a.defaultError}},description:a}}var C,N=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 b,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(T(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={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)},a=this._parseSync({data:e,path:r.path,parent:r});return j(r,a)}"~validate"(e){var t,n;const r={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:r});return O(t)?{value:t.value}:{issues:r.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),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>O(e)?{value:e.value}:{issues:r.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)},r=this._parse({data:e,path:n.path,parent:n}),a=await(T(r)?r:Promise.resolve(r));return j(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const a=e(t),s=()=>r.addIssue({code:c.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new Ee({schema:this,typeName:We.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return $e.create(this,this._def)}nullable(){return Ie.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return Ne.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return ke.create(this,e,this._def)}transform(e){return new Ee({...P(this._def),schema:this,typeName:We.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Me({...P(this._def),innerType:this,defaultValue:t,typeName:We.ZodDefault})}brand(){return new ze({typeName:We.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:We.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return De.create(this,e)}readonly(){return Ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},E=/^c[^\s-]{8,}$/i,$=/^[0-9a-z]+$/,I=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,R=/^[a-z0-9_-]{21}$/i,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,F=/^[-+]?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,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])$/,V=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,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]))$/,B=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,q="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",H=new RegExp(`^${q}$`);function J(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 Y(e){return new RegExp(`^${J(e)}$`)}function G(e){let t=`${q}T${J(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function X(e,t){return!("v4"!==t&&t||!D.test(e))||!("v6"!==t&&t||!U.test(e))}function Q(e,t){if(!L.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return"object"==typeof a&&null!==a&&((!("typ"in a)||"JWT"===(null==a?void 0:a.typ))&&(!!a.alg&&(!t||a.alg===t)))}catch(e){return!1}}function ee(e,t){return!("v4"!==t&&t||!V.test(e))||!("v6"!==t&&t||!B.test(e))}var te=class t extends N{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:i.string,received:e.parsedType}),k}const n=new b;let r;for(const a of this._def.checks)if("min"===a.kind)t.data.length<a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("max"===a.kind)t.data.length>a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("length"===a.kind){const e=t.data.length>a.value,s=t.data.length<a.value;(e||s)&&(r=this._getOrReturnCtx(t,r),e?y(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&y(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if("email"===a.kind)z.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if("emoji"===a.kind)C||(C=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),C.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if("uuid"===a.kind)M.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if("nanoid"===a.kind)R.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if("cuid"===a.kind)E.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if("cuid2"===a.kind)$.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if("ulid"===a.kind)I.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if("url"===a.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),y(r,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())}else if("trim"===a.kind)t.data=t.data.trim();else if("includes"===a.kind)t.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty());else if("toLowerCase"===a.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===a.kind)t.data=t.data.toUpperCase();else if("startsWith"===a.kind)t.data.startsWith(a.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty());else if("endsWith"===a.kind)t.data.endsWith(a.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty());else if("datetime"===a.kind){G(a).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty())}else if("date"===a.kind){H.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty())}else if("time"===a.kind){Y(a).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty())}else"duration"===a.kind?F.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):"ip"===a.kind?X(t.data,a.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):"jwt"===a.kind?Q(t.data,a.alg)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):"cidr"===a.kind?ee(t.data,a.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):"base64"===a.kind?W.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):"base64url"===a.kind?K.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):e.assertNever(a);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,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}te.create=e=>{var t;return new te({checks:[],typeName:We.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var re=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)!==i.number){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:i.number,received:e.parsedType}),k}let n;const r=new b;for(const a of this._def.checks)if("int"===a.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty());else if("min"===a.kind){(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else"multipleOf"===a.kind?0!==ne(t.data,a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_finite,message:a.message}),r.dirty()):e.assertNever(a);return{status:r.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,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:v.toString(a)}]})}_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)}};re.create=e=>new re({checks:[],typeName:We.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)!==i.bigint)return this._getInvalidInput(t);let n;const r=new b;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else"multipleOf"===a.kind?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):e.assertNever(a);return{status:r.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.bigint,received:t.parsedType}),k}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,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:v.toString(a)}]})}_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}};ae.create=e=>{var t;return new ae({checks:[],typeName:We.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var se=class extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.boolean,received:t.parsedType}),k}return w(e.data)}};se.create=e=>new se({typeName:We.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var ie=class t extends N{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return y(e,{code:c.invalid_type,expected:i.date,received:e.parsedType}),k}if(Number.isNaN(t.data.getTime())){return y(this._getOrReturnCtx(t),{code:c.invalid_date}),k}const n=new b;let r;for(const a of this._def.checks)"min"===a.kind?t.data.getTime()<a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):"max"===a.kind?t.data.getTime()>a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):e.assertNever(a);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}};ie.create=e=>new ie({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:We.ZodDate,...P(e)});var oe=class extends N{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.symbol,received:t.parsedType}),k}return w(e.data)}};oe.create=e=>new oe({typeName:We.ZodSymbol,...P(e)});var ce=class extends N{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.undefined,received:t.parsedType}),k}return w(e.data)}};ce.create=e=>new ce({typeName:We.ZodUndefined,...P(e)});var ue=class extends N{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.null,received:t.parsedType}),k}return w(e.data)}};ue.create=e=>new ue({typeName:We.ZodNull,...P(e)});var de=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};de.create=e=>new de({typeName:We.ZodAny,...P(e)});var le=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};le.create=e=>new le({typeName:We.ZodUnknown,...P(e)});var pe=class extends N{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.never,received:t.parsedType}),k}};pe.create=e=>new pe({typeName:We.ZodNever,...P(e)});var me=class extends N{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.void,received:t.parsedType}),k}return w(e.data)}};me.create=e=>new me({typeName:We.ZodVoid,...P(e)});var he=class e extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i.array)return y(t,{code:c.invalid_type,expected:i.array,received:t.parsedType}),k;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(y(t,{code:e?c.too_big:c.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(y(t,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(y(t,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new S(t,e,t.path,n)))).then(e=>b.mergeArray(n,e));const a=[...t.data].map((e,n)=>r.type._parseSync(new S(t,e,t.path,n)));return b.mergeArray(n,a)}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 fe(e){if(e instanceof ge){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=$e.create(fe(r))}return new ge({...e._def,shape:()=>t})}return e instanceof he?new he({...e._def,type:fe(e.element)}):e instanceof $e?$e.create(fe(e.unwrap())):e instanceof Ie?Ie.create(fe(e.unwrap())):e instanceof xe?xe.create(e.items.map(e=>fe(e))):e}he.create=(e,t)=>new he({type:e,minLength:null,maxLength:null,exactLength:null,typeName:We.ZodArray,...P(t)});var ge=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)!==i.object){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.object,received:t.parsedType}),k}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof pe&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||s.push(e);const o=[];for(const e of a){const t=r[e],a=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new S(n,a,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 s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(y(n,{code:c.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new S(n,r,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,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>b.mergeObjectSync(t,e)):b.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 r,a,s,i;const o=null!=(s=null==(a=(r=this._def).errorMap)?void 0:a.call(r,t,n).message)?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!=(i=v.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:We.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const r={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}omit(n){const r={};for(const t of e.objectKeys(this.shape))n[t]||(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}deepPartial(){return fe(this)}partial(n){const r={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?r[t]=e:r[t]=e.optional()}return new t({...this._def,shape:()=>r})}required(n){const r={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])r[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof $e;)e=e._def.innerType;r[t]=e}return new t({...this._def,shape:()=>r})}keyof(){return je(e.objectKeys(this.shape))}};ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:We.ZodObject,...P(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:We.ZodObject,...P(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:We.ZodObject,...P(t)});var ye=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 d(e.ctx.common.issues));return y(t,{code:c.invalid_union,unionErrors:n}),k});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._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&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map(e=>new d(e));return y(t,{code:c.invalid_union,unionErrors:a}),k}}get options(){return this._def.options}};ye.create=(e,t)=>new ye({options:e,typeName:We.ZodUnion,...P(t)});var ve=t=>t instanceof Te?ve(t.schema):t instanceof Ee?ve(t.innerType()):t instanceof Se?[t.value]:t instanceof Pe?t.options:t instanceof Ce?e.objectValues(t.enum):t instanceof Me?ve(t._def.innerType):t instanceof ce?[void 0]:t instanceof ue?[null]:t instanceof $e?[void 0,...ve(t.unwrap())]:t instanceof Ie?[null,...ve(t.unwrap())]:t instanceof ze||t instanceof Ve?ve(t.unwrap()):t instanceof Re?ve(t._def.innerType):[],_e=class e extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return y(t,{code:c.invalid_type,expected:i.object,received:t.parsedType}),k;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=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 r of n){if(a.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);a.set(r,e)}}return new e({typeName:We.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...P(r)})}};function be(t,n){const r=o(t),a=o(n);if(t===n)return{valid:!0,data:t};if(r===i.object&&a===i.object){const r=e.objectKeys(n),a=e.objectKeys(t).filter(e=>-1!==r.indexOf(e)),s={...t,...n};for(const e of a){const r=be(t[e],n[e]);if(!r.valid)return{valid:!1};s[e]=r.data}return{valid:!0,data:s}}if(r===i.array&&a===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let r=0;r<t.length;r++){const a=be(t[r],n[r]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===i.date&&a===i.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var ke=class extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Z(e)||Z(r))return k;const a=be(e.value,r.value);return a.valid?((A(e)||A(r))&&t.dirty(),{status:t.value,value:a.data}):(y(n,{code:c.invalid_intersection_types}),k)};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])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ke.create=(e,t,n)=>new ke({left:e,right:t,typeName:We.ZodIntersection,...P(n)});var xe=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return y(n,{code:c.invalid_type,expected:i.array,received:n.parsedType}),k;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"}),k;!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 r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new S(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>b.mergeArray(t,e)):b.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:We.ZodTuple,rest:null,...P(t)})};var we=class e extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return y(n,{code:c.invalid_type,expected:i.object,received:n.parsedType}),k;const r=[],a=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:a._parse(new S(n,e,n.path,e)),value:s._parse(new S(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?b.mergeObjectAsync(t,r):b.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return new e(n instanceof N?{keyType:t,valueType:n,typeName:We.ZodRecord,...P(r)}:{keyType:te.create(),valueType:t,typeName:We.ZodRecord,...P(n)})}},Ze=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return y(n,{code:c.invalid_type,expected:i.map,received:n.parsedType}),k;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new S(n,e,n.path,[s,"key"])),value:a._parse(new S(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 r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return k;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return k;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}};Ze.create=(e,t,n)=>new Ze({valueType:t,keyType:e,typeName:We.ZodMap,...P(n)});var Ae=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return y(n,{code:c.invalid_type,expected:i.set,received:n.parsedType}),k;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(y(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(y(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return k;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map((e,t)=>a._parse(new S(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>s(e)):s(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)}};Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:We.ZodSet,...P(t)});var Oe=class e extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return y(t,{code:c.invalid_type,expected:i.function,received:t.parsedType}),k;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,h(),l].filter(e=>!!e),issueData:{code:c.invalid_arguments,argumentsError:n}})}function r(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,h(),l].filter(e=>!!e),issueData:{code:c.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ne){const e=this;return w(async function(...t){const i=new d([]),o=await e._def.args.parseAsync(t,a).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,a).catch(e=>{throw i.addIssue(r(c,e)),i})})}{const e=this;return w(function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new d([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,a);if(!c.success)throw new d([r(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:xe.create(t).rest(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,r){return new e({args:t||xe.create([]).rest(le.create()),returns:n||le.create(),typeName:We.ZodFunction,...P(r)})}},Te=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})}};Te.create=(e,t)=>new Te({getter:e,typeName:We.ZodLazy,...P(t)});var Se=class extends N{_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}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};function je(e,t){return new Pe({values:e,typeName:We.ZodEnum,...P(t)})}Se.create=(e,t)=>new Se({value:e,typeName:We.ZodLiteral,...P(t)});var Pe=class t extends N{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),r=this._def.values;return y(n,{expected:e.joinValues(r),received:n.parsedType,code:c.invalid_type}),k}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}),k}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})}};Pe.create=je;var Ce=class extends N{_parse(t){const n=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==i.string&&r.parsedType!==i.number){const t=e.objectValues(n);return y(r,{expected:e.joinValues(t),received:r.parsedType,code:c.invalid_type}),k}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return y(r,{received:r.data,code:c.invalid_enum_value,options:t}),k}return w(t.data)}get enum(){return this._def.values}};Ce.create=(e,t)=>new Ce({values:e,typeName:We.ZodNativeEnum,...P(t)});var Ne=class extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return y(t,{code:c.invalid_type,expected:i.promise,received:t.parsedType}),k;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return w(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ne.create=(e,t)=>new Ne({type:e,typeName:We.ZodPromise,...P(t)});var Ee=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===We.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,s={addIssue:e=>{y(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){const e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===n.value)return k;const t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===n.value?x(t.value):t});{if("aborted"===n.value)return k;const t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===n.value?x(t.value):t}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,s);if(r.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===r.common.async){const t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===t.status?k:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>"aborted"===t.status?k:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!O(e))return k;const t=a.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:r.data,path:r.path,parent:r}).then(e=>O(e)?Promise.resolve(a.transform(e.value,s)).then(e=>({status:n.value,value:e})):k)}e.assertNever(a)}};Ee.create=(e,t,n)=>new Ee({schema:e,typeName:We.ZodEffects,effect:t,...P(n)}),Ee.createWithPreprocess=(e,t,n)=>new Ee({schema:t,effect:{type:"preprocess",transform:e},typeName:We.ZodEffects,...P(n)});var $e=class extends N{_parse(e){return this._getType(e)===i.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:We.ZodOptional,...P(t)});var Ie=class extends N{_parse(e){return this._getType(e)===i.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:We.ZodNullable,...P(t)});var Me=class extends N{_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}};Me.create=(e,t)=>new Me({innerType:e,typeName:We.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:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return T(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:We.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...P(t)});var Le=class extends N{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.nan,received:t.parsedType}),k}return{status:"valid",value:e.data}}};Le.create=e=>new Le({typeName:We.ZodNaN,...P(e)});var Fe=Symbol("zod_brand"),ze=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}},De=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?k:"dirty"===e.status?(t.dirty(),x(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?k:"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:We.ZodPipeline})}},Ve=class extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(O(e)&&(e.value=Object.freeze(e.value)),e);return T(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 Be(e,t={},n){return e?de.create().superRefine((r,a)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ue(t,r),o=null==(i=null!=(s=e.fatal)?s:n)||i;a.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ue(t,r),o=null==(i=null!=(s=e.fatal)?s:n)||i;a.addIssue({code:"custom",...e,fatal:o})}}):de.create()}Ve.create=(e,t)=>new Ve({innerType:e,typeName:We.ZodReadonly,...P(t)});var We,Ke,qe={object:ge.lazycreate};(Ke=We||(We={})).ZodString="ZodString",Ke.ZodNumber="ZodNumber",Ke.ZodNaN="ZodNaN",Ke.ZodBigInt="ZodBigInt",Ke.ZodBoolean="ZodBoolean",Ke.ZodDate="ZodDate",Ke.ZodSymbol="ZodSymbol",Ke.ZodUndefined="ZodUndefined",Ke.ZodNull="ZodNull",Ke.ZodAny="ZodAny",Ke.ZodUnknown="ZodUnknown",Ke.ZodNever="ZodNever",Ke.ZodVoid="ZodVoid",Ke.ZodArray="ZodArray",Ke.ZodObject="ZodObject",Ke.ZodUnion="ZodUnion",Ke.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ke.ZodIntersection="ZodIntersection",Ke.ZodTuple="ZodTuple",Ke.ZodRecord="ZodRecord",Ke.ZodMap="ZodMap",Ke.ZodSet="ZodSet",Ke.ZodFunction="ZodFunction",Ke.ZodLazy="ZodLazy",Ke.ZodLiteral="ZodLiteral",Ke.ZodEnum="ZodEnum",Ke.ZodEffects="ZodEffects",Ke.ZodNativeEnum="ZodNativeEnum",Ke.ZodOptional="ZodOptional",Ke.ZodNullable="ZodNullable",Ke.ZodDefault="ZodDefault",Ke.ZodCatch="ZodCatch",Ke.ZodPromise="ZodPromise",Ke.ZodBranded="ZodBranded",Ke.ZodPipeline="ZodPipeline",Ke.ZodReadonly="ZodReadonly";var He=(e,t={message:`Input not instance of ${e.name}`})=>Be(t=>t instanceof e,t),Je=te.create,Ye=re.create,Ge=Le.create,Xe=ae.create,Qe=se.create,et=ie.create,tt=oe.create,nt=ce.create,rt=ue.create,at=de.create,st=le.create,it=pe.create,ot=me.create,ct=he.create,ut=ge.create,dt=ge.strictCreate,lt=ye.create,pt=_e.create,mt=ke.create,ht=xe.create,ft=we.create,gt=Ze.create,yt=Ae.create,vt=Oe.create,_t=Te.create,bt=Se.create,kt=Pe.create,xt=Ce.create,wt=Ne.create,Zt=Ee.create,At=$e.create,Ot=Ie.create,Tt=Ee.createWithPreprocess,St=De.create,jt=()=>Je().optional(),Pt=()=>Ye().optional(),Ct=()=>Qe().optional(),Nt={string:e=>te.create({...e,coerce:!0}),number:e=>re.create({...e,coerce:!0}),boolean:e=>se.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>ie.create({...e,coerce:!0})},Et=k,$t=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"},Mt=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 Rt(e,t,n,r){(null==r?void 0:r.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Lt(e,t,n,r,a){e[t]=n,Rt(e,t,r,a)}var Ft=(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?Ft(t,e.currentPath):t.join("/")}}function Dt(e,t){return fn(e.type._def,t)}function Vt(e,t,n){const r=null!=n?n:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>Vt(e,t,n))};switch(r){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 r of e.checks)switch(r.kind){case"min":Lt(n,"minimum",r.value,r.message,t);break;case"max":Lt(n,"maximum",r.value,r.message,t)}return n};var Bt=void 0,Wt=/^[cC][^\s-]{8,}$/,Kt=/^[0-9a-z]+$/,qt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ht=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Jt=()=>(void 0===Bt&&(Bt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bt),Yt=/^(?:(?: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])$/,Xt=/^([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 r of e.checks)switch(r.kind){case"min":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Lt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":sn(n,"email",r.message,t);break;case"format:idn-email":sn(n,"idn-email",r.message,t);break;case"pattern:zod":on(n,Ht,r.message,t)}break;case"url":sn(n,"uri",r.message,t);break;case"uuid":sn(n,"uuid",r.message,t);break;case"regex":on(n,r.regex,r.message,t);break;case"cuid":on(n,Wt,r.message,t);break;case"cuid2":on(n,Kt,r.message,t);break;case"startsWith":on(n,RegExp(`^${rn(r.value,t)}`),r.message,t);break;case"endsWith":on(n,RegExp(`${rn(r.value,t)}$`),r.message,t);break;case"datetime":sn(n,"date-time",r.message,t);break;case"date":sn(n,"date",r.message,t);break;case"time":sn(n,"time",r.message,t);break;case"duration":sn(n,"duration",r.message,t);break;case"length":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),Lt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":on(n,RegExp(rn(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&sn(n,"ipv4",r.message,t),"v4"!==r.version&&sn(n,"ipv6",r.message,t);break;case"base64url":on(n,Qt,r.message,t);break;case"jwt":on(n,tn,r.message,t);break;case"cidr":"v6"!==r.version&&on(n,Yt,r.message,t),"v4"!==r.version&&on(n,Gt,r.message,t);break;case"emoji":on(n,Jt(),r.message,t);break;case"ulid":on(n,qt,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":sn(n,"binary",r.message,t);break;case"contentEncoding:base64":Lt(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":on(n,Xt,r.message,t)}break;case"nanoid":on(n,en,r.message,t)}return n}function rn(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 sn(e,t,n,r){var a;e.format||(null==(a=e.anyOf)?void 0:a.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.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&&r.errorMessages&&{errorMessage:{format:n}}})):Lt(e,"format",t,n,r)}function on(e,t,n,r){var a;e.pattern||(null==(a=e.allOf)?void 0:a.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.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,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Lt(e,"pattern",cn(t,r),n,r)}function cn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),a=e.flags.includes("m"),s=e.flags.includes("s"),i=r?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(r)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(a){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 un(e,t){var n,r,a,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)===We.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>{var a;return{...n,[r]:null!=(a=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?a:zt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(r=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(a=e.keyType)?void 0:a._def.typeName)===We.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...r}=nn(e.keyType._def,t);return{...u,propertyNames:r}}if((null==(i=e.keyType)?void 0:i._def.typeName)===We.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===We.ZodBranded&&e.keyType._def.type._def.typeName===We.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...r}=Dt(e.keyType._def,t);return{...u,propertyNames:r}}return u}var dn={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)=>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 pn(e,t){const n="openAi"===t.target,r={type:"object",properties:{}},a=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=mn(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&&(r.properties[e]=c,o||a.push(e))}a.length&&(r.required=a);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&&(r.additionalProperties=i),r}function mn(e){try{return e.isOptional()}catch(e){return!0}}var hn=(e,t,n)=>{switch(t){case We.ZodString:return nn(e,n);case We.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",Rt(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Lt(n,"minimum",r.value,r.message,t):Lt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Lt(n,"maximum",r.value,r.message,t):Lt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",r.value,r.message,t));break;case"multipleOf":Lt(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case We.ZodObject:return pn(e,n);case We.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Lt(n,"minimum",r.value,r.message,t):Lt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Lt(n,"maximum",r.value,r.message,t):Lt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",r.value,r.message,t));break;case"multipleOf":Lt(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case We.ZodBoolean:return{type:"boolean"};case We.ZodDate:return Vt(e,n);case We.ZodUndefined:return function(e){return{not:zt(e)}}(n);case We.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case We.ZodArray:return function(e,t){var n,r,a;const s={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(a=null==(r=e.type)?void 0:r._def)?void 0:a.typeName)!==We.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 We.ZodUnion:case We.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 dn&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=dn[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 We.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 r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const a=[];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,...r}=e;t=r}else r=void 0;a.push(t)}else a.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),a.length?{allOf:a,...r}:void 0}(e,n);case We.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 We.ZodRecord:return un(e,n);case We.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 We.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case We.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case We.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:dn[e.innerType._def.typeName],nullable:!0}:{type:[dn[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 We.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 r=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:zt(t)},r]}:zt(t)})(e,n);case We.ZodMap:return function(e,t){return"record"===t.mapStrategy?un(e,t):{type:"array",maxItems:125,items:{type:"array",items:[fn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||zt(t),fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||zt(t)],minItems:2,maxItems:2}}}(e,n);case We.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 We.ZodLazy:return()=>e.getter()._def;case We.ZodPromise:return function(e,t){return fn(e.type._def,t)}(e,n);case We.ZodNaN:case We.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:zt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case We.ZodEffects:return function(e,t){return"input"===t.effectStrategy?fn(e.schema._def,t):zt(t)}(e,n);case We.ZodAny:return zt(n);case We.ZodUnknown:return function(e){return zt(e)}(n);case We.ZodDefault:return function(e,t){return{...fn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case We.ZodBranded:return Dt(e,n);case We.ZodReadonly:case We.ZodCatch:return((e,t)=>fn(e.innerType._def,t))(e,n);case We.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 We.ZodFunction:case We.ZodVoid:case We.ZodSymbol:default:return}};function fn(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,a,n);if(s!==$t)return s}if(a&&!n){const e=gn(a,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=hn(e,e.typeName,t),o="function"==typeof i?fn(i(),t):i;if(o&&yn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var gn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ft(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 r=Mt(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var a;return{...e,[t]:null!=(a=fn(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?a:zt(r)}},{}):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?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?n:zt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const c=void 0===s?a?{...i,[r.definitionPath]:a}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return"jsonSchema7"===r.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},_n=s.record(s.string(),s.boolean()).describe("Consent requirement mapping"),bn=s.lazy(()=>s.union([s.string(),s.number(),s.boolean(),Zn,s.array(bn)])),kn=s.tuple([bn,bn]).describe("Loop: [source, transform] tuple for array transformations"),xn=s.array(bn).describe("Set: Array of values"),wn=s.record(s.string(),bn).describe("Map: Object mapping keys to values"),Zn=s.object({key:s.string().optional().describe('Property path (e.g., "data.id")'),value:s.union([s.string(),s.number(),s.boolean()]).optional().describe("Static primitive value"),fn:s.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:s.string().optional().describe("Condition function string"),validate:s.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,On=xn,Tn=wn,Sn=(vn(Zn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),vn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),vn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),vn(Tn,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function jn(e,t={},n={}){n={...Sn,...n};const r=Object.entries(t).reduce((t,[r,a])=>{const s=e[r];return n.merge&&Array.isArray(s)&&Array.isArray(a)?t[r]=a.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||r in e)&&(t[r]=a),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function Pn(e){return Array.isArray(e)}function Cn(e){return void 0!==e}function Nn(e){return e===document||e instanceof Element}function En(e){return"object"==typeof e&&null!==e&&!Pn(e)&&"[object Object]"===Object.prototype.toString.call(e)}function $n(e){return"string"==typeof e}function In(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Mn(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Rn(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}import{Const as Ln}from"@walkeros/collector";import{elb as Fn,getAttribute as zn}from"@walkeros/web-core";import{Const as Dn}from"@walkeros/collector";import{getAttribute as Vn}from"@walkeros/web-core";function Un(e,t,n=!0){return e+(t=null!=t?(n?"-":"")+t:"")}function Bn(e,t,n,r=!0){return tr(Vn(t,Un(e,n,r))||"").reduce((e,n)=>{let[r,a]=nr(n);if(!r)return e;if(a||(r.endsWith(":")&&(r=r.slice(0,-1)),a=""),a.startsWith("#")){a=a.slice(1);try{let e=t[a];e||"selected"!==a||(e=t.options[t.selectedIndex].text),a=String(e)}catch(e){a=""}}return r.endsWith("[]")?(r=r.slice(0,-2),Pn(e[r])||(e[r]=[]),e[r].push(In(a))):e[r]=In(a),e},{})}function Wn(e,t=Dn.Commands.Prefix){var n;const r=e||document.body;if(!r)return[];let a=[];const s=Dn.Commands.Action,i=`[${Un(t,s,!1)}]`,o=e=>{Object.keys(Bn(t,e,s,!1)).forEach(n=>{a=a.concat(Kn(e,n,t))})};return r!==document&&(null==(n=r.matches)?void 0:n.call(r,i))&&o(r),er(r,i,o),a}function Kn(e,t,n=Dn.Commands.Prefix){const r=[],{actions:a,nearestOnly:s}=function(e,t,n){let r=t;for(;r;){const t=Vn(r,Un(e,Dn.Commands.Actions,!1));if(t){const e=Jn(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const a=Vn(r,Un(e,Dn.Commands.Action,!1));if(a){const e=Jn(a);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}r=Xn(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t);return a.length?(a.forEach(a=>{const i=tr(a.actionParams||"",",").reduce((e,t)=>(e[Rn(t)]=!0,e),{}),o=Yn(n,e,i,s);if(!o.length){const t="page",r=`[${Un(n,t)}]`,[a,s]=Qn(e,r,n,t);o.push({entity:t,data:a,nested:[],context:s})}o.forEach(e=>{r.push({entity:e.entity,action:a.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r}function qn(e=Dn.Commands.Prefix,t=document){const n=Un(e,Dn.Commands.Globals,!1);let r={};return er(t,`[${n}]`,t=>{r=jn(r,Bn(e,t,Dn.Commands.Globals,!1))}),r}function Hn(e,t){const n=window.location,r="page",a=t===document?document.body:t,[s,i]=Qn(a,`[${Un(e,r)}]`,e,r);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 Jn(e){const t={};return tr(e).forEach(e=>{const[n,r]=nr(e),[a,s]=rr(n);if(!a)return;let[i,o]=rr(r||"");i=i||a,t[a]||(t[a]=[]),t[a].push({trigger:a,triggerParams:s,action:i,actionParams:o})}),t}function Yn(e,t,n,r=!1){const a=[];let s=t;for(n=0!==Object.keys(n||{}).length?n:void 0;s;){const i=Gn(e,s,t,n);if(i&&(a.push(i),r))break;s=Xn(e,s)}return a}function Gn(e,t,n,r){const a=Vn(t,Un(e));if(!a||r&&!r[a])return null;const s=[t],i=`[${Un(e,a)}],[${Un(e,"")}]`,o=Un(e,Dn.Commands.Link,!1);let c={};const u=[],[d,l]=Qn(n||t,i,e,a);er(t,`[${o}]`,t=>{const[n,r]=nr(Vn(t,o));"parent"===r&&er(document.body,`[${o}="${n}:child"]`,t=>{s.push(t);const n=Gn(e,t);n&&u.push(n)})});const p=[];s.forEach(e=>{e.matches(i)&&p.push(e),er(e,i,e=>p.push(e))});let m={};return p.forEach(t=>{m=jn(m,Bn(e,t,"")),c=jn(c,Bn(e,t,a))}),c=jn(jn(m,c),d),s.forEach(t=>{er(t,`[${Un(e)}]`,t=>{const n=Gn(e,t);n&&u.push(n)})}),{entity:a,data:c,context:l,nested:u}}function Xn(e,t){const n=Un(e,Dn.Commands.Link,!1);if(t.matches(`[${n}]`)){const[e,r]=nr(Vn(t,n));if("child"===r)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function Qn(e,t,n,r){let a={};const s={};let i=e;const o=`[${Un(n,Dn.Commands.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(a=jn(Bn(n,i,""),a),a=jn(Bn(n,i,r),a)),i.matches(o)&&(Object.entries(Bn(n,i,Dn.Commands.Context,!1)).forEach(([e,t])=>{t&&!s[e]&&(s[e]=[t,c])}),++c),i=Xn(n,i);return[a,s]}function er(e,t,n){e.querySelectorAll(t).forEach(n)}function tr(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function nr(e){const[t,n]=e.split(/:(.+)/,2);return[Rn(t),Rn(n)]}function rr(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}import{isVisible as ar}from"@walkeros/web-core";var sr=new WeakMap,ir=new WeakMap,or=new WeakMap;function cr(e){const t=Date.now();let n=ir.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:ar(e),lastChecked:t},ir.set(e,n)),n.isVisible}function ur(e){if(window.IntersectionObserver)return Mn(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,r;const a=t.target,s=or.get(e);if(!s)return;const i=s.timers.get(a);if(t.intersectionRatio>0){const r=Date.now();let o=sr.get(a);(!o||r-o.lastChecked>1e3)&&(o={isLarge:a.offsetHeight>window.innerHeight,lastChecked:r},sr.set(a,o));if(t.intersectionRatio>=.5||o.isLarge&&cr(a)){const t=null==(n=s.elementConfigs)?void 0:n.get(a);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!i){const t=window.setTimeout(async()=>{var t,n;if(cr(a)){const r=null==(t=s.elementConfigs)?void 0:t.get(a);(null==r?void 0:r.context)&&await Tr(r.context,a,r.trigger);const i=null==(n=s.elementConfigs)?void 0:n.get(a);(null==i?void 0:i.multiple)?i.blocked=!0:function(e,t){const n=or.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),sr.delete(t),ir.delete(t)}(e,a)}},s.duration);s.timers.set(a,t)}return}}i&&(clearTimeout(i),s.timers.delete(a));const o=null==(r=s.elementConfigs)?void 0:r.get(a);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function dr(e,t,n={multiple:!1}){var r;const a=e.settings.scope||document,s=or.get(a);(null==s?void 0:s.observer)&&t&&(s.elementConfigs||(s.elementConfigs=new WeakMap),s.elementConfigs.set(t,{multiple:null!=(r=n.multiple)&&r,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),s.observer.observe(t))}function lr(e){if(!e)return;const t=or.get(e);t&&(t.observer&&t.observer.disconnect(),or.delete(e))}function pr(e,t,n,r,a,s,i){const{elb:o,settings:c}=e;if($n(t)&&t.startsWith("walker "))return o(t,n);if(En(t)){const e=t;return e.source||(e.source=mr()),e.globals||(e.globals=qn(c.prefix,c.scope||document)),o(e)}const[u]=String(En(t)?t.name:t).split(" ");let d,l=En(n)?n:{},p={},m=!1;if(Nn(n)&&(d=n,m=!0),Nn(a)?d=a:En(a)&&Object.keys(a).length&&(p=a),d){const e=Yn(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 h=qn(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:h,nested:s,custom:i,trigger:$n(r)?r:"",source:mr()})}function mr(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var hr,fr=[],gr="click",yr="hover",vr="load",_r="pulse",br="scroll",kr="submit",xr="impression",wr="visible",Zr="wait";function Ar(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;if(!n)return;n.addEventListener("click",Mn(function(t){jr.call(this,e,t)})),n.addEventListener("submit",Mn(function(t){Pr.call(this,e,t)}))}(e,t)}function Or(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;fr=[];const r=n||document;lr(r),function(e,t=1e3){or.has(e)||or.set(e,{observer:ur(e),timers:new WeakMap,duration:t})}(r,1e3);const a=Un(t.prefix,Ln.Commands.Action,!1);r!==document&&Sr(e,r,a,t);r.querySelectorAll(`[${a}]`).forEach(n=>{Sr(e,n,a,t)}),fr.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const r=window.scrollY+window.innerHeight,a=e.offsetTop;if(r<a)return!0;const s=e.clientHeight;return!(100*(1-(a+s-r)/(s||1))>=n)||(Tr(t,e,br),!1)});hr||(hr=function(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}(function(){fr=n.call(t,fr,e)}),t.addEventListener("scroll",hr))}(e,r)}(e,t)}async function Tr(e,t,n){const r=Kn(t,n,e.settings.prefix);return Promise.all(r.map(t=>pr(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Sr(e,t,n,r){const a=zn(t,n);a&&Object.values(Jn(a)).forEach(n=>n.forEach(n=>{switch(n.trigger){case yr:!function(e,t){t.addEventListener("mouseenter",Mn(function(t){t.target instanceof Element&&Tr(e,t.target,yr)}))}(e,t);break;case vr:!function(e,t){Tr(e,t,vr)}(e,t);break;case _r:!function(e,t,n=""){setInterval(()=>{document.hidden||Tr(e,t,_r)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case br:!function(e,t=""){const n=parseInt(t||"")||50;if(n<0||n>100)return;fr.push([e,n])}(t,n.triggerParams);break;case xr:dr(e,t);break;case wr:dr(e,t,{multiple:!0});break;case Zr:!function(e,t,n=""){setTimeout(()=>Tr(e,t,Zr),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}}))}function jr(e,t){Tr(e,t.target,gr)}function Pr(e,t){t.target&&Tr(e,t.target,kr)}function Cr(e,t={}){const n=t.name||"elbLayer",r=t.window||window;if(!r)return;const a=r;a[n]||(a[n]=[]);const s=a[n];s.push=function(...n){if($r(n[0])){const r=[...Array.from(n[0])],a=Array.prototype.push.apply(this,[r]);return Er(e,t.prefix,r),a}const r=Array.prototype.push.apply(this,n);return n.forEach(n=>{Er(e,t.prefix,n)}),r},Array.isArray(s)&&s.length>0&&function(e,t="data-elb",n){Nr(e,t,n,!0),Nr(e,t,n,!1),n.length=0}(e,t.prefix,s)}function Nr(e,t,n,r){const a=[];let s=!0;n.forEach(e=>{const t=$r(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=!En(i)&&$n(i)&&i.startsWith("walker ");if(En(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!$n(e[0])||""===e[0].trim())return;const n="walker run";s&&e[0]===n&&(s=!1)}(r&&o||!r&&!o)&&a.push(t)}),a.forEach(n=>{Er(e,t,n)})}function Er(e,t="data-elb",n){Mn(()=>{if(Array.isArray(n)){const[r,...a]=n;if(!r||$n(r)&&""===r.trim())return;if($n(r)&&r.startsWith("walker "))return void e(r,a[0]);pr({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},r,...a)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function $r(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}import{sessionStart as Ir}from"@walkeros/web-core";function Mr(e,t={}){return Ir({...t,collector:{push:e,group:void 0}})}var Rr={},Lr={};a(Lr,{env:()=>Fr});var Fr={};a(Fr,{push:()=>Vr});var zr=()=>{},Dr=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Vr={get push(){return Dr()},get command(){return Dr()},get elb(){return Dr()},get window(){return{addEventListener:zr,removeEventListener:zr,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:zr,removeEventListener:zr,querySelector:zr,querySelectorAll:()=>[],getElementById:zr,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:zr,getAttribute:zr,addEventListener:zr,removeEventListener:zr}),body:{appendChild:zr,removeChild:zr},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}};function Ur(e={}){const t=e.prefix||"data-elb";return function(e){let n,r=e;const a={},s={},i={},o={},c={},u={};function d(e){return Object.entries(e).map(([e,t])=>`${e}:${function(e){if(!Cn(e)||null===e)return"undefined";let t=String(e);return t=t.replace(/\\/g,"\\\\"),t=t.replace(/;/g,"\\;"),t=t.replace(/:/g,"\\:"),t=t.replace(/'/g,"\\'"),t}(t)}`).join(";")}const l={entity:e=>(n=e,r=e,l),data(e,t){const n=null!=r?r:"";return a[n]||(a[n]={}),$n(e)?a[n][e]=t:Object.assign(a[n],e),l},action(e,t){if($n(e))if(Cn(t))s[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);s[t]=n}else s[e]=e;else Object.assign(s,e);return l},actions(e,t){if($n(e))if(Cn(t))i[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);i[t]=n}else i[e]=e;else Object.assign(i,e);return l},context:(e,t)=>($n(e)?o[e]=t:Object.assign(o,e),l),globals:(e,t)=>($n(e)?c[e]=t:Object.assign(c,e),l),link:(e,t)=>($n(e)?u[e]=t:Object.assign(u,e),l),get(){const e={};return n&&(e[t]=n),Object.entries(a).forEach(([n,r])=>{if(Object.keys(r).length>0){e[n?`${t}-${n}`:`${t}-`]=d(r)}}),Object.keys(s).length>0&&(e[`${t}action`]=d(s)),Object.keys(i).length>0&&(e[`${t}actions`]=d(i)),Object.keys(o).length>0&&(e[`${t}context`]=d(o)),Object.keys(c).length>0&&(e[`${t}globals`]=d(c)),Object.keys(u).length>0&&(e[`${t}link`]=d(u)),e}};return l}}var Br=async(e,t)=>{const{elb:n,window:r,document:a}=t,s=(null==e?void 0:e.settings)||{},i=r||(void 0!==globalThis.window?globalThis.window:void 0),o=a||(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&&Cr(n,{name:$n(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:i}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;Mr(n,e)}await async function(e,t,n){const r=()=>{e(t,n)};"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}(Ar,d,c);(()=>{if(Or(d,c),c.pageview){const[e,t]=Hn(c.prefix||"data-elb",c.scope);pr(d,"page view",e,"load",t)}})(),$n(c.elb)&&c.elb&&(i[c.elb]=(...e)=>{const[t,n,r,a,s,i]=e;return pr(d,t,n,r,a,s,i)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,r,a,s,i]=e;return pr(d,t,n,r,a,s,i)},destroy:async()=>{o&&lr(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;Mr(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&i&&(Or(d,c),c.pageview)){const[e,t]=Hn(c.prefix||"data-elb",c.scope);pr(d,"page view",e,"load",t)}}}}},Wr=Br;export{Rr as SourceBrowser,Ur as createTagger,Wr as default,Lr as examples,Wn as getAllEvents,Un as getElbAttributeName,Bn as getElbValues,Kn as getEvents,qn as getGlobals,Br as sourceBrowser};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var e,t,n,r=Object.defineProperty,a=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},i={};a(i,{BRAND:()=>De,DIRTY:()=>S,EMPTY_PATH:()=>g,INVALID:()=>k,NEVER:()=>$t,OK:()=>x,ParseStatus:()=>_,Schema:()=>E,ZodAny:()=>ue,ZodArray:()=>fe,ZodBigInt:()=>ae,ZodBoolean:()=>ie,ZodBranded:()=>ze,ZodCatch:()=>Le,ZodDate:()=>se,ZodDefault:()=>Me,ZodDiscriminatedUnion:()=>be,ZodEffects:()=>$e,ZodEnum:()=>Oe,ZodError:()=>u,ZodFirstPartyTypeKind:()=>Je,ZodFunction:()=>Ze,ZodIntersection:()=>ke,ZodIssueCode:()=>c,ZodLazy:()=>Ae,ZodLiteral:()=>Pe,ZodMap:()=>we,ZodNaN:()=>Re,ZodNativeEnum:()=>Te,ZodNever:()=>pe,ZodNull:()=>de,ZodNullable:()=>Ie,ZodNumber:()=>re,ZodObject:()=>ge,ZodOptional:()=>Ne,ZodParsedType:()=>s,ZodPipeline:()=>Fe,ZodPromise:()=>Ee,ZodReadonly:()=>Ue,ZodRecord:()=>xe,ZodSchema:()=>E,ZodSet:()=>je,ZodString:()=>te,ZodSymbol:()=>oe,ZodTransformer:()=>$e,ZodTuple:()=>Se,ZodType:()=>E,ZodUndefined:()=>ce,ZodUnion:()=>ye,ZodUnknown:()=>le,ZodVoid:()=>me,addIssueToContext:()=>y,any:()=>at,array:()=>ct,bigint:()=>Qe,boolean:()=>Xe,coerce:()=>Et,custom:()=>Be,date:()=>et,datetimeRegex:()=>G,defaultErrorMap:()=>l,discriminatedUnion:()=>pt,effect:()=>wt,enum:()=>kt,function:()=>vt,getErrorMap:()=>f,getParsedType:()=>o,instanceof:()=>Ke,intersection:()=>mt,isAborted:()=>w,isAsync:()=>A,isDirty:()=>j,isValid:()=>Z,late:()=>qe,lazy:()=>bt,literal:()=>_t,makeIssue:()=>h,map:()=>gt,nan:()=>Ge,nativeEnum:()=>St,never:()=>st,null:()=>rt,nullable:()=>Zt,number:()=>Ye,object:()=>dt,objectUtil:()=>n,oboolean:()=>Tt,onumber:()=>Ot,optional:()=>jt,ostring:()=>Ct,pipeline:()=>Pt,preprocess:()=>At,promise:()=>xt,quotelessJson:()=>d,record:()=>ht,set:()=>yt,setErrorMap:()=>m,strictObject:()=>ut,string:()=>He,symbol:()=>tt,transformer:()=>wt,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]]),r={};for(const t of n)r[t]=e[t];return t.objectValues(r)},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:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(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 r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};u.create=e=>new u(e);var l=(t,n)=>{let r;switch(t.code){case c.invalid_type:r=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case c.too_small:r="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:r="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:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=n.defaultError,e.assertNever(t)}return{message:r}},p=l;function m(e){p=e}function f(){return p}var h=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let o="";const c=r.filter(e=>!!e).slice().reverse();for(const e of c)o=e(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}},g=[];function y(e,t){const n=f(),r=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(r)}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 r of t){if("aborted"===r.status)return k;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const r=[];for(const e of n){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return k;if("aborted"===a.status)return k;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}},k=Object.freeze({status:"aborted"}),S=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,j=e=>"dirty"===e.status,Z=e=>"valid"===e.status,A=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 P=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},C=(e,t)=>{if(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 O(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var i,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!=(i=null!=o?o:r)?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!=(s=null!=o?o:n)?s:a.defaultError}},description:a}}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(A(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={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)},a=this._parseSync({data:e,path:r.path,parent:r});return C(r,a)}"~validate"(e){var t,n;const r={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:r});return Z(t)?{value:t.value}:{issues:r.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),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>Z(e)?{value:e.value}:{issues:r.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)},r=this._parse({data:e,path:n.path,parent:n}),a=await(A(r)?r:Promise.resolve(r));return C(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const a=e(t),i=()=>r.addIssue({code:c.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(i(),!1)):!!a||(i(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new $e({schema:this,typeName:Je.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return 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 ke.create(this,e,this._def)}transform(e){return new $e({...O(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Me({...O(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new ze({typeName:Je.ZodBranded,type:this,...O(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Le({...O(this._def),innerType:this,catchValue:t,typeName:Je.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,M=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,L=/^[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])$/,V=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,B=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,q="((\\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(`^${q}$`);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 Y(e){return new RegExp(`^${H(e)}$`)}function G(e){let t=`${q}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 Q(e,t){return!("v4"!==t&&t||!F.test(e))||!("v6"!==t&&t||!V.test(e))}function X(e,t){if(!R.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return"object"==typeof a&&null!==a&&((!("typ"in a)||"JWT"===(null==a?void 0:a.typ))&&(!!a.alg&&(!t||a.alg===t)))}catch(e){return!1}}function ee(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!B.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}),k}const n=new _;let r;for(const a of this._def.checks)if("min"===a.kind)t.data.length<a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("max"===a.kind)t.data.length>a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("length"===a.kind){const e=t.data.length>a.value,i=t.data.length<a.value;(e||i)&&(r=this._getOrReturnCtx(t,r),e?y(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&y(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if("email"===a.kind)z.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if("emoji"===a.kind)T||(T=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),T.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if("uuid"===a.kind)M.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if("nanoid"===a.kind)L.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if("cuid"===a.kind)$.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if("cuid2"===a.kind)N.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if("ulid"===a.kind)I.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if("url"===a.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),y(r,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())}else if("trim"===a.kind)t.data=t.data.trim();else if("includes"===a.kind)t.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty());else if("toLowerCase"===a.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===a.kind)t.data=t.data.toUpperCase();else if("startsWith"===a.kind)t.data.startsWith(a.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty());else if("endsWith"===a.kind)t.data.endsWith(a.value)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty());else if("datetime"===a.kind){G(a).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty())}else if("date"===a.kind){K.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty())}else if("time"===a.kind){Y(a).test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty())}else"duration"===a.kind?D.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):"ip"===a.kind?Q(t.data,a.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):"jwt"===a.kind?X(t.data,a.alg)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):"cidr"===a.kind?ee(t.data,a.version)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):"base64"===a.kind?J.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):"base64url"===a.kind?W.test(t.data)||(r=this._getOrReturnCtx(t,r),y(r,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):e.assertNever(a);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,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}te.create=e=>{var t;return new te({checks:[],typeName:Je.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...O(e)})};var re=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}),k}let n;const r=new _;for(const a of this._def.checks)if("int"===a.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty());else if("min"===a.kind){(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else"multipleOf"===a.kind?0!==ne(t.data,a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_finite,message:a.message}),r.dirty()):e.assertNever(a);return{status:r.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,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:v.toString(a)}]})}_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)}};re.create=e=>new re({checks:[],typeName:Je.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...O(e)});var ae=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 r=new _;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else"multipleOf"===a.kind?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),y(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):e.assertNever(a);return{status:r.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:s.bigint,received:t.parsedType}),k}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,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:v.toString(a)}]})}_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}};ae.create=e=>{var t;return new ae({checks:[],typeName:Je.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...O(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}),k}return x(e.data)}};ie.create=e=>new ie({typeName:Je.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...O(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}),k}if(Number.isNaN(t.data.getTime())){return y(this._getOrReturnCtx(t),{code:c.invalid_date}),k}const n=new _;let r;for(const a of this._def.checks)"min"===a.kind?t.data.getTime()<a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):"max"===a.kind?t.data.getTime()>a.value&&(r=this._getOrReturnCtx(t,r),y(r,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):e.assertNever(a);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:Je.ZodDate,...O(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}),k}return x(e.data)}};oe.create=e=>new oe({typeName:Je.ZodSymbol,...O(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}),k}return x(e.data)}};ce.create=e=>new ce({typeName:Je.ZodUndefined,...O(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}),k}return x(e.data)}};de.create=e=>new de({typeName:Je.ZodNull,...O(e)});var ue=class extends E{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};ue.create=e=>new ue({typeName:Je.ZodAny,...O(e)});var le=class extends E{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}};le.create=e=>new le({typeName:Je.ZodUnknown,...O(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}),k}};pe.create=e=>new pe({typeName:Je.ZodNever,...O(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}),k}return x(e.data)}};me.create=e=>new me({typeName:Je.ZodVoid,...O(e)});var fe=class e extends E{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==s.array)return y(t,{code:c.invalid_type,expected:s.array,received:t.parsedType}),k;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(y(t,{code:e?c.too_big:c.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(y(t,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(y(t,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new P(t,e,t.path,n)))).then(e=>_.mergeArray(n,e));const a=[...t.data].map((e,n)=>r.type._parseSync(new P(t,e,t.path,n)));return _.mergeArray(n,a)}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 r=e.shape[n];t[n]=Ne.create(he(r))}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 Se?Se.create(e.items.map(e=>he(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...O(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}),k}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof pe&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=r[e],a=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new P(n,a,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 r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new P(n,r,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,r=await t.value;e.push({key:n,value:r,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 r,a,i,s;const o=null!=(i=null==(a=(r=this._def).errorMap)?void 0:a.call(r,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:Je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const r={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}omit(n){const r={};for(const t of e.objectKeys(this.shape))n[t]||(r[t]=this.shape[t]);return new t({...this._def,shape:()=>r})}deepPartial(){return he(this)}partial(n){const r={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?r[t]=e:r[t]=e.optional()}return new t({...this._def,shape:()=>r})}required(n){const r={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])r[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ne;)e=e._def.innerType;r[t]=e}return new t({...this._def,shape:()=>r})}keyof(){return Ce(e.objectKeys(this.shape))}};ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:Je.ZodObject,...O(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Je.ZodObject,...O(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Je.ZodObject,...O(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}),k});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=a._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&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map(e=>new u(e));return y(t,{code:c.invalid_union,unionErrors:a}),k}}get options(){return this._def.options}};ye.create=(e,t)=>new ye({options:e,typeName:Je.ZodUnion,...O(t)});var ve=t=>t instanceof Ae?ve(t.schema):t instanceof $e?ve(t.innerType()):t instanceof Pe?[t.value]:t instanceof Oe?t.options:t instanceof Te?e.objectValues(t.enum):t instanceof Me?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 Le?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}),k;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=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 r of n){if(a.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);a.set(r,e)}}return new e({typeName:Je.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...O(r)})}};function _e(t,n){const r=o(t),a=o(n);if(t===n)return{valid:!0,data:t};if(r===s.object&&a===s.object){const r=e.objectKeys(n),a=e.objectKeys(t).filter(e=>-1!==r.indexOf(e)),i={...t,...n};for(const e of a){const r=_e(t[e],n[e]);if(!r.valid)return{valid:!1};i[e]=r.data}return{valid:!0,data:i}}if(r===s.array&&a===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let r=0;r<t.length;r++){const a=_e(t[r],n[r]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===s.date&&a===s.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var ke=class extends E{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(w(e)||w(r))return k;const a=_e(e.value,r.value);return a.valid?((j(e)||j(r))&&t.dirty(),{status:t.value,value:a.data}):(y(n,{code:c.invalid_intersection_types}),k)};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])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ke.create=(e,t,n)=>new ke({left:e,right:t,typeName:Je.ZodIntersection,...O(n)});var Se=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}),k;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"}),k;!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 r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new P(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>_.mergeArray(t,e)):_.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Se.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se({items:e,typeName:Je.ZodTuple,rest:null,...O(t)})};var xe=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}),k;const r=[],a=this._def.keyType,i=this._def.valueType;for(const e in n.data)r.push({key:a._parse(new P(n,e,n.path,e)),value:i._parse(new P(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_.mergeObjectAsync(t,r):_.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return new e(n instanceof E?{keyType:t,valueType:n,typeName:Je.ZodRecord,...O(r)}:{keyType:te.create(),valueType:t,typeName:Je.ZodRecord,...O(n)})}},we=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}),k;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:r._parse(new P(n,e,n.path,[i,"key"])),value:a._parse(new P(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 r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return k;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of i){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return k;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}};we.create=(e,t,n)=>new we({valueType:t,keyType:e,typeName:Je.ZodMap,...O(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}),k;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(y(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(y(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return k;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map((e,t)=>a._parse(new P(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:Je.ZodSet,...O(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}),k;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 r(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 a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ee){const e=this;return x(async function(...t){const s=new u([]),o=await e._def.args.parseAsync(t,a).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,a).catch(e=>{throw s.addIssue(r(c,e)),s})})}{const e=this;return x(function(...t){const s=e._def.args.safeParse(t,a);if(!s.success)throw new u([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,a);if(!c.success)throw new u([r(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Se.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,r){return new e({args:t||Se.create([]).rest(le.create()),returns:n||le.create(),typeName:Je.ZodFunction,...O(r)})}},Ae=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})}};Ae.create=(e,t)=>new Ae({getter:e,typeName:Je.ZodLazy,...O(t)});var Pe=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}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ce(e,t){return new Oe({values:e,typeName:Je.ZodEnum,...O(t)})}Pe.create=(e,t)=>new Pe({value:e,typeName:Je.ZodLiteral,...O(t)});var Oe=class t extends E{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),r=this._def.values;return y(n,{expected:e.joinValues(r),received:n.parsedType,code:c.invalid_type}),k}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}),k}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})}};Oe.create=Ce;var Te=class extends E{_parse(t){const n=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==s.string&&r.parsedType!==s.number){const t=e.objectValues(n);return y(r,{expected:e.joinValues(t),received:r.parsedType,code:c.invalid_type}),k}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return y(r,{received:r.data,code:c.invalid_enum_value,options:t}),k}return x(t.data)}get enum(){return this._def.values}};Te.create=(e,t)=>new Te({values:e,typeName:Je.ZodNativeEnum,...O(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}),k;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})))}};Ee.create=(e,t)=>new Ee({type:e,typeName:Je.ZodPromise,...O(t)});var $e=class extends E{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:e=>{y(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===n.value)return k;const t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===n.value?S(t.value):t});{if("aborted"===n.value)return k;const t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===t.status?k:"dirty"===t.status||"dirty"===n.value?S(t.value):t}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(r.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===r.common.async){const t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===t.status?k:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>"aborted"===t.status?k:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Z(e))return k;const t=a.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:r.data,path:r.path,parent:r}).then(e=>Z(e)?Promise.resolve(a.transform(e.value,i)).then(e=>({status:n.value,value:e})):k)}e.assertNever(a)}};$e.create=(e,t,n)=>new $e({schema:e,typeName:Je.ZodEffects,effect:t,...O(n)}),$e.createWithPreprocess=(e,t,n)=>new $e({schema:t,effect:{type:"preprocess",transform:e},typeName:Je.ZodEffects,...O(n)});var Ne=class extends E{_parse(e){return this._getType(e)===s.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ne.create=(e,t)=>new Ne({innerType:e,typeName:Je.ZodOptional,...O(t)});var Ie=class extends E{_parse(e){return this._getType(e)===s.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:Je.ZodNullable,...O(t)});var Me=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}};Me.create=(e,t)=>new Me({innerType:e,typeName:Je.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...O(t)});var Le=class extends E{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return A(r)?r.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"===r.status?r.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Le.create=(e,t)=>new Le({innerType:e,typeName:Je.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...O(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}),k}return{status:"valid",value:e.data}}};Re.create=e=>new Re({typeName:Je.ZodNaN,...O(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?k:"dirty"===e.status?(t.dirty(),S(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?k:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Je.ZodPipeline})}},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 A(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ve(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Be(e,t={},n){return e?ue.create().superRefine((r,a)=>{var i,s;const o=e(r);if(o instanceof Promise)return o.then(e=>{var i,s;if(!e){const e=Ve(t,r),o=null==(s=null!=(i=e.fatal)?i:n)||s;a.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ve(t,r),o=null==(s=null!=(i=e.fatal)?i:n)||s;a.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}Ue.create=(e,t)=>new Ue({innerType:e,typeName:Je.ZodReadonly,...O(t)});var Je,We,qe={object:ge.lazycreate};(We=Je||(Je={})).ZodString="ZodString",We.ZodNumber="ZodNumber",We.ZodNaN="ZodNaN",We.ZodBigInt="ZodBigInt",We.ZodBoolean="ZodBoolean",We.ZodDate="ZodDate",We.ZodSymbol="ZodSymbol",We.ZodUndefined="ZodUndefined",We.ZodNull="ZodNull",We.ZodAny="ZodAny",We.ZodUnknown="ZodUnknown",We.ZodNever="ZodNever",We.ZodVoid="ZodVoid",We.ZodArray="ZodArray",We.ZodObject="ZodObject",We.ZodUnion="ZodUnion",We.ZodDiscriminatedUnion="ZodDiscriminatedUnion",We.ZodIntersection="ZodIntersection",We.ZodTuple="ZodTuple",We.ZodRecord="ZodRecord",We.ZodMap="ZodMap",We.ZodSet="ZodSet",We.ZodFunction="ZodFunction",We.ZodLazy="ZodLazy",We.ZodLiteral="ZodLiteral",We.ZodEnum="ZodEnum",We.ZodEffects="ZodEffects",We.ZodNativeEnum="ZodNativeEnum",We.ZodOptional="ZodOptional",We.ZodNullable="ZodNullable",We.ZodDefault="ZodDefault",We.ZodCatch="ZodCatch",We.ZodPromise="ZodPromise",We.ZodBranded="ZodBranded",We.ZodPipeline="ZodPipeline",We.ZodReadonly="ZodReadonly";var Ke=(e,t={message:`Input not instance of ${e.name}`})=>Be(t=>t instanceof e,t),He=te.create,Ye=re.create,Ge=Re.create,Qe=ae.create,Xe=ie.create,et=se.create,tt=oe.create,nt=ce.create,rt=de.create,at=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=ke.create,ft=Se.create,ht=xe.create,gt=we.create,yt=je.create,vt=Ze.create,bt=Ae.create,_t=Pe.create,kt=Oe.create,St=Te.create,xt=Ee.create,wt=$e.create,jt=Ne.create,Zt=Ie.create,At=$e.createWithPreprocess,Pt=Fe.create,Ct=()=>He().optional(),Ot=()=>Ye().optional(),Tt=()=>Xe().optional(),Et={string:e=>te.create({...e,coerce:!0}),number:e=>re.create({...e,coerce:!0}),boolean:e=>ie.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>se.create({...e,coerce:!0})},$t=k,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"},Mt=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 Lt(e,t,n,r){(null==r?void 0:r.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Rt(e,t,n,r,a){e[t]=n,Lt(e,t,r,a)}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 r=null!=n?n:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>Ut(e,t,n))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Vt(e,t)}}var Vt=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const r of e.checks)switch(r.kind){case"min":Rt(n,"minimum",r.value,r.message,t);break;case"max":Rt(n,"maximum",r.value,r.message,t)}return n};var Bt=void 0,Jt=/^[cC][^\s-]{8,}$/,Wt=/^[0-9a-z]+$/,qt=/^[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===Bt&&(Bt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bt),Yt=/^(?:(?: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])$/,Qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xt=/^([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 r of e.checks)switch(r.kind){case"min":Rt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Rt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":sn(n,"email",r.message,t);break;case"format:idn-email":sn(n,"idn-email",r.message,t);break;case"pattern:zod":on(n,Kt,r.message,t)}break;case"url":sn(n,"uri",r.message,t);break;case"uuid":sn(n,"uuid",r.message,t);break;case"regex":on(n,r.regex,r.message,t);break;case"cuid":on(n,Jt,r.message,t);break;case"cuid2":on(n,Wt,r.message,t);break;case"startsWith":on(n,RegExp(`^${rn(r.value,t)}`),r.message,t);break;case"endsWith":on(n,RegExp(`${rn(r.value,t)}$`),r.message,t);break;case"datetime":sn(n,"date-time",r.message,t);break;case"date":sn(n,"date",r.message,t);break;case"time":sn(n,"time",r.message,t);break;case"duration":sn(n,"duration",r.message,t);break;case"length":Rt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),Rt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":on(n,RegExp(rn(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&sn(n,"ipv4",r.message,t),"v4"!==r.version&&sn(n,"ipv6",r.message,t);break;case"base64url":on(n,Xt,r.message,t);break;case"jwt":on(n,tn,r.message,t);break;case"cidr":"v6"!==r.version&&on(n,Yt,r.message,t),"v4"!==r.version&&on(n,Gt,r.message,t);break;case"emoji":on(n,Ht(),r.message,t);break;case"ulid":on(n,qt,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":sn(n,"binary",r.message,t);break;case"contentEncoding:base64":Rt(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":on(n,Qt,r.message,t)}break;case"nanoid":on(n,en,r.message,t)}return n}function rn(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 sn(e,t,n,r){var a;e.format||(null==(a=e.anyOf)?void 0:a.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.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&&r.errorMessages&&{errorMessage:{format:n}}})):Rt(e,"format",t,n,r)}function on(e,t,n,r){var a;e.pattern||(null==(a=e.allOf)?void 0:a.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.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,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Rt(e,"pattern",cn(t,r),n,r)}function cn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),a=e.flags.includes("m"),i=e.flags.includes("s"),s=r?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(r)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(a){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,r,a,i,s,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===Je.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>{var a;return{...n,[r]:null!=(a=hn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?a:zt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(r=hn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return d;if((null==(a=e.keyType)?void 0:a._def.typeName)===Je.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...r}=nn(e.keyType._def,t);return{...d,propertyNames:r}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Je.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Je.ZodBranded&&e.keyType._def.type._def.typeName===Je.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...r}=Ft(e.keyType._def,t);return{...d,propertyNames:r}}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,r={type:"object",properties:{}},a=[],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&&(r.properties[e]=c,o||a.push(e))}a.length&&(r.required=a);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&&(r.additionalProperties=s),r}function mn(e){try{return e.isOptional()}catch(e){return!0}}var fn=(e,t,n)=>{switch(t){case Je.ZodString:return nn(e,n);case Je.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",Lt(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Rt(n,"minimum",r.value,r.message,t):Rt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Rt(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Rt(n,"maximum",r.value,r.message,t):Rt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Rt(n,"maximum",r.value,r.message,t));break;case"multipleOf":Rt(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case Je.ZodObject:return pn(e,n);case Je.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Rt(n,"minimum",r.value,r.message,t):Rt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Rt(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Rt(n,"maximum",r.value,r.message,t):Rt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Rt(n,"maximum",r.value,r.message,t));break;case"multipleOf":Rt(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case Je.ZodBoolean:return{type:"boolean"};case Je.ZodDate:return Ut(e,n);case Je.ZodUndefined:return function(e){return{not:zt(e)}}(n);case Je.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Je.ZodArray:return function(e,t){var n,r,a;const i={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(a=null==(r=e.type)?void 0:r._def)?void 0:a.typeName)!==Je.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 Je.ZodUnion:case Je.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 Je.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 r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const a=[];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,...r}=e;t=r}else r=void 0;a.push(t)}else a.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),a.length?{allOf:a,...r}:void 0}(e,n);case Je.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>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 Je.ZodRecord:return dn(e,n);case Je.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case Je.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Je.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case Je.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type: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 Je.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 r=hn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:zt(t)},r]}:zt(t)})(e,n);case Je.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 Je.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 Je.ZodLazy:return()=>e.getter()._def;case Je.ZodPromise:return function(e,t){return hn(e.type._def,t)}(e,n);case Je.ZodNaN:case Je.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:zt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Je.ZodEffects:return function(e,t){return"input"===t.effectStrategy?hn(e.schema._def,t):zt(t)}(e,n);case Je.ZodAny:return zt(n);case Je.ZodUnknown:return function(e){return zt(e)}(n);case Je.ZodDefault:return function(e,t){return{...hn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Je.ZodBranded:return Ft(e,n);case Je.ZodReadonly:case Je.ZodCatch:return((e,t)=>hn(e.innerType._def,t))(e,n);case Je.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 Je.ZodFunction:case Je.ZodVoid:case Je.ZodSymbol:default:return}};function hn(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const i=null==(r=t.override)?void 0:r.call(t,e,t,a,n);if(i!==Nt)return i}if(a&&!n){const e=gn(a,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 r=Mt(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var a;return{...e,[t]:null!=(a=hn(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?a:zt(r)}},{}):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?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1))?n:zt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const c=void 0===i?a?{...s,[r.definitionPath]:a}:s:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...a,[i]:s}};return"jsonSchema7"===r.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.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})},kn=i.string(),Sn=i.number(),xn=(i.boolean(),i.string().min(1)),wn=i.number().int().positive(),jn=i.number().int().nonnegative(),Zn=i.number().describe("Tagging version number");i.union([i.string(),i.number(),i.boolean()]).optional();_n({},{ErrorHandlerSchema:()=>Cn,HandlerSchema:()=>Tn,LogHandlerSchema:()=>On,StorageSchema:()=>Pn,StorageTypeSchema:()=>An,errorHandlerJsonSchema:()=>Nn,handlerJsonSchema:()=>Mn,logHandlerJsonSchema:()=>In,storageJsonSchema:()=>$n,storageTypeJsonSchema:()=>En});var An=i.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),Pn=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"),On=i.any().describe("Log handler function: (message, verbose?) => void"),Tn=i.object({Error:Cn.describe("Error handler function"),Log:On.describe("Log handler function")}).describe("Handler interface with error and log functions"),En=vn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),$n=vn(Pn,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Nn=vn(Cn,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),In=vn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Mn=vn(Tn,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});i.object({onError:Cn.optional().describe("Error handler function: (error, state?) => void"),onLog:On.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:()=>Un,DeepPartialEventSchema:()=>Yn,EntitiesSchema:()=>qn,EntitySchema:()=>Wn,EventSchema:()=>Kn,OrderedPropertiesSchema:()=>zn,PartialEventSchema:()=>Hn,PropertiesSchema:()=>Dn,PropertySchema:()=>Rn,PropertyTypeSchema:()=>Ln,SourceSchema:()=>Jn,SourceTypeSchema:()=>Fn,UserSchema:()=>Vn,VersionSchema:()=>Bn,consentJsonSchema:()=>ar,entityJsonSchema:()=>nr,eventJsonSchema:()=>Gn,orderedPropertiesJsonSchema:()=>tr,partialEventJsonSchema:()=>Qn,propertiesJsonSchema:()=>er,sourceTypeJsonSchema:()=>rr,userJsonSchema:()=>Xn});var Ln=i.lazy(()=>i.union([i.boolean(),i.string(),i.number(),i.record(i.string(),Rn)])),Rn=i.lazy(()=>i.union([Ln,i.array(Ln)])),Dn=i.record(i.string(),Rn.optional()).describe("Flexible property collection with optional values"),zn=i.record(i.string(),i.tuple([Rn,i.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Fn=i.union([i.enum(["web","server","app","other"]),i.string()]).describe("Source type: web, server, app, other, or custom"),Un=i.record(i.string(),i.boolean()).describe("Consent requirement mapping (group name → state)"),Vn=Dn.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=Dn.and(i.object({source:kn.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Zn})).describe("Walker version information"),Jn=Dn.and(i.object({type:Fn.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:Dn.describe("Entity-specific properties"),nested:i.array(Wn).describe("Nested child entities"),context:zn.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),qn=i.array(Wn).describe("Array of nested entities"),Kn=i.object({name:i.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Dn.describe("Event-specific properties"),context:zn.describe("Ordered context properties with priorities"),globals:Dn.describe("Global properties shared across events"),custom:Dn.describe("Custom implementation-specific properties"),user:Vn.describe("User identification and attributes"),nested:qn.describe("Related nested entities"),consent:Un.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:wn.describe("Unix timestamp in milliseconds since epoch"),timing:Sn.describe("Event processing timing information"),group:kn.describe("Event grouping identifier"),count:jn.describe("Event count in session"),version:Bn.describe("Walker version information"),source:Jn.describe("Event source information")}).describe("Complete walkerOS event structure"),Hn=Kn.partial().describe("Partial event structure with all fields optional"),Yn=i.lazy(()=>Kn.deepPartial()).describe("Deep partial event structure with all nested fields optional"),Gn=vn(Kn,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),Qn=vn(Hn,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),Xn=vn(Vn,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),er=vn(Dn,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),tr=vn(zn,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),nr=vn(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),rr=vn(Fn,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),ar=vn(Un,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});_n({},{ConfigSchema:()=>fr,LoopSchema:()=>or,MapSchema:()=>dr,PolicySchema:()=>lr,ResultSchema:()=>hr,RuleSchema:()=>pr,RulesSchema:()=>mr,SetSchema:()=>cr,ValueConfigSchema:()=>ur,ValueSchema:()=>ir,ValuesSchema:()=>sr,configJsonSchema:()=>wr,loopJsonSchema:()=>vr,mapJsonSchema:()=>_r,policyJsonSchema:()=>kr,ruleJsonSchema:()=>Sr,rulesJsonSchema:()=>xr,setJsonSchema:()=>br,valueConfigJsonSchema:()=>yr,valueJsonSchema:()=>gr});var ir=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"),ur,i.array(ir).describe("Array of values")])),sr=i.array(ir).describe("Array of transformation values"),or=i.tuple([ir,ir]).describe("Loop transformation: [source, transform] tuple for array processing"),cr=i.array(ir).describe("Set: Array of values for selection or combination"),dr=i.record(i.string(),ir).describe("Map: Object mapping keys to transformation values"),ur=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:dr.optional().describe("Object mapping: transform event data to structured output"),loop:or.optional().describe("Loop transformation: [source, transform] for array processing"),set:cr.optional().describe("Set of values: combine or select from multiple values"),consent:Un.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"),lr=i.record(i.string(),ir).describe("Policy rules for event pre-processing (key → value mapping)"),pr=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:Un.optional().describe("Required consent states to process this event"),settings:i.any().optional().describe("Destination-specific settings for this event mapping"),data:i.union([ir,sr]).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:lr.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),mr=i.record(i.string(),i.record(i.string(),i.union([pr,i.array(pr)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),fr=i.object({consent:Un.optional().describe("Required consent states to process any events"),data:i.union([ir,sr]).optional().describe("Global data transformation applied to all events"),mapping:mr.optional().describe("Entity-action specific mapping rules"),policy:lr.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),hr=i.object({eventMapping:pr.optional().describe("Resolved mapping rule for event"),mappingKey:i.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),gr=vn(ir,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),yr=vn(ur,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),vr=vn(or,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),br=vn(cr,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),_r=vn(dr,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),kr=vn(lr,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Sr=vn(pr,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),xr=vn(mr,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),wr=vn(fr,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});_n({},{BatchSchema:()=>$r,ConfigSchema:()=>jr,ContextSchema:()=>Pr,DLQSchema:()=>Ur,DataSchema:()=>Nr,DestinationPolicySchema:()=>Ar,DestinationsSchema:()=>Rr,InitDestinationsSchema:()=>Lr,InitSchema:()=>Mr,InstanceSchema:()=>Ir,PartialConfigSchema:()=>Zr,PushBatchContextSchema:()=>Or,PushContextSchema:()=>Cr,PushEventSchema:()=>Tr,PushEventsSchema:()=>Er,PushResultSchema:()=>zr,RefSchema:()=>Dr,ResultSchema:()=>Fr,batchJsonSchema:()=>qr,configJsonSchema:()=>Vr,contextJsonSchema:()=>Jr,instanceJsonSchema:()=>Kr,partialConfigJsonSchema:()=>Br,pushContextJsonSchema:()=>Wr,resultJsonSchema:()=>Hr});var jr=i.object({consent:Un.optional().describe("Required consent states to send events to this destination"),settings:i.any().describe("Implementation-specific configuration").optional(),data:i.union([ir,sr]).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:mr.optional().describe("Entity-action specific mapping rules for this destination"),policy:lr.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:On.optional()}).describe("Destination configuration"),Zr=jr.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Ar=lr.describe("Destination policy rules for event pre-processing"),Pr=i.object({collector:i.any().describe("Collector instance (runtime object)"),config:jr.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"),Cr=Pr.extend({mapping:pr.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Or=Cr.describe("Batch push context with event-specific mapping"),Tr=i.object({event:Kn.describe("The event to process"),mapping:pr.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Er=i.array(Tr).describe("Array of events with mappings"),$r=i.object({key:i.string().describe('Batch key (usually mapping key like "product.view")'),events:i.array(Kn).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:pr.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Nr=i.union([i.any(),i.undefined(),i.array(i.union([i.any(),i.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Ir=i.object({config:jr.describe("Destination configuration"),queue:i.array(Kn).optional().describe("Queued events awaiting consent"),dlq:i.array(i.tuple([Kn,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)"),Mr=i.object({code:Ir.describe("Destination instance with implementation"),config:Zr.optional().describe("Partial configuration overrides"),env:i.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Lr=i.record(i.string(),Mr).describe("Map of destination IDs to initialization configurations"),Rr=i.record(i.string(),Ir).describe("Map of destination IDs to runtime instances"),Dr=i.object({id:i.string().describe("Destination ID"),destination:Ir.describe("Destination instance")}).describe("Destination reference (ID + instance)"),zr=i.object({queue:i.array(Kn).optional().describe("Events queued (awaiting consent)"),error:i.any().optional().describe("Error if push failed")}).describe("Push operation result"),Fr=i.object({successful:i.array(Dr).describe("Destinations that processed successfully"),queued:i.array(Dr).describe("Destinations that queued events"),failed:i.array(Dr).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Ur=i.array(i.tuple([Kn,i.any()])).describe("Dead letter queue: [(event, error), ...]"),Vr=vn(jr,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),Br=vn(Zr,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),Jr=vn(Pr,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),Wr=vn(Cr,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),qr=vn($r,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),Kr=vn(Ir,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),Hr=vn(Fr,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});_n({},{CommandTypeSchema:()=>Yr,ConfigSchema:()=>Gr,DestinationsSchema:()=>na,InitConfigSchema:()=>Xr,InstanceSchema:()=>ra,PushContextSchema:()=>ea,SessionDataSchema:()=>Qr,SourcesSchema:()=>ta,commandTypeJsonSchema:()=>aa,configJsonSchema:()=>ia,initConfigJsonSchema:()=>oa,instanceJsonSchema:()=>da,pushContextJsonSchema:()=>ca,sessionDataJsonSchema:()=>sa});var Yr=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"),Gr=i.object({run:i.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Zn,globalsStatic:Dn.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:On.optional()}).describe("Core collector configuration"),Qr=Dn.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:wn.describe("Session start timestamp").optional(),marketing:i.literal(!0).optional().describe("Marketing attribution flag"),updated:wn.describe("Last update timestamp").optional(),isNew:i.boolean().describe("Whether this is a new session").optional(),device:xn.describe("Device identifier").optional(),count:jn.describe("Event count in session").optional(),runs:jn.describe("Number of runs").optional()})).describe("Session state and tracking data"),Xr=Gr.partial().extend({consent:Un.optional().describe("Initial consent state"),user:Vn.optional().describe("Initial user data"),globals:Dn.optional().describe("Initial global properties"),sources:i.any().optional().describe("Source configurations"),destinations:i.any().optional().describe("Destination configurations"),custom:Dn.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),ea=i.object({mapping:fr.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),ta=i.record(i.string(),i.any()).describe("Map of source IDs to source instances"),na=i.record(i.string(),i.any()).describe("Map of destination IDs to destination instances"),ra=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:Gr.describe("Current collector configuration"),consent:Un.describe("Current consent state"),count:i.number().describe("Event count (increments with each event)"),custom:Dn.describe("Custom implementation-specific properties"),sources:ta.describe("Registered source instances"),destinations:na.describe("Registered destination instances"),globals:Dn.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(Kn).describe("Queued events awaiting processing"),round:i.number().describe("Collector run count (increments with each run)"),session:i.union([i.undefined(),Qr]).describe("Current session state"),timing:i.number().describe("Event processing timing information"),user:Vn.describe("Current user data"),version:i.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),aa=vn(Yr,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),ia=vn(Gr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),sa=vn(Qr,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),oa=vn(Xr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),ca=vn(ea,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),da=vn(ra,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});_n({},{BaseEnvSchema:()=>ua,ConfigSchema:()=>la,InitSchema:()=>fa,InitSourceSchema:()=>ha,InitSourcesSchema:()=>ga,InstanceSchema:()=>ma,PartialConfigSchema:()=>pa,baseEnvJsonSchema:()=>ya,configJsonSchema:()=>va,initSourceJsonSchema:()=>ka,initSourcesJsonSchema:()=>Sa,instanceJsonSchema:()=>_a,partialConfigJsonSchema:()=>ba});var ua=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"),la=fr.extend({settings:i.any().describe("Implementation-specific configuration").optional(),env:ua.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"),pa=la.deepPartial().describe("Partial source configuration with all fields deeply optional"),ma=i.object({type:i.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:la.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"),fa=i.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),ha=i.object({code:fa.describe("Source initialization function"),config:pa.optional().describe("Partial configuration overrides"),env:ua.partial().optional().describe("Partial environment overrides"),primary:i.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),ga=i.record(i.string(),ha).describe("Map of source IDs to initialization configurations"),ya=vn(ua,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),va=vn(la,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),ba=vn(pa,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),_a=vn(ma,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),ka=vn(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Sa=vn(ga,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function xa(e){return vn(e,{target:"jsonSchema7",$refStrategy:"none"})}var wa={merge:!0,shallow:!0,extend:!0};function ja(e,t={},n={}){n={...wa,...n};const r=Object.entries(t).reduce((t,[r,a])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(a)?t[r]=a.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=a),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function Za(e){return Array.isArray(e)}function Aa(e){return void 0!==e}function Pa(e){return e===document||e instanceof Element}function Ca(e){return"object"==typeof e&&null!==e&&!Za(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Oa(e){return"string"==typeof e}function Ta(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Ea(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function $a(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}import{Const as Na}from"@walkeros/collector";import{elb as Ia,getAttribute as Ma}from"@walkeros/web-core";import{Const as La}from"@walkeros/collector";import{getAttribute as Ra}from"@walkeros/web-core";function Da(e,t,n=!0){return e+(t=null!=t?(n?"-":"")+t:"")}function za(e,t,n,r=!0){return Ga(Ra(t,Da(e,n,r))||"").reduce((e,n)=>{let[r,a]=Qa(n);if(!r)return e;if(a||(r.endsWith(":")&&(r=r.slice(0,-1)),a=""),a.startsWith("#")){a=a.slice(1);try{let e=t[a];e||"selected"!==a||(e=t.options[t.selectedIndex].text),a=String(e)}catch(e){a=""}}return r.endsWith("[]")?(r=r.slice(0,-2),Za(e[r])||(e[r]=[]),e[r].push(Ta(a))):e[r]=Ta(a),e},{})}function Fa(e,t=La.Commands.Prefix){var n;const r=e||document.body;if(!r)return[];let a=[];const i=La.Commands.Action,s=`[${Da(t,i,!1)}]`,o=e=>{Object.keys(za(t,e,i,!1)).forEach(n=>{a=a.concat(Ua(e,n,t))})};return r!==document&&(null==(n=r.matches)?void 0:n.call(r,s))&&o(r),Ya(r,s,o),a}function Ua(e,t,n=La.Commands.Prefix){const r=[],{actions:a,nearestOnly:i}=function(e,t,n){let r=t;for(;r;){const t=Ra(r,Da(e,La.Commands.Actions,!1));if(t){const e=Ja(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const a=Ra(r,Da(e,La.Commands.Action,!1));if(a){const e=Ja(a);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}r=Ka(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t);return a.length?(a.forEach(a=>{const s=Ga(a.actionParams||"",",").reduce((e,t)=>(e[$a(t)]=!0,e),{}),o=Wa(n,e,s,i);if(!o.length){const t="page",r=`[${Da(n,t)}]`,[a,i]=Ha(e,r,n,t);o.push({entity:t,data:a,nested:[],context:i})}o.forEach(e=>{r.push({entity:e.entity,action:a.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r}function Va(e=La.Commands.Prefix,t=document){const n=Da(e,La.Commands.Globals,!1);let r={};return Ya(t,`[${n}]`,t=>{r=ja(r,za(e,t,La.Commands.Globals,!1))}),r}function Ba(e,t){const n=window.location,r="page",a=t===document?document.body:t,[i,s]=Ha(a,`[${Da(e,r)}]`,e,r);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 Ja(e){const t={};return Ga(e).forEach(e=>{const[n,r]=Qa(e),[a,i]=Xa(n);if(!a)return;let[s,o]=Xa(r||"");s=s||a,t[a]||(t[a]=[]),t[a].push({trigger:a,triggerParams:i,action:s,actionParams:o})}),t}function Wa(e,t,n,r=!1){const a=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=qa(e,i,t,n);if(s&&(a.push(s),r))break;i=Ka(e,i)}return a}function qa(e,t,n,r){const a=Ra(t,Da(e));if(!a||r&&!r[a])return null;const i=[t],s=`[${Da(e,a)}],[${Da(e,"")}]`,o=Da(e,La.Commands.Link,!1);let c={};const d=[],[u,l]=Ha(n||t,s,e,a);Ya(t,`[${o}]`,t=>{const[n,r]=Qa(Ra(t,o));"parent"===r&&Ya(document.body,`[${o}="${n}:child"]`,t=>{i.push(t);const n=qa(e,t);n&&d.push(n)})});const p=[];i.forEach(e=>{e.matches(s)&&p.push(e),Ya(e,s,e=>p.push(e))});let m={};return p.forEach(t=>{m=ja(m,za(e,t,"")),c=ja(c,za(e,t,a))}),c=ja(ja(m,c),u),i.forEach(t=>{Ya(t,`[${Da(e)}]`,t=>{const n=qa(e,t);n&&d.push(n)})}),{entity:a,data:c,context:l,nested:d}}function Ka(e,t){const n=Da(e,La.Commands.Link,!1);if(t.matches(`[${n}]`)){const[e,r]=Qa(Ra(t,n));if("child"===r)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function Ha(e,t,n,r){let a={};const i={};let s=e;const o=`[${Da(n,La.Commands.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(a=ja(za(n,s,""),a),a=ja(za(n,s,r),a)),s.matches(o)&&(Object.entries(za(n,s,La.Commands.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=Ka(n,s);return[a,i]}function Ya(e,t,n){e.querySelectorAll(t).forEach(n)}function Ga(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function Qa(e){const[t,n]=e.split(/:(.+)/,2);return[$a(t),$a(n)]}function Xa(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}import{isVisible as ei}from"@walkeros/web-core";var ti=new WeakMap,ni=new WeakMap,ri=new WeakMap;function ai(e){const t=Date.now();let n=ni.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:ei(e),lastChecked:t},ni.set(e,n)),n.isVisible}function ii(e){if(window.IntersectionObserver)return Ea(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,r;const a=t.target,i=ri.get(e);if(!i)return;const s=i.timers.get(a);if(t.intersectionRatio>0){const r=Date.now();let o=ti.get(a);(!o||r-o.lastChecked>1e3)&&(o={isLarge:a.offsetHeight>window.innerHeight,lastChecked:r},ti.set(a,o));if(t.intersectionRatio>=.5||o.isLarge&&ai(a)){const t=null==(n=i.elementConfigs)?void 0:n.get(a);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(ai(a)){const r=null==(t=i.elementConfigs)?void 0:t.get(a);(null==r?void 0:r.context)&&await xi(r.context,a,r.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(a);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=ri.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),ti.delete(t),ni.delete(t)}(e,a)}},i.duration);i.timers.set(a,t)}return}}s&&(clearTimeout(s),i.timers.delete(a));const o=null==(r=i.elementConfigs)?void 0:r.get(a);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function si(e,t,n={multiple:!1}){var r;const a=e.settings.scope||document,i=ri.get(a);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(r=n.multiple)&&r,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function oi(e){if(!e)return;const t=ri.get(e);t&&(t.observer&&t.observer.disconnect(),ri.delete(e))}function ci(e,t,n,r,a,i,s){const{elb:o,settings:c}=e;if(Oa(t)&&t.startsWith("walker "))return o(t,n);if(Ca(t)){const e=t;return e.source||(e.source=di()),e.globals||(e.globals=Va(c.prefix,c.scope||document)),o(e)}const[d]=String(Ca(t)?t.name:t).split(" ");let u,l=Ca(n)?n:{},p={},m=!1;if(Pa(n)&&(u=n,m=!0),Pa(a)?u=a:Ca(a)&&Object.keys(a).length&&(p=a),u){const e=Wa(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=Va(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:i,custom:s,trigger:Oa(r)?r:"",source:di()})}function di(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var ui,li=[],pi="click",mi="hover",fi="load",hi="pulse",gi="scroll",yi="submit",vi="impression",bi="visible",_i="wait";function ki(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;if(!n)return;n.addEventListener("click",Ea(function(t){ji.call(this,e,t)})),n.addEventListener("submit",Ea(function(t){Zi.call(this,e,t)}))}(e,t)}function Si(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;li=[];const r=n||document;oi(r),function(e,t=1e3){ri.has(e)||ri.set(e,{observer:ii(e),timers:new WeakMap,duration:t})}(r,1e3);const a=Da(t.prefix,Na.Commands.Action,!1);r!==document&&wi(e,r,a,t);r.querySelectorAll(`[${a}]`).forEach(n=>{wi(e,n,a,t)}),li.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const r=window.scrollY+window.innerHeight,a=e.offsetTop;if(r<a)return!0;const i=e.clientHeight;return!(100*(1-(a+i-r)/(i||1))>=n)||(xi(t,e,gi),!1)});ui||(ui=function(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}(function(){li=n.call(t,li,e)}),t.addEventListener("scroll",ui))}(e,r)}(e,t)}async function xi(e,t,n){const r=Ua(t,n,e.settings.prefix);return Promise.all(r.map(t=>ci(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function wi(e,t,n,r){const a=Ma(t,n);a&&Object.values(Ja(a)).forEach(n=>n.forEach(n=>{switch(n.trigger){case mi:!function(e,t){t.addEventListener("mouseenter",Ea(function(t){t.target instanceof Element&&xi(e,t.target,mi)}))}(e,t);break;case fi:!function(e,t){xi(e,t,fi)}(e,t);break;case hi:!function(e,t,n=""){setInterval(()=>{document.hidden||xi(e,t,hi)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case gi:!function(e,t=""){const n=parseInt(t||"")||50;if(n<0||n>100)return;li.push([e,n])}(t,n.triggerParams);break;case vi:si(e,t);break;case bi:si(e,t,{multiple:!0});break;case _i:!function(e,t,n=""){setTimeout(()=>xi(e,t,_i),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}}))}function ji(e,t){xi(e,t.target,pi)}function Zi(e,t){t.target&&xi(e,t.target,yi)}function Ai(e,t={}){const n=t.name||"elbLayer",r=t.window||window;if(!r)return;const a=r;a[n]||(a[n]=[]);const i=a[n];i.push=function(...n){if(Oi(n[0])){const r=[...Array.from(n[0])],a=Array.prototype.push.apply(this,[r]);return Ci(e,t.prefix,r),a}const r=Array.prototype.push.apply(this,n);return n.forEach(n=>{Ci(e,t.prefix,n)}),r},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Pi(e,t,n,!0),Pi(e,t,n,!1),n.length=0}(e,t.prefix,i)}function Pi(e,t,n,r){const a=[];let i=!0;n.forEach(e=>{const t=Oi(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=!Ca(s)&&Oa(s)&&s.startsWith("walker ");if(Ca(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!Oa(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(r&&o||!r&&!o)&&a.push(t)}),a.forEach(n=>{Ci(e,t,n)})}function Ci(e,t="data-elb",n){Ea(()=>{if(Array.isArray(n)){const[r,...a]=n;if(!r||Oa(r)&&""===r.trim())return;if(Oa(r)&&r.startsWith("walker "))return void e(r,a[0]);ci({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},r,...a)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Oi(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}import{sessionStart as Ti}from"@walkeros/web-core";function Ei(e,t={}){return Ti({...t,collector:{push:e,group:void 0}})}var $i={},Ni={};a(Ni,{env:()=>Ii});var Ii={};a(Ii,{push:()=>Ri});var Mi=()=>{},Li=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Ri={get push(){return Li()},get command(){return Li()},get elb(){return Li()},get window(){return{addEventListener:Mi,removeEventListener:Mi,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:Mi,removeEventListener:Mi,querySelector:Mi,querySelectorAll:()=>[],getElementById:Mi,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Mi,getAttribute:Mi,addEventListener:Mi,removeEventListener:Mi}),body:{appendChild:Mi,removeChild:Mi},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}},Di={};a(Di,{DataAttributePrefix:()=>zi,JavaScriptVarName:()=>Fi,ScopeSelector:()=>Ui,SettingsSchema:()=>Ji,TaggerSchema:()=>Wi,settings:()=>qi,tagger:()=>Ki});var zi=i.string().min(1).regex(/^[a-z][a-z0-9-]*$/,"Must be lowercase kebab-case").describe("Prefix for data attributes on DOM elements"),Fi=i.string().min(1).regex(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,"Must be a valid JavaScript identifier").describe("JavaScript variable name"),Ui=i.string().describe('DOM scope for event tracking (CSS selector or "document")').optional(),Vi=i.union([i.boolean(),i.any().describe("SessionConfig object from @walkeros/web-core with tracking settings")]),Bi=i.union([i.boolean(),i.string(),i.any().describe("Elb.Layer array for async command queuing")]),Ji=i.object({prefix:zi.default("data-elb").describe("Prefix for data attributes (default: data-elb)"),scope:Ui.describe("DOM scope for event tracking (default: document)"),pageview:i.boolean().default(!0).describe("Enable automatic pageview tracking"),session:Vi.default(!0).describe("Enable session tracking (boolean or SessionConfig object)"),elb:Fi.default("elb").describe("Name for global elb function"),name:i.string().describe("Custom name for source instance").optional(),elbLayer:Bi.default("elbLayer").describe("Enable elbLayer for async command queuing (boolean, string, or Elb.Layer)")}),Wi=i.object({prefix:zi.default("data-elb").describe("Custom prefix for generated data attributes")}),qi=xa(Ji),Ki=xa(Wi);function Hi(e={}){const t=e.prefix||"data-elb";return function(e){let n,r=e;const a={},i={},s={},o={},c={},d={};function u(e){return Object.entries(e).map(([e,t])=>`${e}:${function(e){if(!Aa(e)||null===e)return"undefined";let t=String(e);return t=t.replace(/\\/g,"\\\\"),t=t.replace(/;/g,"\\;"),t=t.replace(/:/g,"\\:"),t=t.replace(/'/g,"\\'"),t}(t)}`).join(";")}const l={entity:e=>(n=e,r=e,l),data(e,t){const n=null!=r?r:"";return a[n]||(a[n]={}),Oa(e)?a[n][e]=t:Object.assign(a[n],e),l},action(e,t){if(Oa(e))if(Aa(t))i[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);i[t]=n}else i[e]=e;else Object.assign(i,e);return l},actions(e,t){if(Oa(e))if(Aa(t))s[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);s[t]=n}else s[e]=e;else Object.assign(s,e);return l},context:(e,t)=>(Oa(e)?o[e]=t:Object.assign(o,e),l),globals:(e,t)=>(Oa(e)?c[e]=t:Object.assign(c,e),l),link:(e,t)=>(Oa(e)?d[e]=t:Object.assign(d,e),l),get(){const e={};return n&&(e[t]=n),Object.entries(a).forEach(([n,r])=>{if(Object.keys(r).length>0){e[n?`${t}-${n}`:`${t}-`]=u(r)}}),Object.keys(i).length>0&&(e[`${t}action`]=u(i)),Object.keys(s).length>0&&(e[`${t}actions`]=u(s)),Object.keys(o).length>0&&(e[`${t}context`]=u(o)),Object.keys(c).length>0&&(e[`${t}globals`]=u(c)),Object.keys(d).length>0&&(e[`${t}link`]=u(d)),e}};return l}}var Yi=async(e,t)=>{const{elb:n,window:r,document:a}=t,i=(null==e?void 0:e.settings)||{},s=r||(void 0!==globalThis.window?globalThis.window:void 0),o=a||(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&&Ai(n,{name:Oa(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:s}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;Ei(n,e)}await async function(e,t,n){const r=()=>{e(t,n)};"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}(ki,u,c);(()=>{if(Si(u,c),c.pageview){const[e,t]=Ba(c.prefix||"data-elb",c.scope);ci(u,"page view",e,"load",t)}})(),Oa(c.elb)&&c.elb&&(s[c.elb]=(...e)=>{const[t,n,r,a,i,s]=e;return ci(u,t,n,r,a,i,s)})}return{type:"browser",config:d,push:(...e)=>{const[t,n,r,a,i,s]=e;return ci(u,t,n,r,a,i,s)},destroy:async()=>{o&&oi(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;Ei(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&s&&(Si(u,c),c.pageview)){const[e,t]=Ba(c.prefix||"data-elb",c.scope);ci(u,"page view",e,"load",t)}}}}},Gi=Yi;export{$i as SourceBrowser,Hi as createTagger,Gi as default,Ni as examples,Fa as getAllEvents,Da as getElbAttributeName,za as getElbValues,Ua as getEvents,Va as getGlobals,Di as schemas,Yi as sourceBrowser};//# sourceMappingURL=index.mjs.map
|