@walkeros/web-destination-gtag 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/index.js +5517 -25
- package/dist/examples/index.mjs +5517 -25
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +361 -42
- package/dist/index.d.ts +361 -42
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Destination=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},r={};o(r,{DestinationGtag:()=>X,default:()=>K,destinationGtag:()=>J,examples:()=>A,resetConsentState:()=>M});var i=new Set;function c(t,e="https://www.googletagmanager.com/gtag/js?id=",n=globalThis.document){if(i.has(t))return;const a=n.createElement("script");a.src=e+t,n.head.appendChild(a),i.add(t)}function s(t){const e=t;return e.dataLayer=e.dataLayer||[],e.gtag||(e.gtag=function(){e.dataLayer.push(arguments)}),e.gtag}var d={merge:!0,shallow:!0,extend:!0};function u(t,e={},n={}){n={...d,...n};const a=Object.entries(e).reduce((e,[a,o])=>{const r=t[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?e[a]=o.reduce((t,e)=>t.includes(e)?t:[...t,e],[...r]):(n.extend||a in t)&&(e[a]=o),e},{});return n.shallow?{...t,...a}:(Object.assign(t,a),t)}function l(t){return Array.isArray(t)}function g(t){return void 0!==t}function p(t){return"object"==typeof t&&null!==t&&!l(t)&&"[object Object]"===Object.prototype.toString.call(t)}function m(t){return"string"==typeof t}function v(t,e="",n){const a=e.split(".");let o=t;for(let t=0;t<a.length;t++){const e=a[t];if("*"===e&&l(o)){const e=a.slice(t+1).join("."),r=[];for(const t of o){const a=v(t,e,n);r.push(a)}return r}if(o=o instanceof Object?o[e]:void 0,!o)break}return g(o)?o:n}function y(t="entity action",e={}){const n=e.timestamp||(new Date).setHours(0,13,37,0),a={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},o={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return function(t={}){var e;const n=t.timestamp||(new Date).setHours(0,13,37,0),a=t.group||"gr0up",o=t.count||1,r=u({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:"0.2.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},t,{merge:!1});if(t.name){const[n,a]=null!=(e=t.name.split(" "))?e:[];n&&a&&(r.entity=n,r.action=a)}return r}({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["complete",0]},nested:[]},{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[t],...e,name:t})}function f(t){return function(t){return"boolean"==typeof t}(t)||m(t)||function(t){return"number"==typeof t&&!Number.isNaN(t)}(t)||!g(t)||l(t)&&t.every(f)||p(t)&&Object.values(t).every(f)}function h(t){return f(t)?t:void 0}function w(t,e,n){return async function(...a){try{return await t(...a)}catch(t){if(!e)return;return await e(t)}finally{await(null==n?void 0:n())}}}async function b(t,e={},n={}){var a;if(!g(t))return;const o=p(t)&&t.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),r=l(e)?e:[e];for(const e of r){const a=await w(_)(t,e,{...n,consent:o});if(g(a))return a}}async function _(t,e,n={}){const{collector:a,consent:o}=n;return(l(e)?e:[e]).reduce(async(e,r)=>{const i=await e;if(i)return i;const c=m(r)?{key:r}:r;if(!Object.keys(c).length)return;const{condition:s,consent:d,fn:u,key:p,loop:y,map:f,set:E,validate:k,value:x}=c;if(s&&!await w(s)(t,r,a))return;if(d&&!function(t,e={},n={}){const a={...e,...n},o={};let r=void 0===t;return Object.keys(a).forEach(e=>{a[e]&&(o[e]=!0,t&&t[e]&&(r=!0))}),!!r&&o}(d,o))return x;let j=g(x)?x:t;if(u&&(j=await w(u)(t,r,n)),p&&(j=v(t,p,x)),y){const[e,a]=y,o="this"===e?[t]:await b(t,e,n);l(o)&&(j=(await Promise.all(o.map(t=>b(t,a,n)))).filter(g))}else f?j=await Object.entries(f).reduce(async(e,[a,o])=>{const r=await e,i=await b(t,o,n);return g(i)&&(r[a]=i),r},Promise.resolve({})):E&&(j=await Promise.all(E.map(e=>_(t,e,n))));k&&!await w(k)(j)&&(j=void 0);const O=h(j);return g(O)?O:h(x)},Promise.resolve(void 0))}function E(t){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...t}}async function k(t,e,n,a,o){const r=p(e)?e:{},i=n.data?await b(t,n.data,{collector:o}):{},c=(null==a?void 0:a.data)?await b(t,a.data,{collector:o}):{},s=p(i)?i:{},d=p(c)?c:{};return u(u(r,s),d)}function x(t,e,n={},a,o){const{window:r}=E(o);if(!e.measurementId)return;const i=p(a)?a:{},c=function(t,e){const n={};return e.includes("all")&&(e=["context","data","event","globals","source","user","version"]),e.forEach(e=>{let a=t[e]||{};"event"==e&&(a={id:t.id,timing:t.timing,trigger:t.trigger,entity:t.entity,action:t.action,group:t.group,count:t.count}),Object.entries(a).forEach(([t,a])=>{"context"==e&&(a=a[0]),n[`${e}_${t}`]=a})}),n}(t,n.include||e.include||["data"]),s={...c,...i};let d=t.name;!1!==e.snakeCase&&(d=function(t,e=!0){return e?t.replace(/\s+/g,"_").toLowerCase():t}(d)),s.send_to=e.measurementId,e.debug&&(s.debug_mode=!0);(0,r.gtag)("event",d,s)}var j="dataLayer";function O(t,e,n){const{window:a,document:o}=E(n),{containerId:r,dataLayer:i,domain:c}=t,s=i||j;s===j?a.dataLayer=a.dataLayer||[]:a[s]=a[s]||[];a[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"}),e&&r&&function(t,e,n,a=globalThis.document){const o=n!=j?"&l="+n:"",r=a.createElement("script");r.src=e+t+o,a.head.appendChild(r)}(r,c||"https://www.googletagmanager.com/gtm.js?id=",s,o)}var X={},A={};o(A,{env:()=>I,events:()=>S,mapping:()=>z});var I={};o(I,{init:()=>R,push:()=>C,simulation:()=>L});var R={window:{gtag:void 0,dataLayer:[]},document:{createElement:()=>({src:"",setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},C={window:{gtag:Object.assign(()=>{},{}),dataLayer:[]},document:{createElement:()=>({src:"",setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},L=["call:window.gtag"],S={};function U(){const t=y("order complete");return["event","purchase",{transaction_id:t.data.id,value:t.data.total,tax:t.data.taxes,shipping:t.data.shipping,currency:"EUR",items:t.nested.filter(t=>"product"===t.entity).map(t=>({item_id:t.data.id,item_name:t.data.name,quantity:1})),send_to:"G-XXXXXX-1"}]}function P(){const t=y("product add");return["event","add_to_cart",{currency:"EUR",value:t.data.price,items:[{item_id:t.data.id,item_variant:t.data.color,quantity:1}],send_to:"G-XXXXXX-1"}]}function D(){const t=y("order complete");return["event","conversion",{send_to:"AW-XXXXXXXXX/CONVERSION_LABEL",currency:"EUR",value:t.data.total,transaction_id:t.data.id}]}function q(){const t=y("product view");return{event:"product_view",product_id:t.data.id,product_name:t.data.name,product_category:t.data.category,value:t.data.price,currency:"EUR"}}o(S,{adsConversion:()=>D,ga4AddToCart:()=>P,ga4Purchase:()=>U,gtmEvent:()=>q});var z={};o(z,{adsConversion:()=>$,combinedPurchase:()=>V,config:()=>G,ga4AddToCart:()=>T,ga4Purchase:()=>N,gtmProductView:()=>H});var N={name:"purchase",settings:{ga4:{include:["data","context"]}},data:{map:{transaction_id:"data.id",value:"data.total",tax:"data.taxes",shipping:"data.shipping",currency:{key:"data.currency",value:"EUR"},items:{loop:["nested",{condition:t=>p(t)&&"product"===t.entity,map:{item_id:"data.id",item_name:"data.name",quantity:{key:"data.quantity",value:1}}}]}}}},T={name:"add_to_cart",settings:{ga4:{include:["data"]}},data:{map:{currency:{value:"EUR",key:"data.currency"},value:"data.price",items:{loop:["this",{map:{item_id:"data.id",item_variant:"data.color",quantity:{value:1,key:"data.quantity"}}}]}}}},$={name:"CONVERSION_LABEL",settings:{ads:{}},data:{map:{value:"data.total",currency:{value:"EUR",key:"data.currency"},transaction_id:"data.id"}}},H={name:"product_view",settings:{gtm:{}},data:{map:{product_id:"data.id",product_name:"data.name",product_category:"data.category",value:"data.price",currency:{value:"EUR",key:"data.currency"}}}},V={name:"purchase",settings:{ga4:{include:["data"]},ads:{},gtm:{}},data:{map:{transaction_id:"data.id",value:"data.total",currency:{value:"EUR",key:"data.currency"},items:{loop:["nested",{condition:t=>p(t)&&"product"===t.entity,map:{item_id:"data.id",item_name:"data.name",quantity:{value:1,key:"data.quantity"}}}]}}}},G={order:{complete:V},product:{add:T,view:H}},B=!1;function M(){B=!1}var W,F={marketing:["ad_storage","ad_user_data","ad_personalization"],functional:["analytics_storage"]},J={type:"google-gtag",config:{settings:{}},init({config:t,env:e}){const{settings:n={},loadScript:a}=t,{ga4:o,ads:r,gtm:i}=n;return(null==o?void 0:o.measurementId)&&function(t,e,n){const{window:a,document:o}=E(n),{measurementId:r,transport_url:i,server_container_url:d,pageview:u}=t;if(!r)return;e&&c(r,void 0,o),s(a);const l={};i&&(l.transport_url=i),d&&(l.server_container_url=d),!1===u&&(l.send_page_view=!1);const g=a.gtag;g("js",new Date),g("config",r,l)}(o,a,e),(null==r?void 0:r.conversionId)&&function(t,e,n){const{window:a,document:o}=E(n),{conversionId:r}=t;if(!r)return;t.currency||(t.currency="EUR"),e&&c(r,void 0,o),s(a);const i=a.gtag;i("js",new Date),i("config",r)}(r,a,e),(null==i?void 0:i.containerId)&&O(i,a,e),!!((null==o?void 0:o.measurementId)||(null==r?void 0:r.conversionId)||(null==i?void 0:i.containerId))&&t},async push(t,{config:e,mapping:n={},data:a,env:o,collector:r}){const{settings:i={}}=e,{ga4:c,ads:s,gtm:d}=i,u=n.settings||{},l=await k(t,a,e,c,r),g=await k(t,a,e,s,r),m=await k(t,a,e,d,r);(null==c?void 0:c.measurementId)&&x(t,c,u.ga4,l,o),(null==s?void 0:s.conversionId)&&n.name&&function(t,e,n={},a,o,r){const{conversionId:i,currency:c}=e,s=p(a)?a:{},d=n.label||o;if(!d)return;const u={send_to:`${i}/${d}`,currency:c||"EUR",...s},{window:l}=E(r);(0,l.gtag)("event","conversion",u)}(0,s,u.ads,g,n.name,o),(null==d?void 0:d.containerId)&&function(t,e,n={},a,o){const{window:r}=E(o),i={event:t.name};r.dataLayer.push({...i,...p(a)?a:t})}(t,0,u.gtm,m,o)},on(t,e){var n;if("consent"!==t||!e)return;const a=e,o=(null==(n=this.config)?void 0:n.settings)||{},{como:r=!0}=o;if(!r)return;const{window:i}=E(this.env),c=s(i);if(!c)return;const d=!0===r?F:r;if(!B){const t=new Set;if(Object.values(d).forEach(e=>{(Array.isArray(e)?e:[e]).forEach(e=>t.add(e))}),t.size>0){const e={};t.forEach(t=>{e[t]="denied"}),c("consent","default",e)}B=!0}const u={};Object.entries(a).forEach(([t,e])=>{const n=d[t];if(!n)return;const a=Array.isArray(n)?n:[n],o=e?"granted":"denied";a.forEach(t=>{u[t]=o})}),0!==Object.keys(u).length&&c("consent","update",u)}},K=J;return W=r,((o,r,i,c)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of n(r))a.call(o,s)||s===i||t(o,s,{get:()=>r[s],enumerable:!(c=e(r,s))||c.enumerable});return o})(t({},"__esModule",{value:!0}),W)})();
|
|
1
|
+
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,r=(t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})},i={};r(i,{DestinationGtag:()=>Gr,default:()=>Ni,destinationGtag:()=>Ii,examples:()=>Kr,resetConsentState:()=>Ci,schemas:()=>mi});var s=new Set;function o(e,t="https://www.googletagmanager.com/gtag/js?id=",n=globalThis.document){if(s.has(e))return;const a=n.createElement("script");a.src=t+e,n.head.appendChild(a),s.add(e)}function c(e){const t=e;return t.dataLayer=t.dataLayer||[],t.gtag||(t.gtag=function(){t.dataLayer.push(arguments)}),t.gtag}var d,u,l,p={};r(p,{BRAND:()=>Je,DIRTY:()=>T,EMPTY_PATH:()=>x,INVALID:()=>P,NEVER:()=>zt,OK:()=>C,ParseStatus:()=>Z,Schema:()=>L,ZodAny:()=>ye,ZodArray:()=>Se,ZodBigInt:()=>le,ZodBoolean:()=>pe,ZodBranded:()=>qe,ZodCatch:()=>Ve,ZodDate:()=>me,ZodDefault:()=>Ue,ZodDiscriminatedUnion:()=>Ae,ZodEffects:()=>ze,ZodEnum:()=>Re,ZodError:()=>y,ZodFirstPartyTypeKind:()=>Ye,ZodFunction:()=>Ie,ZodIntersection:()=>Pe,ZodIssueCode:()=>f,ZodLazy:()=>Ne,ZodLiteral:()=>$e,ZodMap:()=>Oe,ZodNaN:()=>Be,ZodNativeEnum:()=>De,ZodNever:()=>be,ZodNull:()=>ge,ZodNullable:()=>Fe,ZodNumber:()=>ue,ZodObject:()=>xe,ZodOptional:()=>Xe,ZodParsedType:()=>m,ZodPipeline:()=>We,ZodPromise:()=>Le,ZodReadonly:()=>Ge,ZodRecord:()=>Ce,ZodSchema:()=>L,ZodSet:()=>Ee,ZodString:()=>ce,ZodSymbol:()=>he,ZodTransformer:()=>ze,ZodTuple:()=>Te,ZodType:()=>L,ZodUndefined:()=>fe,ZodUnion:()=>we,ZodUnknown:()=>ve,ZodVoid:()=>_e,addIssueToContext:()=>w,any:()=>lt,array:()=>ft,bigint:()=>it,boolean:()=>st,coerce:()=>Lt,custom:()=>He,date:()=>ot,datetimeRegex:()=>re,defaultErrorMap:()=>v,discriminatedUnion:()=>bt,effect:()=>Ot,enum:()=>Pt,function:()=>jt,getErrorMap:()=>S,getParsedType:()=>h,instanceof:()=>tt,intersection:()=>_t,isAborted:()=>O,isAsync:()=>N,isDirty:()=>E,isValid:()=>I,late:()=>et,lazy:()=>At,literal:()=>Zt,makeIssue:()=>k,map:()=>xt,nan:()=>rt,nativeEnum:()=>Tt,never:()=>mt,null:()=>ut,nullable:()=>It,number:()=>at,object:()=>gt,objectUtil:()=>l,oboolean:()=>Dt,onumber:()=>Rt,optional:()=>Et,ostring:()=>Mt,pipeline:()=>$t,preprocess:()=>Nt,promise:()=>Ct,quotelessJson:()=>g,record:()=>kt,set:()=>wt,setErrorMap:()=>_,strictObject:()=>yt,string:()=>nt,symbol:()=>ct,transformer:()=>Ot,tuple:()=>St,undefined:()=>dt,union:()=>vt,unknown:()=>pt,util:()=>d,void:()=>ht}),(u=d||(d={})).assertEqual=e=>{},u.assertIs=function(e){},u.assertNever=function(e){throw new Error},u.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},u.getValidEnumValues=e=>{const t=u.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return u.objectValues(n)},u.objectValues=e=>u.objectKeys(e).map(function(t){return e[t]}),u.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},u.find=(e,t)=>{for(const n of e)if(t(n))return n},u.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,u.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},u.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(l||(l={})).mergeShapes=(e,t)=>({...e,...t});var m=d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),h=e=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(e)?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(e)?m.array:null===e?m.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?m.promise:"undefined"!=typeof Map&&e instanceof Map?m.map:"undefined"!=typeof Set&&e instanceof Set?m.set:"undefined"!=typeof Date&&e instanceof Date?m.date:m.object;default:return m.unknown}},f=d.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"]),g=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),y=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};y.create=e=>new y(e);var v=(e,t)=>{let n;switch(e.code){case f.invalid_type:n=e.received===m.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,d.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${d.joinValues(e.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${d.joinValues(e.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${d.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:d.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case f.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case f.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=t.defaultError,d.assertNever(e)}return{message:n}},b=v;function _(e){b=e}function S(){return b}var k=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,i=[...n,...r.path||[]],s={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(s,{data:t,defaultError:o}).message;return{...r,path:i,message:o}},x=[];function w(e,t){const n=S(),a=k({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===v?void 0:v].filter(e=>!!e)});e.common.issues.push(a)}var j,A,Z=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return P;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const a=[];for(const e of n){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return e.mergeObjectSync(t,a)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return P;if("aborted"===r.status)return P;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}},P=Object.freeze({status:"aborted"}),T=e=>({status:"dirty",value:e}),C=e=>({status:"valid",value:e}),O=e=>"aborted"===e.status,E=e=>"dirty"===e.status,I=e=>"valid"===e.status,N=e=>"undefined"!=typeof Promise&&e instanceof Promise;(A=j||(j={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},A.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var $=class{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},M=(e,t)=>{if(I(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var i,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(i=null!=o?o:a)?i:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(s=null!=o?o:n)?s:r.defaultError}},description:r}}var D,L=class{get description(){return this._def.description}_getType(e){return h(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z,ctx:{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!=(n=null==t?void 0:t.async)&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},r=this._parseSync({data:e,path:a.path,parent:a});return M(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return I(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>I(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(N(a)?a:Promise.resolve(a));return M(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const r=e(t),i=()=>a.addIssue({code:f.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(i(),!1)):!!r||(i(),!1)})}refinement(e,t){return this._refinement((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1))}_refinement(e){return new ze({schema:this,typeName:Ye.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Xe.create(this,this._def)}nullable(){return Fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Se.create(this)}promise(){return Le.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return Pe.create(this,e,this._def)}transform(e){return new ze({...R(this._def),schema:this,typeName:Ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ue({...R(this._def),innerType:this,defaultValue:t,typeName:Ye.ZodDefault})}brand(){return new qe({typeName:Ye.ZodBranded,type:this,...R(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...R(this._def),innerType:this,catchValue:t,typeName:Ye.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return We.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},z=/^c[^\s-]{8,}$/i,X=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U=/^[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,V=/^[a-z0-9_-]{21}$/i,B=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J=/^[-+]?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)?)??$/,q=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,W=/^(?:(?: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])$/,G=/^(?:(?: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])$/,K=/^(([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]))$/,H=/^(([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])$/,Y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ee="((\\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])))",te=new RegExp(`^${ee}$`);function ne(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ae(e){return new RegExp(`^${ne(e)}$`)}function re(e){let t=`${ee}T${ne(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ie(e,t){return!("v4"!==t&&t||!W.test(e))||!("v6"!==t&&t||!K.test(e))}function se(e,t){if(!B.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===(null==r?void 0:r.typ))&&(!!r.alg&&(!t||r.alg===t)))}catch(e){return!1}}function oe(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!H.test(e))}var ce=class e extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==m.string){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.string,received:t.parsedType}),P}const t=new Z;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),w(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),w(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,i=e.data.length<a.value;(r||i)&&(n=this._getOrReturnCtx(e,n),r?w(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&w(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)q.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"email",code:f.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)D||(D=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"emoji",code:f.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)U.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"uuid",code:f.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)V.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"nanoid",code:f.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)z.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid",code:f.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)X.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid2",code:f.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"ulid",code:f.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),w(n,{validation:"url",code:f.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"regex",code:f.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){re(a).test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){te.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){ae(a).test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:f.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?J.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"duration",code:f.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?ie(e.data,a.version)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"ip",code:f.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?se(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"jwt",code:f.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?oe(e.data,a.version)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"cidr",code:f.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Y.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"base64",code:f.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?Q.test(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{validation:"base64url",code:f.invalid_string,message:a.message}),t.dirty()):d.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:f.invalid_string,...j.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(n=null==e?void 0:e.local)&&n,...j.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...j.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...j.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...j.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...j.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...j.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...j.errToObj(t)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function de(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ce.create=e=>{var t;return new ce({checks:[],typeName:Ye.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var ue=class e extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==m.number){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.number,received:t.parsedType}),P}let t;const n=new Z;for(const a of this._def.checks)if("int"===a.kind)d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:f.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==de(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_finite,message:a.message}),n.dirty()):d.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:j.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&d.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ue.create=e=>new ue({checks:[],typeName:Ye.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var le=class e extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let t;const n=new Z;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):d.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.bigint,received:t.parsedType}),P}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:j.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};le.create=e=>{var t;return new le({checks:[],typeName:Ye.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var pe=class extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==m.boolean){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.boolean,received:t.parsedType}),P}return C(e.data)}};pe.create=e=>new pe({typeName:Ye.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var me=class e extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==m.date){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.date,received:t.parsedType}),P}if(Number.isNaN(e.data.getTime())){return w(this._getOrReturnCtx(e),{code:f.invalid_date}),P}const t=new Z;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),w(n,{code:f.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),w(n,{code:f.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):d.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};me.create=e=>new me({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ye.ZodDate,...R(e)});var he=class extends L{_parse(e){if(this._getType(e)!==m.symbol){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.symbol,received:t.parsedType}),P}return C(e.data)}};he.create=e=>new he({typeName:Ye.ZodSymbol,...R(e)});var fe=class extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.undefined,received:t.parsedType}),P}return C(e.data)}};fe.create=e=>new fe({typeName:Ye.ZodUndefined,...R(e)});var ge=class extends L{_parse(e){if(this._getType(e)!==m.null){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.null,received:t.parsedType}),P}return C(e.data)}};ge.create=e=>new ge({typeName:Ye.ZodNull,...R(e)});var ye=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}};ye.create=e=>new ye({typeName:Ye.ZodAny,...R(e)});var ve=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}};ve.create=e=>new ve({typeName:Ye.ZodUnknown,...R(e)});var be=class extends L{_parse(e){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),P}};be.create=e=>new be({typeName:Ye.ZodNever,...R(e)});var _e=class extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.void,received:t.parsedType}),P}return C(e.data)}};_e.create=e=>new _e({typeName:Ye.ZodVoid,...R(e)});var Se=class e extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==m.array)return w(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),P;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(w(t,{code:e?f.too_big:f.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(w(t,{code:f.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(w(t,{code:f.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new $(t,e,t.path,n)))).then(e=>Z.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new $(t,e,t.path,n)));return Z.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:j.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:j.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};function ke(e){if(e instanceof xe){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Xe.create(ke(a))}return new xe({...e._def,shape:()=>t})}return e instanceof Se?new Se({...e._def,type:ke(e.element)}):e instanceof Xe?Xe.create(ke(e.unwrap())):e instanceof Fe?Fe.create(ke(e.unwrap())):e instanceof Te?Te.create(e.items.map(e=>ke(e))):e}Se.create=(e,t)=>new Se({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ye.ZodArray,...R(t)});var xe=class e extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=d.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof be&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const s=[];for(const e of r){const t=a[e],r=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new $(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(w(n,{code:f.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new $(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of s){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>Z.mergeObjectSync(t,e)):Z.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return j.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,i,s;const o=null!=(i=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?i:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(s=j.errToObj(t).message)?s:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ye.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const n={};for(const e of d.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){const n={};for(const e of d.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ke(this)}partial(t){const n={};for(const e of d.objectKeys(this.shape)){const a=this.shape[e];t&&!t[e]?n[e]=a:n[e]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){const n={};for(const e of d.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Xe;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Me(d.objectKeys(this.shape))}};xe.create=(e,t)=>new xe({shape:()=>e,unknownKeys:"strip",catchall:be.create(),typeName:Ye.ZodObject,...R(t)}),xe.strictCreate=(e,t)=>new xe({shape:()=>e,unknownKeys:"strict",catchall:be.create(),typeName:Ye.ZodObject,...R(t)}),xe.lazycreate=(e,t)=>new xe({shape:e,unknownKeys:"strip",catchall:be.create(),typeName:Ye.ZodObject,...R(t)});var we=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new y(e.ctx.common.issues));return w(t,{code:f.invalid_union,unionErrors:n}),P});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new y(e));return w(t,{code:f.invalid_union,unionErrors:r}),P}}get options(){return this._def.options}};we.create=(e,t)=>new we({options:e,typeName:Ye.ZodUnion,...R(t)});var je=e=>e instanceof Ne?je(e.schema):e instanceof ze?je(e.innerType()):e instanceof $e?[e.value]:e instanceof Re?e.options:e instanceof De?d.objectValues(e.enum):e instanceof Ue?je(e._def.innerType):e instanceof fe?[void 0]:e instanceof ge?[null]:e instanceof Xe?[void 0,...je(e.unwrap())]:e instanceof Fe?[null,...je(e.unwrap())]:e instanceof qe||e instanceof Ge?je(e.unwrap()):e instanceof Ve?je(e._def.innerType):[],Ae=class e extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return w(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),P;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(w(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),P)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,a){const r=new Map;for(const e of n){const n=je(e.shape[t]);if(!n.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of n){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,e)}}return new e({typeName:Ye.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...R(a)})}};function Ze(e,t){const n=h(e),a=h(t);if(e===t)return{valid:!0,data:e};if(n===m.object&&a===m.object){const n=d.objectKeys(t),a=d.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Ze(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===m.array&&a===m.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Ze(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===m.date&&a===m.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Pe=class extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(O(e)||O(a))return P;const r=Ze(e.value,a.value);return r.valid?((E(e)||E(a))&&t.dirty(),{status:t.value,value:r.data}):(w(n,{code:f.invalid_intersection_types}),P)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Pe.create=(e,t,n)=>new Pe({left:e,right:t,typeName:Ye.ZodIntersection,...R(n)});var Te=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return w(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),P;if(n.data.length<this._def.items.length)return w(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new $(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Z.mergeArray(t,e)):Z.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:Ye.ZodTuple,rest:null,...R(t)})};var Ce=class e extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return w(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),P;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new $(n,e,n.path,e)),value:i._parse(new $(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Z.mergeObjectAsync(t,a):Z.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof L?{keyType:t,valueType:n,typeName:Ye.ZodRecord,...R(a)}:{keyType:ce.create(),valueType:t,typeName:Ye.ZodRecord,...R(n)})}},Oe=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return w(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),P;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:a._parse(new $(n,e,n.path,[i,"key"])),value:r._parse(new $(n,t,n.path,[i,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of i){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return P;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of i){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return P;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Oe.create=(e,t,n)=>new Oe({valueType:t,keyType:e,typeName:Ye.ZodMap,...R(n)});var Ee=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return w(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),P;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(w(n,{code:f.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(w(n,{code:f.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const n=new Set;for(const a of e){if("aborted"===a.status)return P;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map((e,t)=>r._parse(new $(n,e,n.path,t)));return n.common.async?Promise.all(s).then(e=>i(e)):i(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:j.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:j.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ee.create=(e,t)=>new Ee({valueType:e,minSize:null,maxSize:null,typeName:Ye.ZodSet,...R(t)});var Ie=class e extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return w(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),P;function n(e,n){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S(),v].filter(e=>!!e),issueData:{code:f.invalid_arguments,argumentsError:n}})}function a(e,n){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S(),v].filter(e=>!!e),issueData:{code:f.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Le){const e=this;return C(async function(...t){const s=new y([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw s.addIssue(n(t,e)),s}),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw s.addIssue(a(c,e)),s})})}{const e=this;return C(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new y([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new y([a(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Te.create(t).rest(ve.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,a){return new e({args:t||Te.create([]).rest(ve.create()),returns:n||ve.create(),typeName:Ye.ZodFunction,...R(a)})}},Ne=class extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ne.create=(e,t)=>new Ne({getter:e,typeName:Ye.ZodLazy,...R(t)});var $e=class extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return w(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Me(e,t){return new Re({values:e,typeName:Ye.ZodEnum,...R(t)})}$e.create=(e,t)=>new $e({value:e,typeName:Ye.ZodLiteral,...R(t)});var Re=class e extends L{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return w(t,{expected:d.joinValues(n),received:t.parsedType,code:f.invalid_type}),P}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return w(t,{received:t.data,code:f.invalid_enum_value,options:n}),P}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Re.create=Me;var De=class extends L{_parse(e){const t=d.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const e=d.objectValues(t);return w(n,{expected:d.joinValues(e),received:n.parsedType,code:f.invalid_type}),P}if(this._cache||(this._cache=new Set(d.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=d.objectValues(t);return w(n,{received:n.data,code:f.invalid_enum_value,options:e}),P}return C(e.data)}get enum(){return this._def.values}};De.create=(e,t)=>new De({values:e,typeName:Ye.ZodNativeEnum,...R(t)});var Le=class extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&!1===t.common.async)return w(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),P;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return C(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Le.create=(e,t)=>new Le({type:e,typeName:Ye.ZodPromise,...R(t)});var ze=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{w(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return P;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?P:"dirty"===a.status||"dirty"===t.value?T(a.value):a});{if("aborted"===t.value)return P;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?P:"dirty"===a.status||"dirty"===t.value?T(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?P:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?P:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!I(e))return P;const i=a.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>I(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):P)}d.assertNever(a)}};ze.create=(e,t,n)=>new ze({schema:e,typeName:Ye.ZodEffects,effect:t,...R(n)}),ze.createWithPreprocess=(e,t,n)=>new ze({schema:t,effect:{type:"preprocess",transform:e},typeName:Ye.ZodEffects,...R(n)});var Xe=class extends L{_parse(e){return this._getType(e)===m.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xe.create=(e,t)=>new Xe({innerType:e,typeName:Ye.ZodOptional,...R(t)});var Fe=class extends L{_parse(e){return this._getType(e)===m.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fe.create=(e,t)=>new Fe({innerType:e,typeName:Ye.ZodNullable,...R(t)});var Ue=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ue.create=(e,t)=>new Ue({innerType:e,typeName:Ye.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});var Ve=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return N(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ve.create=(e,t)=>new Ve({innerType:e,typeName:Ye.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});var Be=class extends L{_parse(e){if(this._getType(e)!==m.nan){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:m.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}};Be.create=e=>new Be({typeName:Ye.ZodNaN,...R(e)});var Je=Symbol("zod_brand"),qe=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},We=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),T(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Ye.ZodPipeline})}},Ge=class extends L{_parse(e){const t=this._def.innerType._parse(e),n=e=>(I(e)&&(e.value=Object.freeze(e.value)),e);return N(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ke(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function He(e,t={},n){return e?ye.create().superRefine((a,r)=>{var i,s;const o=e(a);if(o instanceof Promise)return o.then(e=>{var i,s;if(!e){const e=Ke(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ke(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):ye.create()}Ge.create=(e,t)=>new Ge({innerType:e,typeName:Ye.ZodReadonly,...R(t)});var Ye,Qe,et={object:xe.lazycreate};(Qe=Ye||(Ye={})).ZodString="ZodString",Qe.ZodNumber="ZodNumber",Qe.ZodNaN="ZodNaN",Qe.ZodBigInt="ZodBigInt",Qe.ZodBoolean="ZodBoolean",Qe.ZodDate="ZodDate",Qe.ZodSymbol="ZodSymbol",Qe.ZodUndefined="ZodUndefined",Qe.ZodNull="ZodNull",Qe.ZodAny="ZodAny",Qe.ZodUnknown="ZodUnknown",Qe.ZodNever="ZodNever",Qe.ZodVoid="ZodVoid",Qe.ZodArray="ZodArray",Qe.ZodObject="ZodObject",Qe.ZodUnion="ZodUnion",Qe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Qe.ZodIntersection="ZodIntersection",Qe.ZodTuple="ZodTuple",Qe.ZodRecord="ZodRecord",Qe.ZodMap="ZodMap",Qe.ZodSet="ZodSet",Qe.ZodFunction="ZodFunction",Qe.ZodLazy="ZodLazy",Qe.ZodLiteral="ZodLiteral",Qe.ZodEnum="ZodEnum",Qe.ZodEffects="ZodEffects",Qe.ZodNativeEnum="ZodNativeEnum",Qe.ZodOptional="ZodOptional",Qe.ZodNullable="ZodNullable",Qe.ZodDefault="ZodDefault",Qe.ZodCatch="ZodCatch",Qe.ZodPromise="ZodPromise",Qe.ZodBranded="ZodBranded",Qe.ZodPipeline="ZodPipeline",Qe.ZodReadonly="ZodReadonly";var tt=(e,t={message:`Input not instance of ${e.name}`})=>He(t=>t instanceof e,t),nt=ce.create,at=ue.create,rt=Be.create,it=le.create,st=pe.create,ot=me.create,ct=he.create,dt=fe.create,ut=ge.create,lt=ye.create,pt=ve.create,mt=be.create,ht=_e.create,ft=Se.create,gt=xe.create,yt=xe.strictCreate,vt=we.create,bt=Ae.create,_t=Pe.create,St=Te.create,kt=Ce.create,xt=Oe.create,wt=Ee.create,jt=Ie.create,At=Ne.create,Zt=$e.create,Pt=Re.create,Tt=De.create,Ct=Le.create,Ot=ze.create,Et=Xe.create,It=Fe.create,Nt=ze.createWithPreprocess,$t=We.create,Mt=()=>nt().optional(),Rt=()=>at().optional(),Dt=()=>st().optional(),Lt={string:e=>ce.create({...e,coerce:!0}),number:e=>ue.create({...e,coerce:!0}),boolean:e=>pe.create({...e,coerce:!0}),bigint:e=>le.create({...e,coerce:!0}),date:e=>me.create({...e,coerce:!0})},zt=P,Xt=Symbol("Let zodToJsonSchema decide on which parser to use"),Ft={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Ut=e=>{const t=(e=>"string"==typeof e?{...Ft,name:e}:{...Ft,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Vt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Bt(e,t,n,a,r){e[t]=n,Vt(e,t,a,r)}var Jt=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function qt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Jt(t,e.currentPath):t.join("/")}}function Wt(e,t){return kn(e.type._def,t)}function Gt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Gt(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Kt(e,t)}}var Kt=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const a of e.checks)switch(a.kind){case"min":Bt(n,"minimum",a.value,a.message,t);break;case"max":Bt(n,"maximum",a.value,a.message,t)}return n};var Ht=void 0,Yt=/^[cC][^\s-]{8,}$/,Qt=/^[0-9a-z]+$/,en=/^[0-9A-HJKMNP-TV-Z]{26}$/,tn=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,nn=()=>(void 0===Ht&&(Ht=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ht),an=/^(?:(?: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])$/,rn=/^(([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])$/,sn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,on=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cn=/^[a-zA-Z0-9_-]{21}$/,dn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function un(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Bt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Bt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":mn(n,"email",a.message,t);break;case"format:idn-email":mn(n,"idn-email",a.message,t);break;case"pattern:zod":hn(n,tn,a.message,t)}break;case"url":mn(n,"uri",a.message,t);break;case"uuid":mn(n,"uuid",a.message,t);break;case"regex":hn(n,a.regex,a.message,t);break;case"cuid":hn(n,Yt,a.message,t);break;case"cuid2":hn(n,Qt,a.message,t);break;case"startsWith":hn(n,RegExp(`^${ln(a.value,t)}`),a.message,t);break;case"endsWith":hn(n,RegExp(`${ln(a.value,t)}$`),a.message,t);break;case"datetime":mn(n,"date-time",a.message,t);break;case"date":mn(n,"date",a.message,t);break;case"time":mn(n,"time",a.message,t);break;case"duration":mn(n,"duration",a.message,t);break;case"length":Bt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Bt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":hn(n,RegExp(ln(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&mn(n,"ipv4",a.message,t),"v4"!==a.version&&mn(n,"ipv6",a.message,t);break;case"base64url":hn(n,on,a.message,t);break;case"jwt":hn(n,dn,a.message,t);break;case"cidr":"v6"!==a.version&&hn(n,an,a.message,t),"v4"!==a.version&&hn(n,rn,a.message,t);break;case"emoji":hn(n,nn(),a.message,t);break;case"ulid":hn(n,en,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":mn(n,"binary",a.message,t);break;case"contentEncoding:base64":Bt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":hn(n,sn,a.message,t)}break;case"nanoid":hn(n,cn,a.message,t)}return n}function ln(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)pn.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var pn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function mn(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):Bt(e,"format",t,n,a)}function hn(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:fn(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Bt(e,"pattern",fn(t,a),n,a)}function fn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),i=e.flags.includes("s"),s=a?e.source.toLowerCase():e.source;let o="",c=!1,d=!1,u=!1;for(let e=0;e<s.length;e++)if(c)o+=s[e],c=!1;else{if(a)if(d){if(s[e].match(/[a-z]/)){u?(o+=s[e],o+=`${s[e-2]}-${s[e]}`.toUpperCase(),u=!1):"-"===s[e+1]&&(null==(n=s[e+2])?void 0:n.match(/[a-z]/))?(o+=s[e],u=!0):o+=`${s[e]}${s[e].toUpperCase()}`;continue}}else if(s[e].match(/[a-z]/)){o+=`[${s[e]}${s[e].toUpperCase()}]`;continue}if(r){if("^"===s[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===s[e]){o+="($|(?=[\r\n]))";continue}}i&&"."===s[e]?o+=d?`${s[e]}\r\n`:`[${s[e]}\r\n]`:(o+=s[e],"\\"===s[e]?c=!0:d&&"]"===s[e]?d=!1:d||"["!==s[e]||(d=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function gn(e,t){var n,a,r,i,s,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===Ye.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=kn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:qt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=kn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return d;if((null==(r=e.keyType)?void 0:r._def.typeName)===Ye.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=un(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Ye.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Ye.ZodBranded&&e.keyType._def.type._def.typeName===Ye.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Wt(e.keyType._def,t);return{...d,propertyNames:a}}return d}var yn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var vn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>kn(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function bn(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],i=e.shape();for(const e in i){let s=i[e];if(void 0===s||void 0===s._def)continue;let o=_n(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=kn(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return kn(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==s&&(a.additionalProperties=s),a}function _n(e){try{return e.isOptional()}catch(e){return!0}}var Sn=(e,t,n)=>{switch(t){case Ye.ZodString:return un(e,n);case Ye.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"int":n.type="integer",Vt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Bt(n,"minimum",a.value,a.message,t):Bt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Bt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Bt(n,"maximum",a.value,a.message,t):Bt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Bt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Bt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Ye.ZodObject:return bn(e,n);case Ye.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?Bt(n,"minimum",a.value,a.message,t):Bt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Bt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Bt(n,"maximum",a.value,a.message,t):Bt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Bt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Bt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Ye.ZodBoolean:return{type:"boolean"};case Ye.ZodDate:return Gt(e,n);case Ye.ZodUndefined:return function(e){return{not:qt(e)}}(n);case Ye.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Ye.ZodArray:return function(e,t){var n,a,r;const i={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==Ye.ZodAny&&(i.items=kn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Bt(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Bt(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Bt(i,"minItems",e.exactLength.value,e.exactLength.message,t),Bt(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Ye.ZodUnion:case Ye.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return vn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in yn&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=yn[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return vn(e,t)}(e,n);case Ye.ZodIntersection:return function(e,t){const n=[kn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),kn(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...a}=e;t=a}else a=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),r.length?{allOf:r,...a}:void 0}(e,n);case Ye.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>kn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:kn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>kn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Ye.ZodRecord:return gn(e,n);case Ye.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case Ye.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ye.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(n.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case Ye.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:yn[e.innerType._def.typeName],nullable:!0}:{type:[yn[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=kn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=kn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Ye.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return kn(e.innerType._def,t);const a=kn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:qt(t)},a]}:qt(t)})(e,n);case Ye.ZodMap:return function(e,t){return"record"===t.mapStrategy?gn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[kn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||qt(t),kn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||qt(t)],minItems:2,maxItems:2}}}(e,n);case Ye.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:kn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Bt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Bt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Ye.ZodLazy:return()=>e.getter()._def;case Ye.ZodPromise:return function(e,t){return kn(e.type._def,t)}(e,n);case Ye.ZodNaN:case Ye.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:qt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Ye.ZodEffects:return function(e,t){return"input"===t.effectStrategy?kn(e.schema._def,t):qt(t)}(e,n);case Ye.ZodAny:return qt(n);case Ye.ZodUnknown:return function(e){return qt(e)}(n);case Ye.ZodDefault:return function(e,t){return{...kn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Ye.ZodBranded:return Wt(e,n);case Ye.ZodReadonly:case Ye.ZodCatch:return((e,t)=>kn(e.innerType._def,t))(e,n);case Ye.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return kn(e.in._def,t);if("output"===t.pipeStrategy)return kn(e.out._def,t);const n=kn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,kn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Ye.ZodFunction:case Ye.ZodVoid:case Ye.ZodSymbol:default:return}};function kn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const i=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(i!==Xt)return i}if(r&&!n){const e=xn(r,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const s=Sn(e,e.typeName,t),o="function"==typeof s?kn(s(),t):s;if(o&&wn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var xn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Jt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),qt(t)):"seen"===t.$refStrategy?qt(t):void 0}},wn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),jn=(e,t)=>{var n;const a=Ut(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=kn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:qt(a)}},{}):void 0;const i="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,s=null!=(n=kn(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:qt(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(s.title=o),a.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[a.openAiAnyTypeName]||(r[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const c=void 0===i?r?{...s,[a.definitionPath]:r}:s:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,i].join("/"),[a.definitionPath]:{...r,[i]:s}};return"jsonSchema7"===a.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},An=Object.defineProperty,Zn=(e,t)=>{for(var n in t)An(e,n,{get:t[n],enumerable:!0})},Pn=p.string(),Tn=p.number(),Cn=(p.boolean(),p.string().min(1)),On=p.number().int().positive(),En=p.number().int().nonnegative(),In=p.number().describe("Tagging version number");p.union([p.string(),p.number(),p.boolean()]).optional();Zn({},{ErrorHandlerSchema:()=>Mn,HandlerSchema:()=>Dn,LogHandlerSchema:()=>Rn,StorageSchema:()=>$n,StorageTypeSchema:()=>Nn,errorHandlerJsonSchema:()=>Xn,handlerJsonSchema:()=>Un,logHandlerJsonSchema:()=>Fn,storageJsonSchema:()=>zn,storageTypeJsonSchema:()=>Ln});var Nn=p.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),$n=p.object({Local:p.literal("local"),Session:p.literal("session"),Cookie:p.literal("cookie")}).describe("Storage type constants for type-safe references"),Mn=p.any().describe("Error handler function: (error, state?) => void"),Rn=p.any().describe("Log handler function: (message, verbose?) => void"),Dn=p.object({Error:Mn.describe("Error handler function"),Log:Rn.describe("Log handler function")}).describe("Handler interface with error and log functions"),Ln=jn(Nn,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),zn=jn($n,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Xn=jn(Mn,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Fn=jn(Rn,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Un=jn(Dn,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});p.object({onError:Mn.optional().describe("Error handler function: (error, state?) => void"),onLog:Rn.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),p.object({verbose:p.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),p.object({queue:p.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),p.object({}).partial(),p.object({init:p.boolean().describe("Whether to initialize immediately").optional(),loadScript:p.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),p.object({disabled:p.boolean().describe("Set to true to disable").optional()}).partial(),p.object({primary:p.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),p.object({settings:p.any().optional().describe("Implementation-specific configuration")}).partial(),p.object({env:p.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),p.object({type:p.string().optional().describe("Instance type identifier"),config:p.any().describe("Instance configuration")}).partial(),p.object({collector:p.any().describe("Collector instance (runtime object)"),config:p.any().describe("Configuration"),env:p.any().describe("Environment dependencies")}).partial(),p.object({batch:p.number().optional().describe("Batch size: bundle N events for batch processing"),batched:p.any().optional().describe("Batch of events to be processed")}).partial(),p.object({ignore:p.boolean().describe("Set to true to skip processing").optional(),condition:p.string().optional().describe("Condition function: return true to process")}).partial(),p.object({sources:p.record(p.string(),p.any()).describe("Map of source instances")}).partial(),p.object({destinations:p.record(p.string(),p.any()).describe("Map of destination instances")}).partial();Zn({},{ConsentSchema:()=>Gn,DeepPartialEventSchema:()=>aa,EntitiesSchema:()=>ea,EntitySchema:()=>Qn,EventSchema:()=>ta,OrderedPropertiesSchema:()=>qn,PartialEventSchema:()=>na,PropertiesSchema:()=>Jn,PropertySchema:()=>Bn,PropertyTypeSchema:()=>Vn,SourceSchema:()=>Yn,SourceTypeSchema:()=>Wn,UserSchema:()=>Kn,VersionSchema:()=>Hn,consentJsonSchema:()=>la,entityJsonSchema:()=>da,eventJsonSchema:()=>ra,orderedPropertiesJsonSchema:()=>ca,partialEventJsonSchema:()=>ia,propertiesJsonSchema:()=>oa,sourceTypeJsonSchema:()=>ua,userJsonSchema:()=>sa});var Vn=p.lazy(()=>p.union([p.boolean(),p.string(),p.number(),p.record(p.string(),Bn)])),Bn=p.lazy(()=>p.union([Vn,p.array(Vn)])),Jn=p.record(p.string(),Bn.optional()).describe("Flexible property collection with optional values"),qn=p.record(p.string(),p.tuple([Bn,p.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Wn=p.union([p.enum(["web","server","app","other"]),p.string()]).describe("Source type: web, server, app, other, or custom"),Gn=p.record(p.string(),p.boolean()).describe("Consent requirement mapping (group name → state)"),Kn=Jn.and(p.object({id:p.string().optional().describe("User identifier"),device:p.string().optional().describe("Device identifier"),session:p.string().optional().describe("Session identifier"),hash:p.string().optional().describe("Hashed identifier"),address:p.string().optional().describe("User address"),email:p.string().email().optional().describe("User email address"),phone:p.string().optional().describe("User phone number"),userAgent:p.string().optional().describe("Browser user agent string"),browser:p.string().optional().describe("Browser name"),browserVersion:p.string().optional().describe("Browser version"),deviceType:p.string().optional().describe("Device type (mobile, desktop, tablet)"),os:p.string().optional().describe("Operating system"),osVersion:p.string().optional().describe("Operating system version"),screenSize:p.string().optional().describe("Screen dimensions"),language:p.string().optional().describe("User language"),country:p.string().optional().describe("User country"),region:p.string().optional().describe("User region/state"),city:p.string().optional().describe("User city"),zip:p.string().optional().describe("User postal code"),timezone:p.string().optional().describe("User timezone"),ip:p.string().optional().describe("User IP address"),internal:p.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Hn=Jn.and(p.object({source:Pn.describe('Walker implementation version (e.g., "2.0.0")'),tagging:In})).describe("Walker version information"),Yn=Jn.and(p.object({type:Wn.describe("Source type identifier"),id:Pn.describe("Source identifier (typically URL on web)"),previous_id:Pn.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),Qn=p.lazy(()=>p.object({entity:p.string().describe("Entity name"),data:Jn.describe("Entity-specific properties"),nested:p.array(Qn).describe("Nested child entities"),context:qn.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),ea=p.array(Qn).describe("Array of nested entities"),ta=p.object({name:p.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Jn.describe("Event-specific properties"),context:qn.describe("Ordered context properties with priorities"),globals:Jn.describe("Global properties shared across events"),custom:Jn.describe("Custom implementation-specific properties"),user:Kn.describe("User identification and attributes"),nested:ea.describe("Related nested entities"),consent:Gn.describe("Consent states at event time"),id:Cn.describe("Unique event identifier (timestamp-based)"),trigger:Pn.describe("Event trigger identifier"),entity:Pn.describe("Parsed entity from event name"),action:Pn.describe("Parsed action from event name"),timestamp:On.describe("Unix timestamp in milliseconds since epoch"),timing:Tn.describe("Event processing timing information"),group:Pn.describe("Event grouping identifier"),count:En.describe("Event count in session"),version:Hn.describe("Walker version information"),source:Yn.describe("Event source information")}).describe("Complete walkerOS event structure"),na=ta.partial().describe("Partial event structure with all fields optional"),aa=p.lazy(()=>ta.deepPartial()).describe("Deep partial event structure with all nested fields optional"),ra=jn(ta,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),ia=jn(na,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),sa=jn(Kn,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),oa=jn(Jn,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),ca=jn(qn,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),da=jn(Qn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),ua=jn(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),la=jn(Gn,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});Zn({},{ConfigSchema:()=>Sa,LoopSchema:()=>ha,MapSchema:()=>ga,PolicySchema:()=>va,ResultSchema:()=>ka,RuleSchema:()=>ba,RulesSchema:()=>_a,SetSchema:()=>fa,ValueConfigSchema:()=>ya,ValueSchema:()=>pa,ValuesSchema:()=>ma,configJsonSchema:()=>Oa,loopJsonSchema:()=>ja,mapJsonSchema:()=>Za,policyJsonSchema:()=>Pa,ruleJsonSchema:()=>Ta,rulesJsonSchema:()=>Ca,setJsonSchema:()=>Aa,valueConfigJsonSchema:()=>wa,valueJsonSchema:()=>xa});var pa=p.lazy(()=>p.union([p.string().describe('String value or property path (e.g., "data.id")'),p.number().describe("Numeric value"),p.boolean().describe("Boolean value"),ya,p.array(pa).describe("Array of values")])),ma=p.array(pa).describe("Array of transformation values"),ha=p.tuple([pa,pa]).describe("Loop transformation: [source, transform] tuple for array processing"),fa=p.array(pa).describe("Set: Array of values for selection or combination"),ga=p.record(p.string(),pa).describe("Map: Object mapping keys to transformation values"),ya=p.object({key:p.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:p.union([p.string(),p.number(),p.boolean()]).optional().describe("Static primitive value"),fn:p.string().optional().describe("Custom transformation function as string (serialized)"),map:ga.optional().describe("Object mapping: transform event data to structured output"),loop:ha.optional().describe("Loop transformation: [source, transform] for array processing"),set:fa.optional().describe("Set of values: combine or select from multiple values"),consent:Gn.optional().describe("Required consent states to include this value"),condition:p.string().optional().describe("Condition function as string: return true to include value"),validate:p.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),va=p.record(p.string(),pa).describe("Policy rules for event pre-processing (key → value mapping)"),ba=p.object({batch:p.number().optional().describe("Batch size: bundle N events for batch processing"),condition:p.string().optional().describe("Condition function as string: return true to process event"),consent:Gn.optional().describe("Required consent states to process this event"),settings:p.any().optional().describe("Destination-specific settings for this event mapping"),data:p.union([pa,ma]).optional().describe("Data transformation rules for event"),ignore:p.boolean().optional().describe("Set to true to skip processing this event"),name:p.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:va.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),_a=p.record(p.string(),p.record(p.string(),p.union([ba,p.array(ba)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),Sa=p.object({consent:Gn.optional().describe("Required consent states to process any events"),data:p.union([pa,ma]).optional().describe("Global data transformation applied to all events"),mapping:_a.optional().describe("Entity-action specific mapping rules"),policy:va.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),ka=p.object({eventMapping:ba.optional().describe("Resolved mapping rule for event"),mappingKey:p.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),xa=jn(pa,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),wa=jn(ya,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ja=jn(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Aa=jn(fa,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Za=jn(ga,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Pa=jn(va,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Ta=jn(ba,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),Ca=jn(_a,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Oa=jn(Sa,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});Zn({},{BatchSchema:()=>za,ConfigSchema:()=>Ea,ContextSchema:()=>$a,DLQSchema:()=>Ga,DataSchema:()=>Xa,DestinationPolicySchema:()=>Na,DestinationsSchema:()=>Ba,InitDestinationsSchema:()=>Va,InitSchema:()=>Ua,InstanceSchema:()=>Fa,PartialConfigSchema:()=>Ia,PushBatchContextSchema:()=>Ra,PushContextSchema:()=>Ma,PushEventSchema:()=>Da,PushEventsSchema:()=>La,PushResultSchema:()=>qa,RefSchema:()=>Ja,ResultSchema:()=>Wa,batchJsonSchema:()=>er,configJsonSchema:()=>Ka,contextJsonSchema:()=>Ya,instanceJsonSchema:()=>tr,partialConfigJsonSchema:()=>Ha,pushContextJsonSchema:()=>Qa,resultJsonSchema:()=>nr});var Ea=p.object({consent:Gn.optional().describe("Required consent states to send events to this destination"),settings:p.any().describe("Implementation-specific configuration").optional(),data:p.union([pa,ma]).optional().describe("Global data transformation applied to all events for this destination"),env:p.any().describe("Environment dependencies (platform-specific)").optional(),id:Cn.describe("Destination instance identifier (defaults to destination key)").optional(),init:p.boolean().describe("Whether to initialize immediately").optional(),loadScript:p.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:_a.optional().describe("Entity-action specific mapping rules for this destination"),policy:va.optional().describe("Pre-processing policy rules applied before event mapping"),queue:p.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:p.boolean().describe("Enable verbose logging for debugging").optional(),onError:Mn.optional(),onLog:Rn.optional()}).describe("Destination configuration"),Ia=Ea.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Na=va.describe("Destination policy rules for event pre-processing"),$a=p.object({collector:p.any().describe("Collector instance (runtime object)"),config:Ea.describe("Destination configuration"),data:p.union([p.any(),p.undefined(),p.array(p.union([p.any(),p.undefined()]))]).optional().describe("Transformed event data"),env:p.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ma=$a.extend({mapping:ba.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ra=Ma.describe("Batch push context with event-specific mapping"),Da=p.object({event:ta.describe("The event to process"),mapping:ba.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),La=p.array(Da).describe("Array of events with mappings"),za=p.object({key:p.string().describe('Batch key (usually mapping key like "product.view")'),events:p.array(ta).describe("Array of events in batch"),data:p.array(p.union([p.any(),p.undefined(),p.array(p.union([p.any(),p.undefined()]))])).describe("Transformed data for each event"),mapping:ba.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Xa=p.union([p.any(),p.undefined(),p.array(p.union([p.any(),p.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Fa=p.object({config:Ea.describe("Destination configuration"),queue:p.array(ta).optional().describe("Queued events awaiting consent"),dlq:p.array(p.tuple([ta,p.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:p.string().optional().describe("Destination type identifier"),env:p.any().optional().describe("Environment dependencies"),init:p.any().optional().describe("Initialization function"),push:p.any().describe("Push function for single events"),pushBatch:p.any().optional().describe("Batch push function"),on:p.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ua=p.object({code:Fa.describe("Destination instance with implementation"),config:Ia.optional().describe("Partial configuration overrides"),env:p.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Va=p.record(p.string(),Ua).describe("Map of destination IDs to initialization configurations"),Ba=p.record(p.string(),Fa).describe("Map of destination IDs to runtime instances"),Ja=p.object({id:p.string().describe("Destination ID"),destination:Fa.describe("Destination instance")}).describe("Destination reference (ID + instance)"),qa=p.object({queue:p.array(ta).optional().describe("Events queued (awaiting consent)"),error:p.any().optional().describe("Error if push failed")}).describe("Push operation result"),Wa=p.object({successful:p.array(Ja).describe("Destinations that processed successfully"),queued:p.array(Ja).describe("Destinations that queued events"),failed:p.array(Ja).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Ga=p.array(p.tuple([ta,p.any()])).describe("Dead letter queue: [(event, error), ...]"),Ka=jn(Ea,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),Ha=jn(Ia,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),Ya=jn($a,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),Qa=jn(Ma,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),er=jn(za,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),tr=jn(Fa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),nr=jn(Wa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});Zn({},{CommandTypeSchema:()=>ar,ConfigSchema:()=>rr,DestinationsSchema:()=>dr,InitConfigSchema:()=>sr,InstanceSchema:()=>ur,PushContextSchema:()=>or,SessionDataSchema:()=>ir,SourcesSchema:()=>cr,commandTypeJsonSchema:()=>lr,configJsonSchema:()=>pr,initConfigJsonSchema:()=>hr,instanceJsonSchema:()=>gr,pushContextJsonSchema:()=>fr,sessionDataJsonSchema:()=>mr});var ar=p.union([p.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),p.string()]).describe("Collector command type: standard commands or custom string for extensions"),rr=p.object({run:p.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:In,globalsStatic:Jn.describe("Static global properties that persist across collector runs"),sessionStatic:p.record(p.any()).describe("Static session data that persists across collector runs"),verbose:p.boolean().describe("Enable verbose logging for debugging"),onError:Mn.optional(),onLog:Rn.optional()}).describe("Core collector configuration"),ir=Jn.and(p.object({isStart:p.boolean().describe("Whether this is a new session start"),storage:p.boolean().describe("Whether storage is available"),id:Cn.describe("Session identifier").optional(),start:On.describe("Session start timestamp").optional(),marketing:p.literal(!0).optional().describe("Marketing attribution flag"),updated:On.describe("Last update timestamp").optional(),isNew:p.boolean().describe("Whether this is a new session").optional(),device:Cn.describe("Device identifier").optional(),count:En.describe("Event count in session").optional(),runs:En.describe("Number of runs").optional()})).describe("Session state and tracking data"),sr=rr.partial().extend({consent:Gn.optional().describe("Initial consent state"),user:Kn.optional().describe("Initial user data"),globals:Jn.optional().describe("Initial global properties"),sources:p.any().optional().describe("Source configurations"),destinations:p.any().optional().describe("Destination configurations"),custom:Jn.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),or=p.object({mapping:Sa.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),cr=p.record(p.string(),p.any()).describe("Map of source IDs to source instances"),dr=p.record(p.string(),p.any()).describe("Map of destination IDs to destination instances"),ur=p.object({push:p.any().describe("Push function for processing events"),command:p.any().describe("Command function for walker commands"),allowed:p.boolean().describe("Whether event processing is allowed"),config:rr.describe("Current collector configuration"),consent:Gn.describe("Current consent state"),count:p.number().describe("Event count (increments with each event)"),custom:Jn.describe("Custom implementation-specific properties"),sources:cr.describe("Registered source instances"),destinations:dr.describe("Registered destination instances"),globals:Jn.describe("Current global properties"),group:p.string().describe("Event grouping identifier"),hooks:p.any().describe("Lifecycle hook functions"),on:p.any().describe("Event lifecycle configuration"),queue:p.array(ta).describe("Queued events awaiting processing"),round:p.number().describe("Collector run count (increments with each run)"),session:p.union([p.undefined(),ir]).describe("Current session state"),timing:p.number().describe("Event processing timing information"),user:Kn.describe("Current user data"),version:p.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),lr=jn(ar,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),pr=jn(rr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),mr=jn(ir,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),hr=jn(sr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),fr=jn(or,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),gr=jn(ur,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});Zn({},{BaseEnvSchema:()=>yr,ConfigSchema:()=>vr,InitSchema:()=>Sr,InitSourceSchema:()=>kr,InitSourcesSchema:()=>xr,InstanceSchema:()=>_r,PartialConfigSchema:()=>br,baseEnvJsonSchema:()=>wr,configJsonSchema:()=>jr,initSourceJsonSchema:()=>Pr,initSourcesJsonSchema:()=>Tr,instanceJsonSchema:()=>Zr,partialConfigJsonSchema:()=>Ar});var yr=p.object({push:p.any().describe("Collector push function"),command:p.any().describe("Collector command function"),sources:p.any().optional().describe("Map of registered source instances"),elb:p.any().describe("Public API function (alias for collector.push)")}).catchall(p.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),vr=Sa.extend({settings:p.any().describe("Implementation-specific configuration").optional(),env:yr.optional().describe("Environment dependencies (platform-specific)"),id:Cn.describe("Source identifier (defaults to source key)").optional(),onError:Mn.optional(),disabled:p.boolean().describe("Set to true to disable").optional(),primary:p.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),br=vr.deepPartial().describe("Partial source configuration with all fields deeply optional"),_r=p.object({type:p.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:vr.describe("Current source configuration"),push:p.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:p.any().optional().describe("Cleanup function called when source is removed"),on:p.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Sr=p.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),kr=p.object({code:Sr.describe("Source initialization function"),config:br.optional().describe("Partial configuration overrides"),env:yr.partial().optional().describe("Partial environment overrides"),primary:p.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),xr=p.record(p.string(),kr).describe("Map of source IDs to initialization configurations"),wr=jn(yr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),jr=jn(vr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),Ar=jn(br,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),Zr=jn(_r,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),Pr=jn(kr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Tr=jn(xr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function Cr(e){return jn(e,{target:"jsonSchema7",$refStrategy:"none"})}var Or={merge:!0,shallow:!0,extend:!0};function Er(e,t={},n={}){n={...Or,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const i=e[a];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function Ir(e){return Array.isArray(e)}function Nr(e){return void 0!==e}function $r(e){return"object"==typeof e&&null!==e&&!Ir(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Mr(e){return"string"==typeof e}function Rr(e,t="",n){const a=t.split(".");let r=e;for(let e=0;e<a.length;e++){const t=a[e];if("*"===t&&Ir(r)){const t=a.slice(e+1).join("."),i=[];for(const e of r){const a=Rr(e,t,n);i.push(a)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return Nr(r)?r:n}function Dr(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return function(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",r=e.count||1,i=Er({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${n}-${a}-${r}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:r,version:{source:"0.3.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(i.entity=n,i.action=a)}return i}({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function Lr(e){return function(e){return"boolean"==typeof e}(e)||Mr(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!Nr(e)||Ir(e)&&e.every(Lr)||$r(e)&&Object.values(e).every(Lr)}function zr(e){return Lr(e)?e:void 0}function Xr(e,t,n){return async function(...a){try{return await e(...a)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function Fr(e,t={},n={}){var a;if(!Nr(e))return;const r=$r(e)&&e.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),i=Ir(t)?t:[t];for(const t of i){const a=await Xr(Ur)(e,t,{...n,consent:r});if(Nr(a))return a}}async function Ur(e,t,n={}){const{collector:a,consent:r}=n;return(Ir(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const o=Mr(i)?{key:i}:i;if(!Object.keys(o).length)return;const{condition:c,consent:d,fn:u,key:l,loop:p,map:m,set:h,validate:f,value:g}=o;if(c&&!await Xr(c)(e,i,a))return;if(d&&!function(e,t={},n={}){const a={...t,...n},r={};let i=void 0===e;return Object.keys(a).forEach(t=>{a[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}(d,r))return g;let y=Nr(g)?g:e;if(u&&(y=await Xr(u)(e,i,n)),l&&(y=Rr(e,l,g)),p){const[t,a]=p,r="this"===t?[e]:await Fr(e,t,n);Ir(r)&&(y=(await Promise.all(r.map(e=>Fr(e,a,n)))).filter(Nr))}else m?y=await Object.entries(m).reduce(async(t,[a,r])=>{const i=await t,s=await Fr(e,r,n);return Nr(s)&&(i[a]=s),i},Promise.resolve({})):h&&(y=await Promise.all(h.map(t=>Ur(e,t,n))));f&&!await Xr(f)(y)&&(y=void 0);const v=zr(y);return Nr(v)?v:zr(g)},Promise.resolve(void 0))}function Vr(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}async function Br(e,t,n,a,r){const i=$r(t)?t:{},s=n.data?await Fr(e,n.data,{collector:r}):{},o=(null==a?void 0:a.data)?await Fr(e,a.data,{collector:r}):{},c=$r(s)?s:{},d=$r(o)?o:{};return Er(Er(i,c),d)}function Jr(e,t,n={},a,r){const{window:i}=Vr(r);if(!t.measurementId)return;const s=$r(a)?a:{},o=function(e,t){const n={};return t.includes("all")&&(t=["context","data","event","globals","source","user","version"]),t.forEach(t=>{let a=e[t]||{};"event"==t&&(a={id:e.id,timing:e.timing,trigger:e.trigger,entity:e.entity,action:e.action,group:e.group,count:e.count}),Object.entries(a).forEach(([e,a])=>{"context"==t&&(a=a[0]),n[`${t}_${e}`]=a})}),n}(e,n.include||t.include||["data"]),c={...o,...s};let d=e.name;!1!==t.snakeCase&&(d=function(e,t=!0){return t?e.replace(/\s+/g,"_").toLowerCase():e}(d)),c.send_to=t.measurementId,t.debug&&(c.debug_mode=!0);(0,i.gtag)("event",d,c)}var qr="dataLayer";function Wr(e,t,n){const{window:a,document:r}=Vr(n),{containerId:i,dataLayer:s,domain:o}=e,c=s||qr;c===qr?a.dataLayer=a.dataLayer||[]:a[c]=a[c]||[];a[c].push({"gtm.start":(new Date).getTime(),event:"gtm.js"}),t&&i&&function(e,t,n,a=globalThis.document){const r=n!=qr?"&l="+n:"",i=a.createElement("script");i.src=t+e+r,a.head.appendChild(i)}(i,o||"https://www.googletagmanager.com/gtm.js?id=",c,r)}var Gr={},Kr={};r(Kr,{env:()=>Hr,events:()=>ti,mapping:()=>si});var Hr={};r(Hr,{init:()=>Yr,push:()=>Qr,simulation:()=>ei});var Yr={window:{gtag:void 0,dataLayer:[]},document:{createElement:()=>({src:"",setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},Qr={window:{gtag:Object.assign(()=>{},{}),dataLayer:[]},document:{createElement:()=>({src:"",setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},ei=["call:window.gtag"],ti={};function ni(){const e=Dr("order complete");return["event","purchase",{transaction_id:e.data.id,value:e.data.total,tax:e.data.taxes,shipping:e.data.shipping,currency:"EUR",items:e.nested.filter(e=>"product"===e.entity).map(e=>({item_id:e.data.id,item_name:e.data.name,quantity:1})),send_to:"G-XXXXXX-1"}]}function ai(){const e=Dr("product add");return["event","add_to_cart",{currency:"EUR",value:e.data.price,items:[{item_id:e.data.id,item_variant:e.data.color,quantity:1}],send_to:"G-XXXXXX-1"}]}function ri(){const e=Dr("order complete");return["event","conversion",{send_to:"AW-XXXXXXXXX/CONVERSION_LABEL",currency:"EUR",value:e.data.total,transaction_id:e.data.id}]}function ii(){const e=Dr("product view");return{event:"product_view",product_id:e.data.id,product_name:e.data.name,product_category:e.data.category,value:e.data.price,currency:"EUR"}}r(ti,{adsConversion:()=>ri,ga4AddToCart:()=>ai,ga4Purchase:()=>ni,gtmEvent:()=>ii});var si={};r(si,{adsConversion:()=>di,combinedPurchase:()=>li,config:()=>pi,ga4AddToCart:()=>ci,ga4Purchase:()=>oi,gtmProductView:()=>ui});var oi={name:"purchase",settings:{ga4:{include:["data","context"]}},data:{map:{transaction_id:"data.id",value:"data.total",tax:"data.taxes",shipping:"data.shipping",currency:{key:"data.currency",value:"EUR"},items:{loop:["nested",{condition:e=>$r(e)&&"product"===e.entity,map:{item_id:"data.id",item_name:"data.name",quantity:{key:"data.quantity",value:1}}}]}}}},ci={name:"add_to_cart",settings:{ga4:{include:["data"]}},data:{map:{currency:{value:"EUR",key:"data.currency"},value:"data.price",items:{loop:["this",{map:{item_id:"data.id",item_variant:"data.color",quantity:{value:1,key:"data.quantity"}}}]}}}},di={name:"CONVERSION_LABEL",settings:{ads:{}},data:{map:{value:"data.total",currency:{value:"EUR",key:"data.currency"},transaction_id:"data.id"}}},ui={name:"product_view",settings:{gtm:{}},data:{map:{product_id:"data.id",product_name:"data.name",product_category:"data.category",value:"data.price",currency:{value:"EUR",key:"data.currency"}}}},li={name:"purchase",settings:{ga4:{include:["data"]},ads:{},gtm:{}},data:{map:{transaction_id:"data.id",value:"data.total",currency:{value:"EUR",key:"data.currency"},items:{loop:["nested",{condition:e=>$r(e)&&"product"===e.entity,map:{item_id:"data.id",item_name:"data.name",quantity:{value:1,key:"data.quantity"}}}]}}}},pi={order:{complete:li},product:{add:ci,view:ui}},mi={};r(mi,{AdsSettingsSchema:()=>yi,ConsentModeSchema:()=>fi,GA4SettingsSchema:()=>gi,GTMSettingsSchema:()=>vi,IncludeSchema:()=>hi,MappingSchema:()=>xi,SettingsSchema:()=>bi,ads:()=>Zi,ga4:()=>Ai,gtm:()=>Pi,mapping:()=>ji,settings:()=>wi});var hi=p.array(p.enum(["all","context","data","event","globals","source","user","version"])),fi=p.union([p.boolean(),p.record(p.union([p.string(),p.array(p.string())]))]),gi=p.object({measurementId:p.string().regex(/^G-[A-Z0-9]+$/,"Must be a valid GA4 Measurement ID (G-XXXXXXXXXX)").describe("GA4 Measurement ID from Google Analytics (like G-XXXXXXXXXX)"),debug:p.boolean().describe("Enable debug mode for GA4 (like true)").optional(),include:hi.describe("Array of properties to include in events (like ['data', 'context', 'user'])").optional(),pageview:p.boolean().describe("Enable automatic pageview tracking (like true)").optional(),server_container_url:p.string().url().describe("Server-side GTM container URL (like https://server-container.com)").optional(),snakeCase:p.boolean().describe("Convert parameter names to snake_case (like true)").optional(),transport_url:p.string().url().describe("Custom transport URL for GA4 (like https://analytics.example.com/mp/collect)").optional(),data:p.any().describe("Custom data mapping configuration").optional()}),yi=p.object({conversionId:p.string().regex(/^AW-[0-9]+$/,"Must be a valid Ads Conversion ID (AW-XXXXXXXXXX)").describe("Google Ads Conversion ID (required)"),currency:p.string().length(3).describe("Currency code (ISO 4217, e.g., USD, EUR)").optional(),data:p.any().describe("Custom data mapping (WalkerOS.Mapping.Value | Values)").optional()}),vi=p.object({containerId:p.string().regex(/^GTM-[A-Z0-9]+$/,"Must be a valid GTM Container ID (GTM-XXXXXXX)").describe("GTM Container ID (required)"),dataLayer:p.string().describe("Custom dataLayer variable name (default: dataLayer)").optional(),domain:p.string().describe("Custom GTM domain for script loading").optional(),data:p.any().describe("Custom data mapping (WalkerOS.Mapping.Value | Values)").optional()}),bi=p.object({como:fi.describe("Consent mode configuration: false (disabled), true (use defaults), or custom mapping").optional(),ga4:gi.describe("GA4-specific configuration settings (like { measurementId: G-XXXXXXXXXX })").optional(),ads:yi.describe("Google Ads specific configuration settings (like { conversionId: AW-XXXXXXXXX })").optional(),gtm:vi.describe("Google Tag Manager specific configuration settings (like { containerId: GTM-XXXXXXX })").optional()}).refine(e=>{var t,n,a;return(null==(t=e.ga4)?void 0:t.measurementId)||(null==(n=e.ads)?void 0:n.conversionId)||(null==(a=e.gtm)?void 0:a.containerId)},{message:"At least one Google tool must be configured (ga4.measurementId, ads.conversionId, or gtm.containerId)"}),_i=p.object({include:hi.describe("Override which event properties to include for this specific event").optional()}),Si=p.object({label:p.string().describe("Conversion label for this specific event").optional()}),ki=p.object({}),xi=p.object({ga4:_i.describe("GA4-specific event mapping").optional(),ads:Si.describe("Google Ads-specific event mapping").optional(),gtm:ki.describe("GTM-specific event mapping").optional()}),wi=Cr(bi),ji=Cr(xi),Ai=Cr(gi),Zi=Cr(yi),Pi=Cr(vi),Ti=!1;function Ci(){Ti=!1}var Oi,Ei={marketing:["ad_storage","ad_user_data","ad_personalization"],functional:["analytics_storage"]},Ii={type:"google-gtag",config:{settings:{}},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{ga4:r,ads:i,gtm:s}=n;return(null==r?void 0:r.measurementId)&&function(e,t,n){const{window:a,document:r}=Vr(n),{measurementId:i,transport_url:s,server_container_url:d,pageview:u}=e;if(!i)return;t&&o(i,void 0,r),c(a);const l={};s&&(l.transport_url=s),d&&(l.server_container_url=d),!1===u&&(l.send_page_view=!1);const p=a.gtag;p("js",new Date),p("config",i,l)}(r,a,t),(null==i?void 0:i.conversionId)&&function(e,t,n){const{window:a,document:r}=Vr(n),{conversionId:i}=e;if(!i)return;e.currency||(e.currency="EUR"),t&&o(i,void 0,r),c(a);const s=a.gtag;s("js",new Date),s("config",i)}(i,a,t),(null==s?void 0:s.containerId)&&Wr(s,a,t),!!((null==r?void 0:r.measurementId)||(null==i?void 0:i.conversionId)||(null==s?void 0:s.containerId))&&e},async push(e,{config:t,mapping:n={},data:a,env:r,collector:i}){const{settings:s={}}=t,{ga4:o,ads:c,gtm:d}=s,u=n.settings||{},l=await Br(e,a,t,o,i),p=await Br(e,a,t,c,i),m=await Br(e,a,t,d,i);(null==o?void 0:o.measurementId)&&Jr(e,o,u.ga4,l,r),(null==c?void 0:c.conversionId)&&n.name&&function(e,t,n={},a,r,i){const{conversionId:s,currency:o}=t,c=$r(a)?a:{},d=n.label||r;if(!d)return;const u={send_to:`${s}/${d}`,currency:o||"EUR",...c},{window:l}=Vr(i);(0,l.gtag)("event","conversion",u)}(0,c,u.ads,p,n.name,r),(null==d?void 0:d.containerId)&&function(e,t,n={},a,r){const{window:i}=Vr(r),s={event:e.name};i.dataLayer.push({...s,...$r(a)?a:e})}(e,0,u.gtm,m,r)},on(e,t){var n;if("consent"!==e||!t)return;const a=t,r=(null==(n=this.config)?void 0:n.settings)||{},{como:i=!0}=r;if(!i)return;const{window:s}=Vr(this.env),o=c(s);if(!o)return;const d=!0===i?Ei:i;if(!Ti){const e=new Set;if(Object.values(d).forEach(t=>{(Array.isArray(t)?t:[t]).forEach(t=>e.add(t))}),e.size>0){const t={};e.forEach(e=>{t[e]="denied"}),o("consent","default",t)}Ti=!0}const u={};Object.entries(a).forEach(([e,t])=>{const n=d[e];if(!n)return;const a=Array.isArray(n)?n:[n],r=t?"granted":"denied";a.forEach(e=>{u[e]=r})}),0!==Object.keys(u).length&&o("consent","update",u)}},Ni=Ii;return Oi=i,((r,i,s,o)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of n(i))a.call(r,c)||c===s||e(r,c,{get:()=>i[c],enumerable:!(o=t(i,c))||o.enumerable});return r})(e({},"__esModule",{value:!0}),Oi)})();
|