@aranova/tracking-browser 0.12.1 → 0.13.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 rt=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Yn=Object.getOwnPropertyNames;var Wn=Object.prototype.hasOwnProperty;var Ft=(t,e)=>{for(var n in e)rt(t,n,{get:e[n],enumerable:!0})},Jn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Yn(e))!Wn.call(t,a)&&a!==n&&rt(t,a,{get:()=>e[a],enumerable:!(r=qn(e,a))||r.enumerable});return t};var Qn=t=>Jn(rt({},"__esModule",{value:!0}),t);var Va={};Ft(Va,{default:()=>Ma,init:()=>Hn});var Ut="0.12.1";var at="consent_state",Kt="consent_timestamp";function it(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function B(){if(typeof window>"u")return"pending";let t=window.localStorage.getItem(at);return t==="granted"||t==="denied"?t:"pending"}function fe(t){typeof window>"u"||(window.localStorage.setItem(at,t),window.localStorage.setItem(Kt,new Date().toISOString()),typeof window.gtag=="function"&&window.gtag("consent","update",it(t)))}function Ve(){let t=B();return(t==="granted"||t==="denied")&&fe(t),t}var Gt="https://www.googletagmanager.com/gtag/js",st="data-aranova-tracking";function er(t){return`aranova-${t}`}var tr=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function ot(t){return tr.test(t)}function je(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function ct(){je()("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",wait_for_update:500})}function ut(t){if(typeof document>"u")return;let e=er("gtag-loader");if(document.querySelector(`script[${st}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${Gt}?id=${encodeURIComponent(t)}`,r.setAttribute(st,e),document.head.append(r)}function Ht(t){let e=je();e("js",new Date),e("config",t)}function dt(t){typeof window>"u"||typeof document>"u"||ot(t)&&(ct(),ut(t),Ht(t),Ve())}function lt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(ot);if(e.length===0)return;ct(),ut(e[0]);let n=je();n("js",new Date);for(let r of e)n("config",r);Ve()}var pt=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function De(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function mt(t){return typeof t=="string"&&t.length>0?t:null}function ge(t){return pt.reduce((e,n)=>(e[n]=mt(t(n)),e),De())}function Zt(t){return pt.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}function he(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 mt(decodeURIComponent(r))}function Bt(t,e,n=7776e3){if(typeof document>"u")return;let r=encodeURIComponent(e);document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}function qt(t,e=7776e3){let n=Zt(t);return Object.entries(n).forEach(([r,a])=>{Bt(r,a,e)}),n}function ye(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 qt(n.searchParams,e),ge(he)}var ft="aranova_tracking_visitor",Le="aranova_tracking_session";function $e(){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 Yt(t){try{return window.localStorage.getItem(t)}catch{return null}}function gt(t,e){try{window.localStorage.setItem(t,e)}catch{}}function ht(){if(typeof window>"u")return $e();let t=Yt(ft);if(t&&t.length>0)return t;let e=$e();return gt(ft,e),e}function _e(t=Date.now()){if(typeof window>"u")return{id:$e(),isNew:!0};let e=Yt(Le);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 gt(Le,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:$e(),last_event_at:t};return gt(Le,JSON.stringify(n)),{id:n.id,isNew:!0}}var c={};Ft(c,{BRAND:()=>Er,DIRTY:()=>Q,EMPTY_PATH:()=>ir,INVALID:()=>h,NEVER:()=>la,OK:()=>R,ParseStatus:()=>E,Schema:()=>x,ZodAny:()=>W,ZodArray:()=>Z,ZodBigInt:()=>ee,ZodBoolean:()=>te,ZodBranded:()=>Ae,ZodCatch:()=>pe,ZodDate:()=>ne,ZodDefault:()=>le,ZodDiscriminatedUnion:()=>Ue,ZodEffects:()=>V,ZodEnum:()=>ue,ZodError:()=>I,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>Ge,ZodIntersection:()=>se,ZodIssueCode:()=>l,ZodLazy:()=>oe,ZodLiteral:()=>ce,ZodMap:()=>we,ZodNaN:()=>Te,ZodNativeEnum:()=>de,ZodNever:()=>D,ZodNull:()=>ae,ZodNullable:()=>F,ZodNumber:()=>X,ZodObject:()=>A,ZodOptional:()=>N,ZodParsedType:()=>f,ZodPipeline:()=>Pe,ZodPromise:()=>J,ZodReadonly:()=>me,ZodRecord:()=>Ke,ZodSchema:()=>x,ZodSet:()=>Ce,ZodString:()=>Y,ZodSymbol:()=>ke,ZodTransformer:()=>V,ZodTuple:()=>z,ZodType:()=>x,ZodUndefined:()=>re,ZodUnion:()=>ie,ZodUnknown:()=>H,ZodVoid:()=>be,addIssueToContext:()=>m,any:()=>jr,array:()=>zr,bigint:()=>Pr,boolean:()=>on,coerce:()=>da,custom:()=>rn,date:()=>Or,datetimeRegex:()=>tn,defaultErrorMap:()=>K,discriminatedUnion:()=>Gr,effect:()=>na,enum:()=>Xr,function:()=>Wr,getErrorMap:()=>ve,getParsedType:()=>$,instanceof:()=>Ir,intersection:()=>Hr,isAborted:()=>ze,isAsync:()=>Se,isDirty:()=>Fe,isValid:()=>q,late:()=>Rr,lazy:()=>Jr,literal:()=>Qr,makeIssue:()=>Ie,map:()=>qr,nan:()=>Ar,nativeEnum:()=>ea,never:()=>Lr,null:()=>Vr,nullable:()=>aa,number:()=>sn,object:()=>Fr,objectUtil:()=>yt,oboolean:()=>ua,onumber:()=>ca,optional:()=>ra,ostring:()=>oa,pipeline:()=>sa,preprocess:()=>ia,promise:()=>ta,quotelessJson:()=>nr,record:()=>Br,set:()=>Yr,setErrorMap:()=>ar,strictObject:()=>Ur,string:()=>an,symbol:()=>Nr,transformer:()=>na,tuple:()=>Zr,undefined:()=>Mr,union:()=>Kr,unknown:()=>Dr,util:()=>k,void:()=>$r});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 s of a)i[s]=s;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return t.objectValues(s)},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 s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(let s of a)if(i(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var yt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(yt||(yt={}));var f=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=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 l=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"]),nr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),I=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 s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,d=0;for(;d<s.path.length;){let u=s.path[d];d===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};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()}};I.create=t=>new I(t);var rr=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===f.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.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 l.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 l.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 l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,k.assertNever(t)}return{message:n}},K=rr;var Wt=K;function ar(t){Wt=t}function ve(){return Wt}var Ie=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",d=r.filter(u=>!!u).slice().reverse();for(let u of d)o=u(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}},ir=[];function m(t,e){let n=ve(),r=Ie({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===K?void 0:K].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,s=await a.value;r.push({key:i,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return h;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),Q=t=>({status:"dirty",value:t}),R=t=>({status:"valid",value:t}),ze=t=>t.status==="aborted",Fe=t=>t.status==="dirty",q=t=>t.status==="valid",Se=t=>typeof Promise<"u"&&t instanceof Promise;var g;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));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}},Jt=(t,e)=>{if(q(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 I(t.common.issues);return this._error=n,this._error}}};function v(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:(s,o)=>{let{message:d}=t;return s.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:d??n??o.defaultError}},description:a}}var x=class{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:$(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:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Se(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:$(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Jt(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return q(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=>q(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:$(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(Se(a)?a:Promise.resolve(a));return Jt(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 s=e(a),o=()=>i.addIssue({code:l.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(d=>d?!0:(o(),!1)):s?!0:(o(),!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 V({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 N.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return J.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return se.create(this,e,this._def)}transform(e){return new V({...v(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new le({...v(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new Ae({typeName:y.ZodBranded,type:this,...v(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new pe({...v(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 Pe.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sr=/^c[^\s-]{8,}$/i,or=/^[0-9a-z]+$/,cr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ur=/^[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,dr=/^[a-z0-9_-]{21}$/i,lr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pr=/^[-+]?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)?)??$/,mr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_t,gr=/^(?:(?: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])$/,hr=/^(?:(?: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])$/,yr=/^(([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]))$/,_r=/^(([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])$/,vr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xt="((\\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])))",xr=new RegExp(`^${Xt}$`);function en(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 kr(t){return new RegExp(`^${en(t)}$`)}function tn(t){let e=`${Xt}T${en(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 br(t,e){return!!((e==="v4"||!e)&&gr.test(t)||(e==="v6"||!e)&&yr.test(t))}function wr(t,e){if(!lr.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 Cr(t,e){return!!((e==="v4"||!e)&&hr.test(t)||(e==="v6"||!e)&&_r.test(t))}var Y=class t extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let i=this._getOrReturnCtx(e);return m(i,{code:l.invalid_type,expected:f.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),m(a,{code:l.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),m(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?m(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(a,{code:l.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")mr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"email",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")_t||(_t=new RegExp(fr,"u")),_t.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"emoji",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ur.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"uuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"nanoid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"cuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")or.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"cuid2",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")cr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"ulid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),m(a,{validation:"url",code:l.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),m(a,{validation:"regex",code:l.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),m(a,{code:l.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),m(a,{code:l.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),m(a,{code:l.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?tn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:l.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?xr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:l.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?kr(i).test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:l.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?pr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"duration",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?br(e.data,i.version)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"ip",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?wr(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"jwt",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Cr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"cidr",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?vr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"base64",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Sr.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"base64url",code:l.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:l.invalid_string,...g.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...g.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...g.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...g.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...g.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...g.errToObj(n)})}nonempty(e){return this.min(1,g.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}};Y.create=t=>new Y({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,...v(t)});function Tr(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(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}var X=class t extends x{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 m(i,{code:l.invalid_type,expected:f.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),m(r,{code:l.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),m(r,{code:l.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),m(r,{code:l.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Tr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:l.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:l.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,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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)}};X.create=t=>new X({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,...v(t)});var ee=class t extends x{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 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),m(r,{code:l.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),m(r,{code:l.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),m(r,{code:l.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 m(n,{code:l.invalid_type,expected:f.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.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:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.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}};ee.create=t=>new ee({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,...v(t)});var te=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.boolean,received:r.parsedType}),h}return R(e.data)}};te.create=t=>new te({typeName:y.ZodBoolean,coerce:t?.coerce||!1,...v(t)});var ne=class t extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let i=this._getOrReturnCtx(e);return m(i,{code:l.invalid_type,expected:f.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return m(i,{code:l.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),m(a,{code:l.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),m(a,{code:l.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:g.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}};ne.create=t=>new ne({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,...v(t)});var ke=class extends x{_parse(e){if(this._getType(e)!==f.symbol){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.symbol,received:r.parsedType}),h}return R(e.data)}};ke.create=t=>new ke({typeName:y.ZodSymbol,...v(t)});var re=class extends x{_parse(e){if(this._getType(e)!==f.undefined){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.undefined,received:r.parsedType}),h}return R(e.data)}};re.create=t=>new re({typeName:y.ZodUndefined,...v(t)});var ae=class extends x{_parse(e){if(this._getType(e)!==f.null){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.null,received:r.parsedType}),h}return R(e.data)}};ae.create=t=>new ae({typeName:y.ZodNull,...v(t)});var W=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};W.create=t=>new W({typeName:y.ZodAny,...v(t)});var H=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};H.create=t=>new H({typeName:y.ZodUnknown,...v(t)});var D=class extends x{_parse(e){let n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:f.never,received:n.parsedType}),h}};D.create=t=>new D({typeName:y.ZodNever,...v(t)});var be=class extends x{_parse(e){if(this._getType(e)!==f.undefined){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.void,received:r.parsedType}),h}return R(e.data)}};be.create=t=>new be({typeName:y.ZodVoid,...v(t)});var Z=class t extends x{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==f.array)return m(n,{code:l.invalid_type,expected:f.array,received:n.parsedType}),h;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(m(n,{code:s?l.too_big:l.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?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&&(m(n,{code:l.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&&(m(n,{code:l.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((s,o)=>a.type._parseAsync(new M(n,s,n.path,o)))).then(s=>E.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new M(n,s,n.path,o)));return E.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:g.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:g.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,...v(e)});function xe(t){if(t instanceof A){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=N.create(xe(r))}return new A({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:xe(t.element)}):t instanceof N?N.create(xe(t.unwrap())):t instanceof F?F.create(xe(t.unwrap())):t instanceof z?z.create(t.items.map(e=>xe(e))):t}var A=class t extends x{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)!==f.object){let u=this._getOrReturnCtx(e);return m(u,{code:l.invalid_type,expected:f.object,received:u.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof D&&this._def.unknownKeys==="strip"))for(let u in a.data)s.includes(u)||o.push(u);let d=[];for(let u of s){let p=i[u],_=a.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new M(a,_,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof D){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(u==="strict")o.length>0&&(m(a,{code:l.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of o){let _=a.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new M(a,_,a.path,p)),alwaysSet:p in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of d){let _=await p.key,b=await p.value;u.push({key:_,value:b,alwaysSet:p.alwaysSet})}return u}).then(u=>E.mergeObjectSync(r,u)):E.mergeObjectSync(r,d)}get shape(){return this._def.shape()}strict(e){return g.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:g.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 xe(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 N;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return nn(k.objectKeys(this.shape))}};A.create=(t,e)=>new A({shape:()=>t,unknownKeys:"strip",catchall:D.create(),typeName:y.ZodObject,...v(e)});A.strictCreate=(t,e)=>new A({shape:()=>t,unknownKeys:"strict",catchall:D.create(),typeName:y.ZodObject,...v(e)});A.lazycreate=(t,e)=>new A({shape:t,unknownKeys:"strip",catchall:D.create(),typeName:y.ZodObject,...v(e)});var ie=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new I(o.ctx.common.issues));return m(n,{code:l.invalid_union,unionErrors:s}),h}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let d of r){let u={...n,common:{...n.common,issues:[]},parent:null},p=d._parseSync({data:n.data,path:n.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(d=>new I(d));return m(n,{code:l.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};ie.create=(t,e)=>new ie({options:t,typeName:y.ZodUnion,...v(e)});var G=t=>t instanceof oe?G(t.schema):t instanceof V?G(t.innerType()):t instanceof ce?[t.value]:t instanceof ue?t.options:t instanceof de?k.objectValues(t.enum):t instanceof le?G(t._def.innerType):t instanceof re?[void 0]:t instanceof ae?[null]:t instanceof N?[void 0,...G(t.unwrap())]:t instanceof F?[null,...G(t.unwrap())]:t instanceof Ae||t instanceof me?G(t.unwrap()):t instanceof pe?G(t._def.innerType):[],Ue=class t extends x{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return m(n,{code:l.invalid_type,expected:f.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}):(m(n,{code:l.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 s=G(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...v(r)})}};function vt(t,e){let n=$(t),r=$(e);if(t===e)return{valid:!0,data:t};if(n===f.object&&r===f.object){let a=k.objectKeys(e),i=k.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(let o of i){let d=vt(t[o],e[o]);if(!d.valid)return{valid:!1};s[o]=d.data}return{valid:!0,data:s}}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 s=t[i],o=e[i],d=vt(s,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return n===f.date&&r===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var se=class extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(ze(i)||ze(s))return h;let o=vt(i.value,s.value);return o.valid?((Fe(i)||Fe(s))&&n.dirty(),{status:n.value,value:o.data}):(m(r,{code:l.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,s])=>a(i,s)):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}))}};se.create=(t,e,n)=>new se({left:t,right:e,typeName:y.ZodIntersection,...v(n)});var z=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return m(r,{code:l.invalid_type,expected:f.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return m(r,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new M(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>E.mergeArray(n,s)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:t,typeName:y.ZodTuple,rest:null,...v(e)})};var Ke=class t extends x{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 m(r,{code:l.invalid_type,expected:f.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new M(r,o,r.path,o)),value:s._parse(new M(r,r.data[o],r.path,o)),alwaysSet:o 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 x?new t({keyType:e,valueType:n,typeName:y.ZodRecord,...v(r)}):new t({keyType:Y.create(),valueType:e,typeName:y.ZodRecord,...v(n)})}},we=class extends x{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 m(r,{code:l.invalid_type,expected:f.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,d],u)=>({key:a._parse(new M(r,o,r.path,[u,"key"])),value:i._parse(new M(r,d,r.path,[u,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of s){let u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return h;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(u.value,p.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let d of s){let u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return h;(u.status==="dirty"||p.status==="dirty")&&n.dirty(),o.set(u.value,p.value)}return{status:n.value,value:o}}}};we.create=(t,e,n)=>new we({valueType:e,keyType:t,typeName:y.ZodMap,...v(n)});var Ce=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return m(r,{code:l.invalid_type,expected:f.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(m(r,{code:l.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&&(m(r,{code:l.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(d){let u=new Set;for(let p of d){if(p.status==="aborted")return h;p.status==="dirty"&&n.dirty(),u.add(p.value)}return{status:n.value,value:u}}let o=[...r.data.values()].map((d,u)=>i._parse(new M(r,d,r.path,u)));return r.common.async?Promise.all(o).then(d=>s(d)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Ce.create=(t,e)=>new Ce({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...v(e)});var Ge=class t extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.function)return m(n,{code:l.invalid_type,expected:f.function,received:n.parsedType}),h;function r(o,d){return Ie({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ve(),K].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:d}})}function a(o,d){return Ie({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ve(),K].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:d}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof J){let o=this;return R(async function(...d){let u=new I([]),p=await o._def.args.parseAsync(d,i).catch(T=>{throw u.addIssue(r(d,T)),u}),_=await Reflect.apply(s,this,p);return await o._def.returns._def.type.parseAsync(_,i).catch(T=>{throw u.addIssue(a(_,T)),u})})}else{let o=this;return R(function(...d){let u=o._def.args.safeParse(d,i);if(!u.success)throw new I([r(d,u.error)]);let p=Reflect.apply(s,this,u.data),_=o._def.returns.safeParse(p,i);if(!_.success)throw new I([a(p,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:z.create(e).rest(H.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||z.create([]).rest(H.create()),returns:n||H.create(),typeName:y.ZodFunction,...v(r)})}},oe=class extends x{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})}};oe.create=(t,e)=>new oe({getter:t,typeName:y.ZodLazy,...v(e)});var ce=class extends x{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return m(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};ce.create=(t,e)=>new ce({value:t,typeName:y.ZodLiteral,...v(e)});function nn(t,e){return new ue({values:t,typeName:y.ZodEnum,...v(e)})}var ue=class t extends x{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return m(n,{expected:k.joinValues(r),received:n.parsedType,code:l.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 m(n,{received:n.data,code:l.invalid_enum_value,options:r}),h}return R(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})}};ue.create=nn;var de=class extends x{_parse(e){let n=k.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){let a=k.objectValues(n);return m(r,{expected:k.joinValues(a),received:r.parsedType,code:l.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 m(r,{received:r.data,code:l.invalid_enum_value,options:a}),h}return R(e.data)}get enum(){return this._def.values}};de.create=(t,e)=>new de({values:t,typeName:y.ZodNativeEnum,...v(e)});var J=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==f.promise&&n.common.async===!1)return m(n,{code:l.invalid_type,expected:f.promise,received:n.parsedType}),h;let r=n.parsedType===f.promise?n.data:Promise.resolve(n.data);return R(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};J.create=(t,e)=>new J({type:t,typeName:y.ZodPromise,...v(e)});var V=class extends x{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:s=>{m(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return h;let d=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return d.status==="aborted"?h:d.status==="dirty"?Q(d.value):n.value==="dirty"?Q(d.value):d});{if(n.value==="aborted")return h;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?h:o.status==="dirty"?Q(o.value):n.value==="dirty"?Q(o.value):o}}if(a.type==="refinement"){let s=o=>{let d=a.refinement(o,i);if(r.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!q(s))return h;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>q(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):h);k.assertNever(a)}};V.create=(t,e,n)=>new V({schema:t,typeName:y.ZodEffects,effect:e,...v(n)});V.createWithPreprocess=(t,e,n)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...v(n)});var N=class extends x{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(t,e)=>new N({innerType:t,typeName:y.ZodOptional,...v(e)});var F=class extends x{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};F.create=(t,e)=>new F({innerType:t,typeName:y.ZodNullable,...v(e)});var le=class extends x{_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}};le.create=(t,e)=>new le({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var pe=class extends x{_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 Se(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};pe.create=(t,e)=>new pe({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var Te=class extends x{_parse(e){if(this._getType(e)!==f.nan){let r=this._getOrReturnCtx(e);return m(r,{code:l.invalid_type,expected:f.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Te.create=t=>new Te({typeName:y.ZodNaN,...v(t)});var Er=Symbol("zod_brand"),Ae=class extends x{_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}},Pe=class t extends x{_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})}},me=class extends x{_parse(e){let n=this._def.innerType._parse(e),r=a=>(q(a)&&(a.value=Object.freeze(a.value)),a);return Se(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};me.create=(t,e)=>new me({innerType:t,typeName:y.ZodReadonly,...v(e)});function Qt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function rn(t,e={},n){return t?W.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=Qt(e,r),d=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:d})}});if(!i){let s=Qt(e,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):W.create()}var Rr={object:A.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 Ir=(t,e={message:`Input not instance of ${t.name}`})=>rn(n=>n instanceof t,e),an=Y.create,sn=X.create,Ar=Te.create,Pr=ee.create,on=te.create,Or=ne.create,Nr=ke.create,Mr=re.create,Vr=ae.create,jr=W.create,Dr=H.create,Lr=D.create,$r=be.create,zr=Z.create,Fr=A.create,Ur=A.strictCreate,Kr=ie.create,Gr=Ue.create,Hr=se.create,Zr=z.create,Br=Ke.create,qr=we.create,Yr=Ce.create,Wr=Ge.create,Jr=oe.create,Qr=ce.create,Xr=ue.create,ea=de.create,ta=J.create,na=V.create,ra=N.create,aa=F.create,ia=V.createWithPreprocess,sa=Pe.create,oa=()=>an().optional(),ca=()=>sn().optional(),ua=()=>on().optional(),da={string:(t=>Y.create({...t,coerce:!0})),number:(t=>X.create({...t,coerce:!0})),boolean:(t=>te.create({...t,coerce:!0})),bigint:(t=>ee.create({...t,coerce:!0})),date:(t=>ne.create({...t,coerce:!0}))};var la=h;var He=c.object({page:c.object({title:c.string().nullable(),path:c.string(),search:c.string(),hash:c.string()}).strict(),referrer:c.string().nullable(),viewport:c.object({w:c.number(),h:c.number()}).strict().nullable().optional()}).strict(),cn=c.object({}).strict();var kt="aranova_tracking_last_fired_url",St=null,xt=!1;function pa(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function ma(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function fa(){if(!xt){xt=!0;let t=pa(kt);t!==null&&(St=t)}return St}function ga(t){St=t,xt=!0,ma(kt,t)}function un(t){return typeof window>"u"||typeof document>"u"?null:He.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 Oe(t){if(typeof window>"u")return;let e=window.location.href,n=fa(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,s=un(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&ga(e)}function bt(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Oe(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function wt(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let u=window.location.pathname+window.location.search;u!==n&&(n=u,Oe(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function s(...u){a(...u),setTimeout(r,0)}function o(...u){i(...u),setTimeout(r,0)}function d(u){u.persisted&&Oe(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",d),e.skipInitial||Oe(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",d)}}function Ze(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(Ze);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Ze(r);return e}return t}function Ct(t,e,n,r,a=null){let i=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let d={};for(let[u,p]of Object.entries(r.automatic)){let _=Ze(p);Object.keys(_).length>0&&(d[u]=_)}if(r.manual)for(let[u,p]of Object.entries(r.manual)){if(p===void 0)continue;let _=Ze(p);Object.keys(_).length>0&&(d[u]=_)}Object.keys(d).length>0&&(o=d)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:i,manual:s},trigger_config:o,configured_gtag_ids:a}}var ln=2e3,pn=10,Be=50,qe="X-Aranova-Api-Key",Ye="X-Aranova-Sdk-Version",We="X-Aranova-Sdk-Package",Je="X-Aranova-Sdk-Surface",Qe="X-Aranova-Sdk-Environment";function ya(t,e,n,r,a){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,environment:r,active_gtag_ids:a}}function _a(){if(typeof window>"u")return De();try{ye()}catch{}return ge(he)}function va(){try{return{state:B()}}catch{return null}}async function dn(t,e,n,r,a){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[qe]:n,[Ye]:r.sdkVersion,[We]:r.packageName,[Je]:r.surface,[Qe]:r.environment},body:e,keepalive:a,credentials:"omit",mode:"cors"})}catch{}}function Tt(t){let e=t.flushIntervalMs??ln,n=Math.min(t.maxQueueSize??pn,Be),r=t.sdkVersion??null,a=t.packageName??null,i=t.environment??"production",s=t.activeGtagIds??null,d=`${t.endpoint.replace(/\/$/,"")}/events`,u={sdkVersion:r??"",packageName:a??"",surface:t.surface,environment:i},p=[],_=null,b=null,T=!1,S=ht(),C=_e(),L=C.id;typeof window<"u"&&(b=window.location.href);function Ee(){let w=Ct(t.surface,r,a,t.triggers??null,s);p.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:w,occurred_at:new Date().toISOString()})}C.isNew&&Ee();function zt(){let w=_e();w.isNew&&w.id!==L&&Ee(),L=w.id;let P=_a(),Re=ya(t.surface,r,a,i,s);return{session_id:L,visitor_id:S,gclid:P.gclid,fbclid:P.fbclid,utm_source:P.utm_source,utm_medium:P.utm_medium,utm_campaign:P.utm_campaign,utm_term:P.utm_term,utm_content:P.utm_content,first_page:b,consent_state:va(),context:Re}}function Zn(){_!==null||T||(_=setTimeout(()=>{_=null,nt()},e))}function tt(){_!==null&&(clearTimeout(_),_=null)}async function nt(){if(p.length===0)return;let w=p.slice(0,Be);p=p.slice(w.length),tt();let P={session:zt(),events:w},Re=JSON.stringify(P);await dn(d,Re,t.apiKey,u,!1)}function Bn(w){if(T||!w||typeof w.eventType!="string"||w.eventType.length===0)return;let P=w.occurredAt instanceof Date?w.occurredAt.toISOString():typeof w.occurredAt=="string"?w.occurredAt:new Date().toISOString();p.push({event_type:w.eventType,page_url:w.pageUrl??(typeof window>"u"?null:window.location.href),metadata:w.metadata??null,occurred_at:P}),p.length>=n?nt():Zn()}function Me(){if(p.length===0)return;let w=p.slice(0,Be);p=p.slice(w.length),tt();let P={session:zt(),events:w},Re=JSON.stringify(P);dn(d,Re,t.apiKey,u,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",Me),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Me()})),{trackEvent:Bn,flush:nt,getSessionId:()=>L,getVisitorId:()=>S,destroy:()=>{T=!0,p.length>0&&Me(),tt(),p=[],typeof window<"u"&&window.removeEventListener("pagehide",Me)}}}var mn=c.object({cta_name:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional(),destination_url:c.string().nullable().optional()}).strict(),fn=c.object({}).strict();var Sa=c.object({automatic:c.array(c.string()),manual:c.array(c.string())}).strict(),gn=c.object({sdk_version:c.string(),package_name:c.string().nullable(),surface:c.enum(["next","react","script"]),triggers:Sa,trigger_config:c.record(c.string(),c.record(c.string(),c.unknown())).nullable().optional(),configured_gtag_ids:c.record(c.string(),c.string()).nullable().optional()}).strict(),hn=c.object({}).strict();var yn=c.object({form:c.object({id:c.string(),action:c.string().nullable()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),_n=c.object({selector:c.string().optional()}).strict();var Et=c.lazy(()=>c.union([c.string(),c.number().finite(),c.boolean(),c.null(),c.array(Et),c.record(Et)])),vn=c.object({form:c.object({id:c.string(),action:c.string().nullable(),fields:c.array(c.object({name:c.string(),type:c.string(),label:c.string().nullable(),value:Et}).strict()).optional()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),Sn=c.object({}).strict();var xn=c.object({page_count:c.number().int().min(2),page:c.object({path:c.string()}).strict()}).strict(),kn=c.object({pageThreshold:c.number().int().min(2)}).strict();var bn=c.object({phone_number:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional()}).strict(),wn=c.object({}).strict();var Cn=c.object({depth_percent:c.number().int().min(1).max(100),page:c.object({path:c.string()}).strict()}).strict(),Tn=c.object({thresholds:c.array(c.number().int().min(1).max(100)).min(1)}).strict();var xa=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],En=c.enum(xa),Rn=c.object({page_name:En,page:c.object({path:c.string()}).strict()}).strict(),In=c.object({pages:c.array(c.object({name:En,pathPattern:c.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var An=c.object({duration_ms:c.number().int().nonnegative(),page:c.object({path:c.string()}).strict()}).strict(),Pn=c.object({thresholdSeconds:c.number().int().positive()}).strict();var Rt={page_view:{kind:"automatic",metadataSchema:He,configSchema:cn},time_on_site:{kind:"automatic",metadataSchema:An,configSchema:Pn},specific_page_visit:{kind:"automatic",metadataSchema:Rn,configSchema:In},scroll_depth:{kind:"automatic",metadataSchema:Cn,configSchema:Tn},multi_page_session:{kind:"automatic",metadataSchema:xn,configSchema:kn},form_start:{kind:"automatic",metadataSchema:yn,configSchema:_n},sdk_heartbeat:{kind:"automatic",metadataSchema:gn,configSchema:hn},form_submit:{kind:"manual",metadataSchema:vn,configSchema:Sn},phone_click:{kind:"manual",metadataSchema:bn,configSchema:wn},cta_click:{kind:"manual",metadataSchema:mn,configSchema:fn}},ts=Object.entries(Rt).filter(([,t])=>t.kind==="automatic").map(([t])=>t),ns=Object.entries(Rt).filter(([,t])=>t.kind==="manual").map(([t])=>t);function It(t){return Rt[t]}function At(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,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function d(){if(s||a===null)return;let _=n-r;if(_<=0){o();return}i=setTimeout(o,_)}function u(){i!==null&&(clearTimeout(i),i=null)}function p(){s||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),u()):(a=Date.now(),d()))}return document.addEventListener("visibilitychange",p),d(),()=>{u(),document.removeEventListener("visibilitychange",p)}}function Pt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function a(){let u=window.location.pathname;for(let{name:p,pathPattern:_}of n){if(_.lastIndex=0,!_.test(u))continue;let b=`${p}:${u}`;r.has(b)||(r.add(b),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:p,page:{path:u}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...u){i(...u),setTimeout(a,0)}function d(...u){s(...u),setTimeout(a,0)}return history.pushState=o,history.replaceState=d,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=s,window.removeEventListener("popstate",a)}}function Ot(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 s(){let S=document.documentElement,C=window.scrollY||S.scrollTop,L=S.scrollHeight,Ee=S.clientHeight;return L<=Ee?100:Math.round((C+Ee)/L*100)}function o(){let S=s();for(let C of n)S>=C&&!r.has(C)&&(r.add(C),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:C,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function d(){i===null&&(i=requestAnimationFrame(()=>{i=null,o()}))}function u(){let S=window.location.pathname;S!==a&&(a=S,r=new Set,setTimeout(o,0))}let p=history.pushState.bind(history),_=history.replaceState.bind(history);function b(...S){p(...S),setTimeout(u,0)}function T(...S){_(...S),setTimeout(u,0)}return history.pushState=b,history.replaceState=T,window.addEventListener("popstate",u),window.addEventListener("scroll",d,{passive:!0}),setTimeout(o,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=p,history.replaceState=_,window.removeEventListener("popstate",u),window.removeEventListener("scroll",d)}}var Nt="aranova_tracking_mps_paths",On="aranova_tracking_mps_session",Mt="aranova_tracking_mps_fired";function ka(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function Vt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=ka();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let S=n.getItem(Nt);return S?new Set(JSON.parse(S)):new Set}catch{return new Set}}function s(S){try{n.setItem(Nt,JSON.stringify([...S]))}catch{}}function o(){let S=_e().id;n.getItem(On)!==S&&(n.setItem(On,S),n.removeItem(Nt),n.removeItem(Mt))}function d(){return n.getItem(Mt)==="1"}function u(){let S=window.location.pathname;if(S===a||(a=S,o(),d()))return;let C=i();C.add(S),s(C),C.size>=r&&(n.setItem(Mt,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:C.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let p=history.pushState.bind(history),_=history.replaceState.bind(history);function b(...S){p(...S),setTimeout(u,0)}function T(...S){_(...S),setTimeout(u,0)}return history.pushState=b,history.replaceState=T,window.addEventListener("popstate",u),u(),()=>{history.pushState=p,history.replaceState=_,window.removeEventListener("popstate",u)}}function jt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,a=window.location.pathname;function i(b){if(b.id)return`id:${b.id}`;let T=b.getAttribute("action");return T?`action:${T}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(b)}`}function s(b){let T=b.target;if(!(T instanceof HTMLElement))return;let S=T.closest(n);if(!S||S.tagName!=="FORM")return;let C=i(S);r.has(C)||(r.add(C),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 o(){let b=window.location.pathname;b!==a&&(a=b,r=new Set)}let d=history.pushState.bind(history),u=history.replaceState.bind(history);function p(...b){d(...b),setTimeout(o,0)}function _(...b){u(...b),setTimeout(o,0)}return history.pushState=p,history.replaceState=_,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=d,history.replaceState=u,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}var Xe=class extends Error{constructor(e,n){super(e),this.name="AranovaApiError",this.status=n.status,this.code=n.code,this.requestId=n.requestId}};function ba(t){let e={[qe]:t.apiKey};return t.sdkVersion&&(e[Ye]=t.sdkVersion),t.packageName&&(e[We]=t.packageName),t.surface&&(e[Je]=t.surface),t.environment&&(e[Qe]=t.environment),e}function wa(t,e){return`${t.replace(/\/$/,"")}${e}`}async function j(t,e,n,r){let a=ba(t);r!==void 0&&(a["Content-Type"]="application/json");let i=await fetch(wa(t.endpoint,n),{method:e,headers:a,body:r===void 0?void 0:JSON.stringify(r)});if(!i.ok){let s,o;try{let d=await i.json();if(d&&typeof d=="object"){let u=d;typeof u.detail=="string"&&(s=u.detail),typeof u.code=="string"&&(o=u.code)}}catch{}throw new Xe(s??i.statusText??"Request failed",{status:i.status,code:o,requestId:i.headers.get("x-request-id")??void 0})}if(i.status!==204)return await i.json()}function Nn(t){return{async record(e){let n=e.currency??t.defaultCurrency;if(!n)throw new Error("record: `currency` is required (pass it on the sale or set config.defaultCurrency)");let r={...e,currency:n,occurred_at:e.occurred_at??new Date().toISOString()};return j(t,"POST","/sales",r)},async list(e){let{cursor:n,limit:r,sort:a,order:i,want_total:s,...o}=e??{};return j(t,"POST","/sales/query",{filters:o,...r!==void 0?{limit:r}:{},...n!==void 0?{cursor:n}:{},...a!==void 0?{sort:a}:{},...i!==void 0?{order:i}:{},...s!==void 0?{want_total:s}:{}})},async summary(e){let{range:n,include_categories:r,include_deleted_services:a,top_n:i,since:s,until:o,timezone:d,granularity:u,compare_to:p,..._}=e;return j(t,"POST","/sales/summary",{filters:_,...n!==void 0?{range:n}:{},...r!==void 0?{include_categories:r}:{},...a!==void 0?{include_deleted_services:a}:{},...i!==void 0?{top_n:i}:{},...s!==void 0?{since:s}:{},...o!==void 0?{until:o}:{},...d!==void 0?{timezone:d}:{},...u!==void 0?{granularity:u}:{},...p!==void 0?{compare_to:p}:{}})},async get(e){return j(t,"GET",`/sales/${e}`)},async update(e,n){return j(t,"PATCH",`/sales/${e}`,n)},async delete(e){await j(t,"DELETE",`/sales/${e}`)},customers:{async list(e){let{segment:n,sort:r,order:a,cursor:i,limit:s,want_total:o,...d}=e??{};return j(t,"POST","/customers/query",{filters:d,...n!==void 0?{segment:n}:{},...r!==void 0?{sort:r}:{},...a!==void 0?{order:a}:{},...i!==void 0?{cursor:i}:{},...s!==void 0?{limit:s}:{},...o!==void 0?{want_total:o}:{}})},async get(e,n){let r=new URLSearchParams;n?.include_sales!==void 0&&r.set("include_sales",String(n.include_sales)),n?.limit!==void 0&&r.set("limit",String(n.limit)),n?.cursor!=null&&r.set("cursor",n.cursor);let a=r.toString();return j(t,"GET",`/customers/${encodeURIComponent(e)}${a?`?${a}`:""}`)},async summary(e){let{range:n,since:r,until:a,timezone:i,compare_to:s,...o}=e??{};return j(t,"POST","/customers/summary",{filters:o,...n!==void 0?{range:n}:{},...r!==void 0?{since:r}:{},...a!==void 0?{until:a}:{},...i!==void 0?{timezone:i}:{},...s!==void 0?{compare_to:s}:{}})}},business:{async config(){return j(t,"GET","/business/config")}}}}var Ca=["USD","CAD"],Ta=["production","development"],Mn=c.enum(Ca),Ne=c.number().int().nonnegative(),Ea=c.string().regex(/^\d+(\.\d{1,3})?$/),Vn=c.record(c.unknown()),jn=c.object({external_item_id:c.string().nullable().optional(),name:c.string().nullable().optional(),category:c.string().nullable().optional(),quantity:Ea,unit_price_cents:Ne,unit_cost_cents:Ne.nullable().optional()}).strict(),Dn=c.object({service:c.string(),amount_cents:Ne}).strict(),Ln=c.string().max(200),$n=c.string().max(64),zn=c.string().max(320).email();function Fn(t,e,{requireAmount:n}){if(t.services!=null){t.service!=null&&e.addIssue({code:c.ZodIssueCode.custom,message:"pass either `service` or `services`, not both",path:["services"]}),t.services.length===0&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not be empty",path:["services"]});let r=t.services.map(a=>a.service);if(new Set(r).size!==r.length&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not list the same service more than once",path:["services"]}),t.amount_total_cents!=null){let a=t.services.reduce((i,s)=>i+s.amount_cents,0);t.amount_total_cents!==a&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",path:["amount_total_cents"]})}}else n&&t.amount_total_cents==null&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents is required unless `services` is provided",path:["amount_total_cents"]})}var Ss=c.object({external_id:c.string().nullable().optional(),description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Dn).nullable().optional(),currency:Mn,amount_total_cents:Ne.nullable().optional(),occurred_at:c.string().datetime(),environment:c.enum(Ta).default("production"),items:c.array(jn).default([]),metadata:Vn.nullable().optional(),customer_name:Ln.nullable().optional(),customer_phone:$n.nullable().optional(),customer_email:zn.nullable().optional()}).strict().superRefine((t,e)=>Fn(t,e,{requireAmount:!0})),xs=c.object({description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(Dn).nullable().optional(),currency:Mn.optional(),amount_total_cents:Ne.optional(),occurred_at:c.string().datetime().optional(),items:c.array(jn).optional(),metadata:Vn.nullable().optional(),customer_name:Ln.nullable().optional(),customer_phone:$n.nullable().optional(),customer_email:zn.nullable().optional()}).strict().superRefine((t,e)=>Fn(t,e,{requireAmount:!1}));var Dt="aranova-tracking-consent-banner";function Ia(){return ge(he)}function Kn(){document.querySelector(`#${Dt}`)?.remove()}function Gn(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 Aa(){if(typeof document>"u"||B()!=="pending"||document.querySelector(`#${Dt}`))return;let t=document.createElement("div");t.id=Dt,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=Gn("Decline",()=>{fe("denied"),Kn()},{}),i=Gn("Accept",()=>{fe("granted"),Kn()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.append(a),r.append(i),e.append(n),e.append(r),t.append(e),document.body.append(t)}var O=null,Lt=null,U=[],et=null;function Pa(){for(let t=U.length-1;t>=0;t--)U[t]();U=[],O!==null&&(O.destroy(),O=null),Lt=null,et=null}function Hn(t={}){if(typeof window>"u")return;window.AranovaTracking=$t;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,gtagIds:s,environment:o,renderConsentBanner:d=!0,triggers:u}=t;if(r&&ye(window.location.href,a),s&&Object.keys(s).length>0?lt(s):i&&dt(i),d&&Aa(),Pa(),!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}et=Nn({apiKey:e,endpoint:n});let p=u??{automatic:{page_view:{}},manual:{}};Lt=p,O=Tt({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:Ut,triggers:p,environment:o,activeGtagIds:s??(i?{default:i}:void 0)}),U.push(wt(O)),U.push(bt(O));let b=p.automatic.time_on_site;b&&U.push(At(O,b));let T=p.automatic.specific_page_visit;T&&U.push(Pt(O,T));let S=p.automatic.scroll_depth;S&&U.push(Ot(O,S));let C=p.automatic.multi_page_session;C&&U.push(Vt(O,C));let L=p.automatic.form_start;L&&U.push(jt(O,L))}function Oa(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=Lt;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{It(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}O.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}function Na(){if(et===null)throw new Error("[AranovaTracking] sales() called before init({ apiKey, endpoint })");return et}var $t={init:Hn,captureTrackingParams:()=>ye(),getTrackingParams:Ia,getConsentState:B,setConsentState:fe,trackEvent:Oa,sales:Na};typeof window<"u"&&(window.AranovaTracking=$t);var Ma=$t;return Qn(Va);})();
|
|
1
|
+
"use strict";var AranovaTracking=(()=>{var gt=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var yr=Object.prototype.hasOwnProperty;var rn=(t,e)=>{for(var n in e)gt(t,n,{get:e[n],enumerable:!0})},_r=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of hr(e))!yr.call(t,a)&&a!==n&>(t,a,{get:()=>e[a],enumerable:!(r=gr(e,a))||r.enumerable});return t};var vr=t=>_r(gt({},"__esModule",{value:!0}),t);var si={};rn(si,{default:()=>ii,init:()=>pr});var an="0.13.0";var ht="consent_state",sn="consent_timestamp";function yt(t){return{ad_storage:t,ad_user_data:t,ad_personalization:t,analytics_storage:t}}function L(){if(typeof window>"u")return"pending";try{let t=window.localStorage.getItem(ht);if(t==="granted"||t==="denied")return t}catch{}return"pending"}function he(t){if(!(typeof window>"u")){try{window.localStorage.setItem(ht,t),window.localStorage.setItem(sn,new Date().toISOString())}catch{}typeof window.gtag=="function"&&window.gtag("consent","update",yt(t)),typeof window.fbq=="function"&&window.fbq("consent",t==="granted"?"grant":"revoke")}}function Ge(){let t=L();return(t==="granted"||t==="denied")&&he(t),t}var Ue=["gclid","fbclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function ye(){return{gclid:null,fbclid:null,utm_source:null,utm_medium:null,utm_campaign:null,utm_term:null,utm_content:null}}function Ke(t){return typeof t=="string"&&t.length>0?t:null}function _e(t){return Ue.reduce((e,n)=>(e[n]=Ke(t(n)),e),ye())}function on(t){return Ue.reduce((e,n)=>{let r=t.get(n);return typeof r=="string"&&r.trim().length>0&&(e[n]=r),e},{})}var xr="_aranova_track_";function cn(t){return`${xr}${t}`}function He(t,e,n=7776e3){let r=encodeURIComponent(e);if(typeof document<"u")try{document.cookie=`${t}=${r}; Max-Age=${n}; Path=/; SameSite=Lax`}catch{}if(typeof window<"u")try{window.localStorage.setItem(cn(t),r)}catch{}}function ve(t){if(typeof document<"u"){let n=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(`${t}=`));if(n){let[,r=""]=n.split("=");return Ke(decodeURIComponent(r))}}if(typeof window<"u")try{let e=window.localStorage.getItem(cn(t));if(e)return Ke(decodeURIComponent(e))}catch{}return null}function Se(t){return ve(t)}function un(t,e,n=7776e3){He(t,e,n)}function _t(t,e){return Ue.reduce((n,r)=>(n[r]=t[r]??e[r],n),ye())}function dn(t,e=7776e3){let n=on(t);return Object.entries(n).forEach(([r,a])=>{un(r,a,e)}),n}function X(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 dn(n.searchParams,e),_e(Se)}var ln="https://www.googletagmanager.com/gtag/js",xe="data-aranova-tracking";function br(t){return`aranova-${t}`}var kr=/^[A-Z]{1,3}-[A-Za-z0-9_-]+$/;function vt(t){return kr.test(t)}function qe(){return window.dataLayer=window.dataLayer||[],typeof window.gtag=="function"||(window.gtag=(...t)=>{window.dataLayer?.push(t)}),window.gtag}function St(){qe()("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=br("gtag-loader");if(document.querySelector(`script[${xe}="${e}"]`))return;let r=document.createElement("script");r.async=!0,r.src=`${ln}?id=${encodeURIComponent(t)}`,r.setAttribute(xe,e),document.head.append(r)}function pn(t){let e=qe();e("js",new Date),e("config",t)}function bt(t){typeof window>"u"||typeof document>"u"||vt(t)&&(St(),xt(t),pn(t),Ge())}function kt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&vt(r));if(e.length===0)return;St(),xt(e[0]);let n=qe();n("js",new Date);for(let r of e)n("config",r);Ge()}var fn="https://connect.facebook.net/en_US/fbevents.js",wt="_fbc",mn="_fbp",wr=/^\d{15,16}$/;function Ct(t){return wr.test(t)}function gn(t){let e=t.split(".").filter(Boolean);return Math.max(0,e.length-1)}function hn(t,e,n){let r=n??(typeof window>"u"?"":window.location.hostname);return`fb.${gn(r)}.${e}.${t}`}function Ne(){return ve(wt)}function Be(){return ve(mn)}function Cr(){if(typeof window>"u")return null;try{let t=new URL(window.location.href).searchParams.get("fbclid");return t&&t.trim().length>0?t:null}catch{return null}}function Me(t=typeof Date>"u"?0:Date.now()){if(typeof window>"u"||Ne())return;let e=Cr()??ve("fbclid");e&&He(wt,hn(e,t),7776e3)}function Tr(t){return`aranova-${t}`}function Ye(){let t=window;if(typeof t.fbq=="function")return t.fbq;let e=function(...n){e.callMethod?e.callMethod.apply(e,n):e.queue.push(n)};return e.push=e,e.loaded=!0,e.version="2.0",e.queue=[],t.fbq=e,t._fbq||(t._fbq=e),e}function Tt(){Ye()("consent","revoke")}function Et(){if(typeof document>"u")return;let t=Tr("fbq-loader");if(document.querySelector(`script[${xe}="${t}"]`))return;let n=document.createElement("script");n.async=!0,n.src=fn,n.setAttribute(xe,t),document.head.append(n)}function yn(t){let e=Ye();e("init",t),e("track","PageView")}function It(){if(typeof window>"u")return;let t=L();t==="granted"?window.fbq?.("consent","grant"):t==="denied"&&window.fbq?.("consent","revoke")}function Rt(t){typeof window>"u"||typeof document>"u"||Ct(t)&&(Tt(),Et(),yn(t),It(),Me())}function Pt(t){if(typeof window>"u"||typeof document>"u")return;let e=Object.values(t).filter(r=>typeof r=="string"&&Ct(r));if(e.length===0)return;Tt(),Et();let n=Ye();for(let r of e)n("init",r);n("track","PageView"),It(),Me()}var At="aranova_tracking_visitor",We="aranova_tracking_session";function Je(){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 _n(t){try{return window.localStorage.getItem(t)}catch{return null}}function Ot(t,e){try{window.localStorage.setItem(t,e)}catch{}}function Nt(){if(typeof window>"u")return Je();let t=_n(At);if(t&&t.length>0)return t;let e=Je();return Ot(At,e),e}function be(t=Date.now()){if(typeof window>"u")return{id:Je(),isNew:!0};let e=_n(We);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 Ot(We,JSON.stringify(a)),{id:r.id,isNew:!1}}}catch{}let n={id:Je(),last_event_at:t};return Ot(We,JSON.stringify(n)),{id:n.id,isNew:!0}}var c={};rn(c,{BRAND:()=>Qr,DIRTY:()=>ee,EMPTY_PATH:()=>Pr,INVALID:()=>h,NEVER:()=>ja,OK:()=>I,ParseStatus:()=>E,Schema:()=>x,ZodAny:()=>J,ZodArray:()=>Z,ZodBigInt:()=>ne,ZodBoolean:()=>re,ZodBranded:()=>je,ZodCatch:()=>me,ZodDate:()=>ae,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>et,ZodEffects:()=>V,ZodEnum:()=>le,ZodError:()=>R,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>nt,ZodIntersection:()=>ce,ZodIssueCode:()=>l,ZodLazy:()=>ue,ZodLiteral:()=>de,ZodMap:()=>Ie,ZodNaN:()=>Pe,ZodNativeEnum:()=>pe,ZodNever:()=>D,ZodNull:()=>se,ZodNullable:()=>G,ZodNumber:()=>te,ZodObject:()=>P,ZodOptional:()=>N,ZodParsedType:()=>m,ZodPipeline:()=>De,ZodPromise:()=>Q,ZodReadonly:()=>ge,ZodRecord:()=>tt,ZodSchema:()=>x,ZodSet:()=>Re,ZodString:()=>W,ZodSymbol:()=>Te,ZodTransformer:()=>V,ZodTuple:()=>z,ZodType:()=>x,ZodUndefined:()=>ie,ZodUnion:()=>oe,ZodUnknown:()=>q,ZodVoid:()=>Ee,addIssueToContext:()=>p,any:()=>oa,array:()=>la,bigint:()=>na,boolean:()=>Rn,coerce:()=>Va,custom:()=>Tn,date:()=>ra,datetimeRegex:()=>wn,defaultErrorMap:()=>U,discriminatedUnion:()=>ga,effect:()=>Ea,enum:()=>wa,function:()=>xa,getErrorMap:()=>ke,getParsedType:()=>$,instanceof:()=>ea,intersection:()=>ha,isAborted:()=>Qe,isAsync:()=>we,isDirty:()=>Xe,isValid:()=>Y,late:()=>Xr,lazy:()=>ba,literal:()=>ka,makeIssue:()=>Ve,map:()=>va,nan:()=>ta,nativeEnum:()=>Ca,never:()=>ua,null:()=>sa,nullable:()=>Ra,number:()=>In,object:()=>pa,objectUtil:()=>Mt,oboolean:()=>Ma,onumber:()=>Na,optional:()=>Ia,ostring:()=>Oa,pipeline:()=>Aa,preprocess:()=>Pa,promise:()=>Ta,quotelessJson:()=>Er,record:()=>_a,set:()=>Sa,setErrorMap:()=>Rr,strictObject:()=>fa,string:()=>En,symbol:()=>aa,transformer:()=>Ea,tuple:()=>ya,undefined:()=>ia,union:()=>ma,unknown:()=>ca,util:()=>b,void:()=>da});var b;(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 s of a)i[s]=s;return i},t.getValidEnumValues=a=>{let i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return t.objectValues(s)},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 s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(let s of a)if(i(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var Mt;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Mt||(Mt={}));var m=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}};var l=b.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"]),Er=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R=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 s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,d=0;for(;d<s.path.length;){let u=s.path[d];d===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};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,b.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()}};R.create=t=>new R(t);var Ir=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===m.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,b.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${b.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${b.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.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}"`:b.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.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 l.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 l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,b.assertNever(t)}return{message:n}},U=Ir;var vn=U;function Rr(t){vn=t}function ke(){return vn}var Ve=t=>{let{data:e,path:n,errorMaps:r,issueData:a}=t,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",d=r.filter(u=>!!u).slice().reverse();for(let u of d)o=u(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}},Pr=[];function p(t,e){let n=ke(),r=Ve({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===U?void 0:U].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,s=await a.value;r.push({key:i,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return h;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},h=Object.freeze({status:"aborted"}),ee=t=>({status:"dirty",value:t}),I=t=>({status:"valid",value:t}),Qe=t=>t.status==="aborted",Xe=t=>t.status==="dirty",Y=t=>t.status==="valid",we=t=>typeof Promise<"u"&&t instanceof Promise;var g;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));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}},Sn=(t,e)=>{if(Y(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 R(t.common.issues);return this._error=n,this._error}}};function S(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:(s,o)=>{let{message:d}=t;return s.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:d??n??o.defaultError}},description:a}}var x=class{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:$(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:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(we(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:$(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Sn(r,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Y(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=>Y(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:$(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(we(a)?a:Promise.resolve(a));return Sn(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 s=e(a),o=()=>i.addIssue({code:l.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(d=>d?!0:(o(),!1)):s?!0:(o(),!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 V({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 N.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return Q.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return ce.create(this,e,this._def)}transform(e){return new V({...S(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new fe({...S(this._def),innerType:this,defaultValue:n,typeName:y.ZodDefault})}brand(){return new je({typeName:y.ZodBranded,type:this,...S(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new me({...S(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 De.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ar=/^c[^\s-]{8,}$/i,Or=/^[0-9a-z]+$/,Nr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Mr=/^[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,Vr=/^[a-z0-9_-]{21}$/i,jr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dr=/^[-+]?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)?)??$/,Fr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vt,$r=/^(?:(?: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])$/,zr=/^(?:(?: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])$/,Gr=/^(([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]))$/,Kr=/^(([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])$/,Ur=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bn="((\\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])))",qr=new RegExp(`^${bn}$`);function kn(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 Zr(t){return new RegExp(`^${kn(t)}$`)}function wn(t){let e=`${bn}T${kn(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 Br(t,e){return!!((e==="v4"||!e)&&$r.test(t)||(e==="v6"||!e)&&Gr.test(t))}function Yr(t,e){if(!jr.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 Wr(t,e){return!!((e==="v4"||!e)&&zr.test(t)||(e==="v6"||!e)&&Kr.test(t))}var W=class t extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let i=this._getOrReturnCtx(e);return p(i,{code:l.invalid_type,expected:m.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),p(a,{code:l.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),p(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?p(a,{code:l.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(a,{code:l.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Fr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"email",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Vt||(Vt=new RegExp(Lr,"u")),Vt.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"emoji",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Mr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"uuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Vr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"nanoid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Ar.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Or.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid2",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Nr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ulid",code:l.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),p(a,{validation:"url",code:l.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),p(a,{validation:"regex",code:l.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),p(a,{code:l.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),p(a,{code:l.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),p(a,{code:l.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?wn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:l.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?qr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:l.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Zr(i).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:l.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Dr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"duration",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Br(e.data,i.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ip",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Yr(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"jwt",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Wr(e.data,i.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cidr",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Ur.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64",code:l.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Hr.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64url",code:l.invalid_string,message:i.message}),r.dirty()):b.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),{validation:n,code:l.invalid_string,...g.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...g.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...g.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...g.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...g.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...g.errToObj(n)})}nonempty(e){return this.min(1,g.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}};W.create=t=>new W({checks:[],typeName:y.ZodString,coerce:t?.coerce??!1,...S(t)});function Jr(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(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}var te=class t extends x{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)!==m.number){let i=this._getOrReturnCtx(e);return p(i,{code:l.invalid_type,expected:m.number,received:i.parsedType}),h}let r,a=new E;for(let i of this._def.checks)i.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.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),p(r,{code:l.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),p(r,{code:l.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Jr(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),p(r,{code:l.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.not_finite,message:i.message}),a.dirty()):b.assertNever(i);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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"&&b.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)}};te.create=t=>new te({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,...S(t)});var ne=class t extends x{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)!==m.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),p(r,{code:l.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),p(r,{code:l.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),p(r,{code:l.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):b.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:m.bigint,received:n.parsedType}),h}gte(e,n){return this.setLimit("min",e,!0,g.toString(n))}gt(e,n){return this.setLimit("min",e,!1,g.toString(n))}lte(e,n){return this.setLimit("max",e,!0,g.toString(n))}lt(e,n){return this.setLimit("max",e,!1,g.toString(n))}setLimit(e,n,r,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.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:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:g.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}};ne.create=t=>new ne({checks:[],typeName:y.ZodBigInt,coerce:t?.coerce??!1,...S(t)});var re=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.boolean,received:r.parsedType}),h}return I(e.data)}};re.create=t=>new re({typeName:y.ZodBoolean,coerce:t?.coerce||!1,...S(t)});var ae=class t extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let i=this._getOrReturnCtx(e);return p(i,{code:l.invalid_type,expected:m.date,received:i.parsedType}),h}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return p(i,{code:l.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),p(a,{code:l.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),p(a,{code:l.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):b.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:g.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}};ae.create=t=>new ae({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,...S(t)});var Te=class extends x{_parse(e){if(this._getType(e)!==m.symbol){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.symbol,received:r.parsedType}),h}return I(e.data)}};Te.create=t=>new Te({typeName:y.ZodSymbol,...S(t)});var ie=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.undefined,received:r.parsedType}),h}return I(e.data)}};ie.create=t=>new ie({typeName:y.ZodUndefined,...S(t)});var se=class extends x{_parse(e){if(this._getType(e)!==m.null){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.null,received:r.parsedType}),h}return I(e.data)}};se.create=t=>new se({typeName:y.ZodNull,...S(t)});var J=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}};J.create=t=>new J({typeName:y.ZodAny,...S(t)});var q=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}};q.create=t=>new q({typeName:y.ZodUnknown,...S(t)});var D=class extends x{_parse(e){let n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:m.never,received:n.parsedType}),h}};D.create=t=>new D({typeName:y.ZodNever,...S(t)});var Ee=class extends x{_parse(e){if(this._getType(e)!==m.undefined){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.void,received:r.parsedType}),h}return I(e.data)}};Ee.create=t=>new Ee({typeName:y.ZodVoid,...S(t)});var Z=class t extends x{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==m.array)return p(n,{code:l.invalid_type,expected:m.array,received:n.parsedType}),h;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(p(n,{code:s?l.too_big:l.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?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&&(p(n,{code:l.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&&(p(n,{code:l.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((s,o)=>a.type._parseAsync(new M(n,s,n.path,o)))).then(s=>E.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new M(n,s,n.path,o)));return E.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:g.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:g.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,...S(e)});function Ce(t){if(t instanceof P){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=N.create(Ce(r))}return new P({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:Ce(t.element)}):t instanceof N?N.create(Ce(t.unwrap())):t instanceof G?G.create(Ce(t.unwrap())):t instanceof z?z.create(t.items.map(e=>Ce(e))):t}var P=class t extends x{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=b.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return p(u,{code:l.invalid_type,expected:m.object,received:u.parsedType}),h}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof D&&this._def.unknownKeys==="strip"))for(let u in a.data)s.includes(u)||o.push(u);let d=[];for(let u of s){let f=i[u],_=a.data[u];d.push({key:{status:"valid",value:u},value:f._parse(new M(a,_,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof D){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of o)d.push({key:{status:"valid",value:f},value:{status:"valid",value:a.data[f]}});else if(u==="strict")o.length>0&&(p(a,{code:l.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of o){let _=a.data[f];d.push({key:{status:"valid",value:f},value:u._parse(new M(a,_,a.path,f)),alwaysSet:f in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of d){let _=await f.key,k=await f.value;u.push({key:_,value:k,alwaysSet:f.alwaysSet})}return u}).then(u=>E.mergeObjectSync(r,u)):E.mergeObjectSync(r,d)}get shape(){return this._def.shape()}strict(e){return g.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:g.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 b.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 b.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ce(this)}partial(e){let n={};for(let r of b.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 b.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof N;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return Cn(b.objectKeys(this.shape))}};P.create=(t,e)=>new P({shape:()=>t,unknownKeys:"strip",catchall:D.create(),typeName:y.ZodObject,...S(e)});P.strictCreate=(t,e)=>new P({shape:()=>t,unknownKeys:"strict",catchall:D.create(),typeName:y.ZodObject,...S(e)});P.lazycreate=(t,e)=>new P({shape:t,unknownKeys:"strip",catchall:D.create(),typeName:y.ZodObject,...S(e)});var oe=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new R(o.ctx.common.issues));return p(n,{code:l.invalid_union,unionErrors:s}),h}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let d of r){let u={...n,common:{...n.common,issues:[]},parent:null},f=d._parseSync({data:n.data,path:n.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(d=>new R(d));return p(n,{code:l.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};oe.create=(t,e)=>new oe({options:t,typeName:y.ZodUnion,...S(e)});var H=t=>t instanceof ue?H(t.schema):t instanceof V?H(t.innerType()):t instanceof de?[t.value]:t instanceof le?t.options:t instanceof pe?b.objectValues(t.enum):t instanceof fe?H(t._def.innerType):t instanceof ie?[void 0]:t instanceof se?[null]:t instanceof N?[void 0,...H(t.unwrap())]:t instanceof G?[null,...H(t.unwrap())]:t instanceof je||t instanceof ge?H(t.unwrap()):t instanceof me?H(t._def.innerType):[],et=class t extends x{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:l.invalid_type,expected:m.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}):(p(n,{code:l.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 s=H(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...S(r)})}};function jt(t,e){let n=$(t),r=$(e);if(t===e)return{valid:!0,data:t};if(n===m.object&&r===m.object){let a=b.objectKeys(e),i=b.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(let o of i){let d=jt(t[o],e[o]);if(!d.valid)return{valid:!1};s[o]=d.data}return{valid:!0,data:s}}else if(n===m.array&&r===m.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let s=t[i],o=e[i],d=jt(s,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return n===m.date&&r===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ce=class extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(Qe(i)||Qe(s))return h;let o=jt(i.value,s.value);return o.valid?((Xe(i)||Xe(s))&&n.dirty(),{status:n.value,value:o.data}):(p(r,{code:l.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,s])=>a(i,s)):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}))}};ce.create=(t,e,n)=>new ce({left:t,right:e,typeName:y.ZodIntersection,...S(n)});var z=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return p(r,{code:l.invalid_type,expected:m.array,received:r.parsedType}),h;if(r.data.length<this._def.items.length)return p(r,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&r.data.length>this._def.items.length&&(p(r,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new M(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>E.mergeArray(n,s)):E.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:t,typeName:y.ZodTuple,rest:null,...S(e)})};var tt=class t extends x{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!==m.object)return p(r,{code:l.invalid_type,expected:m.object,received:r.parsedType}),h;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new M(r,o,r.path,o)),value:s._parse(new M(r,r.data[o],r.path,o)),alwaysSet:o 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 x?new t({keyType:e,valueType:n,typeName:y.ZodRecord,...S(r)}):new t({keyType:W.create(),valueType:e,typeName:y.ZodRecord,...S(n)})}},Ie=class extends x{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!==m.map)return p(r,{code:l.invalid_type,expected:m.map,received:r.parsedType}),h;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,d],u)=>({key:a._parse(new M(r,o,r.path,[u,"key"])),value:i._parse(new M(r,d,r.path,[u,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of s){let u=await d.key,f=await d.value;if(u.status==="aborted"||f.status==="aborted")return h;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),o.set(u.value,f.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let d of s){let u=d.key,f=d.value;if(u.status==="aborted"||f.status==="aborted")return h;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),o.set(u.value,f.value)}return{status:n.value,value:o}}}};Ie.create=(t,e,n)=>new Ie({valueType:e,keyType:t,typeName:y.ZodMap,...S(n)});var Re=class t extends x{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return p(r,{code:l.invalid_type,expected:m.set,received:r.parsedType}),h;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(p(r,{code:l.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&&(p(r,{code:l.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(d){let u=new Set;for(let f of d){if(f.status==="aborted")return h;f.status==="dirty"&&n.dirty(),u.add(f.value)}return{status:n.value,value:u}}let o=[...r.data.values()].map((d,u)=>i._parse(new M(r,d,r.path,u)));return r.common.async?Promise.all(o).then(d=>s(d)):s(o)}min(e,n){return new t({...this._def,minSize:{value:e,message:g.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:g.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Re.create=(t,e)=>new Re({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...S(e)});var nt=class t extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.function)return p(n,{code:l.invalid_type,expected:m.function,received:n.parsedType}),h;function r(o,d){return Ve({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ke(),U].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:d}})}function a(o,d){return Ve({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ke(),U].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:d}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Q){let o=this;return I(async function(...d){let u=new R([]),f=await o._def.args.parseAsync(d,i).catch(T=>{throw u.addIssue(r(d,T)),u}),_=await Reflect.apply(s,this,f);return await o._def.returns._def.type.parseAsync(_,i).catch(T=>{throw u.addIssue(a(_,T)),u})})}else{let o=this;return I(function(...d){let u=o._def.args.safeParse(d,i);if(!u.success)throw new R([r(d,u.error)]);let f=Reflect.apply(s,this,u.data),_=o._def.returns.safeParse(f,i);if(!_.success)throw new R([a(f,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:z.create(e).rest(q.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||z.create([]).rest(q.create()),returns:n||q.create(),typeName:y.ZodFunction,...S(r)})}},ue=class extends x{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})}};ue.create=(t,e)=>new ue({getter:t,typeName:y.ZodLazy,...S(e)});var de=class extends x{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return p(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};de.create=(t,e)=>new de({value:t,typeName:y.ZodLiteral,...S(e)});function Cn(t,e){return new le({values:t,typeName:y.ZodEnum,...S(e)})}var le=class t extends x{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return p(n,{expected:b.joinValues(r),received:n.parsedType,code:l.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 p(n,{received:n.data,code:l.invalid_enum_value,options:r}),h}return I(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})}};le.create=Cn;var pe=class extends x{_parse(e){let n=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==m.string&&r.parsedType!==m.number){let a=b.objectValues(n);return p(r,{expected:b.joinValues(a),received:r.parsedType,code:l.invalid_type}),h}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=b.objectValues(n);return p(r,{received:r.data,code:l.invalid_enum_value,options:a}),h}return I(e.data)}get enum(){return this._def.values}};pe.create=(t,e)=>new pe({values:t,typeName:y.ZodNativeEnum,...S(e)});var Q=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==m.promise&&n.common.async===!1)return p(n,{code:l.invalid_type,expected:m.promise,received:n.parsedType}),h;let r=n.parsedType===m.promise?n.data:Promise.resolve(n.data);return I(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Q.create=(t,e)=>new Q({type:t,typeName:y.ZodPromise,...S(e)});var V=class extends x{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:s=>{p(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return h;let d=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return d.status==="aborted"?h:d.status==="dirty"?ee(d.value):n.value==="dirty"?ee(d.value):d});{if(n.value==="aborted")return h;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?h:o.status==="dirty"?ee(o.value):n.value==="dirty"?ee(o.value):o}}if(a.type==="refinement"){let s=o=>{let d=a.refinement(o,i);if(r.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Y(s))return h;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Y(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):h);b.assertNever(a)}};V.create=(t,e,n)=>new V({schema:t,typeName:y.ZodEffects,effect:e,...S(n)});V.createWithPreprocess=(t,e,n)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...S(n)});var N=class extends x{_parse(e){return this._getType(e)===m.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(t,e)=>new N({innerType:t,typeName:y.ZodOptional,...S(e)});var G=class extends x{_parse(e){return this._getType(e)===m.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(t,e)=>new G({innerType:t,typeName:y.ZodNullable,...S(e)});var fe=class extends x{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===m.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var me=class extends x{_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 we(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new R(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new R(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};me.create=(t,e)=>new me({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var Pe=class extends x{_parse(e){if(this._getType(e)!==m.nan){let r=this._getOrReturnCtx(e);return p(r,{code:l.invalid_type,expected:m.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}};Pe.create=t=>new Pe({typeName:y.ZodNaN,...S(t)});var Qr=Symbol("zod_brand"),je=class extends x{_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}},De=class t extends x{_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(),ee(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})}},ge=class extends x{_parse(e){let n=this._def.innerType._parse(e),r=a=>(Y(a)&&(a.value=Object.freeze(a.value)),a);return we(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};ge.create=(t,e)=>new ge({innerType:t,typeName:y.ZodReadonly,...S(e)});function xn(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Tn(t,e={},n){return t?J.create().superRefine((r,a)=>{let i=t(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=xn(e,r),d=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:d})}});if(!i){let s=xn(e,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):J.create()}var Xr={object:P.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 ea=(t,e={message:`Input not instance of ${t.name}`})=>Tn(n=>n instanceof t,e),En=W.create,In=te.create,ta=Pe.create,na=ne.create,Rn=re.create,ra=ae.create,aa=Te.create,ia=ie.create,sa=se.create,oa=J.create,ca=q.create,ua=D.create,da=Ee.create,la=Z.create,pa=P.create,fa=P.strictCreate,ma=oe.create,ga=et.create,ha=ce.create,ya=z.create,_a=tt.create,va=Ie.create,Sa=Re.create,xa=nt.create,ba=ue.create,ka=de.create,wa=le.create,Ca=pe.create,Ta=Q.create,Ea=V.create,Ia=N.create,Ra=G.create,Pa=V.createWithPreprocess,Aa=De.create,Oa=()=>En().optional(),Na=()=>In().optional(),Ma=()=>Rn().optional(),Va={string:(t=>W.create({...t,coerce:!0})),number:(t=>te.create({...t,coerce:!0})),boolean:(t=>re.create({...t,coerce:!0})),bigint:(t=>ne.create({...t,coerce:!0})),date:(t=>ae.create({...t,coerce:!0}))};var ja=h;var rt=c.object({page:c.object({title:c.string().nullable(),path:c.string(),search:c.string(),hash:c.string()}).strict(),referrer:c.string().nullable(),viewport:c.object({w:c.number(),h:c.number()}).strict().nullable().optional()}).strict(),Pn=c.object({}).strict();var Lt="aranova_tracking_last_fired_url",Dt=null,Ft=!1;function Da(t){try{return typeof window>"u"?null:window.sessionStorage.getItem(t)}catch{return null}}function Fa(t,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(t,e)}catch{}}function La(){if(!Ft){Ft=!0;let t=Da(Lt);t!==null&&(Dt=t)}return Dt}function $a(t){Dt=t,Ft=!0,Fa(Lt,t)}function An(t){return typeof window>"u"||typeof document>"u"?null:rt.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 Fe(t){if(typeof window>"u")return;let e=window.location.href,n=La(),r=n!==null&&n!==e?n:null,a=typeof document<"u"&&document.referrer||null,s=An(r??a);t.trackEvent({eventType:"page_view",pageUrl:e,metadata:s}),e!==n&&$a(e)}function $t(t){if(typeof window>"u")return()=>{};function e(n){n.persisted&&Fe(t)}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}function zt(t,e={}){if(typeof window>"u"||typeof history>"u")return()=>{};let n=window.location.pathname+window.location.search;function r(){let u=window.location.pathname+window.location.search;u!==n&&(n=u,Fe(t))}let a=history.pushState.bind(history),i=history.replaceState.bind(history);function s(...u){a(...u),setTimeout(r,0)}function o(...u){i(...u),setTimeout(r,0)}function d(u){u.persisted&&Fe(t)}return history.pushState=s,history.replaceState=o,window.addEventListener("popstate",r),window.addEventListener("pageshow",d),e.skipInitial||Fe(t),()=>{history.pushState=a,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("pageshow",d)}}function at(t){if(t instanceof RegExp)return t.source;if(Array.isArray(t))return t.map(at);if(t!==null&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=at(r);return e}return t}function Gt(t,e,n,r,a=null){let i=r?Object.keys(r.automatic):[],s=r?.manual?Object.keys(r.manual):[],o=null;if(r){let d={};for(let[u,f]of Object.entries(r.automatic)){let _=at(f);Object.keys(_).length>0&&(d[u]=_)}if(r.manual)for(let[u,f]of Object.entries(r.manual)){if(f===void 0)continue;let _=at(f);Object.keys(_).length>0&&(d[u]=_)}Object.keys(d).length>0&&(o=d)}return{sdk_version:e??"unknown",package_name:n,surface:t,triggers:{automatic:i,manual:s},trigger_config:o,configured_gtag_ids:a}}var Nn=2e3,Mn=10,it=50,st="X-Aranova-Api-Key",ot="X-Aranova-Sdk-Version",ct="X-Aranova-Sdk-Package",ut="X-Aranova-Sdk-Surface",dt="X-Aranova-Sdk-Environment";function Ga(t,e,n,r,a){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,environment:r,active_gtag_ids:a}}function Ka(){if(typeof window>"u")return ye();try{X()}catch{}return _e(Se)}function Ua(){try{return{state:L()}}catch{return null}}async function On(t,e,n,r,a){if(typeof fetch=="function")try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",[st]:n,[ot]:r.sdkVersion,[ct]:r.packageName,[ut]:r.surface,[dt]:r.environment},body:e,keepalive:a,credentials:"omit",mode:"cors"})}catch{}}function Kt(t){let e=t.flushIntervalMs??Nn,n=Math.min(t.maxQueueSize??Mn,it),r=t.sdkVersion??null,a=t.packageName??null,i=t.environment??"production",s=t.activeGtagIds??null,d=`${t.endpoint.replace(/\/$/,"")}/events`,u={sdkVersion:r??"",packageName:a??"",surface:t.surface,environment:i},f=[],_=null,k=null,T=ye(),v=!1,C=Nt(),B=be(),F=B.id;if(typeof window<"u"){k=window.location.href;try{T=X()}catch{}try{Me()}catch{}}function Ae(){let w=Gt(t.surface,r,a,t.triggers??null,s);f.push({event_type:"sdk_heartbeat",page_url:typeof window>"u"?null:window.location.href,metadata:w,occurred_at:new Date().toISOString()})}B.isNew&&Ae();function $e(){let w=be();w.isNew&&w.id!==F&&Ae(),F=w.id;let A=_t(Ka(),T),Oe=Ga(t.surface,r,a,i,s);return{session_id:F,visitor_id:C,gclid:A.gclid,fbclid:A.fbclid,fbc:Ne(),fbp:Be(),utm_source:A.utm_source,utm_medium:A.utm_medium,utm_campaign:A.utm_campaign,utm_term:A.utm_term,utm_content:A.utm_content,first_page:k,consent_state:Ua(),context:Oe}}function fr(){_!==null||v||(_=setTimeout(()=>{_=null,mt()},e))}function ft(){_!==null&&(clearTimeout(_),_=null)}async function mt(){if(f.length===0)return;let w=f.slice(0,it);f=f.slice(w.length),ft();let A={session:$e(),events:w},Oe=JSON.stringify(A);await On(d,Oe,t.apiKey,u,!1)}function mr(w){if(v||!w||typeof w.eventType!="string"||w.eventType.length===0)return;let A=w.occurredAt instanceof Date?w.occurredAt.toISOString():typeof w.occurredAt=="string"?w.occurredAt:new Date().toISOString();f.push({event_type:w.eventType,page_url:w.pageUrl??(typeof window>"u"?null:window.location.href),metadata:w.metadata??null,occurred_at:A}),f.length>=n?mt():fr()}function ze(){if(f.length===0)return;let w=f.slice(0,it);f=f.slice(w.length),ft();let A={session:$e(),events:w},Oe=JSON.stringify(A);On(d,Oe,t.apiKey,u,!0)}return typeof window<"u"&&(window.addEventListener("pagehide",ze),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&ze()})),{trackEvent:mr,flush:mt,getSessionId:()=>F,getVisitorId:()=>C,destroy:()=>{v=!0,f.length>0&&ze(),ft(),f=[],typeof window<"u"&&window.removeEventListener("pagehide",ze)}}}var Vn=c.object({cta_name:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional(),destination_url:c.string().nullable().optional()}).strict(),jn=c.object({}).strict();var Ha=c.object({automatic:c.array(c.string()),manual:c.array(c.string())}).strict(),Dn=c.object({sdk_version:c.string(),package_name:c.string().nullable(),surface:c.enum(["next","react","script"]),triggers:Ha,trigger_config:c.record(c.string(),c.record(c.string(),c.unknown())).nullable().optional(),configured_gtag_ids:c.record(c.string(),c.string()).nullable().optional()}).strict(),Fn=c.object({}).strict();var Ln=c.object({form:c.object({id:c.string(),action:c.string().nullable()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),$n=c.object({selector:c.string().optional()}).strict();var Ut=c.lazy(()=>c.union([c.string(),c.number().finite(),c.boolean(),c.null(),c.array(Ut),c.record(Ut)])),zn=c.object({form:c.object({id:c.string(),action:c.string().nullable(),fields:c.array(c.object({name:c.string(),type:c.string(),label:c.string().nullable(),value:Ut}).strict()).optional()}).strict(),page:c.object({path:c.string()}).strict()}).strict(),Gn=c.object({}).strict();var Kn=c.object({page_count:c.number().int().min(2),page:c.object({path:c.string()}).strict()}).strict(),Un=c.object({pageThreshold:c.number().int().min(2)}).strict();var Hn=c.object({phone_number:c.string(),page:c.object({path:c.string()}).strict(),section:c.string().nullable().optional()}).strict(),qn=c.object({}).strict();var Zn=c.object({depth_percent:c.number().int().min(1).max(100),page:c.object({path:c.string()}).strict()}).strict(),Bn=c.object({thresholds:c.array(c.number().int().min(1).max(100)).min(1)}).strict();var qa=["contact_page","about_page","services_page","booking_page","location_page","pricing_page","faq_page","testimonials_page"],Yn=c.enum(qa),Wn=c.object({page_name:Yn,page:c.object({path:c.string()}).strict()}).strict(),Jn=c.object({pages:c.array(c.object({name:Yn,pathPattern:c.custom(t=>t instanceof RegExp,{message:"pathPattern must be a RegExp"})}).strict()).min(1)}).strict();var Qn=c.object({duration_ms:c.number().int().nonnegative(),page:c.object({path:c.string()}).strict()}).strict(),Xn=c.object({thresholdSeconds:c.number().int().positive()}).strict();var Ht={page_view:{kind:"automatic",metadataSchema:rt,configSchema:Pn},time_on_site:{kind:"automatic",metadataSchema:Qn,configSchema:Xn},specific_page_visit:{kind:"automatic",metadataSchema:Wn,configSchema:Jn},scroll_depth:{kind:"automatic",metadataSchema:Zn,configSchema:Bn},multi_page_session:{kind:"automatic",metadataSchema:Kn,configSchema:Un},form_start:{kind:"automatic",metadataSchema:Ln,configSchema:$n},sdk_heartbeat:{kind:"automatic",metadataSchema:Dn,configSchema:Fn},form_submit:{kind:"manual",metadataSchema:zn,configSchema:Gn},phone_click:{kind:"manual",metadataSchema:Hn,configSchema:qn},cta_click:{kind:"manual",metadataSchema:Vn,configSchema:jn}},Os=Object.entries(Ht).filter(([,t])=>t.kind==="automatic").map(([t])=>t),Ns=Object.entries(Ht).filter(([,t])=>t.kind==="manual").map(([t])=>t);function qt(t){return Ht[t]}function Zt(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,s=!1;function o(){s||(s=!0,t.trackEvent({eventType:"time_on_site",metadata:{duration_ms:n,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function d(){if(s||a===null)return;let _=n-r;if(_<=0){o();return}i=setTimeout(o,_)}function u(){i!==null&&(clearTimeout(i),i=null)}function f(){s||(document.visibilityState==="hidden"?(a!==null&&(r+=Date.now()-a,a=null),u()):(a=Date.now(),d()))}return document.addEventListener("visibilitychange",f),d(),()=>{u(),document.removeEventListener("visibilitychange",f)}}function Bt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let{pages:n}=e,r=new Set;function a(){let u=window.location.pathname;for(let{name:f,pathPattern:_}of n){if(_.lastIndex=0,!_.test(u))continue;let k=`${f}:${u}`;r.has(k)||(r.add(k),t.trackEvent({eventType:"specific_page_visit",metadata:{page_name:f,page:{path:u}},pageUrl:window.location.href,occurredAt:null}))}}let i=history.pushState.bind(history),s=history.replaceState.bind(history);function o(...u){i(...u),setTimeout(a,0)}function d(...u){s(...u),setTimeout(a,0)}return history.pushState=o,history.replaceState=d,window.addEventListener("popstate",a),a(),()=>{history.pushState=i,history.replaceState=s,window.removeEventListener("popstate",a)}}function Yt(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 s(){let v=document.documentElement,C=window.scrollY||v.scrollTop,B=v.scrollHeight,F=v.clientHeight;return B<=F?100:Math.round((C+F)/B*100)}function o(){let v=s();for(let C of n)v>=C&&!r.has(C)&&(r.add(C),t.trackEvent({eventType:"scroll_depth",metadata:{depth_percent:C,page:{path:a}},pageUrl:window.location.href,occurredAt:null}))}function d(){i===null&&(i=requestAnimationFrame(()=>{i=null,o()}))}function u(){let v=window.location.pathname;v!==a&&(a=v,r=new Set,setTimeout(o,0))}let f=history.pushState.bind(history),_=history.replaceState.bind(history);function k(...v){f(...v),setTimeout(u,0)}function T(...v){_(...v),setTimeout(u,0)}return history.pushState=k,history.replaceState=T,window.addEventListener("popstate",u),window.addEventListener("scroll",d,{passive:!0}),setTimeout(o,0),()=>{i!==null&&cancelAnimationFrame(i),history.pushState=f,history.replaceState=_,window.removeEventListener("popstate",u),window.removeEventListener("scroll",d)}}var Wt="aranova_tracking_mps_paths",er="aranova_tracking_mps_session",Jt="aranova_tracking_mps_fired";function Za(){try{return typeof window<"u"?window.sessionStorage:null}catch{return null}}function Qt(t,e){if(typeof window>"u"||typeof history>"u")return()=>{};let n=Za();if(!n)return()=>{};let{pageThreshold:r}=e,a="";function i(){try{let v=n.getItem(Wt);return v?new Set(JSON.parse(v)):new Set}catch{return new Set}}function s(v){try{n.setItem(Wt,JSON.stringify([...v]))}catch{}}function o(){let v=be().id;n.getItem(er)!==v&&(n.setItem(er,v),n.removeItem(Wt),n.removeItem(Jt))}function d(){return n.getItem(Jt)==="1"}function u(){let v=window.location.pathname;if(v===a||(a=v,o(),d()))return;let C=i();C.add(v),s(C),C.size>=r&&(n.setItem(Jt,"1"),t.trackEvent({eventType:"multi_page_session",metadata:{page_count:C.size,page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}let f=history.pushState.bind(history),_=history.replaceState.bind(history);function k(...v){f(...v),setTimeout(u,0)}function T(...v){_(...v),setTimeout(u,0)}return history.pushState=k,history.replaceState=T,window.addEventListener("popstate",u),u(),()=>{history.pushState=f,history.replaceState=_,window.removeEventListener("popstate",u)}}function Xt(t,e){if(typeof window>"u"||typeof document>"u")return()=>{};let n=e.selector??"form",r=new Set,a=window.location.pathname;function i(k){if(k.id)return`id:${k.id}`;let T=k.getAttribute("action");return T?`action:${T}`:`index:${Array.from(document.querySelectorAll(n)).indexOf(k)}`}function s(k){let T=k.target;if(!(T instanceof HTMLElement))return;let v=T.closest(n);if(!v||v.tagName!=="FORM")return;let C=i(v);r.has(C)||(r.add(C),t.trackEvent({eventType:"form_start",metadata:{form:{id:v.id||"",action:v.getAttribute("action")??null},page:{path:window.location.pathname}},pageUrl:window.location.href,occurredAt:null}))}function o(){let k=window.location.pathname;k!==a&&(a=k,r=new Set)}let d=history.pushState.bind(history),u=history.replaceState.bind(history);function f(...k){d(...k),setTimeout(o,0)}function _(...k){u(...k),setTimeout(o,0)}return history.pushState=f,history.replaceState=_,window.addEventListener("popstate",o),document.addEventListener("focusin",s),()=>{history.pushState=d,history.replaceState=u,window.removeEventListener("popstate",o),document.removeEventListener("focusin",s)}}var lt=class extends Error{constructor(e,n){super(e),this.name="AranovaApiError",this.status=n.status,this.code=n.code,this.requestId=n.requestId}};function Ba(t){let e={[st]:t.apiKey};return t.sdkVersion&&(e[ot]=t.sdkVersion),t.packageName&&(e[ct]=t.packageName),t.surface&&(e[ut]=t.surface),t.environment&&(e[dt]=t.environment),e}function Ya(t,e){return`${t.replace(/\/$/,"")}${e}`}async function j(t,e,n,r){let a=Ba(t);r!==void 0&&(a["Content-Type"]="application/json");let i=await fetch(Ya(t.endpoint,n),{method:e,headers:a,body:r===void 0?void 0:JSON.stringify(r)});if(!i.ok){let s,o;try{let d=await i.json();if(d&&typeof d=="object"){let u=d;typeof u.detail=="string"&&(s=u.detail),typeof u.code=="string"&&(o=u.code)}}catch{}throw new lt(s??i.statusText??"Request failed",{status:i.status,code:o,requestId:i.headers.get("x-request-id")??void 0})}if(i.status!==204)return await i.json()}function tr(t){return{async record(e){let n=e.currency??t.defaultCurrency;if(!n)throw new Error("record: `currency` is required (pass it on the sale or set config.defaultCurrency)");let r={...e,currency:n,occurred_at:e.occurred_at??new Date().toISOString()};return j(t,"POST","/sales",r)},async list(e){let{cursor:n,limit:r,sort:a,order:i,want_total:s,...o}=e??{};return j(t,"POST","/sales/query",{filters:o,...r!==void 0?{limit:r}:{},...n!==void 0?{cursor:n}:{},...a!==void 0?{sort:a}:{},...i!==void 0?{order:i}:{},...s!==void 0?{want_total:s}:{}})},async summary(e){let{range:n,include_categories:r,include_deleted_services:a,top_n:i,since:s,until:o,timezone:d,granularity:u,compare_to:f,..._}=e;return j(t,"POST","/sales/summary",{filters:_,...n!==void 0?{range:n}:{},...r!==void 0?{include_categories:r}:{},...a!==void 0?{include_deleted_services:a}:{},...i!==void 0?{top_n:i}:{},...s!==void 0?{since:s}:{},...o!==void 0?{until:o}:{},...d!==void 0?{timezone:d}:{},...u!==void 0?{granularity:u}:{},...f!==void 0?{compare_to:f}:{}})},async get(e){return j(t,"GET",`/sales/${e}`)},async update(e,n){return j(t,"PATCH",`/sales/${e}`,n)},async delete(e){await j(t,"DELETE",`/sales/${e}`)},customers:{async list(e){let{segment:n,sort:r,order:a,cursor:i,limit:s,want_total:o,...d}=e??{};return j(t,"POST","/customers/query",{filters:d,...n!==void 0?{segment:n}:{},...r!==void 0?{sort:r}:{},...a!==void 0?{order:a}:{},...i!==void 0?{cursor:i}:{},...s!==void 0?{limit:s}:{},...o!==void 0?{want_total:o}:{}})},async get(e,n){let r=new URLSearchParams;n?.include_sales!==void 0&&r.set("include_sales",String(n.include_sales)),n?.limit!==void 0&&r.set("limit",String(n.limit)),n?.cursor!=null&&r.set("cursor",n.cursor);let a=r.toString();return j(t,"GET",`/customers/${encodeURIComponent(e)}${a?`?${a}`:""}`)},async summary(e){let{range:n,since:r,until:a,timezone:i,compare_to:s,...o}=e??{};return j(t,"POST","/customers/summary",{filters:o,...n!==void 0?{range:n}:{},...r!==void 0?{since:r}:{},...a!==void 0?{until:a}:{},...i!==void 0?{timezone:i}:{},...s!==void 0?{compare_to:s}:{}})}},business:{async config(){return j(t,"GET","/business/config")}}}}var Wa=["USD","CAD"],Ja=["production","development"],nr=c.enum(Wa),Le=c.number().int().nonnegative(),Qa=c.string().regex(/^\d+(\.\d{1,3})?$/),rr=c.record(c.unknown()),ar=c.object({external_item_id:c.string().nullable().optional(),name:c.string().nullable().optional(),category:c.string().nullable().optional(),quantity:Qa,unit_price_cents:Le,unit_cost_cents:Le.nullable().optional()}).strict(),ir=c.object({service:c.string(),amount_cents:Le}).strict(),sr=c.string().max(200),or=c.string().max(64),cr=c.string().max(320).email();function ur(t,e,{requireAmount:n}){if(t.services!=null){t.service!=null&&e.addIssue({code:c.ZodIssueCode.custom,message:"pass either `service` or `services`, not both",path:["services"]}),t.services.length===0&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not be empty",path:["services"]});let r=t.services.map(a=>a.service);if(new Set(r).size!==r.length&&e.addIssue({code:c.ZodIssueCode.custom,message:"`services` must not list the same service more than once",path:["services"]}),t.amount_total_cents!=null){let a=t.services.reduce((i,s)=>i+s.amount_cents,0);t.amount_total_cents!==a&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",path:["amount_total_cents"]})}}else n&&t.amount_total_cents==null&&e.addIssue({code:c.ZodIssueCode.custom,message:"amount_total_cents is required unless `services` is provided",path:["amount_total_cents"]})}var Js=c.object({external_id:c.string().nullable().optional(),description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(ir).nullable().optional(),currency:nr,amount_total_cents:Le.nullable().optional(),occurred_at:c.string().datetime(),environment:c.enum(Ja).default("production"),items:c.array(ar).default([]),metadata:rr.nullable().optional(),customer_name:sr.nullable().optional(),customer_phone:or.nullable().optional(),customer_email:cr.nullable().optional()}).strict().superRefine((t,e)=>ur(t,e,{requireAmount:!0})),Qs=c.object({description:c.string().nullable().optional(),service:c.string().nullable().optional(),services:c.array(ir).nullable().optional(),currency:nr.optional(),amount_total_cents:Le.optional(),occurred_at:c.string().datetime().optional(),items:c.array(ar).optional(),metadata:rr.nullable().optional(),customer_name:sr.nullable().optional(),customer_phone:or.nullable().optional(),customer_email:cr.nullable().optional()}).strict().superRefine((t,e)=>ur(t,e,{requireAmount:!1}));var en="aranova-tracking-consent-banner";function ei(){return _e(Se)}function dr(){document.querySelector(`#${en}`)?.remove()}function lr(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 ti(){if(typeof document>"u"||L()!=="pending"||document.querySelector(`#${en}`))return;let t=document.createElement("div");t.id=en,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=lr("Decline",()=>{he("denied"),dr()},{}),i=lr("Accept",()=>{he("granted"),dr()},{background:"#111827",color:"#ffffff",border:"1px solid #111827"});r.append(a),r.append(i),e.append(n),e.append(r),t.append(e),document.body.append(t)}var O=null,tn=null,K=[],pt=null;function ni(){for(let t=K.length-1;t>=0;t--)K[t]();K=[],O!==null&&(O.destroy(),O=null),tn=null,pt=null}function pr(t={}){if(typeof window>"u")return;window.AranovaTracking=nn;let{apiKey:e,endpoint:n,autoCaptureTrackingParams:r=!0,cookieMaxAgeSeconds:a=7776e3,gtagId:i,gtagIds:s,metaPixelId:o,metaPixelIds:d,environment:u,renderConsentBanner:f=!0,triggers:_}=t;if(r&&X(window.location.href,a),s&&Object.keys(s).length>0?kt(s):i&&bt(i),d&&Object.keys(d).length>0?Pt(d):o&&Rt(o),f&&ti(),ni(),!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}pt=tr({apiKey:e,endpoint:n});let k=_??{automatic:{page_view:{}},manual:{}};tn=k;let T=s?Object.fromEntries(Object.entries(s).filter($e=>$e[1]!=null)):i?{default:i}:void 0;O=Kt({apiKey:e,endpoint:n,surface:"script",packageName:"@aranova/tracking-browser",sdkVersion:an,triggers:k,environment:u,activeGtagIds:T}),K.push(zt(O)),K.push($t(O));let v=k.automatic.time_on_site;v&&K.push(Zt(O,v));let C=k.automatic.specific_page_visit;C&&K.push(Bt(O,C));let B=k.automatic.scroll_depth;B&&K.push(Yt(O,B));let F=k.automatic.multi_page_session;F&&K.push(Qt(O,F));let Ae=k.automatic.form_start;Ae&&K.push(Xt(O,Ae))}function ri(t,e){if(O===null){console.warn("[AranovaTracking] trackEvent called before init({ apiKey, endpoint })");return}let n=tn;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{qt(t).metadataSchema.parse(e)}catch(a){console.warn(`[AranovaTracking] trackEvent: metadata for "${t}" failed schema validation`,a);return}O.trackEvent({eventType:t,metadata:e,pageUrl:null,occurredAt:null})}function ai(){if(pt===null)throw new Error("[AranovaTracking] sales() called before init({ apiKey, endpoint })");return pt}var nn={init:pr,captureTrackingParams:()=>X(),getTrackingParams:ei,getConsentState:L,setConsentState:he,trackEvent:ri,sales:ai};typeof window<"u"&&(window.AranovaTracking=nn);var ii=nn;return vr(si);})();
|
|
2
2
|
//# sourceMappingURL=aranova-tracking.global.js.map
|