@aranova/tracking-browser 0.4.2 → 0.5.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.
@@ -1,2 +1,2 @@
1
- "use strict";var AranovaTracking=(()=>{var Ue=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var sn=Object.prototype.hasOwnProperty;var gt=(t,e)=>{for(var n in e)Ue(t,n,{get:e[n],enumerable:!0})},on=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of an(e))!sn.call(t,a)&&a!==n&&Ue(t,a,{get:()=>e[a],enumerable:!(r=rn(e,a))||r.enumerable});return t};var cn=t=>on(Ue({},"__esModule",{value:!0}),t);var Mr={};gt(Mr,{default:()=>Nr,init:()=>en});var ht="0.4.2";var Ze="consent_state",yt="consent_timestamp";function Ke(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function $(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(Ze);return t==="granted"||t==="denied"?t:"pending"}function ue(t){typeof window>"u"||(window.localStorage.setItem(Ze,t),window.localStorage.setItem(yt,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",Ke(t)))}function Fe(){let t=$();return(t==="granted"||t==="denied")&&ue(t),t}var _t="https://www.googletagmanager.com/gtag/js",Ge="data-aranova-tracking";function un(t){return`aranova-${t}`}function Be(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function vt(){Be()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function xt(t){if(typeof document>"u")return;let e=un("gtag-loader");if(document.querySelector(`script[${Ge}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${_t}?id=${encodeURIComponent(t)}`,r.setAttribute(Ge,e),document.head.appendChild(r)}function kt(t){let e=Be();e("js",new Date),e("config",t)}function He(t){typeof window>"u"||typeof document>"u"||(vt(),xt(t),kt(t),Fe())}var We=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Ee(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function Ye(t){return typeof t=="string"&&t.length>0?t:null}function le(t){return We.reduce((e,n)=>(e[n]=Ye(t(n)),e),Ee())}function wt(t){return We.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}function fe(t){if(typeof document>"u")return null;let n=(document.cookie?document.cookie.split("; "):[]).find(a=>a.startsWith(`${t}=`));if(!n)return null;let[,r=""]=n.split("=");return Ye(decodeURIComponent(r))}function Tt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function St(t,e=7776e3){let n=wt(t);return Object.entries(n).forEach(([r,a])=>{Tt(r,a,e)}),n}function pe(t=typeof window>"u"?"":window.location.href,e=7776e3){let n=typeof window>"u"?new URL(t||"https://example.invalid"):new URL(t,window.location.origin);return St(n.searchParams,e),le(fe)}var qe="aranova_tracking_visitor",Ae="aranova_tracking_session";function Re(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`}function bt(t){try{return window.localStorage.getItem(t)}catch{return null}}function Je(t,e){try{window.localStorage.setItem(t,e)}catch{}}function Xe(){if(typeof window>"u")return Re();let t=bt(qe);if(t&&t.length>0)return t;let e=Re();return Je(qe,e),e}function Ie(t=Date.now()){if(typeof window>"u")return Re();let e=bt(Ae);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=18e5){let a={id:r.id,last_event_at:t};return Je(Ae,JSON.stringify(a)),r.id}}catch{}let n={id:Re(),last_event_at:t};return Je(Ae,JSON.stringify(n)),n.id}var y={};gt(y,{BRAND:()=>jn,DIRTY:()=>G,EMPTY_PATH:()=>mn,INVALID:()=>m,NEVER:()=>xr,OK:()=>S,ParseStatus:()=>T,Schema:()=>v,ZodAny:()=>Z,ZodArray:()=>D,ZodBigInt:()=>H,ZodBoolean:()=>W,ZodBranded:()=>Te,ZodCatch:()=>ie,ZodDate:()=>Y,ZodDefault:()=>ae,ZodDiscriminatedUnion:()=>Ne,ZodEffects:()=>R,ZodEnum:()=>ne,ZodError:()=>b,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>Ve,ZodIntersection:()=>Q,ZodIssueCode:()=>c,ZodLazy:()=>ee,ZodLiteral:()=>te,ZodMap:()=>ve,ZodNaN:()=>ke,ZodNativeEnum:()=>re,ZodNever:()=>I,ZodNull:()=>J,ZodNullable:()=>N,ZodNumber:()=>B,ZodObject:()=>C,ZodOptional:()=>E,ZodParsedType:()=>f,ZodPipeline:()=>Se,ZodPromise:()=>K,ZodReadonly:()=>se,ZodRecord:()=>Me,ZodSchema:()=>v,ZodSet:()=>xe,ZodString:()=>U,ZodSymbol:()=>ye,ZodTransformer:()=>R,ZodTuple:()=>P,ZodType:()=>v,ZodUndefined:()=>q,ZodUnion:()=>X,ZodUnknown:()=>L,ZodVoid:()=>_e,addIssueToContext:()=>l,any:()=>Gn,array:()=>Yn,bigint:()=>zn,boolean:()=>jt,coerce:()=>vr,custom:()=>Nt,date:()=>Un,datetimeRegex:()=>Ot,defaultErrorMap:()=>V,discriminatedUnion:()=>Qn,effect:()=>lr,enum:()=>cr,function:()=>ir,getErrorMap:()=>me,getParsedType:()=>O,instanceof:()=>Dn,intersection:()=>er,isAborted:()=>Oe,isAsync:()=>ge,isDirty:()=>Pe,isValid:()=>z,late:()=>Ln,lazy:()=>sr,literal:()=>or,makeIssue:()=>we,map:()=>rr,nan:()=>$n,nativeEnum:()=>dr,never:()=>Hn,null:()=>Fn,nullable:()=>pr,number:()=>Vt,object:()=>qn,objectUtil:()=>Qe,oboolean:()=>_r,onumber:()=>yr,optional:()=>fr,ostring:()=>hr,pipeline:()=>gr,preprocess:()=>mr,promise:()=>ur,quotelessJson:()=>ln,record:()=>nr,set:()=>ar,setErrorMap:()=>pn,strictObject:()=>Jn,string:()=>Mt,symbol:()=>Zn,transformer:()=>lr,tuple:()=>tr,undefined:()=>Kn,union:()=>Xn,unknown:()=>Bn,util:()=>x,void:()=>Wn});var x;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let i={};for(let o of a)i[o]=o;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(let s of i)o[s]=a[s];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(let o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(x||(x={}));var Qe;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Qe||(Qe={}));var f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),O=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}};var c=x.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"]),ln=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),b=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},a=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,u=0;for(;u<o.path.length;){let d=o.path[u];u===o.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(n(o))):s[d]=s[d]||{_errors:[]},s=s[d],u++}}};return a(this),r}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,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};b.create=t=>new b(t);var fn=(t,e)=>{let n;switch(t.code){case c.invalid_type:t.received===f.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:n=`Unrecognized key(s) in object: ${x.joinValues(t.keys,", ")}`;break;case c.invalid_union:n="Invalid input";break;case c.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${x.joinValues(t.options)}`;break;case c.invalid_enum_value:n=`Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:n="Invalid function arguments";break;case c.invalid_return_type:n="Invalid function return type";break;case c.invalid_date:n="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:x.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case c.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case c.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case c.custom:n="Invalid input";break;case c.invalid_intersection_types:n="Intersection results could not be merged";break;case c.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:n="Number must be finite";break;default:n=e.defaultError,x.assertNever(t)}return{message:n}},V=fn;var Ct=V;function pn(t){Ct=t}function me(){return Ct}var we=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="",u=r.filter(d=>!!d).slice().reverse();for(let d of u)s=d(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}},mn=[];function l(t,e){let n=me(),r=we({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===V?void 0:V].filter(a=>!!a)});t.common.issues.push(r)}var T=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let a of n){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n){let i=await a.key,o=await a.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return m;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},m=Object.freeze({status:"aborted"}),G=t=>({status:"dirty",value:t}),S=t=>({status:"valid",value:t}),Oe=t=>t.status==="aborted",Pe=t=>t.status==="dirty",z=t=>t.status==="valid",ge=t=>typeof Promise<"u"&&t instanceof Promise;var p;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var A=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Et=(t,e)=>{if(z(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new b(t.common.issues);return this._error=n,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,s)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:u??n??s.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return O(e.data)}_getOrReturnCtx(e,n){return n||{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 T,ctx:{common:e.parent.common,data:e.data,parsedType:O(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ge(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Et(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return z(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>z(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:O(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ge(a)?a:Promise.resolve(a));return Et(r,i)}refine(e,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let o=e(a),s=()=>i.addIssue({code:c.custom,...r(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new R({schema:this,typeName:g.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:n=>this["~validate"](n)}}optional(){return E.create(this,this._def)}nullable(){return N.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return K.create(this,this._def)}or(e){return X.create([this,e],this._def)}and(e){return Q.create(this,e,this._def)}transform(e){return new R({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ae({..._(this._def),innerType:this,defaultValue:n,typeName:g.ZodDefault})}brand(){return new Te({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ie({..._(this._def),innerType:this,catchValue:n,typeName:g.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Se.create(this,e)}readonly(){return se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gn=/^c[^\s-]{8,}$/i,hn=/^[0-9a-z]+$/,yn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_n=/^[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,vn=/^[a-z0-9_-]{21}$/i,xn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kn=/^[-+]?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)?)??$/,wn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",et,Sn=/^(?:(?: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])$/,bn=/^(?:(?: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])$/,Cn=/^(([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]))$/,En=/^(([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])$/,An=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rt="((\\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])))",In=new RegExp(`^${Rt}$`);function It(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function On(t){return new RegExp(`^${It(t)}$`)}function Ot(t){let e=`${Rt}T${It(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Pn(t,e){return!!((e==="v4"||!e)&&Sn.test(t)||(e==="v6"||!e)&&Cn.test(t))}function Nn(t,e){if(!xn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Mn(t,e){return!!((e==="v4"||!e)&&bn.test(t)||(e==="v6"||!e)&&En.test(t))}var U=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let i=this._getOrReturnCtx(e);return l(i,{code:c.invalid_type,expected:f.string,received:i.parsedType}),m}let r=new T,a;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?l(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&l(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")wn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"email",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")et||(et=new RegExp(Tn,"u")),et.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"emoji",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")_n.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"uuid",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")vn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"nanoid",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")gn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cuid",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")hn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cuid2",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")yn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"ulid",code:c.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),l(a,{validation:"url",code:c.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"regex",code:c.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ot(i).test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?In.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?On(i).test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:c.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?kn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"duration",code:c.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Pn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"ip",code:c.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Nn(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"jwt",code:c.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Mn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cidr",code:c.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?An.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"base64",code:c.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Rn.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"base64url",code:c.invalid_string,message:i.message}),r.dirty()):x.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:c.invalid_string,...p.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...p.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...p.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...p.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...p.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...p.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...p.errToObj(n)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};U.create=t=>new U({checks:[],typeName:g.ZodString,coerce:t?.coerce??!1,..._(t)});function Vn(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(t.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}var B=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let i=this._getOrReturnCtx(e);return l(i,{code:c.invalid_type,expected:f.number,received:i.parsedType}),m}let r,a=new T;for(let i of this._def.checks)i.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Vn(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),l(r,{code:c.not_finite,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,p.toString(n))}gt(e,n){return this.setLimit("min",e,!1,p.toString(n))}lte(e,n){return this.setLimit("max",e,!0,p.toString(n))}lt(e,n){return this.setLimit("max",e,!1,p.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:p.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};B.create=t=>new B({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,..._(t)});var H=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let r,a=new T;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),l(r,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):x.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.bigint,received:n.parsedType}),m}gte(e,n){return this.setLimit("min",e,!0,p.toString(n))}gt(e,n){return this.setLimit("min",e,!1,p.toString(n))}lte(e,n){return this.setLimit("max",e,!0,p.toString(n))}lt(e,n){return this.setLimit("max",e,!1,p.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:p.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:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};H.create=t=>new H({checks:[],typeName:g.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var W=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.boolean,received:r.parsedType}),m}return S(e.data)}};W.create=t=>new W({typeName:g.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var Y=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let i=this._getOrReturnCtx(e);return l(i,{code:c.invalid_type,expected:f.date,received:i.parsedType}),m}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return l(i,{code:c.invalid_date}),m}let r=new T,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:c.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):x.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Y.create=t=>new Y({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,..._(t)});var ye=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.symbol,received:r.parsedType}),m}return S(e.data)}};ye.create=t=>new ye({typeName:g.ZodSymbol,..._(t)});var q=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.undefined,received:r.parsedType}),m}return S(e.data)}};q.create=t=>new q({typeName:g.ZodUndefined,..._(t)});var J=class extends v{_parse(e){if(this._getType(e)!==f.null){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.null,received:r.parsedType}),m}return S(e.data)}};J.create=t=>new J({typeName:g.ZodNull,..._(t)});var Z=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}};Z.create=t=>new Z({typeName:g.ZodAny,..._(t)});var L=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}};L.create=t=>new L({typeName:g.ZodUnknown,..._(t)});var I=class extends v{_parse(e){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:f.never,received:n.parsedType}),m}};I.create=t=>new I({typeName:g.ZodNever,..._(t)});var _e=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.void,received:r.parsedType}),m}return S(e.data)}};_e.create=t=>new _e({typeName:g.ZodVoid,..._(t)});var D=class t extends v{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==f.array)return l(n,{code:c.invalid_type,expected:f.array,received:n.parsedType}),m;if(a.exactLength!==null){let o=n.data.length>a.exactLength.value,s=n.data.length<a.exactLength.value;(o||s)&&(l(n,{code:o?c.too_big:c.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(l(n,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(l(n,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>a.type._parseAsync(new A(n,o,n.path,s)))).then(o=>T.mergeArray(r,o));let i=[...n.data].map((o,s)=>a.type._parseSync(new A(n,o,n.path,s)));return T.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:p.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:p.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:p.toString(n)}})}nonempty(e){return this.min(1,e)}};D.create=(t,e)=>new D({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});function he(t){if(t instanceof C){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=E.create(he(r))}return new C({...t._def,shape:()=>e})}else return t instanceof D?new D({...t._def,type:he(t.element)}):t instanceof E?E.create(he(t.unwrap())):t instanceof N?N.create(he(t.unwrap())):t instanceof P?P.create(t.items.map(e=>he(e))):t}var C=class t extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=x.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==f.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:f.object,received:d.parsedType}),m}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(let d in a.data)o.includes(d)||s.push(d);let u=[];for(let d of o){let h=i[d],w=a.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new A(a,w,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof I){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of s)u.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(d==="strict")s.length>0&&(l(a,{code:c.unrecognized_keys,keys:s}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of s){let w=a.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new A(a,w,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of u){let w=await h.key,ce=await h.value;d.push({key:w,value:ce,alwaysSet:h.alwaysSet})}return d}).then(d=>T.mergeObjectSync(r,d)):T.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:p.errToObj(e).message??a}:{message:a}}}:{}})}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:g.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of x.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of x.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return he(this)}partial(e){let n={};for(let r of x.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of x.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof E;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return Pt(x.objectKeys(this.shape))}};C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:I.create(),typeName:g.ZodObject,..._(e)});C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:I.create(),typeName:g.ZodObject,..._(e)});C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:I.create(),typeName:g.ZodObject,..._(e)});var X=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new b(s.ctx.common.issues));return l(n,{code:c.invalid_union,unionErrors:o}),m}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(a);{let i,o=[];for(let u of r){let d={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(u=>new b(u));return l(n,{code:c.invalid_union,unionErrors:s}),m}}get options(){return this._def.options}};X.create=(t,e)=>new X({options:t,typeName:g.ZodUnion,..._(e)});var j=t=>t instanceof ee?j(t.schema):t instanceof R?j(t.innerType()):t instanceof te?[t.value]:t instanceof ne?t.options:t instanceof re?x.objectValues(t.enum):t instanceof ae?j(t._def.innerType):t instanceof q?[void 0]:t instanceof J?[null]:t instanceof E?[void 0,...j(t.unwrap())]:t instanceof N?[null,...j(t.unwrap())]:t instanceof Te||t instanceof se?j(t.unwrap()):t instanceof ie?j(t._def.innerType):[],Ne=class t extends v{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:c.invalid_type,expected:f.object,received:n.parsedType}),m;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(l(n,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let a=new Map;for(let i of n){let o=j(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,i)}}return new t({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function tt(t,e){let n=O(t),r=O(e);if(t===e)return{valid:!0,data:t};if(n===f.object&&r===f.object){let a=x.objectKeys(e),i=x.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(let s of i){let u=tt(t[s],e[s]);if(!u.valid)return{valid:!1};o[s]=u.data}return{valid:!0,data:o}}else if(n===f.array&&r===f.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let o=t[i],s=e[i],u=tt(o,s);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return n===f.date&&r===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Q=class extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,o)=>{if(Oe(i)||Oe(o))return m;let s=tt(i.value,o.value);return s.valid?((Pe(i)||Pe(o))&&n.dirty(),{status:n.value,value:s.data}):(l(r,{code:c.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Q.create=(t,e,n)=>new Q({left:t,right:e,typeName:g.ZodIntersection,..._(n)});var P=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return l(r,{code:c.invalid_type,expected:f.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return l(r,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(l(r,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new A(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>T.mergeArray(n,o)):T.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};P.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:t,typeName:g.ZodTuple,rest:null,..._(e)})};var Me=class t extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return l(r,{code:c.invalid_type,expected:f.object,received:r.parsedType}),m;let a=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)a.push({key:i._parse(new A(r,s,r.path,s)),value:o._parse(new A(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?T.mergeObjectAsync(n,a):T.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof v?new t({keyType:e,valueType:n,typeName:g.ZodRecord,..._(r)}):new t({keyType:U.create(),valueType:e,typeName:g.ZodRecord,..._(n)})}},ve=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.map)return l(r,{code:c.invalid_type,expected:f.map,received:r.parsedType}),m;let a=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,u],d)=>({key:a._parse(new A(r,s,r.path,[d,"key"])),value:i._parse(new A(r,u,r.path,[d,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of o){let d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),s.set(d.value,h.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let u of o){let d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),s.set(d.value,h.value)}return{status:n.value,value:s}}}};ve.create=(t,e,n)=>new ve({valueType:e,keyType:t,typeName:g.ZodMap,..._(n)});var xe=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return l(r,{code:c.invalid_type,expected:f.set,received:r.parsedType}),m;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(l(r,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(l(r,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function o(u){let d=new Set;for(let h of u){if(h.status==="aborted")return m;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}let s=[...r.data.values()].map((u,d)=>i._parse(new A(r,u,r.path,d)));return r.common.async?Promise.all(s).then(u=>o(u)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:p.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:p.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};xe.create=(t,e)=>new xe({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});var Ve=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.function)return l(n,{code:c.invalid_type,expected:f.function,received:n.parsedType}),m;function r(s,u){return we({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,me(),V].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function a(s,u){return we({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,me(),V].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof K){let s=this;return S(async function(...u){let d=new b([]),h=await s._def.args.parseAsync(u,i).catch(de=>{throw d.addIssue(r(u,de)),d}),w=await Reflect.apply(o,this,h);return await s._def.returns._def.type.parseAsync(w,i).catch(de=>{throw d.addIssue(a(w,de)),d})})}else{let s=this;return S(function(...u){let d=s._def.args.safeParse(u,i);if(!d.success)throw new b([r(u,d.error)]);let h=Reflect.apply(o,this,d.data),w=s._def.returns.safeParse(h,i);if(!w.success)throw new b([a(h,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:P.create(e).rest(L.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||P.create([]).rest(L.create()),returns:n||L.create(),typeName:g.ZodFunction,..._(r)})}},ee=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ee.create=(t,e)=>new ee({getter:t,typeName:g.ZodLazy,..._(e)});var te=class extends v{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return l(n,{received:n.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};te.create=(t,e)=>new te({value:t,typeName:g.ZodLiteral,..._(e)});function Pt(t,e){return new ne({values:t,typeName:g.ZodEnum,..._(e)})}var ne=class t extends v{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return l(n,{expected:x.joinValues(r),received:n.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return l(n,{received:n.data,code:c.invalid_enum_value,options:r}),m}return S(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;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(r=>!e.includes(r)),{...this._def,...n})}};ne.create=Pt;var re=class extends v{_parse(e){let n=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){let a=x.objectValues(n);return l(r,{expected:x.joinValues(a),received:r.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=x.objectValues(n);return l(r,{received:r.data,code:c.invalid_enum_value,options:a}),m}return S(e.data)}get enum(){return this._def.values}};re.create=(t,e)=>new re({values:t,typeName:g.ZodNativeEnum,..._(e)});var K=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.promise&&n.common.async===!1)return l(n,{code:c.invalid_type,expected:f.promise,received:n.parsedType}),m;let r=n.parsedType===f.promise?n.data:Promise.resolve(n.data);return S(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};K.create=(t,e)=>new K({type:t,typeName:g.ZodPromise,..._(e)});var R=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{l(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let o=a.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return m;let u=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return u.status==="aborted"?m:u.status==="dirty"?G(u.value):n.value==="dirty"?G(u.value):u});{if(n.value==="aborted")return m;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?m:s.status==="dirty"?G(s.value):n.value==="dirty"?G(s.value):s}}if(a.type==="refinement"){let o=s=>{let u=a.refinement(s,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?m:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?m:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!z(o))return m;let s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>z(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:n.value,value:s})):m);x.assertNever(a)}};R.create=(t,e,n)=>new R({schema:t,typeName:g.ZodEffects,effect:e,..._(n)});R.createWithPreprocess=(t,e,n)=>new R({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,..._(n)});var E=class extends v{_parse(e){return this._getType(e)===f.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(t,e)=>new E({innerType:t,typeName:g.ZodOptional,..._(e)});var N=class extends v{_parse(e){return this._getType(e)===f.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(t,e)=>new N({innerType:t,typeName:g.ZodNullable,..._(e)});var ae=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ie=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ge(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new b(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new b(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var ke=class extends v{_parse(e){if(this._getType(e)!==f.nan){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:f.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}};ke.create=t=>new ke({typeName:g.ZodNaN,..._(t)});var jn=Symbol("zod_brand"),Te=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Se=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?m:i.status==="dirty"?(n.dirty(),G(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:g.ZodPipeline})}},se=class extends v{_parse(e){let n=this._def.innerType._parse(e),r=a=>(z(a)&&(a.value=Object.freeze(a.value)),a);return ge(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};se.create=(t,e)=>new se({innerType:t,typeName:g.ZodReadonly,..._(e)});function At(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Nt(t,e={},n){return t?Z.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let s=At(e,r),u=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:u})}});if(!i){let o=At(e,r),s=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:s})}}):Z.create()}var Ln={object:C.lazycreate},g;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(g||(g={}));var Dn=(t,e={message:`Input not instance of ${t.name}`})=>Nt(n=>n instanceof t,e),Mt=U.create,Vt=B.create,$n=ke.create,zn=H.create,jt=W.create,Un=Y.create,Zn=ye.create,Kn=q.create,Fn=J.create,Gn=Z.create,Bn=L.create,Hn=I.create,Wn=_e.create,Yn=D.create,qn=C.create,Jn=C.strictCreate,Xn=X.create,Qn=Ne.create,er=Q.create,tr=P.create,nr=Me.create,rr=ve.create,ar=xe.create,ir=Ve.create,sr=ee.create,or=te.create,cr=ne.create,dr=re.create,ur=K.create,lr=R.create,fr=E.create,pr=N.create,mr=R.createWithPreprocess,gr=Se.create,hr=()=>Mt().optional(),yr=()=>Vt().optional(),_r=()=>jt().optional(),vr={string:(t=>U.create({...t,coerce:!0})),number:(t=>B.create({...t,coerce:!0})),boolean:(t=>W.create({...t,coerce:!0})),bigint:(t=>H.create({...t,coerce:!0})),date:(t=>Y.create({...t,coerce:!0}))};var xr=m;var je=y.object({page:y.object({title:y.string().nullable(),path:y.string(),search:y.string(),hash:y.string()}),referrer:y.string().nullable(),viewport:y.object({w:y.number(),h:y.number()}).nullable().optional()}).strict(),Lt=y.object({}).strict();var at="aranova_tracking_last_fired_url",nt=null,rt=!1;function kr(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function wr(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Tr(){if(!rt){rt=!0;let t=kr(at);t!==null&&(nt=t)}return nt}function Sr(t){nt=t,rt=!0,wr(at,t)}function Dt(t){return typeof window>"u"||typeof document>"u"?null:je.parse({page:{title:document.title||null,path:window.location.pathname,search:window.location.search,hash:window.location.hash},referrer:t!==void 0?t:document.referrer||null,viewport:{w:window.innerWidth,h:window.innerHeight}})}function be(t){if(typeof window>"u")return;let e=window.location.href,n=Tr(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,o=Dt(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:o}),e!==n&&Sr(e)}function it(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&be(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function st(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let d=window.location.pathname+window.location.search;d!==n&&(n=d,be(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function o(...d){a(...d),setTimeout(r,0)}function s(...d){i(...d),setTimeout(r,0)}function u(d){d.persisted&&be(t)}return history.pushState=o,history.replaceState=s,window.addEventListener("popstate",r),window.addEventListener("pageshow",u),e.skipInitial||be(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",u)}}var zt=2e3,Ut=10,Le=50,Zt="X-Aranova-Api-Key";function Cr(t,e,n){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null}}function Er(){if(typeof window>"u")return Ee();try{pe()}catch{}return le(fe)}function Ar(){try{return{state:$()}}catch{return null}}async function $t(t,e,n,r){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[Zt]:n},body:e,keepalive:r,credentials:"omit",mode:"cors"})}catch{}}function ot(t){let e=t.flushIntervalMs??zt,n=Math.min(t.maxQueueSize??Ut,Le),r=t.sdkVersion??null,a=t.packageName??null,o=`${t.endpoint.replace(/\/$/,"")}/events`,s=[],u=null,d=null,h=!1,w=Xe(),ce=Ie();typeof window<"u"&&(d=window.location.href);function de(){ce=Ie();let k=Er(),F=Cr(t.surface,r,a);return{session_id:ce,visitor_id:w,gclid:k.gclid,fbclid:k.fbclid,utm_source:k.utm_source,utm_medium:k.utm_medium,utm_campaign:k.utm_campaign,utm_term:k.utm_term,utm_content:k.utm_content,first_page:d,consent_state:Ar(),context:F}}function tn(){u!==null||h||(u=setTimeout(()=>{u=null,$e()},e))}function De(){u!==null&&(clearTimeout(u),u=null)}async function $e(){if(s.length===0)return;let k=s.slice(0,Le);s=s.slice(k.length),De();let F={session:de(),events:k},ze=JSON.stringify(F);await $t(o,ze,t.apiKey,!1)}function nn(k){if(h||!k||typeof k.eventType!="string"||k.eventType.length===0)return;let F=k.occurredAt instanceof Date?k.occurredAt.toISOString():typeof k.occurredAt=="string"?k.occurredAt:new Date().toISOString();s.push({event_type:k.eventType,page_url:k.pageUrl??(typeof window>"u"?null:window.location.href),metadata:k.metadata??null,occurred_at:F}),s.length>=n?$e():tn()}function Ce(){if(s.length===0)return;let k=s.slice(0,Le);s=s.slice(k.length),De();let F={session:de(),events:k},ze=JSON.stringify(F);$t(o,ze,t.apiKey,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Ce),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ce()})),{trackEvent:nn,flush:$e,getSessionId:()=>ce,getVisitorId:()=>w,destroy:()=>{h=!0,s.length>0&&Ce(),De(),s=[],typeof window<"u"&&window.removeEventListener("pagehide",Ce)}}}var Kt=y.object({page:y.object({path:y.string()})}).strict(),Ft=y.object({pathPattern:y.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict();var Gt=y.object({form:y.object({id:y.string(),action:y.string().nullable()}),page:y.object({path:y.string()})}).strict(),Bt=y.object({}).strict();var Ht=y.object({element:y.object({tag:y.string(),text:y.string().nullable(),href:y.string()}),page:y.object({path:y.string()})}).strict(),Wt=y.object({}).strict();var Yt=y.object({duration_ms:y.number().int().nonnegative(),page:y.object({path:y.string()})}).strict(),qt=y.object({thresholdSeconds:y.number().int().positive()}).strict();var ct={page_view:{kind:"automatic",metadataSchema:je,configSchema:Lt},time_on_site:{kind:"automatic",metadataSchema:Yt,configSchema:qt},contact_page_visit:{kind:"automatic",metadataSchema:Kt,configSchema:Ft},form_submit:{kind:"manual",metadataSchema:Gt,configSchema:Bt},phone_click:{kind:"manual",metadataSchema:Ht,configSchema:Wt}},La=Object.entries(ct).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Da=Object.entries(ct).filter(([,t])=>t.kind==="manual").map(([t])=>t);function dt(t){return ct[t]}function ut(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,a=document.visibilityState==="visible"?Date.now():null,i=null,o=!1;function s(){o||(o=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function u(){if(o||a===null)return;let w=n-r;if(w<=0){s();return}i=setTimeout(s,w)}function d(){i!==null&&(clearTimeout(i),i=null)}function h(){o||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),d()):(a=Date.now(),u()))}return document.addEventListener("visibilitychange",h),u(),()=>{d(),document.removeEventListener("visibilitychange",h)}}function lt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pathPattern:n}=e,r=null;function a(){let d=window.location.pathname;n.test(d)&&r!==d&&(r=d,t.trackEvent({eventType:"contact_page_visit",metadata:{page:{path:d}},pageUrl:window.location.href,occurredAt:null}))}let i=history.pushState.bind(history),o=history.replaceState.bind(history);function s(...d){i(...d),setTimeout(a,0)}function u(...d){o(...d),setTimeout(a,0)}return history.pushState=s,history.replaceState=u,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=o,window.removeEventListener("popstate",a)}}var ft="aranova-tracking-consent-banner";function Rr(){return le(fe)}function Xt(){document.getElementById(ft)?.remove()}function Qt(t,e,n){let r=document.createElement("button");return r.type="button",r.textContent=t,Object.assign(r.style,{borderRadius:"6px",padding:"10px 16px",fontSize:"14px",fontWeight:"600",cursor:"pointer",border:"1px solid #d1d5db",background:"#ffffff",color:"#374151"},n),r.addEventListener("click",e),r}function Ir(){if(typeof document>"u"||$()!=="pending"||document.getElementById(ft))return;let t=document.createElement("div");t.id=ft,Object.assign(t.style,{position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483647",background:"#ffffff",borderTop:"1px solid #e5e7eb",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.12)",padding:"16px",fontFamily:"Inter, system-ui, sans-serif"});let e=document.createElement("div");Object.assign(e.style,{maxWidth:"960px",margin:"0 auto",display:"flex",flexDirection:"column",gap:"12px"});let n=document.createElement("p");n.textContent="We use cookies to understand ad performance and improve how our marketing works across visits. You can accept or decline this tracking.",Object.assign(n.style,{margin:"0",color:"#374151",fontSize:"14px",lineHeight:"1.5"});let r=document.createElement("div");Object.assign(r.style,{display:"flex",gap:"8px",flexWrap:"wrap"});let a=Qt("Decline",()=>{ue("denied"),Xt()},{}),i=Qt("Accept",()=>{ue("granted"),Xt()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.appendChild(a),r.appendChild(i),e.appendChild(n),e.appendChild(r),t.appendChild(e),document.body.appendChild(t)}var M=null,pt=null,oe=[];function Or(){for(let t=oe.length-1;t>=0;t--)oe[t]();oe=[],M!==null&&(M.destroy(),M=null),pt=null}function en(t={}){if(typeof window>"u")return;window.AranovaTracking=mt;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,renderConsentBanner:o=!0,triggers:s}=t;if(r&&pe(window.location.href,a),i&&He(i),o&&Ir(),Or(),!e||!n){(e||n)&&console.warn("[AranovaTracking] init() requires both `apiKey` and `endpoint` to enable first-party event ingest. Page-view events will not be sent.");return}let u=s??{automatic:{page_view:{}},manual:{}};pt=u,M=ot({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:ht}),oe.push(st(M)),oe.push(it(M));let d=u.automatic.time_on_site;d&&oe.push(ut(M,d));let h=u.automatic.contact_page_visit;h&&oe.push(lt(M,h))}function Pr(t,e){if(M===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=pt;if(n===null){console.warn("[AranovaTracking] trackEvent called but no trigger registry was passed to init()");return}let r=n.manual??{};if(!(t in r)){console.warn(`[AranovaTracking] trackEvent: event "${t}" is not registered as a manual trigger. Register it under \`triggers.manual\` in init().`);return}try{dt(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}M.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}var mt={init:en,captureTrackingParams:()=>pe(),getTrackingParams:Rr,getConsentState:$,setConsentState:ue,trackEvent:Pr};typeof window<"u"&&(window.AranovaTracking=mt);var Nr=mt;return cn(Mr);})();
1
+ "use strict";var AranovaTracking=(()=>{var Ze=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var kn=Object.prototype.hasOwnProperty;var xt=(t,e)=>{for(var n in e)Ze(t,n,{get:e[n],enumerable:!0})},xn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Sn(e))!kn.call(t,a)&&a!==n&&Ze(t,a,{get:()=>e[a],enumerable:!(r=vn(e,a))||r.enumerable});return t};var wn=t=>xn(Ze({},"__esModule",{value:!0}),t);var Jr={};xt(Jr,{default:()=>qr,init:()=>_n});var wt="0.5.0";var Ke="consent_state",Tt="consent_timestamp";function Ge(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function K(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(Ke);return t==="granted"||t==="denied"?t:"pending"}function pe(t){typeof window>"u"||(window.localStorage.setItem(Ke,t),window.localStorage.setItem(Tt,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",Ge(t)))}function He(){let t=K();return(t==="granted"||t==="denied")&&pe(t),t}var Ct="https://www.googletagmanager.com/gtag/js",Be="data-aranova-tracking";function Cn(t){return`aranova-${t}`}function Ye(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function bt(){Ye()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function Et(t){if(typeof document>"u")return;let e=Cn("gtag-loader");if(document.querySelector(`script[${Be}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${Ct}?id=${encodeURIComponent(t)}`,r.setAttribute(Be,e),document.head.appendChild(r)}function At(t){let e=Ye();e("js",new Date),e("config",t)}function We(t){typeof window>"u"||typeof document>"u"||(bt(),Et(t),At(t),He())}var qe=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Oe(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function Je(t){return typeof t=="string"&&t.length>0?t:null}function me(t){return qe.reduce((e,n)=>(e[n]=Je(t(n)),e),Oe())}function Pt(t){return qe.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}function ge(t){if(typeof document>"u")return null;let n=(document.cookie?document.cookie.split("; "):[]).find(a=>a.startsWith(`${t}=`));if(!n)return null;let[,r=""]=n.split("=");return Je(decodeURIComponent(r))}function Rt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function It(t,e=7776e3){let n=Pt(t);return Object.entries(n).forEach(([r,a])=>{Rt(r,a,e)}),n}function he(t=typeof window>"u"?"":window.location.href,e=7776e3){let n=typeof window>"u"?new URL(t||"https://example.invalid"):new URL(t,window.location.origin);return It(n.searchParams,e),me(ge)}var Xe="aranova_tracking_visitor",Me="aranova_tracking_session";function Ne(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`}function Ot(t){try{return window.localStorage.getItem(t)}catch{return null}}function Qe(t,e){try{window.localStorage.setItem(t,e)}catch{}}function et(){if(typeof window>"u")return Ne();let t=Ot(Xe);if(t&&t.length>0)return t;let e=Ne();return Qe(Xe,e),e}function ye(t=Date.now()){if(typeof window>"u")return Ne();let e=Ot(Me);if(e)try{let r=JSON.parse(e);if(typeof r.id=="string"&&typeof r.last_event_at=="number"&&t-r.last_event_at<=18e5){let a={id:r.id,last_event_at:t};return Qe(Me,JSON.stringify(a)),r.id}}catch{}let n={id:Ne(),last_event_at:t};return Qe(Me,JSON.stringify(n)),n.id}var l={};xt(l,{BRAND:()=>Jn,DIRTY:()=>q,EMPTY_PATH:()=>Pn,INVALID:()=>h,NEVER:()=>jr,OK:()=>A,ParseStatus:()=>E,Schema:()=>v,ZodAny:()=>B,ZodArray:()=>Z,ZodBigInt:()=>X,ZodBoolean:()=>Q,ZodBranded:()=>Ee,ZodCatch:()=>ue,ZodDate:()=>ee,ZodDefault:()=>de,ZodDiscriminatedUnion:()=>De,ZodEffects:()=>N,ZodEnum:()=>oe,ZodError:()=>P,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>$e,ZodIntersection:()=>ae,ZodIssueCode:()=>d,ZodLazy:()=>ie,ZodLiteral:()=>se,ZodMap:()=>we,ZodNaN:()=>Ce,ZodNativeEnum:()=>ce,ZodNever:()=>j,ZodNull:()=>ne,ZodNullable:()=>L,ZodNumber:()=>J,ZodObject:()=>R,ZodOptional:()=>O,ZodParsedType:()=>p,ZodPipeline:()=>Ae,ZodPromise:()=>Y,ZodReadonly:()=>le,ZodRecord:()=>Le,ZodSchema:()=>v,ZodSet:()=>Te,ZodString:()=>H,ZodSymbol:()=>ke,ZodTransformer:()=>N,ZodTuple:()=>D,ZodType:()=>v,ZodUndefined:()=>te,ZodUnion:()=>re,ZodUnknown:()=>U,ZodVoid:()=>xe,addIssueToContext:()=>f,any:()=>sr,array:()=>ur,bigint:()=>tr,boolean:()=>Zt,coerce:()=>Nr,custom:()=>zt,date:()=>nr,datetimeRegex:()=>Lt,defaultErrorMap:()=>z,discriminatedUnion:()=>mr,effect:()=>br,enum:()=>wr,function:()=>Sr,getErrorMap:()=>_e,getParsedType:()=>V,instanceof:()=>Qn,intersection:()=>gr,isAborted:()=>je,isAsync:()=>ve,isDirty:()=>Ve,isValid:()=>G,late:()=>Xn,lazy:()=>kr,literal:()=>xr,makeIssue:()=>be,map:()=>_r,nan:()=>er,nativeEnum:()=>Tr,never:()=>cr,null:()=>ir,nullable:()=>Ar,number:()=>Ut,object:()=>lr,objectUtil:()=>tt,oboolean:()=>Mr,onumber:()=>Or,optional:()=>Er,ostring:()=>Ir,pipeline:()=>Rr,preprocess:()=>Pr,promise:()=>Cr,quotelessJson:()=>bn,record:()=>yr,set:()=>vr,setErrorMap:()=>An,strictObject:()=>fr,string:()=>Ft,symbol:()=>rr,transformer:()=>br,tuple:()=>hr,undefined:()=>ar,union:()=>pr,unknown:()=>or,util:()=>k,void:()=>dr});var k;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let i={};for(let o of a)i[o]=o;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(let s of i)o[s]=a[s];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(let o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var tt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(tt||(tt={}));var p=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var d=k.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"]),bn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),P=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},a=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(o))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return a(this),r}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,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};P.create=t=>new P(t);var En=(t,e)=>{let n;switch(t.code){case d.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:k.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case d.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case d.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=e.defaultError,k.assertNever(t)}return{message:n}},z=En;var Mt=z;function An(t){Mt=t}function _e(){return Mt}var be=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="",u=r.filter(c=>!!c).slice().reverse();for(let c of u)s=c(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}},Pn=[];function f(t,e){let n=_e(),r=be({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===z?void 0:z].filter(a=>!!a)});t.common.issues.push(r)}var E=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let a of n){if(a.status==="aborted")return h;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n){let i=await a.key,o=await a.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return h;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),q=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),je=t=>t.status==="aborted",Ve=t=>t.status==="dirty",G=t=>t.status==="valid",ve=t=>typeof Promise<"u"&&t instanceof Promise;var m;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var M=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Nt=(t,e)=>{if(G(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new P(t.common.issues);return this._error=n,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,s)=>{let{message:u}=t;return o.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:u??n??s.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ve(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Nt(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return G(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>G(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ve(a)?a:Promise.resolve(a));return Nt(r,i)}refine(e,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let o=e(a),s=()=>i.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new N({schema:this,typeName:y.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:n=>this["~validate"](n)}}optional(){return O.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return Y.create(this,this._def)}or(e){return re.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new N({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new de({..._(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Ee({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ue({..._(this._def),innerType:this,catchValue:n,typeName:y.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Rn=/^c[^\s-]{8,}$/i,In=/^[0-9a-z]+$/,On=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Mn=/^[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,Nn=/^[a-z0-9_-]{21}$/i,jn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vn=/^[-+]?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)?)??$/,Dn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ln="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",nt,$n=/^(?:(?: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])$/,zn=/^(?:(?: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])$/,Fn=/^(([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]))$/,Un=/^(([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])$/,Zn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vt="((\\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])))",Gn=new RegExp(`^${Vt}$`);function Dt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Hn(t){return new RegExp(`^${Dt(t)}$`)}function Lt(t){let e=`${Vt}T${Dt(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Bn(t,e){return!!((e==="v4"||!e)&&$n.test(t)||(e==="v6"||!e)&&Fn.test(t))}function Yn(t,e){if(!jn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Wn(t,e){return!!((e==="v4"||!e)&&zn.test(t)||(e==="v6"||!e)&&Un.test(t))}var H=class t extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let i=this._getOrReturnCtx(e);return f(i,{code:d.invalid_type,expected:p.string,received:i.parsedType}),h}let r=new E,a;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?f(a,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&f(a,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Dn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")nt||(nt=new RegExp(Ln,"u")),nt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Mn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Nn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Rn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")In.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")On.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),f(a,{validation:"url",code:d.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"regex",code:d.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Lt(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Gn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Hn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:d.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Vn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Bn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Yn(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Wn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Zn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Kn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:d.invalid_string,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...m.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...m.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...m.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...m.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...m.errToObj(n)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};H.create=t=>new H({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,..._(t)});function qn(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(t.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}var J=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let i=this._getOrReturnCtx(e);return f(i,{code:d.invalid_type,expected:p.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?qn(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_finite,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};J.create=t=>new J({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var X=class t extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let r,a=new E;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):k.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,m.toString(n))}gt(e,n){return this.setLimit("min",e,!1,m.toString(n))}lte(e,n){return this.setLimit("max",e,!0,m.toString(n))}lt(e,n){return this.setLimit("max",e,!1,m.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:m.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:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};X.create=t=>new X({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var Q=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.boolean,received:r.parsedType}),h}return A(e.data)}};Q.create=t=>new Q({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var ee=class t extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let i=this._getOrReturnCtx(e);return f(i,{code:d.invalid_type,expected:p.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return f(i,{code:d.invalid_date}),h}let r=new E,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:d.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:d.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):k.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};ee.create=t=>new ee({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var ke=class extends v{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.symbol,received:r.parsedType}),h}return A(e.data)}};ke.create=t=>new ke({typeName:y.ZodSymbol,..._(t)});var te=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.undefined,received:r.parsedType}),h}return A(e.data)}};te.create=t=>new te({typeName:y.ZodUndefined,..._(t)});var ne=class extends v{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.null,received:r.parsedType}),h}return A(e.data)}};ne.create=t=>new ne({typeName:y.ZodNull,..._(t)});var B=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}};B.create=t=>new B({typeName:y.ZodAny,..._(t)});var U=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}};U.create=t=>new U({typeName:y.ZodUnknown,..._(t)});var j=class extends v{_parse(e){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.never,received:n.parsedType}),h}};j.create=t=>new j({typeName:y.ZodNever,..._(t)});var xe=class extends v{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.void,received:r.parsedType}),h}return A(e.data)}};xe.create=t=>new xe({typeName:y.ZodVoid,..._(t)});var Z=class t extends v{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==p.array)return f(n,{code:d.invalid_type,expected:p.array,received:n.parsedType}),h;if(a.exactLength!==null){let o=n.data.length>a.exactLength.value,s=n.data.length<a.exactLength.value;(o||s)&&(f(n,{code:o?d.too_big:d.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(f(n,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(f(n,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>a.type._parseAsync(new M(n,o,n.path,s)))).then(o=>E.mergeArray(r,o));let i=[...n.data].map((o,s)=>a.type._parseSync(new M(n,o,n.path,s)));return E.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:m.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:m.toString(n)}})}nonempty(e){return this.min(1,e)}};Z.create=(t,e)=>new Z({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function Se(t){if(t instanceof R){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=O.create(Se(r))}return new R({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:Se(t.element)}):t instanceof O?O.create(Se(t.unwrap())):t instanceof L?L.create(Se(t.unwrap())):t instanceof D?D.create(t.items.map(e=>Se(e))):t}var R=class t extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=k.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let c=this._getOrReturnCtx(e);return f(c,{code:d.invalid_type,expected:p.object,received:c.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let c in a.data)o.includes(c)||s.push(c);let u=[];for(let c of o){let g=i[c],x=a.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new M(a,x,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof j){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(c==="strict")s.length>0&&(f(a,{code:d.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let x=a.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new M(a,x,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let c=[];for(let g of u){let x=await g.key,w=await g.value;c.push({key:x,value:w,alwaysSet:g.alwaysSet})}return c}).then(c=>E.mergeObjectSync(r,c)):E.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:m.errToObj(e).message??a}:{message:a}}}:{}})}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:y.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of k.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of k.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Se(this)}partial(e){let n={};for(let r of k.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of k.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof O;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return $t(k.objectKeys(this.shape))}};R.create=(t,e)=>new R({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:y.ZodObject,..._(e)});R.strictCreate=(t,e)=>new R({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:y.ZodObject,..._(e)});R.lazycreate=(t,e)=>new R({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:y.ZodObject,..._(e)});var re=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new P(s.ctx.common.issues));return f(n,{code:d.invalid_union,unionErrors:o}),h}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(a);{let i,o=[];for(let u of r){let c={...n,common:{...n.common,issues:[]},parent:null},g=u._parseSync({data:n.data,path:n.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(u=>new P(u));return f(n,{code:d.invalid_union,unionErrors:s}),h}}get options(){return this._def.options}};re.create=(t,e)=>new re({options:t,typeName:y.ZodUnion,..._(e)});var F=t=>t instanceof ie?F(t.schema):t instanceof N?F(t.innerType()):t instanceof se?[t.value]:t instanceof oe?t.options:t instanceof ce?k.objectValues(t.enum):t instanceof de?F(t._def.innerType):t instanceof te?[void 0]:t instanceof ne?[null]:t instanceof O?[void 0,...F(t.unwrap())]:t instanceof L?[null,...F(t.unwrap())]:t instanceof Ee||t instanceof le?F(t.unwrap()):t instanceof ue?F(t._def.innerType):[],De=class t extends v{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:d.invalid_type,expected:p.object,received:n.parsedType}),h;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(f(n,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let a=new Map;for(let i of n){let o=F(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,..._(r)})}};function rt(t,e){let n=V(t),r=V(e);if(t===e)return{valid:!0,data:t};if(n===p.object&&r===p.object){let a=k.objectKeys(e),i=k.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(let s of i){let u=rt(t[s],e[s]);if(!u.valid)return{valid:!1};o[s]=u.data}return{valid:!0,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let o=t[i],s=e[i],u=rt(o,s);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return n===p.date&&r===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ae=class extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,o)=>{if(je(i)||je(o))return h;let s=rt(i.value,o.value);return s.valid?((Ve(i)||Ve(o))&&n.dirty(),{status:n.value,value:s.data}):(f(r,{code:d.invalid_intersection_types}),h)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ae.create=(t,e,n)=>new ae({left:t,right:e,typeName:y.ZodIntersection,..._(n)});var D=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:d.invalid_type,expected:p.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return f(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new M(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>E.mergeArray(n,o)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};D.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new D({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var Le=class t extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return f(r,{code:d.invalid_type,expected:p.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)a.push({key:i._parse(new M(r,s,r.path,s)),value:o._parse(new M(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?E.mergeObjectAsync(n,a):E.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof v?new t({keyType:e,valueType:n,typeName:y.ZodRecord,..._(r)}):new t({keyType:H.create(),valueType:e,typeName:y.ZodRecord,..._(n)})}},we=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return f(r,{code:d.invalid_type,expected:p.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,u],c)=>({key:a._parse(new M(r,s,r.path,[c,"key"])),value:i._parse(new M(r,u,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,g=await u.value;if(c.status==="aborted"||g.status==="aborted")return h;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),s.set(c.value,g.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let u of o){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return h;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),s.set(c.value,g.value)}return{status:n.value,value:s}}}};we.create=(t,e,n)=>new we({valueType:e,keyType:t,typeName:y.ZodMap,..._(n)});var Te=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:d.invalid_type,expected:p.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(f(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function o(u){let c=new Set;for(let g of u){if(g.status==="aborted")return h;g.status==="dirty"&&n.dirty(),c.add(g.value)}return{status:n.value,value:c}}let s=[...r.data.values()].map((u,c)=>i._parse(new M(r,u,r.path,c)));return r.common.async?Promise.all(s).then(u=>o(u)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:m.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:m.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Te.create=(t,e)=>new Te({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var $e=class t extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return f(n,{code:d.invalid_type,expected:p.function,received:n.parsedType}),h;function r(s,u){return be({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),z].filter(c=>!!c),issueData:{code:d.invalid_arguments,argumentsError:u}})}function a(s,u){return be({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_e(),z].filter(c=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:u}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof Y){let s=this;return A(async function(...u){let c=new P([]),g=await s._def.args.parseAsync(u,i).catch(C=>{throw c.addIssue(r(u,C)),c}),x=await Reflect.apply(o,this,g);return await s._def.returns._def.type.parseAsync(x,i).catch(C=>{throw c.addIssue(a(x,C)),c})})}else{let s=this;return A(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new P([r(u,c.error)]);let g=Reflect.apply(o,this,c.data),x=s._def.returns.safeParse(g,i);if(!x.success)throw new P([a(g,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:D.create(e).rest(U.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||D.create([]).rest(U.create()),returns:n||U.create(),typeName:y.ZodFunction,..._(r)})}},ie=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ie.create=(t,e)=>new ie({getter:t,typeName:y.ZodLazy,..._(e)});var se=class extends v{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return f(n,{received:n.data,code:d.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};se.create=(t,e)=>new se({value:t,typeName:y.ZodLiteral,..._(e)});function $t(t,e){return new oe({values:t,typeName:y.ZodEnum,..._(e)})}var oe=class t extends v{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{expected:k.joinValues(r),received:n.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return f(n,{received:n.data,code:d.invalid_enum_value,options:r}),h}return A(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;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(r=>!e.includes(r)),{...this._def,...n})}};oe.create=$t;var ce=class extends v{_parse(e){let n=k.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let a=k.objectValues(n);return f(r,{expected:k.joinValues(a),received:r.parsedType,code:d.invalid_type}),h}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=k.objectValues(n);return f(r,{received:r.data,code:d.invalid_enum_value,options:a}),h}return A(e.data)}get enum(){return this._def.values}};ce.create=(t,e)=>new ce({values:t,typeName:y.ZodNativeEnum,..._(e)});var Y=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===!1)return f(n,{code:d.invalid_type,expected:p.promise,received:n.parsedType}),h;let r=n.parsedType===p.promise?n.data:Promise.resolve(n.data);return A(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Y.create=(t,e)=>new Y({type:t,typeName:y.ZodPromise,..._(e)});var N=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{f(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let o=a.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return h;let u=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return u.status==="aborted"?h:u.status==="dirty"?q(u.value):n.value==="dirty"?q(u.value):u});{if(n.value==="aborted")return h;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?h:s.status==="dirty"?q(s.value):n.value==="dirty"?q(s.value):s}}if(a.type==="refinement"){let o=s=>{let u=a.refinement(s,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?h:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!G(o))return h;let s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>G(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:n.value,value:s})):h);k.assertNever(a)}};N.create=(t,e,n)=>new N({schema:t,typeName:y.ZodEffects,effect:e,..._(n)});N.createWithPreprocess=(t,e,n)=>new N({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(n)});var O=class extends v{_parse(e){return this._getType(e)===p.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(t,e)=>new O({innerType:t,typeName:y.ZodOptional,..._(e)});var L=class extends v{_parse(e){return this._getType(e)===p.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(t,e)=>new L({innerType:t,typeName:y.ZodNullable,..._(e)});var de=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};de.create=(t,e)=>new de({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ue=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ve(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new P(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new P(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ue.create=(t,e)=>new ue({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Ce=class extends v{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Ce.create=t=>new Ce({typeName:y.ZodNaN,..._(t)});var Jn=Symbol("zod_brand"),Ee=class extends v{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Ae=class t extends v{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?h:i.status==="dirty"?(n.dirty(),q(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?h:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:y.ZodPipeline})}},le=class extends v{_parse(e){let n=this._def.innerType._parse(e),r=a=>(G(a)&&(a.value=Object.freeze(a.value)),a);return ve(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodReadonly,..._(e)});function jt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function zt(t,e={},n){return t?B.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let s=jt(e,r),u=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:u})}});if(!i){let o=jt(e,r),s=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:s})}}):B.create()}var Xn={object:R.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var Qn=(t,e={message:`Input not instance of ${t.name}`})=>zt(n=>n instanceof t,e),Ft=H.create,Ut=J.create,er=Ce.create,tr=X.create,Zt=Q.create,nr=ee.create,rr=ke.create,ar=te.create,ir=ne.create,sr=B.create,or=U.create,cr=j.create,dr=xe.create,ur=Z.create,lr=R.create,fr=R.strictCreate,pr=re.create,mr=De.create,gr=ae.create,hr=D.create,yr=Le.create,_r=we.create,vr=Te.create,Sr=$e.create,kr=ie.create,xr=se.create,wr=oe.create,Tr=ce.create,Cr=Y.create,br=N.create,Er=O.create,Ar=L.create,Pr=N.createWithPreprocess,Rr=Ae.create,Ir=()=>Ft().optional(),Or=()=>Ut().optional(),Mr=()=>Zt().optional(),Nr={string:(t=>H.create({...t,coerce:!0})),number:(t=>J.create({...t,coerce:!0})),boolean:(t=>Q.create({...t,coerce:!0})),bigint:(t=>X.create({...t,coerce:!0})),date:(t=>ee.create({...t,coerce:!0}))};var jr=h;var ze=l.object({page:l.object({title:l.string().nullable(),path:l.string(),search:l.string(),hash:l.string()}),referrer:l.string().nullable(),viewport:l.object({w:l.number(),h:l.number()}).nullable().optional()}).strict(),Kt=l.object({}).strict();var st="aranova_tracking_last_fired_url",at=null,it=!1;function Vr(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function Dr(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function Lr(){if(!it){it=!0;let t=Vr(st);t!==null&&(at=t)}return at}function $r(t){at=t,it=!0,Dr(st,t)}function Gt(t){return typeof window>"u"||typeof document>"u"?null:ze.parse({page:{title:document.title||null,path:window.location.pathname,search:window.location.search,hash:window.location.hash},referrer:t!==void 0?t:document.referrer||null,viewport:{w:window.innerWidth,h:window.innerHeight}})}function Pe(t){if(typeof window>"u")return;let e=window.location.href,n=Lr(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,o=Gt(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:o}),e!==n&&$r(e)}function ot(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Pe(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function ct(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let c=window.location.pathname+window.location.search;c!==n&&(n=c,Pe(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function o(...c){a(...c),setTimeout(r,0)}function s(...c){i(...c),setTimeout(r,0)}function u(c){c.persisted&&Pe(t)}return history.pushState=o,history.replaceState=s,window.addEventListener("popstate",r),window.addEventListener("pageshow",u),e.skipInitial||Pe(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",u)}}var Bt=2e3,Yt=10,Fe=50,Wt="X-Aranova-Api-Key";function Fr(t,e,n){return{surface:t,sdk_version:e,package_name:n,site_origin:typeof window>"u"?null:window.location.origin,page_title:typeof document>"u"?null:document.title||null,referrer:typeof document>"u"?null:document.referrer||null}}function Ur(){if(typeof window>"u")return Oe();try{he()}catch{}return me(ge)}function Zr(){try{return{state:K()}}catch{return null}}async function Ht(t,e,n,r){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[Wt]:n},body:e,keepalive:r,credentials:"omit",mode:"cors"})}catch{}}function dt(t){let e=t.flushIntervalMs??Bt,n=Math.min(t.maxQueueSize??Yt,Fe),r=t.sdkVersion??null,a=t.packageName??null,o=`${t.endpoint.replace(/\/$/,"")}/events`,s=[],u=null,c=null,g=!1,x=et(),w=ye();typeof window<"u"&&(c=window.location.href);function C(){w=ye();let T=Ur(),W=Fr(t.surface,r,a);return{session_id:w,visitor_id:x,gclid:T.gclid,fbclid:T.fbclid,utm_source:T.utm_source,utm_medium:T.utm_medium,utm_campaign:T.utm_campaign,utm_term:T.utm_term,utm_content:T.utm_content,first_page:c,consent_state:Zr(),context:W}}function S(){u!==null||g||(u=setTimeout(()=>{u=null,fe()},e))}function b(){u!==null&&(clearTimeout(u),u=null)}async function fe(){if(s.length===0)return;let T=s.slice(0,Fe);s=s.slice(T.length),b();let W={session:C(),events:T},Ue=JSON.stringify(W);await Ht(o,Ue,t.apiKey,!1)}function Re(T){if(g||!T||typeof T.eventType!="string"||T.eventType.length===0)return;let W=T.occurredAt instanceof Date?T.occurredAt.toISOString():typeof T.occurredAt=="string"?T.occurredAt:new Date().toISOString();s.push({event_type:T.eventType,page_url:T.pageUrl??(typeof window>"u"?null:window.location.href),metadata:T.metadata??null,occurred_at:W}),s.length>=n?fe():S()}function Ie(){if(s.length===0)return;let T=s.slice(0,Fe);s=s.slice(T.length),b();let W={session:C(),events:T},Ue=JSON.stringify(W);Ht(o,Ue,t.apiKey,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Ie),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ie()})),{trackEvent:Re,flush:fe,getSessionId:()=>w,getVisitorId:()=>x,destroy:()=>{g=!0,s.length>0&&Ie(),b(),s=[],typeof window<"u"&&window.removeEventListener("pagehide",Ie)}}}var qt=l.object({cta_name:l.string(),page:l.object({path:l.string()}),section:l.string().nullable().optional(),destination_url:l.string().nullable().optional()}).strict(),Jt=l.object({}).strict();var Xt=l.object({form:l.object({id:l.string(),action:l.string().nullable()}),page:l.object({path:l.string()})}).strict(),Qt=l.object({selector:l.string().optional()}).strict();var en=l.object({form:l.object({id:l.string(),action:l.string().nullable(),fields:l.array(l.object({name:l.string(),type:l.string(),label:l.string().nullable(),has_value:l.boolean()})).optional()}),page:l.object({path:l.string()})}).strict(),tn=l.object({}).strict();var nn=l.object({page_count:l.number().int().min(2),page:l.object({path:l.string()})}).strict(),rn=l.object({pageThreshold:l.number().int().min(2)}).strict();var an=l.object({phone_number:l.string(),page:l.object({path:l.string()}),section:l.string().nullable().optional()}).strict(),sn=l.object({}).strict();var on=l.object({depth_percent:l.number().int().min(1).max(100),page:l.object({path:l.string()})}).strict(),cn=l.object({thresholds:l.array(l.number().int().min(1).max(100)).min(1)}).strict();var Kr=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],dn=l.enum(Kr),un=l.object({page_name:dn,page:l.object({path:l.string()})}).strict(),ln=l.object({pages:l.array(l.object({name:dn,pathPattern:l.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})})).min(1)}).strict();var fn=l.object({duration_ms:l.number().int().nonnegative(),page:l.object({path:l.string()})}).strict(),pn=l.object({thresholdSeconds:l.number().int().positive()}).strict();var ut={page_view:{kind:"automatic",metadataSchema:ze,configSchema:Kt},time_on_site:{kind:"automatic",metadataSchema:fn,configSchema:pn},specific_page_visit:{kind:"automatic",metadataSchema:un,configSchema:ln},scroll_depth:{kind:"automatic",metadataSchema:on,configSchema:cn},multi_page_session:{kind:"automatic",metadataSchema:nn,configSchema:rn},form_start:{kind:"automatic",metadataSchema:Xt,configSchema:Qt},form_submit:{kind:"manual",metadataSchema:en,configSchema:tn},phone_click:{kind:"manual",metadataSchema:an,configSchema:sn},cta_click:{kind:"manual",metadataSchema:qt,configSchema:Jt}},fi=Object.entries(ut).filter(([,t])=>t.kind==="automatic").map(([t])=>t),pi=Object.entries(ut).filter(([,t])=>t.kind==="manual").map(([t])=>t);function lt(t){return ut[t]}function ft(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.thresholdSeconds*1e3,r=0,a=document.visibilityState==="visible"?Date.now():null,i=null,o=!1;function s(){o||(o=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function u(){if(o||a===null)return;let x=n-r;if(x<=0){s();return}i=setTimeout(s,x)}function c(){i!==null&&(clearTimeout(i),i=null)}function g(){o||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),c()):(a=Date.now(),u()))}return document.addEventListener("visibilitychange",g),u(),()=>{c(),document.removeEventListener("visibilitychange",g)}}function pt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function a(){let c=window.location.pathname;for(let{name:g,pathPattern:x}of n){if(x.lastIndex=0,!x.test(c))continue;let w=`${g}:${c}`;r.has(w)||(r.add(w),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:g,page:{path:c}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),o=history.replaceState.bind(history);function s(...c){i(...c),setTimeout(a,0)}function u(...c){o(...c),setTimeout(a,0)}return history.pushState=s,history.replaceState=u,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=o,window.removeEventListener("popstate",a)}}function mt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=new Set(e.thresholds),r=new Set,a=window.location.pathname,i=null;function o(){let S=document.documentElement,b=window.scrollY||S.scrollTop,fe=S.scrollHeight,Re=S.clientHeight;return fe<=Re?100:Math.round((b+Re)/fe*100)}function s(){let S=o();for(let b of n)S>=b&&!r.has(b)&&(r.add(b),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:b,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function u(){i===null&&(i=requestAnimationFrame(()=>{i=null,s()}))}function c(){let S=window.location.pathname;S!==a&&(a=S,r=new Set,setTimeout(s,0))}let g=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){g(...S),setTimeout(c,0)}function C(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),window.addEventListener("scroll",u,{passive:!0}),setTimeout(s,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=g,history.replaceState=x,window.removeEventListener("popstate",c),window.removeEventListener("scroll",u)}}var gt="aranova_tracking_mps_paths",mn="aranova_tracking_mps_session",ht="aranova_tracking_mps_fired";function Gr(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function yt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=Gr();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let S=n.getItem(gt);return S?new Set(JSON.parse(S)):new Set}catch{return new Set}}function o(S){try{n.setItem(gt,JSON.stringify([...S]))}catch{}}function s(){let S=ye();n.getItem(mn)!==S&&(n.setItem(mn,S),n.removeItem(gt),n.removeItem(ht))}function u(){return n.getItem(ht)==="1"}function c(){let S=window.location.pathname;if(S===a||(a=S,s(),u()))return;let b=i();b.add(S),o(b),b.size>=r&&(n.setItem(ht,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:b.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let g=history.pushState.bind(history),x=history.replaceState.bind(history);function w(...S){g(...S),setTimeout(c,0)}function C(...S){x(...S),setTimeout(c,0)}return history.pushState=w,history.replaceState=C,window.addEventListener("popstate",c),c(),()=>{history.pushState=g,history.replaceState=x,window.removeEventListener("popstate",c)}}function _t(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,a=window.location.pathname;function i(w){if(w.id)return`id:${w.id}`;let C=w.getAttribute("action");return C?`action:${C}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(w)}`}function o(w){let C=w.target;if(!(C instanceof HTMLElement))return;let S=C.closest(n);if(!S||S.tagName!=="FORM")return;let b=i(S);r.has(b)||(r.add(b),t.trackEvent({eventType:"form_start",metadata:{form:{id:S.id||"",action:S.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function s(){let w=window.location.pathname;w!==a&&(a=w,r=new Set)}let u=history.pushState.bind(history),c=history.replaceState.bind(history);function g(...w){u(...w),setTimeout(s,0)}function x(...w){c(...w),setTimeout(s,0)}return history.pushState=g,history.replaceState=x,window.addEventListener("popstate",s),document.addEventListener("focusin",o),()=>{history.pushState=u,history.replaceState=c,window.removeEventListener("popstate",s),document.removeEventListener("focusin",o)}}var vt="aranova-tracking-consent-banner";function Hr(){return me(ge)}function hn(){document.getElementById(vt)?.remove()}function yn(t,e,n){let r=document.createElement("button");return r.type="button",r.textContent=t,Object.assign(r.style,{borderRadius:"6px",padding:"10px 16px",fontSize:"14px",fontWeight:"600",cursor:"pointer",border:"1px solid #d1d5db",background:"#ffffff",color:"#374151"},n),r.addEventListener("click",e),r}function Br(){if(typeof document>"u"||K()!=="pending"||document.getElementById(vt))return;let t=document.createElement("div");t.id=vt,Object.assign(t.style,{position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483647",background:"#ffffff",borderTop:"1px solid #e5e7eb",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.12)",padding:"16px",fontFamily:"Inter, system-ui, sans-serif"});let e=document.createElement("div");Object.assign(e.style,{maxWidth:"960px",margin:"0 auto",display:"flex",flexDirection:"column",gap:"12px"});let n=document.createElement("p");n.textContent="We use cookies to understand ad performance and improve how our marketing works across visits. You can accept or decline this tracking.",Object.assign(n.style,{margin:"0",color:"#374151",fontSize:"14px",lineHeight:"1.5"});let r=document.createElement("div");Object.assign(r.style,{display:"flex",gap:"8px",flexWrap:"wrap"});let a=yn("Decline",()=>{pe("denied"),hn()},{}),i=yn("Accept",()=>{pe("granted"),hn()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.appendChild(a),r.appendChild(i),e.appendChild(n),e.appendChild(r),t.appendChild(e),document.body.appendChild(t)}var I=null,St=null,$=[];function Yr(){for(let t=$.length-1;t>=0;t--)$[t]();$=[],I!==null&&(I.destroy(),I=null),St=null}function _n(t={}){if(typeof window>"u")return;window.AranovaTracking=kt;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,renderConsentBanner:o=!0,triggers:s}=t;if(r&&he(window.location.href,a),i&&We(i),o&&Br(),Yr(),!e||!n){(e||n)&&console.warn("[AranovaTracking] init() requires both `apiKey` and `endpoint` to enable first-party event ingest. Page-view events will not be sent.");return}let u=s??{automatic:{page_view:{}},manual:{}};St=u,I=dt({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:wt}),$.push(ct(I)),$.push(ot(I));let c=u.automatic.time_on_site;c&&$.push(ft(I,c));let g=u.automatic.specific_page_visit;g&&$.push(pt(I,g));let x=u.automatic.scroll_depth;x&&$.push(mt(I,x));let w=u.automatic.multi_page_session;w&&$.push(yt(I,w));let C=u.automatic.form_start;C&&$.push(_t(I,C))}function Wr(t,e){if(I===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=St;if(n===null){console.warn("[AranovaTracking] trackEvent called but no trigger registry was passed to init()");return}let r=n.manual??{};if(!(t in r)){console.warn(`[AranovaTracking] trackEvent: event "${t}" is not registered as a manual trigger. Register it under \`triggers.manual\` in init().`);return}try{lt(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}I.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}var kt={init:_n,captureTrackingParams:()=>he(),getTrackingParams:Hr,getConsentState:K,setConsentState:pe,trackEvent:Wr};typeof window<"u"&&(window.AranovaTracking=kt);var qr=kt;return wn(Jr);})();
2
2
  //# sourceMappingURL=aranova-tracking.global.js.map