@aranova/tracking-browser 0.16.0 → 0.16.1

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