@walkeros/walker.js 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/walker.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var e,t,n=Object.getOwnPropertyNames,r=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports}),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},i={merge:!0,shallow:!0,extend:!0};function s(e,t={},n={}){n={...i,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function a(e){return Array.isArray(e)}function c(e){return void 0!==e}function u(e){return"object"==typeof e&&null!==e&&!a(e)&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return"string"==typeof e}function d(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=d(e[r],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(d(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function f(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&a(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=f(e,t,n);i.push(r)}return i}if(o=o instanceof Object?o[t]:void 0,!o)break}return c(o)?o:n}function p(e,t={},n={}){const r={...t,...n},o={};let i=void 0===e;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}var{version:g}=r();function m(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function y(e){return function(e){return"boolean"==typeof e}(e)||l(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!c(e)||a(e)&&e.every(y)||u(e)&&Object.values(e).every(y)}function h(e){return y(e)?e:void 0}function w(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function b(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function v(e,t={},n={}){var r;if(!c(e))return;const o=u(e)&&e.consent||n.consent||(null==(r=n.collector)?void 0:r.consent),i=a(t)?t:[t];for(const t of i){const r=await b(k)(e,t,{...n,consent:o});if(c(r))return r}}async function k(e,t,n={}){const{collector:r,consent:o}=n;return(a(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const u=l(i)?{key:i}:i;if(!Object.keys(u).length)return;const{condition:d,consent:g,fn:m,key:y,loop:w,map:S,set:x,validate:O,value:j}=u;if(d&&!await b(d)(e,i,r))return;if(g&&!p(g,o))return j;let _=c(j)?j:e;if(m&&(_=await b(m)(e,i,n)),y&&(_=f(e,y,j)),w){const[t,r]=w,o="this"===t?[e]:await v(e,t,n);a(o)&&(_=(await Promise.all(o.map(e=>v(e,r,n)))).filter(c))}else S?_=await Object.entries(S).reduce(async(t,[r,o])=>{const i=await t,s=await v(e,o,n);return c(s)&&(i[r]=s),i},Promise.resolve({})):x&&(_=await Promise.all(x.map(t=>k(e,t,n))));O&&!await b(O)(_)&&(_=void 0);const E=h(_);return c(E)?E:h(j)},Promise.resolve(void 0))}function S(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function x(e,t,n){return function(...r){let o;const i="post"+t,s=n["pre"+t],a=n[i];return o=s?s({fn:e},...r):e(...r),a&&(o=a({fn:e,result:o},...r)),o}}function O(e,t){return(e.getAttribute(t)||"").trim()}function j(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,r]=function(e){const[t,n]=e.split(/:(.+)/,2);return[S(t||""),S(n||"")]}(e);n&&("true"===r?t[n]=!0:"false"===r?t[n]=!1:r&&/^\d+$/.test(r)?t[n]=parseInt(r,10):r&&/^\d+\.\d+$/.test(r)?t[n]=parseFloat(r):t[n]=r||!0)}),t}var _=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function E(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const r=window.innerHeight,o=e.getBoundingClientRect(),i=o.height,s=o.y,a=s+i,c={x:o.x+e.offsetWidth/2,y:o.y+e.offsetHeight/2};if(i<=r){if(e.offsetWidth+o.width===0||e.offsetHeight+o.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=r/2;if(s<0&&a<e)return!1;if(a>r&&s>e)return!1;n=document.elementFromPoint(c.x,r/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function L(e,t,n){return!1===n?e:(n||(n=C),n(e,t,C))}var A,$,C=(e,t)=>{const n=(null==t?void 0:t.push)||_,r={};return e.id&&(r.session=e.id),e.storage&&e.device&&(r.device=e.device),n("walker user",r),e.isStart&&n({name:"session start",data:e}),e};function q(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,r="";return e&&(n=0,r=e),{e:n,v:r}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:P(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function P(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let r=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(r+="; domain="+i),document.cookie=r;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return q(e,r)}function D(e={}){const t=Date.now(),{length:n=30,deviceKey:r="elbDeviceId",deviceStorage:o="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=R(e);let l=!1;const d=w((e,t,n)=>{let r=q(e,n);return r||(r=m(8),P(e,r,1440*t,n)),String(r)})(r,i,o),f=w((e,r)=>{const o=JSON.parse(String(q(e,r)));return c||(o.isNew=!1,u.marketing&&(Object.assign(o,u),l=!0),l||o.updated+6e4*n<t?(delete o.id,delete o.referrer,o.start=t,o.count++,o.runs=1,l=!0):o.runs++),o},()=>{l=!0})(s,a)||{},p={id:m(12),start:t,isNew:!0,count:1,runs:1},g=Object.assign(p,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return P(s,JSON.stringify(g),2*n,a),g}function R(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const r=new URL(e.url||window.location.href),o=e.referrer||document.referrer,i=o&&new URL(o).hostname,a=function(e,t={}){const n="clickId",r={},o={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(s(o,t)).forEach(([t,o])=>{const i=e.searchParams.get(t);i&&(o===n&&(o=t,r[n]=t),r[o]=i)}),r}(r,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(r.hostname),t=!n.includes(i)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:m(12),referrer:i},a,e.data):n}var I,N,W=Object.getOwnPropertyNames,X=(A={"package.json"(e,t){t.exports={name:"@walkeros/collector",description:"Unified platform-agnostic collector for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{"@walkeros/core":"0.1.2"},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/collector"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","collector","event processing"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return $||(0,A[W(A)[0]])(($={exports:{}}).exports,$),$.exports}),M={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},U=M;function T(e,t,n,r){let o,i=n||[];switch(n||(i=e.on[t]||[]),t){case U.Consent:o=r||e.consent;break;case U.Session:o=e.session;break;case U.Ready:case U.Run:default:o=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&w(e.on)(t,o)}),Object.values(e.destinations).forEach(e=>{e.on&&w(e.on)(t,o)}),i.length)switch(t){case U.Consent:!function(e,t,n){const r=n||e.consent;t.forEach(t=>{Object.keys(r).filter(e=>e in t).forEach(n=>{w(t[n])(e,r)})})}(e,i,r);break;case U.Ready:case U.Run:a=i,(s=e).allowed&&a.forEach(e=>{w(e)(s)});break;case U.Session:!function(e,t){e.session&&t.forEach(t=>{w(t)(e,e.session)})}(e,i)}var s,a}async function H(e,t,n,r){let o;switch(t){case U.Config:u(n)&&s(e.config,n,{shallow:!1});break;case U.Consent:u(n)&&(o=await async function(e,t){const{consent:n}=e;let r=!1;const o={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;o[e]=n,r=r||n}),e.consent=s(n,o),T(e,"consent",void 0,o),r?B(e):J({ok:!0})}(e,n));break;case U.Custom:u(n)&&(e.custom=s(e.custom,n));break;case U.Destination:u(n)&&function(e){return"function"==typeof e}(n.push)&&(o=await async function(e,t,n){const{code:r,config:o={},env:i={}}=t,s=n||o||{init:!1},a={...r,config:s,env:z(r.env,i)};let c=a.config.id;if(!c)do{c=m(4)}while(e.destinations[c]);return e.destinations[c]=a,!1!==a.config.queue&&(a.queue=[...e.queue]),B(e,void 0,{[c]:a})}(e,{code:n},r));break;case U.Globals:u(n)&&(e.globals=s(e.globals,n));break;case U.On:l(n)&&function(e,t,n){const r=e.on,o=r[t]||[],i=a(n)?n:[n];i.forEach(e=>{o.push(e)}),r[t]=o,T(e,t,i)}(e,n,r);break;case U.Ready:T(e,"ready");break;case U.Run:o=await async function(e,t){e.allowed=!0,e.count=0,e.group=m(),e.timing=Date.now(),t&&(t.consent&&(e.consent=s(e.consent,t.consent)),t.user&&(e.user=s(e.user,t.user)),t.globals&&(e.globals=s(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=s(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await B(e);return T(e,"run"),n}(e,n);break;case U.Session:T(e,"session");break;case U.User:u(n)&&s(e.user,n,{shallow:!1})}return o||{ok:!0,successful:[],queued:[],failed:[]}}function G(e,t,n){return x(async(r,o,i)=>await b(async()=>{if("string"==typeof r&&r.startsWith("walker ")){const n=r.replace("walker ","");return await t(e,n,o,i)}{const s=n("string"==typeof r?{name:r}:r),{event:a,command:c}=function(e,t,n={}){const r=function(e){return typeof e==typeof""}(t)?{name:t,...n}:{...n,...t||{}};if(!r.name)throw new Error("Event name is required");const[o,i]=r.name.split(" ");if(!o||!i)throw new Error("Event name is invalid");if(o===M.Walker)return{command:i};++e.count;const{timestamp:s=Date.now(),group:a=e.group,count:c=e.count}=r,{name:u=`${o} ${i}`,data:l={},context:d={},globals:f=e.globals,custom:p={},user:g=e.user,nested:m=[],consent:y=e.consent,id:h=`${s}-${a}-${c}`,trigger:w="",entity:b=o,action:v=i,timing:k=0,version:S={source:e.version,tagging:e.config.tagging||0},source:x={type:"collector",id:"",previous_id:""}}=r;return{event:{name:u,data:l,context:d,globals:f,custom:p,user:g,nested:m,consent:y,id:h,trigger:w,entity:b,action:v,timestamp:s,timing:k,group:a,count:c,version:S,source:x}}}(e,s.name,s);return c?await t(e,c,o,i):await B(e,a)}},()=>J({ok:!1}))(),"Push",e.hooks)}async function B(e,t,n){const{allowed:r,consent:o,globals:i,user:a}=e;if(!r)return J({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,r])=>{let c=(r.queue||[]).map(e=>({...e,consent:o}));if(r.queue=[],t){let n=d(t);await Promise.all(Object.entries(r.config.policy||[]).map(async([r,o])=>{const i=await v(t,o,{collector:e});n=function(e,t,n){const r=d(e),o=t.split(".");let i=r;for(let e=0;e<o.length;e++){const t=o[e];e===o.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return r}(n,r,i)})),c.push(n)}if(!c.length)return{id:n,destination:r,skipped:!0};const u=[],l=c.filter(e=>{const t=p(r.config.consent,o,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(r.queue.concat(l),!u.length)return{id:n,destination:r,queue:c};if(!await b(K)(e,r))return{id:n,destination:r,queue:c};let f=!1;return r.dlq||(r.dlq=[]),await Promise.all(u.map(async t=>(t.globals=s(i,t.globals),t.user=s(a,t.user),await b(F,n=>(e.config.onError&&e.config.onError(n,e),f=!0,r.dlq.push([t,n]),!1))(e,r,t),t))),{id:n,destination:r,error:f}})),u=[],l=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),l.push(n)):u.push(n)}return J({ok:!f.length,event:t,successful:u,queued:l,failed:f})}async function K(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:z(t.env,t.config.env)},r=await x(t.init,"DestinationInit",e.hooks)(n);if(!1===r)return r;t.config={...r||t.config,init:!0}}return!0}async function F(e,t,n){var r;const{config:o}=t,{eventMapping:i,mappingKey:l}=await async function(e,t){var n;const[r,o]=(e.name||"").split(" ");if(!t||!r||!o)return{};let i,s="",c=r,u=o;const l=t=>{if(t)return(t=a(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(s=`${c} ${u}`),{eventMapping:i,mappingKey:s}}(n,o.mapping);let d=o.data&&await v(n,o.data,{collector:e});if(i){if(i.ignore)return!1;if(i.name&&(n.name=i.name),i.data){const t=i.data&&await v(n,i.data,{collector:e});d=u(d)&&u(t)?s(d,t):t}}const f={collector:e,config:o,data:d,mapping:i,env:z(t.env,o.env)};if((null==i?void 0:i.batch)&&t.pushBatch){const s=i.batched||{key:l||"",events:[],data:[]};s.events.push(n),c(d)&&s.data.push(d),i.batchFn=i.batchFn||function(e,t=1e3,n=!1){let r,o=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;o&&clearTimeout(o),o=setTimeout(()=>{o=null,n&&!i||(r=e(...s),a(r))},t),c&&(i=!0,r=e(...s),a(r))})}((e,t)=>{const n={collector:t,config:o,data:d,mapping:i,env:z(e.env,o.env)};x(e.pushBatch,"DestinationPushBatch",t.hooks)(s,n),s.events=[],s.data=[]},i.batch),i.batched=s,null==(r=i.batchFn)||r.call(i,t,e)}else await x(t.push,"DestinationPush",e.hooks)(n,f);return!0}function J(e){var t;return s({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function z(e,t){return e||t?t?e&&u(e)&&u(t)?{...e,...t}:t:e:{}}async function V(e={}){const t=await async function(e){const{version:t}=X(),n=s({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:r,run:!0,sources:{},destinations:{},consent:{},user:{},globals:{},custom:{}},e,{merge:!1,extend:!1});function r(e,t){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},t||n.verbose)}n.onLog=r;const o={...n.globalsStatic,...n.globals},i={allowed:!1,config:n,consent:n.consent||{},count:0,custom:n.custom||{},destinations:{},globals:o,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:n.user||{},version:t,sources:{},push:void 0};return i.push=G(i,H,e=>({timing:Math.round((Date.now()-i.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),i.sources=await async function(e,t={}){const n={};for(const[r,o]of Object.entries(t)){const{code:t,config:i={},env:s={}}=o,a={elb:(...t)=>e.push(...t),...s},c=await b(t)(i,a);c&&(n[r]=c)}return n}(i,n.sources),i.destinations=await async function(e,t={}){const n={};for(const[e,r]of Object.entries(t)){const{code:t,config:o={},env:i={}}=r,s={...t.config,...o},a=z(t.env,i);n[e]={...t,config:s,env:a}}return n}(0,n.destinations),i}(e),{consent:n,user:r,globals:o,custom:i}=e;return n&&await t.push("walker consent",n),r&&await t.push("walker user",r),o&&Object.assign(t.globals,o),i&&Object.assign(t.custom,i),t.config.run&&await t.push("walker run"),{collector:t,elb:t.push}}var Y=Object.getOwnPropertyNames,Q=(I={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return N||(0,I[Y(I)[0]])((N={exports:{}}).exports,N),N.exports}),Z={merge:!0,shallow:!0,extend:!0};function ee(e,t={},n={}){n={...Z,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function te(e){return Array.isArray(e)}function ne(e){return e===document||e instanceof Element}function re(e){return"object"==typeof e&&null!==e&&!te(e)&&"[object Object]"===Object.prototype.toString.call(e)}function oe(e){return"string"==typeof e}function ie(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}var{version:se}=Q();function ae(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function ce(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ue(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function le(e,t,n,r=!0){return be(O(t,ue(e,n,r))||"").reduce((e,n)=>{let[r,o]=ve(n);if(!r)return e;if(o||(r.endsWith(":")&&(r=r.slice(0,-1)),o=""),o.startsWith("#")){o=o.slice(1);try{let e=t[o];e||"selected"!==o||(e=t.options[t.selectedIndex].text),o=String(e)}catch(e){o=""}}return r.endsWith("[]")?(r=r.slice(0,-2),te(e[r])||(e[r]=[]),e[r].push(ie(o))):e[r]=ie(o),e},{})}function de(e=U.Prefix,t=document){const n=ue(e,U.Globals,!1);let r={};return we(t,`[${n}]`,t=>{r=ee(r,le(e,t,U.Globals,!1))}),r}function fe(e,t){const n=window.location,r="page",o=t===document?document.body:t,[i,s]=he(o,`[${ue(e,r)}]`,e,r);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function pe(e){const t={};return be(e).forEach(e=>{const[n,r]=ve(e),[o,i]=ke(n);if(!o)return;let[s,a]=ke(r||"");s=s||o,t[o]||(t[o]=[]),t[o].push({trigger:o,triggerParams:i,action:s,actionParams:a})}),t}function ge(e,t,n,r=!1){const o=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=me(e,i,t,n);if(s&&(o.push(s),r))break;i=ye(e,i)}return o}function me(e,t,n,r){const o=O(t,ue(e));if(!o||r&&!r[o])return null;const i=[t],s=`[${ue(e,o)}],[${ue(e,"")}]`,a=ue(e,U.Link,!1);let c={};const u=[],[l,d]=he(n||t,s,e,o);we(t,`[${a}]`,t=>{const[n,r]=ve(O(t,a));"parent"===r&&we(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=me(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),we(e,s,e=>f.push(e))});let p={};return f.forEach(t=>{p=ee(p,le(e,t,"")),c=ee(c,le(e,t,o))}),c=ee(ee(p,c),l),i.forEach(t=>{we(t,`[${ue(e)}]`,t=>{const n=me(e,t);n&&u.push(n)})}),{entity:o,data:c,context:d,nested:u}}function ye(e,t){const n=ue(e,U.Link,!1);if(t.matches(`[${n}]`)){const[e,r]=ve(O(t,n));if("child"===r)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function he(e,t,n,r){let o={};const i={};let s=e;const a=`[${ue(n,U.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(o=ee(le(n,s,""),o),o=ee(le(n,s,r),o)),s.matches(a)&&(Object.entries(le(n,s,U.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=ye(n,s);return[o,i]}function we(e,t,n){e.querySelectorAll(t).forEach(n)}function be(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function ve(e){const[t,n]=e.split(/:(.+)/,2);return[ce(t),ce(n)]}function ke(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var Se=new WeakMap,xe=new WeakMap,Oe=new WeakMap;function je(e){const t=Date.now();let n=xe.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:E(e),lastChecked:t},xe.set(e,n)),n.isVisible}function _e(e){if(window.IntersectionObserver)return ae(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,r;const o=t.target,i=Oe.get(e);if(!i)return;const s=i.timers.get(o);if(t.intersectionRatio>0){const r=Date.now();let a=Se.get(o);if((!a||r-a.lastChecked>1e3)&&(a={isLarge:o.offsetHeight>window.innerHeight,lastChecked:r},Se.set(o,a)),t.intersectionRatio>=.5||a.isLarge&&je(o)){const t=null==(n=i.elementConfigs)?void 0:n.get(o);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(je(o)){const r=null==(t=i.elementConfigs)?void 0:t.get(o);(null==r?void 0:r.context)&&await Ue(r.context,o,r.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(o);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=Oe.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),Se.delete(t),xe.delete(t)}(e,o)}},i.duration);i.timers.set(o,t)}return}}s&&(clearTimeout(s),i.timers.delete(o));const a=null==(r=i.elementConfigs)?void 0:r.get(o);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function Ee(e,t,n={multiple:!1}){var r;const o=e.settings.scope||document,i=Oe.get(o);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(r=n.multiple)&&r,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Le(e){if(!e)return;const t=Oe.get(e);t&&(t.observer&&t.observer.disconnect(),Oe.delete(e))}var Ae,$e=performance.now();function Ce(e,t,n,r,o,i,s){const{elb:a,settings:c}=e;if(oe(t)&&t.startsWith("walker "))return a(t,n);if(re(t)){const e=t;return e.source||(e.source=qe()),e.globals||(e.globals=de(c.prefix,c.scope||document)),a(e)}const[u]=String(re(t)?t.name:t).split(" ");let l,d=re(n)?n:{},f={},p=!1;if(ne(n)&&(l=n,p=!0),ne(o)?l=o:re(o)&&Object.keys(o).length&&(f=o),l){const e=ge(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(p&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const g=de(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:g,nested:i,custom:s,trigger:oe(r)?r:"",timing:Math.round((performance.now()-$e)/10)/100,source:qe()})}function qe(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Pe=[],De="hover",Re="load",Ie="pulse",Ne="scroll",We="wait";function Xe(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",ae(function(t){He.call(this,e,t)})),n.addEventListener("submit",ae(function(t){Ge.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Pe=[];const r=n||document;Le(r),function(e,t=1e3){Oe.has(e)||Oe.set(e,{observer:_e(e),timers:new WeakMap,duration:t})}(r,1e3);const o=ue(t.prefix,U.Action,!1);r!==document&&Te(e,r,o,t),r.querySelectorAll(`[${o}]`).forEach(n=>{Te(e,n,o,t)}),Pe.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const r=window.scrollY+window.innerHeight,o=e.offsetTop;if(r<o)return!0;const i=e.clientHeight;return!(100*(1-(o+i-r)/(i||1))>=n&&(Ue(t,e,Ne),1))});Ae||(Ae=function(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}(function(){Pe=n.call(t,Pe,e)}),t.addEventListener("scroll",Ae))}(e,r)}(e,t)}async function Ue(e,t,n){const r=function(e,t,n=U.Prefix){const r=[],{actions:o,nearestOnly:i}=function(e,t,n){let r=t;for(;r;){const t=O(r,ue(e,U.Actions,!1));if(t){const e=pe(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const o=O(r,ue(e,U.Action,!1));if(o){const e=pe(o);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}r=ye(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t);return o.length?(o.forEach(o=>{const s=be(o.actionParams||"",",").reduce((e,t)=>(e[ce(t)]=!0,e),{}),a=ge(n,e,s,i);if(!a.length){const t="page",r=`[${ue(n,t)}]`,[o,i]=he(e,r,n,t);a.push({entity:t,data:o,nested:[],context:i})}a.forEach(e=>{r.push({entity:e.entity,action:o.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r}(t,n,e.settings.prefix);return Promise.all(r.map(t=>Ce(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Te(e,t,n,r){const o=O(t,n);o&&Object.values(pe(o)).forEach(n=>n.forEach(n=>{switch(n.trigger){case De:r=e,t.addEventListener("mouseenter",ae(function(e){e.target instanceof Element&&Ue(r,e.target,De)}));break;case Re:!function(e,t){Ue(e,t,Re)}(e,t);break;case Ie:!function(e,t,n=""){setInterval(()=>{document.hidden||Ue(e,t,Ie)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Ne:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Pe.push([e,n])}(t,n.triggerParams);break;case"impression":Ee(e,t);break;case"visible":Ee(e,t,{multiple:!0});break;case We:!function(e,t,n=""){setTimeout(()=>Ue(e,t,We),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var r}))}function He(e,t){Ue(e,t.target,"click")}function Ge(e,t){t.target&&Ue(e,t.target,"submit")}function Be(e,t,n,r){const o=[];let i=!0;n.forEach(e=>{const t=Fe(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!re(s)&&oe(s)&&s.startsWith("walker ");if(re(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!oe(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(r&&a||!r&&!a)&&o.push(t)}),o.forEach(n=>{Ke(e,t,n)})}function Ke(e,t="data-elb",n){ae(()=>{if(Array.isArray(n)){const[r,...o]=n;if(!r||oe(r)&&""===r.trim())return;if(oe(r)&&r.startsWith("walker "))return void e(r,o[0]);Ce({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},r,...o)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Fe(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Je(e,t={}){return function(e={}){const{cb:t,consent:n,collector:r,storage:o}=e,i=(null==r?void 0:r.push)||_;if(!n)return L((o?D:R)(e),r,t);{const r=function(e,t){let n;return(r,o)=>{if(c(n)&&n===(null==r?void 0:r.group))return;n=null==r?void 0:r.group;let i=()=>R(e);return e.consent&&p((a(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),o)&&(i=()=>D(e)),L(i(),r,t)}}(e,t);i("walker on","consent",(a(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{}))}}({...t,collector:{push:e,group:void 0}})}var ze=async(e,t)=>{try{const n=t||{},{elb:r,window:o,document:i}=n;if(!r)throw new Error("Browser source requires elb function in environment");const s=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}((null==e?void 0:e.settings)||{},i),a={settings:s},c={elb:r,settings:s};if(i&&o){if(!1!==s.elbLayer&&function(e,t={}){const n=t.name||"elbLayer",r=t.window||("undefined"!=typeof window?window:void 0);if(!r)return;const o=r;o[n]||(o[n]=[]);const i=o[n];i.push=function(...n){if(Fe(n[0])){const r=[...Array.from(n[0])],o=Array.prototype.push.apply(this,[r]);return Ke(e,t.prefix,r),o}const r=Array.prototype.push.apply(this,n);return n.forEach(n=>{Ke(e,t.prefix,n)}),r},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Be(e,t,n,!0),Be(e,t,n,!1),n.length=0}(e,t.prefix,i)}(r,{name:oe(s.elbLayer)?s.elbLayer:"elbLayer",prefix:s.prefix,window:o}),s.session){const e="boolean"==typeof s.session?{}:s.session;Je(r,e)}await async function(e,t,n){const r=()=>{e(t,n)};"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}(Xe,c,s),(()=>{if(Me(c,s),s.pageview){const[e,t]=fe(s.prefix||"data-elb",s.scope);Ce(c,"page view",e,"load",t)}})(),oe(s.elb)&&s.elb&&(o[s.elb]=(...e)=>{const[t,n,r,o,i,s]=e;return Ce(c,t,n,r,o,i,s)})}return{type:"browser",config:a,push:(...e)=>{const[t,n,r,o,i,s]=e;return Ce(c,t,n,r,o,i,s)},destroy:async()=>{i&&Le(s.scope||i)},on:async(e,t)=>{switch(e){case"consent":if(s.session&&t){const e="boolean"==typeof s.session?{}:s.session;Je(r,e)}break;case"session":case"ready":default:break;case"run":if(i&&o&&(Me(c,s),s.pageview)){const[e,t]=fe(s.prefix||"data-elb",s.scope);Ce(c,"page view",e,"load",t)}}}}}catch(e){throw e}},Ve=Object.defineProperty,Ye=(e,t)=>{for(var n in t)Ve(e,n,{get:t[n],enumerable:!0})},Qe=!1;function Ze(e,t={},n){if(t.filter&&!0===w(()=>t.filter(n),()=>!1)())return;const r=function(e){if(u(e)&&l(e.event)){const{event:t,...n}=e;return{name:t,...n}}return a(e)&&e.length>=2?et(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?et(Array.from(e)):null;var t}(n);if(!r)return;const o={name:`${t.prefix||"dataLayer"} ${r.name}`,data:r,context:{},globals:{},custom:{},consent:{},nested:[],user:{},id:Math.random().toString(36).substring(2,15),trigger:"",entity:"",action:"",timestamp:Date.now(),timing:0,group:"",count:0,version:{source:"1.0.0",tagging:2},source:{type:"dataLayer",id:"",previous_id:""}};w(()=>e(o),()=>{})()}function et(e){const[t,n,r]=e;if(!l(t))return null;let o,i={};switch(t){case"consent":if(!l(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!u(r)||null===r)return null;o=`${t} ${n}`,i={...r};break;case"event":if(!l(n))return null;o=n,u(r)&&(i={...r});break;case"config":if(!l(n))return null;o=`${t} ${n}`,u(r)&&(i={...r});break;case"set":if(l(n))o=`${t} ${n}`,u(r)&&(i={...r});else{if(!u(n))return null;o=`${t} custom`,i={...n}}break;default:return null}return{name:o,...i}}function tt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function nt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function rt(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ot(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function it(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function st(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function at(){return["set",{currency:"EUR",country:"DE"}]}function ct(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Ye({},{add_to_cart:()=>ot,config:()=>st,consentDefault:()=>nt,consentUpdate:()=>tt,directDataLayerEvent:()=>ct,purchase:()=>rt,setCustom:()=>at,view_item:()=>it});Ye({},{add_to_cart:()=>dt,config:()=>mt,configGA4:()=>pt,consentOnlyMapping:()=>yt,consentUpdate:()=>ut,customEvent:()=>gt,purchase:()=>lt,view_item:()=>ft});var ut={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},lt={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},dt={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},ft={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},pt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},gt={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},mt={consent:{update:ut},purchase:lt,add_to_cart:dt,view_item:ft,"config G-XXXXXXXXXX":pt,custom_event:gt,"*":{data:{}}},yt={consent:{update:ut}},ht=async(e,t)=>{try{const n=t||{},{elb:r,window:o}=n;if(!r)throw new Error("DataLayer source requires elb function in environment");const i={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},s={settings:i};return o&&(function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",o=window[r];if(Array.isArray(o)&&!Qe){Qe=!0;try{for(const t of o)Ze(e,n,t)}finally{Qe=!1}}}(r,s),function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);const o=window[r];if(!Array.isArray(o))return;const i=o.push.bind(o);o.push=function(...t){if(Qe)return i(...t);Qe=!0;try{for(const r of t)Ze(e,n,r)}finally{Qe=!1}return i(...t)}}(r,s)),{type:"dataLayer",config:s,push:r,destroy:async()=>{const e=i.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}}catch(e){throw e}};function wt(){window.dataLayer=window.dataLayer||[];const e=e=>{u(e)&&u(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=j(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(e={}){const t=s({collector:{destinations:{dataLayer:{code:wt()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),n={...t.collector,sources:{browser:{code:ze,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=u(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:ht,config:{settings:e}})}const{collector:r}=await V(n);if(!r.sources.browser)throw new Error("Browser source not initialized in walker.js");const o=r.sources.browser.push,i={collector:r,elb:o};return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o),t.name&&(window[t.name]=r)),i}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
1
+ "use strict";(()=>{var e,t,n,a=Object.defineProperty,r={};((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})})(r,{BRAND:()=>Me,DIRTY:()=>k,EMPTY_PATH:()=>h,INVALID:()=>b,NEVER:()=>Ct,OK:()=>x,ParseStatus:()=>_,Schema:()=>N,ZodAny:()=>ue,ZodArray:()=>me,ZodBigInt:()=>ae,ZodBoolean:()=>re,ZodBranded:()=>Fe,ZodCatch:()=>Re,ZodDate:()=>se,ZodDefault:()=>Ie,ZodDiscriminatedUnion:()=>ve,ZodEffects:()=>Ce,ZodEnum:()=>Pe,ZodError:()=>u,ZodFirstPartyTypeKind:()=>qe,ZodFunction:()=>Ae,ZodIntersection:()=>be,ZodIssueCode:()=>o,ZodLazy:()=>Se,ZodLiteral:()=>Oe,ZodMap:()=>we,ZodNaN:()=>Le,ZodNativeEnum:()=>je,ZodNever:()=>le,ZodNull:()=>ce,ZodNullable:()=>$e,ZodNumber:()=>ne,ZodObject:()=>he,ZodOptional:()=>Ee,ZodParsedType:()=>s,ZodPipeline:()=>ze,ZodPromise:()=>Ne,ZodReadonly:()=>De,ZodRecord:()=>xe,ZodSchema:()=>N,ZodSet:()=>Ze,ZodString:()=>ee,ZodSymbol:()=>ie,ZodTransformer:()=>Ce,ZodTuple:()=>ke,ZodType:()=>N,ZodUndefined:()=>oe,ZodUnion:()=>ge,ZodUnknown:()=>de,ZodVoid:()=>pe,addIssueToContext:()=>g,any:()=>at,array:()=>ot,bigint:()=>Ye,boolean:()=>Ge,coerce:()=>Nt,custom:()=>Ve,date:()=>Qe,datetimeRegex:()=>H,defaultErrorMap:()=>d,discriminatedUnion:()=>lt,effect:()=>wt,enum:()=>bt,function:()=>yt,getErrorMap:()=>m,getParsedType:()=>i,instanceof:()=>We,intersection:()=>pt,isAborted:()=>w,isAsync:()=>S,isDirty:()=>Z,isValid:()=>A,late:()=>Ke,lazy:()=>vt,literal:()=>_t,makeIssue:()=>f,map:()=>ht,nan:()=>He,nativeEnum:()=>kt,never:()=>st,null:()=>nt,nullable:()=>At,number:()=>Je,object:()=>ct,objectUtil:()=>n,oboolean:()=>jt,onumber:()=>Pt,optional:()=>Zt,ostring:()=>Tt,pipeline:()=>Ot,preprocess:()=>St,promise:()=>xt,quotelessJson:()=>c,record:()=>ft,set:()=>gt,setErrorMap:()=>p,strictObject:()=>ut,string:()=>Xe,symbol:()=>et,transformer:()=>wt,tuple:()=>mt,undefined:()=>tt,union:()=>dt,unknown:()=>rt,util:()=>e,void:()=>it}),(t=e||(e={})).assertEqual=e=>{},t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const t of n)a[t]=e[t];return t.objectValues(a)},t.objectValues=e=>t.objectKeys(e).map(function(t){return e[t]}),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});var s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},o=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),c=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),u=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},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(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const 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()}};u.create=e=>new u(e);var d=(t,n)=>{let a;switch(t.code){case o.invalid_type:a=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case o.invalid_union:a="Invalid input";break;case o.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case o.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:a="Invalid function arguments";break;case o.invalid_return_type:a="Invalid function return type";break;case o.invalid_date:a="Invalid date";break;case o.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case o.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case o.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case o.custom:a="Invalid input";break;case o.invalid_intersection_types:a="Intersection results could not be merged";break;case o.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}},l=d;function p(e){l=e}function m(){return l}var f=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},h=[];function g(e,t){const n=m(),a=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===d?void 0:d].filter(e=>!!e)});e.common.issues.push(a)}var y,v,_=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 b;"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 b;if("aborted"===r.status)return b;"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}}},b=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,Z=e=>"dirty"===e.status,A=e=>"valid"===e.status,S=e=>"undefined"!=typeof Promise&&e instanceof Promise;(v=y||(y={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},v.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var O=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}},T=(e,t)=>{if(A(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new u(e.common.issues);return this._error=t,this._error}}};function P(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 s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(s=null!=o?o:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var j,N=class{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S(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:i(e)},r=this._parseSync({data:e,path:a.path,parent:a});return T(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:i(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return A(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=>A(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:i(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(S(a)?a:Promise.resolve(a));return T(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),s=()=>a.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!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 Ce({schema:this,typeName:qe.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 Ee.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ne.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new Ce({...P(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ie({...P(this._def),innerType:this,defaultValue:t,typeName:qe.ZodDefault})}brand(){return new Fe({typeName:qe.ZodBranded,type:this,...P(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Re({...P(this._def),innerType:this,catchValue:t,typeName:qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ze.create(this,e)}readonly(){return De.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,R=/^[a-z0-9_-]{21}$/i,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M=/^[-+]?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)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z=/^(?:(?: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])$/,D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,U=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,V=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,K="((\\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])))",W=new RegExp(`^${K}$`);function X(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 J(e){return new RegExp(`^${X(e)}$`)}function H(e){let t=`${K}T${X(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 Y(e,t){return!("v4"!==t&&t||!z.test(e))||!("v6"!==t&&t||!U.test(e))}function G(e,t){if(!L.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 Q(e,t){return!("v4"!==t&&t||!D.test(e))||!("v6"!==t&&t||!V.test(e))}var ee=class t extends N{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.string,received:e.parsedType}),b}const n=new _;let a;for(const r of this._def.checks)if("min"===r.kind)t.data.length<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("max"===r.kind)t.data.length>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("length"===r.kind){const e=t.data.length>r.value,s=t.data.length<r.value;(e||s)&&(a=this._getOrReturnCtx(t,a),e?g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if("email"===r.kind)F.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"email",code:o.invalid_string,message:r.message}),n.dirty());else if("emoji"===r.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"emoji",code:o.invalid_string,message:r.message}),n.dirty());else if("uuid"===r.kind)I.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"uuid",code:o.invalid_string,message:r.message}),n.dirty());else if("nanoid"===r.kind)R.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"nanoid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid"===r.kind)C.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid2"===r.kind)E.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid2",code:o.invalid_string,message:r.message}),n.dirty());else if("ulid"===r.kind)$.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ulid",code:o.invalid_string,message:r.message}),n.dirty());else if("url"===r.kind)try{new URL(t.data)}catch(e){a=this._getOrReturnCtx(t,a),g(a,{validation:"url",code:o.invalid_string,message:r.message}),n.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"regex",code:o.invalid_string,message:r.message}),n.dirty())}else if("trim"===r.kind)t.data=t.data.trim();else if("includes"===r.kind)t.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty());else if("toLowerCase"===r.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===r.kind)t.data=t.data.toUpperCase();else if("startsWith"===r.kind)t.data.startsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty());else if("endsWith"===r.kind)t.data.endsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty());else if("datetime"===r.kind){H(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"datetime",message:r.message}),n.dirty())}else if("date"===r.kind){W.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty())}else if("time"===r.kind){J(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"time",message:r.message}),n.dirty())}else"duration"===r.kind?M.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):"ip"===r.kind?Y(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ip",code:o.invalid_string,message:r.message}),n.dirty()):"jwt"===r.kind?G(t.data,r.alg)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"jwt",code:o.invalid_string,message:r.message}),n.dirty()):"cidr"===r.kind?Q(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cidr",code:o.invalid_string,message:r.message}),n.dirty()):"base64"===r.kind?q.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):"base64url"===r.kind?B.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):e.assertNever(r);return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:o.invalid_string,...y.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.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,...y.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,...y.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...y.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function te(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}ee.create=e=>{var t;return new ee({checks:[],typeName:qe.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var ne=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.number,received:e.parsedType}),b}let n;const a=new _;for(const r of this._def.checks)if("int"===r.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==te(t.data,r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_finite,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ne.create=e=>new ne({checks:[],typeName:qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var ae=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(e){return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let n;const a=new _;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};ae.create=e=>{var t;return new ae({checks:[],typeName:qe.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var re=class extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.boolean,received:t.parsedType}),b}return x(e.data)}};re.create=e=>new re({typeName:qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var se=class t extends N{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.date,received:e.parsedType}),b}if(Number.isNaN(t.data.getTime())){return g(this._getOrReturnCtx(t),{code:o.invalid_date}),b}const n=new _;let a;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?t.data.getTime()>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):e.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};se.create=e=>new se({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:qe.ZodDate,...P(e)});var ie=class extends N{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.symbol,received:t.parsedType}),b}return x(e.data)}};ie.create=e=>new ie({typeName:qe.ZodSymbol,...P(e)});var oe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.undefined,received:t.parsedType}),b}return x(e.data)}};oe.create=e=>new oe({typeName:qe.ZodUndefined,...P(e)});var ce=class extends N{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.null,received:t.parsedType}),b}return x(e.data)}};ce.create=e=>new ce({typeName:qe.ZodNull,...P(e)});var ue=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};ue.create=e=>new ue({typeName:qe.ZodAny,...P(e)});var de=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}};de.create=e=>new de({typeName:qe.ZodUnknown,...P(e)});var le=class extends N{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.never,received:t.parsedType}),b}};le.create=e=>new le({typeName:qe.ZodNever,...P(e)});var pe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.void,received:t.parsedType}),b}return x(e.data)}};pe.create=e=>new pe({typeName:qe.ZodVoid,...P(e)});var me=class e extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==s.array)return g(t,{code:o.invalid_type,expected:s.array,received:t.parsedType}),b;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(g(t,{code:e?o.too_big:o.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&&(g(t,{code:o.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&&(g(t,{code:o.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 O(t,e,t.path,n)))).then(e=>_.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new O(t,e,t.path,n)));return _.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:y.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:y.toString(n)}})}nonempty(e){return this.min(1,e)}};function fe(e){if(e instanceof he){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Ee.create(fe(a))}return new he({...e._def,shape:()=>t})}return e instanceof me?new me({...e._def,type:fe(e.element)}):e instanceof Ee?Ee.create(fe(e.unwrap())):e instanceof $e?$e.create(fe(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>fe(e))):e}me.create=(e,t)=>new me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...P(t)});var he=class t extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof le&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const c=[];for(const e of r){const t=a[e],r=n.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new O(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof le){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)c.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(g(n,{code:o.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];c.push({key:{status:"valid",value:t},value:e._parse(new O(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of c){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new t({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,t,n).message)?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!=(i=y.errToObj(e).message)?i:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const a={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}omit(n){const a={};for(const t of e.objectKeys(this.shape))n[t]||(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}deepPartial(){return fe(this)}partial(n){const a={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?a[t]=e:a[t]=e.optional()}return new t({...this._def,shape:()=>a})}required(n){const a={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])a[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ee;)e=e._def.innerType;a[t]=e}return new t({...this._def,shape:()=>a})}keyof(){return Te(e.objectKeys(this.shape))}};he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)});var ge=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new u(e.ctx.common.issues));return g(t,{code:o.invalid_union,unionErrors:n}),b});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new u(e));return g(t,{code:o.invalid_union,unionErrors:r}),b}}get options(){return this._def.options}};ge.create=(e,t)=>new ge({options:e,typeName:qe.ZodUnion,...P(t)});var ye=t=>t instanceof Se?ye(t.schema):t instanceof Ce?ye(t.innerType()):t instanceof Oe?[t.value]:t instanceof Pe?t.options:t instanceof je?e.objectValues(t.enum):t instanceof Ie?ye(t._def.innerType):t instanceof oe?[void 0]:t instanceof ce?[null]:t instanceof Ee?[void 0,...ye(t.unwrap())]:t instanceof $e?[null,...ye(t.unwrap())]:t instanceof Fe||t instanceof De?ye(t.unwrap()):t instanceof Re?ye(t._def.innerType):[],ve=class e extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b;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}):(g(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),b)}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=ye(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:qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...P(a)})}};function _e(t,n){const a=i(t),r=i(n);if(t===n)return{valid:!0,data:t};if(a===s.object&&r===s.object){const a=e.objectKeys(n),r=e.objectKeys(t).filter(e=>-1!==a.indexOf(e)),s={...t,...n};for(const e of r){const a=_e(t[e],n[e]);if(!a.valid)return{valid:!1};s[e]=a.data}return{valid:!0,data:s}}if(a===s.array&&r===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let a=0;a<t.length;a++){const r=_e(t[a],n[a]);if(!r.valid)return{valid:!1};e.push(r.data)}return{valid:!0,data:e}}return a===s.date&&r===s.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var be=class extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(w(e)||w(a))return b;const r=_e(e.value,a.value);return r.valid?((Z(e)||Z(a))&&t.dirty(),{status:t.value,value:r.data}):(g(n,{code:o.invalid_intersection_types}),b)};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}))}};be.create=(e,t,n)=>new be({left:e,right:t,typeName:qe.ZodIntersection,...P(n)});var ke=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return g(n,{code:o.invalid_type,expected:s.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return g(n,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:o.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 O(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:qe.ZodTuple,rest:null,...P(t)})};var xe=class e extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.object)return g(n,{code:o.invalid_type,expected:s.object,received:n.parsedType}),b;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new O(n,e,n.path,e)),value:i._parse(new O(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_.mergeObjectAsync(t,a):_.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof N?{keyType:t,valueType:n,typeName:qe.ZodRecord,...P(a)}:{keyType:ee.create(),valueType:t,typeName:qe.ZodRecord,...P(n)})}},we=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.map)return g(n,{code:o.invalid_type,expected:s.map,received:n.parsedType}),b;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new O(n,e,n.path,[s,"key"])),value:r._parse(new O(n,t,n.path,[s,"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 b;"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 b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};we.create=(e,t,n)=>new we({valueType:t,keyType:e,typeName:qe.ZodMap,...P(n)});var Ze=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return g(n,{code:o.invalid_type,expected:s.set,received:n.parsedType}),b;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(g(n,{code:o.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&&(g(n,{code:o.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 b;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const c=[...n.data.values()].map((e,t)=>r._parse(new O(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>i(e)):i(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:y.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ze.create=(e,t)=>new Ze({valueType:e,minSize:null,maxSize:null,typeName:qe.ZodSet,...P(t)});var Ae=class e extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return g(t,{code:o.invalid_type,expected:s.function,received:t.parsedType}),b;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_arguments,argumentsError:n}})}function a(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ne){const e=this;return x(async function(...t){const s=new u([]),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 x(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new u([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new u([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:ke.create(t).rest(de.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||ke.create([]).rest(de.create()),returns:n||de.create(),typeName:qe.ZodFunction,...P(a)})}},Se=class extends N{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Se.create=(e,t)=>new Se({getter:e,typeName:qe.ZodLazy,...P(t)});var Oe=class extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Te(e,t){return new Pe({values:e,typeName:qe.ZodEnum,...P(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:qe.ZodLiteral,...P(t)});var Pe=class t extends N{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),a=this._def.values;return g(n,{expected:e.joinValues(a),received:n.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return g(e,{received:e.data,code:o.invalid_enum_value,options:n}),b}return x(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};Pe.create=Te;var je=class extends N{_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==s.string&&a.parsedType!==s.number){const t=e.objectValues(n);return g(a,{expected:e.joinValues(t),received:a.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return g(a,{received:a.data,code:o.invalid_enum_value,options:t}),b}return x(t.data)}get enum(){return this._def.values}};je.create=(e,t)=>new je({values:e,typeName:qe.ZodNativeEnum,...P(t)});var Ne=class extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return g(t,{code:o.invalid_type,expected:s.promise,received:t.parsedType}),b;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return x(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ne.create=(e,t)=>new Ne({type:e,typeName:qe.ZodPromise,...P(t)});var Ce=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:e=>{g(a,e),e.fatal?n.abort():n.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===n.value)return b;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t});{if("aborted"===n.value)return b;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);if(a.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===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!A(e))return b;const t=r.transform(e.value,s);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>A(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:n.value,value:e})):b)}e.assertNever(r)}};Ce.create=(e,t,n)=>new Ce({schema:e,typeName:qe.ZodEffects,effect:t,...P(n)}),Ce.createWithPreprocess=(e,t,n)=>new Ce({schema:t,effect:{type:"preprocess",transform:e},typeName:qe.ZodEffects,...P(n)});var Ee=class extends N{_parse(e){return this._getType(e)===s.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ee.create=(e,t)=>new Ee({innerType:e,typeName:qe.ZodOptional,...P(t)});var $e=class extends N{_parse(e){return this._getType(e)===s.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:qe.ZodNullable,...P(t)});var Ie=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...P(t)});var Re=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return S(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...P(t)});var Le=class extends N{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}};Le.create=e=>new Le({typeName:qe.ZodNaN,...P(e)});var Me=Symbol("zod_brand"),Fe=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ze=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?b:"dirty"===e.status?(t.dirty(),k(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?b:"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:qe.ZodPipeline})}},De=class extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return S(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ue(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Ve(e,t={},n){return e?ue.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}De.create=(e,t)=>new De({innerType:e,typeName:qe.ZodReadonly,...P(t)});var qe,Be,Ke={object:he.lazycreate};(Be=qe||(qe={})).ZodString="ZodString",Be.ZodNumber="ZodNumber",Be.ZodNaN="ZodNaN",Be.ZodBigInt="ZodBigInt",Be.ZodBoolean="ZodBoolean",Be.ZodDate="ZodDate",Be.ZodSymbol="ZodSymbol",Be.ZodUndefined="ZodUndefined",Be.ZodNull="ZodNull",Be.ZodAny="ZodAny",Be.ZodUnknown="ZodUnknown",Be.ZodNever="ZodNever",Be.ZodVoid="ZodVoid",Be.ZodArray="ZodArray",Be.ZodObject="ZodObject",Be.ZodUnion="ZodUnion",Be.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Be.ZodIntersection="ZodIntersection",Be.ZodTuple="ZodTuple",Be.ZodRecord="ZodRecord",Be.ZodMap="ZodMap",Be.ZodSet="ZodSet",Be.ZodFunction="ZodFunction",Be.ZodLazy="ZodLazy",Be.ZodLiteral="ZodLiteral",Be.ZodEnum="ZodEnum",Be.ZodEffects="ZodEffects",Be.ZodNativeEnum="ZodNativeEnum",Be.ZodOptional="ZodOptional",Be.ZodNullable="ZodNullable",Be.ZodDefault="ZodDefault",Be.ZodCatch="ZodCatch",Be.ZodPromise="ZodPromise",Be.ZodBranded="ZodBranded",Be.ZodPipeline="ZodPipeline",Be.ZodReadonly="ZodReadonly";var We=(e,t={message:`Input not instance of ${e.name}`})=>Ve(t=>t instanceof e,t),Xe=ee.create,Je=ne.create,He=Le.create,Ye=ae.create,Ge=re.create,Qe=se.create,et=ie.create,tt=oe.create,nt=ce.create,at=ue.create,rt=de.create,st=le.create,it=pe.create,ot=me.create,ct=he.create,ut=he.strictCreate,dt=ge.create,lt=ve.create,pt=be.create,mt=ke.create,ft=xe.create,ht=we.create,gt=Ze.create,yt=Ae.create,vt=Se.create,_t=Oe.create,bt=Pe.create,kt=je.create,xt=Ne.create,wt=Ce.create,Zt=Ee.create,At=$e.create,St=Ce.createWithPreprocess,Ot=ze.create,Tt=()=>Xe().optional(),Pt=()=>Je().optional(),jt=()=>Ge().optional(),Nt={string:e=>ee.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>re.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>se.create({...e,coerce:!0})},Ct=b,Et=Symbol("Let zodToJsonSchema decide on which parser to use"),$t={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"},It=e=>{const t=(e=>"string"==typeof e?{...$t,name:e}:{...$t,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Rt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Lt(e,t,n,a,r){e[t]=n,Rt(e,t,a,r)}var Mt=(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 Ft(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Mt(t,e.currentPath):t.join("/")}}function zt(e,t){return fn(e.type._def,t)}function Dt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Dt(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 Ut(e,t)}}var Ut=(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":Lt(n,"minimum",a.value,a.message,t);break;case"max":Lt(n,"maximum",a.value,a.message,t)}return n};var Vt=void 0,qt=/^[cC][^\s-]{8,}$/,Bt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Xt=()=>(void 0===Vt&&(Vt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Vt),Jt=/^(?:(?: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])$/,Ht=/^(([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])$/,Yt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt=/^[a-zA-Z0-9_-]{21}$/,en=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function tn(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Lt(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":rn(n,"email",a.message,t);break;case"format:idn-email":rn(n,"idn-email",a.message,t);break;case"pattern:zod":sn(n,Wt,a.message,t)}break;case"url":rn(n,"uri",a.message,t);break;case"uuid":rn(n,"uuid",a.message,t);break;case"regex":sn(n,a.regex,a.message,t);break;case"cuid":sn(n,qt,a.message,t);break;case"cuid2":sn(n,Bt,a.message,t);break;case"startsWith":sn(n,RegExp(`^${nn(a.value,t)}`),a.message,t);break;case"endsWith":sn(n,RegExp(`${nn(a.value,t)}$`),a.message,t);break;case"datetime":rn(n,"date-time",a.message,t);break;case"date":rn(n,"date",a.message,t);break;case"time":rn(n,"time",a.message,t);break;case"duration":rn(n,"duration",a.message,t);break;case"length":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Lt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":sn(n,RegExp(nn(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&rn(n,"ipv4",a.message,t),"v4"!==a.version&&rn(n,"ipv6",a.message,t);break;case"base64url":sn(n,Gt,a.message,t);break;case"jwt":sn(n,en,a.message,t);break;case"cidr":"v6"!==a.version&&sn(n,Jt,a.message,t),"v4"!==a.version&&sn(n,Ht,a.message,t);break;case"emoji":sn(n,Xt(),a.message,t);break;case"ulid":sn(n,Kt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":rn(n,"binary",a.message,t);break;case"contentEncoding:base64":Lt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":sn(n,Yt,a.message,t)}break;case"nanoid":sn(n,Qt,a.message,t)}return n}function nn(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)an.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var an=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function rn(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}}})):Lt(e,"format",t,n,a)}function sn(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:on(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Lt(e,"pattern",on(t,a),n,a)}function on(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(r){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function cn(e,t){var n,a,r,s,i,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===qe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Ft(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===qe.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=tn(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===qe.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===qe.ZodBranded&&e.keyType._def.type._def.typeName===qe.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=zt(e.keyType._def,t);return{...u,propertyNames:a}}return u}var un={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var dn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function ln(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=pn(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=fn(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return fn(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(a.additionalProperties=i),a}function pn(e){try{return e.isOptional()}catch(e){return!0}}var mn=(e,t,n)=>{switch(t){case qe.ZodString:return tn(e,n);case qe.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",Rt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodObject:return ln(e,n);case qe.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?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodBoolean:return{type:"boolean"};case qe.ZodDate:return Dt(e,n);case qe.ZodUndefined:return function(e){return{not:Ft(e)}}(n);case qe.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case qe.ZodArray:return function(e,t){var n,a,r;const s={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)!==qe.ZodAny&&(s.items=fn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Lt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Lt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Lt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Lt(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case qe.ZodUnion:case qe.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return dn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in un&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=un[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return dn(e,t)}(e,n);case qe.ZodIntersection:return function(e,t){const n=[fn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),fn(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let 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 qe.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:fn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case qe.ZodRecord:return cn(e,n);case qe.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 qe.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case qe.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 qe.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:un[e.innerType._def.typeName],nullable:!0}:{type:[un[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case qe.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return fn(e.innerType._def,t);const a=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Ft(t)},a]}:Ft(t)})(e,n);case qe.ZodMap:return function(e,t){return"record"===t.mapStrategy?cn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[fn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ft(t),fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ft(t)],minItems:2,maxItems:2}}}(e,n);case qe.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Lt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Lt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case qe.ZodLazy:return()=>e.getter()._def;case qe.ZodPromise:return function(e,t){return fn(e.type._def,t)}(e,n);case qe.ZodNaN:case qe.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Ft({...e,currentPath:[...e.currentPath,"not"]})}}(n);case qe.ZodEffects:return function(e,t){return"input"===t.effectStrategy?fn(e.schema._def,t):Ft(t)}(e,n);case qe.ZodAny:return Ft(n);case qe.ZodUnknown:return function(e){return Ft(e)}(n);case qe.ZodDefault:return function(e,t){return{...fn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case qe.ZodBranded:return zt(e,n);case qe.ZodReadonly:case qe.ZodCatch:return((e,t)=>fn(e.innerType._def,t))(e,n);case qe.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return fn(e.in._def,t);if("output"===t.pipeStrategy)return fn(e.out._def,t);const n=fn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,fn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case qe.ZodFunction:case qe.ZodVoid:case qe.ZodSymbol:default:return}};function fn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Et)return s}if(r&&!n){const e=hn(r,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=mn(e,e.typeName,t),o="function"==typeof i?fn(i(),t):i;if(o&&gn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var hn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Mt(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`),Ft(t)):"seen"===t.$refStrategy?Ft(t):void 0}},gn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),yn=(e,t)=>{var n;const a=It(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=fn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Ft(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=fn(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:Ft(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.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===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};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},vn={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},_n=r.record(r.string(),r.boolean()).describe("Consent requirement mapping"),bn=r.lazy(()=>r.union([r.string(),r.number(),r.boolean(),Zn,r.array(bn)])),kn=r.tuple([bn,bn]).describe("Loop: [source, transform] tuple for array transformations"),xn=r.array(bn).describe("Set: Array of values"),wn=r.record(r.string(),bn).describe("Map: Object mapping keys to values"),Zn=r.object({key:r.string().optional().describe('Property path (e.g., "data.id")'),value:r.union([r.string(),r.number(),r.boolean()]).optional().describe("Static primitive value"),fn:r.string().optional().describe("Function string for custom transformation"),map:wn.optional().describe("Object with key-value mappings"),loop:kn.optional().describe("Tuple [source, transform]"),set:xn.optional().describe("Array of values"),consent:_n.optional().describe("Required consent states"),condition:r.string().optional().describe("Condition function string"),validate:r.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),An=kn,Sn=xn,On=wn,Tn=(yn(Zn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),yn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),yn(Sn,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),yn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Pn(e,t={},n={}){n={...Tn,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function jn(e){return Array.isArray(e)}function Nn(e){return void 0!==e}function Cn(e){return"object"==typeof e&&null!==e&&!jn(e)&&"[object Object]"===Object.prototype.toString.call(e)}function En(e){return"string"==typeof e}function $n(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=$n(e[a],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push($n(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function In(e,t="",n){const a=t.split(".");let r=e;for(let e=0;e<a.length;e++){const t=a[e];if("*"===t&&jn(r)){const t=a.slice(e+1).join("."),s=[];for(const e of r){const a=In(e,t,n);s.push(a)}return s}if(r=r instanceof Object?r[t]:void 0,!r)break}return Nn(r)?r:n}function Rn(e,t,n){if(!Cn(e))return e;const a=$n(e),r=t.split(".");let s=a;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?s[t]=n:(t in s&&"object"==typeof s[t]&&null!==s[t]||(s[t]={}),s=s[t])}return a}function Ln(e,t={},n={}){const a={...t,...n},r={};let s=void 0===e;return Object.keys(a).forEach(t=>{a[t]&&(r[t]=!0,e&&e[t]&&(s=!0))}),!!s&&r}function Mn(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Fn(e){return function(e){return"boolean"==typeof e}(e)||En(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!Nn(e)||jn(e)&&e.every(Fn)||Cn(e)&&Object.values(e).every(Fn)}function zn(e){return Fn(e)?e:void 0}function Dn(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Un(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 Vn(e,t={},n={}){var a;if(!Nn(e))return;const r=Cn(e)&&e.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),s=jn(t)?t:[t];for(const t of s){const a=await Un(qn)(e,t,{...n,consent:r});if(Nn(a))return a}}async function qn(e,t,n={}){const{collector:a,consent:r}=n;return(jn(t)?t:[t]).reduce(async(t,s)=>{const i=await t;if(i)return i;const o=En(s)?{key:s}:s;if(!Object.keys(o).length)return;const{condition:c,consent:u,fn:d,key:l,loop:p,map:m,set:f,validate:h,value:g}=o;if(c&&!await Un(c)(e,s,a))return;if(u&&!Ln(u,r))return g;let y=Nn(g)?g:e;if(d&&(y=await Un(d)(e,s,n)),l&&(y=In(e,l,g)),p){const[t,a]=p,r="this"===t?[e]:await Vn(e,t,n);jn(r)&&(y=(await Promise.all(r.map(e=>Vn(e,a,n)))).filter(Nn))}else m?y=await Object.entries(m).reduce(async(t,[a,r])=>{const s=await t,i=await Vn(e,r,n);return Nn(i)&&(s[a]=i),s},Promise.resolve({})):f&&(y=await Promise.all(f.map(t=>qn(e,t,n))));h&&!await Un(h)(y)&&(y=void 0);const v=zn(y);return Nn(v)?v:zn(g)},Promise.resolve(void 0))}async function Bn(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));const{eventMapping:a,mappingKey:r}=await async function(e,t){var n;const[a,r]=(e.name||"").split(" ");if(!t||!a||!r)return{};let s,i="",o=a,c=r;const u=t=>{if(t)return(t=jn(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[o]||(o="*");const d=t[o];return d&&(d[c]||(c="*"),s=u(d[c])),s||(o="*",c="*",s=u(null==(n=t[o])?void 0:n[c])),s&&(i=`${o} ${c}`),{eventMapping:s,mappingKey:i}}(e,t.mapping);(null==a?void 0:a.policy)&&await Promise.all(Object.entries(a.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));let s=t.data&&await Vn(e,t.data,{collector:n});if(a){if(a.ignore)return{event:e,data:s,mapping:a,mappingKey:r,ignore:!0};if(a.name&&(e.name=a.name),a.data){const t=a.data&&await Vn(e,a.data,{collector:n});s=Cn(s)&&Cn(t)?Pn(s,t):t}}return{event:e,data:s,mapping:a,mappingKey:r,ignore:!1}}function Kn(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Wn(e,t,n){return function(...a){let r;const s="post"+t,i=n["pre"+t],o=n[s];return r=i?i({fn:e},...a):e(...a),o&&(r=o({fn:e,result:r},...a)),r}}function Xn(e,t){return(e.getAttribute(t)||"").trim()}function Jn(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,a]=function(e){const[t,n]=e.split(/:(.+)/,2);return[Kn(t||""),Kn(n||"")]}(e);n&&("true"===a?t[n]=!0:"false"===a?t[n]=!1:a&&/^\d+$/.test(a)?t[n]=parseInt(a,10):a&&/^\d+\.\d+$/.test(a)?t[n]=parseFloat(a):t[n]=a||!0)}),t}var Hn=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function Yn(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const a=window.innerHeight,r=e.getBoundingClientRect(),s=r.height,i=r.y,o=i+s,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(s<=a){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=a/2;if(i<0&&o<e)return!1;if(o>a&&i>e)return!1;n=document.elementFromPoint(c.x,a/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function Gn(e,t,n){return!1===n?e:(n||(n=Qn),n(e,t,Qn))}var Qn=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):Hn("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):Hn({name:"session start",data:e})),e};function ea(e,t=vn.Storage.Session){var n;function a(e){try{return JSON.parse(e||"")}catch(t){let n=1,a="";return e&&(n=0,a=e),{e:n,v:a}}}let r,s;switch(t){case vn.Storage.Cookie:r=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case vn.Storage.Local:s=a(window.localStorage.getItem(e));break;case vn.Storage.Session:s=a(window.sessionStorage.getItem(e))}return s&&(r=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=vn.Storage.Session){switch(t){case vn.Storage.Cookie:ta(e,"",0,t);break;case vn.Storage.Local:window.localStorage.removeItem(e);break;case vn.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),r="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(r||"")}function ta(e,t,n=30,a=vn.Storage.Session,r){const s={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(s);switch(a){case vn.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let a=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;r&&(a+="; domain="+r),document.cookie=a;break}case vn.Storage.Local:window.localStorage.setItem(e,i);break;case vn.Storage.Session:window.sessionStorage.setItem(e,i)}return ea(e,a)}function na(e={}){const t=Date.now(),{length:n=30,deviceKey:a="elbDeviceId",deviceStorage:r="local",deviceAge:s=30,sessionKey:i="elbSessionId",sessionStorage:o="local",pulse:c=!1}=e,u=aa(e);let d=!1;const l=Dn((e,t,n)=>{let a=ea(e,n);return a||(a=Mn(8),ta(e,a,1440*t,n)),String(a)})(a,s,r),p=Dn((e,a)=>{const r=JSON.parse(String(ea(e,a)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),d=!0),d||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,d=!0):r.runs++),r},()=>{d=!0})(i,o)||{},m={id:Mn(12),start:t,isNew:!0,count:1,runs:1},f=Object.assign(m,u,p,{device:l},{isStart:d,storage:!0,updated:t},e.data);return ta(i,JSON.stringify(f),2*n,o),f}function aa(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const a=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,i=function(e,t={}){const n="clickId",a={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(Pn(r,t)).forEach(([t,r])=>{const s=e.searchParams.get(t);s&&(r===n&&(r=t,a[n]=t),a[r]=s)}),a}(a,e.parameters);if(Object.keys(i).length&&(i.marketing||(i.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(a.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:Mn(12),referrer:s},i,e.data):n}var ra,sa,ia,oa={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"};async function ca(e,t,n){const{allowed:a,consent:r,globals:s,user:i}=e;if(!a)return la({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const o=await Promise.all(Object.entries(n||{}).map(async([n,a])=>{let o=(a.queue||[]).map(e=>({...e,consent:r}));if(a.queue=[],t){const e=$n(t);o.push(e)}if(!o.length)return{id:n,destination:a,skipped:!0};const c=[],u=o.filter(e=>{const t=Ln(a.config.consent,r,e.consent);return!t||(e.consent=t,c.push(e),!1)});if(a.queue.concat(u),!c.length)return{id:n,destination:a,queue:o};if(!await Un(ua)(e,a))return{id:n,destination:a,queue:o};let d=!1;return a.dlq||(a.dlq=[]),await Promise.all(c.map(async t=>(t.globals=Pn(s,t.globals),t.user=Pn(i,t.user),await Un(da,n=>(e.config.onError&&e.config.onError(n,e),d=!0,a.dlq.push([t,n]),!1))(e,a,t),t))),{id:n,destination:a,error:d}})),c=[],u=[],d=[];for(const e of o){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?d.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),u.push(n)):c.push(n)}return la({ok:!d.length,event:t,successful:c,queued:u,failed:d})}async function ua(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:pa(t.env,t.config.env)},a=await Wn(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function da(e,t,n){var a;const{config:r}=t,s=await Bn(n,r,e);if(s.ignore)return!1;const i={collector:e,config:r,data:s.data,mapping:s.mapping,env:pa(t.env,r.env)},o=s.mapping;if((null==o?void 0:o.batch)&&t.pushBatch){const n=o.batched||{key:s.mappingKey||"",events:[],data:[]};n.events.push(s.event),Nn(s.data)&&n.data.push(s.data),o.batchFn=o.batchFn||function(e,t=1e3,n=!1){let a,r=null,s=!1;return(...i)=>new Promise(o=>{const c=n&&!s;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!s||(a=e(...i),o(a))},t),c&&(s=!0,a=e(...i),o(a))})}((e,t)=>{const a={collector:t,config:r,data:s.data,mapping:o,env:pa(e.env,r.env)};Wn(e.pushBatch,"DestinationPushBatch",t.hooks)(n,a),n.events=[],n.data=[]},o.batch),o.batched=n,null==(a=o.batchFn)||a.call(o,t,e)}else await Wn(t.push,"DestinationPush",e.hooks)(s.event,i);return!0}function la(e){var t;return Pn({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function pa(e,t){return e||t?t?e&&Cn(e)&&Cn(t)?{...e,...t}:t:e:{}}function ma(e,t,n,a){let r,s=n||[];switch(n||(s=e.on[t]||[]),t){case oa.Consent:r=a||e.consent;break;case oa.Session:r=e.session;break;case oa.Ready:case oa.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&Dn(e.on)(t,r)}),Object.values(e.destinations).forEach(e=>{if(e.on){Dn(e.on)(t,r)}}),s.length)switch(t){case oa.Consent:!function(e,t,n){const a=n||e.consent;t.forEach(t=>{Object.keys(a).filter(e=>e in t).forEach(n=>{Dn(t[n])(e,a)})})}(e,s,a);break;case oa.Ready:case oa.Run:o=s,(i=e).allowed&&o.forEach(e=>{Dn(e)(i)});break;case oa.Session:!function(e,t){e.session&&t.forEach(t=>{Dn(t)(e,e.session)})}(e,s)}var i,o}async function fa(e,t,n,a){let r;switch(t){case oa.Config:Cn(n)&&Pn(e.config,n,{shallow:!1});break;case oa.Consent:Cn(n)&&(r=await async function(e,t){const{consent:n}=e;let a=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,a=a||n}),e.consent=Pn(n,r),ma(e,"consent",void 0,r),a?ca(e):la({ok:!0})}(e,n));break;case oa.Custom:Cn(n)&&(e.custom=Pn(e.custom,n));break;case oa.Destination:Cn(n)&&"function"==typeof n.push&&(r=await async function(e,t,n){const{code:a,config:r={},env:s={}}=t,i=n||r||{init:!1},o={...a,config:i,env:pa(a.env,s)};let c=o.config.id;if(!c)do{c=Mn(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),ca(e,void 0,{[c]:o})}(e,{code:n},a));break;case oa.Globals:Cn(n)&&(e.globals=Pn(e.globals,n));break;case oa.On:En(n)&&function(e,t,n){const a=e.on,r=a[t]||[],s=jn(n)?n:[n];s.forEach(e=>{r.push(e)}),a[t]=r,ma(e,t,s)}(e,n,a);break;case oa.Ready:ma(e,"ready");break;case oa.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Mn(),e.timing=Date.now(),t&&(t.consent&&(e.consent=Pn(e.consent,t.consent)),t.user&&(e.user=Pn(e.user,t.user)),t.globals&&(e.globals=Pn(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=Pn(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await ca(e);return ma(e,"run"),n}(e,n);break;case oa.Session:ma(e,"session");break;case oa.User:Cn(n)&&Pn(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ha(e,t){return Wn(async(n,a={})=>await Un(async()=>{let r=n;if(a.mapping){const t=await Bn(r,a.mapping,e);if(t.ignore)return la({ok:!0});if(a.mapping.consent&&!Ln(a.mapping.consent,e.consent,t.event.consent))return la({ok:!0});r=t.event}const s=t(r),i=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,a]=t.name.split(" ");if(!n||!a)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:s=e.group,count:i=e.count}=t,{name:o=`${n} ${a}`,data:c={},context:u={},globals:d=e.globals,custom:l={},user:p=e.user,nested:m=[],consent:f=e.consent,id:h=`${r}-${s}-${i}`,trigger:g="",entity:y=n,action:v=a,timing:_=0,version:b={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:o,data:c,context:u,globals:d,custom:l,user:p,nested:m,consent:f,id:h,trigger:g,entity:y,action:v,timestamp:r,timing:_,group:s,count:i,version:b,source:k}}(e,s);return await ca(e,i)},()=>la({ok:!1}))(),"Push",e.hooks)}async function ga(e){const t=Pn({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:n,run:!0},e,{merge:!1,extend:!1});function n(e,n){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},n||t.verbose)}t.onLog=n;const a={...t.globalsStatic,...e.globals},r={allowed:!1,config:t,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:a,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.2.1",sources:{},push:void 0,command:void 0};return r.push=ha(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(i=fa,Wn(async(e,t,n)=>await Un(async()=>await i(s,e,t,n),()=>la({ok:!1}))(),"Command",(s=r).hooks)),r.destinations=await async function(e,t={}){const n={};for(const[e,a]of Object.entries(t)){const{code:t,config:r={},env:s={}}=a,i={...t.config,...r},o=pa(t.env,s);n[e]={...t,config:i,env:o}}return n}(0,e.destinations||{}),r;var s,i}async function ya(e){e=e||{};const t=await ga(e),n=(a=t,{type:"elb",config:{},push:async(e,t,n,r,s,i)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return a.command(r,t,n)}let o;if("string"==typeof e)o={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(o.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};o=e,t&&"object"==typeof t&&!Array.isArray(t)&&(o.data={...o.data||{},...t})}return r&&"object"==typeof r&&(o.context=r),s&&Array.isArray(s)&&(o.nested=s),i&&"object"==typeof i&&(o.custom=i),a.push(o)}});var a;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[a,r]of Object.entries(t)){const{code:t,config:s={},env:i={},primary:o}=r,c={push:(t,n={})=>e.push(t,{...n,mapping:s}),command:e.command,sources:e.sources,elb:e.sources.elb.push,...i},u=await Un(t)(s,c);u&&(o&&(u.config={...u.config,primary:o}),n[a]=u)}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:s,user:i,globals:o,custom:c}=e;s&&await t.command("consent",s),i&&await t.command("user",i),o&&Object.assign(t.globals,o),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const d=Object.values(t.sources).filter(e=>"elb"!==e.type),l=d.find(e=>e.config.primary);return l?u=l.push:d.length>0&&(u=d[0].push),{collector:t,elb:u}}var va=Object.defineProperty,_a=(e,t)=>{for(var n in t)va(e,n,{get:t[n],enumerable:!0})},ba={};_a(ba,{BRAND:()=>ns,DIRTY:()=>La,EMPTY_PATH:()=>Ea,INVALID:()=>Ra,NEVER:()=>Xs,OK:()=>Ma,ParseStatus:()=>Ia,Schema:()=>Wa,ZodAny:()=>Ar,ZodArray:()=>Pr,ZodBigInt:()=>_r,ZodBoolean:()=>br,ZodBranded:()=>as,ZodCatch:()=>Gr,ZodDate:()=>kr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>$r,ZodEffects:()=>Xr,ZodEnum:()=>Br,ZodError:()=>Aa,ZodFirstPartyTypeKind:()=>es,ZodFunction:()=>Dr,ZodIntersection:()=>Rr,ZodIssueCode:()=>wa,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>Fr,ZodNaN:()=>Qr,ZodNativeEnum:()=>Kr,ZodNever:()=>Or,ZodNull:()=>Zr,ZodNullable:()=>Hr,ZodNumber:()=>vr,ZodObject:()=>Nr,ZodOptional:()=>Jr,ZodParsedType:()=>ka,ZodPipeline:()=>rs,ZodPromise:()=>Wr,ZodReadonly:()=>ss,ZodRecord:()=>Mr,ZodSchema:()=>Wa,ZodSet:()=>zr,ZodString:()=>gr,ZodSymbol:()=>xr,ZodTransformer:()=>Xr,ZodTuple:()=>Lr,ZodType:()=>Wa,ZodUndefined:()=>wr,ZodUnion:()=>Cr,ZodUnknown:()=>Sr,ZodVoid:()=>Tr,addIssueToContext:()=>$a,any:()=>_s,array:()=>ws,bigint:()=>ms,boolean:()=>fs,coerce:()=>Ws,custom:()=>os,date:()=>hs,datetimeRegex:()=>pr,defaultErrorMap:()=>Sa,discriminatedUnion:()=>Os,effect:()=>Fs,enum:()=>Rs,function:()=>Es,getErrorMap:()=>Pa,getParsedType:()=>xa,instanceof:()=>us,intersection:()=>Ts,isAborted:()=>Fa,isAsync:()=>Ua,isDirty:()=>za,isValid:()=>Da,late:()=>cs,lazy:()=>$s,literal:()=>Is,makeIssue:()=>Ca,map:()=>Ns,nan:()=>ps,nativeEnum:()=>Ls,never:()=>ks,null:()=>vs,nullable:()=>Ds,number:()=>ls,object:()=>Zs,objectUtil:()=>ia,oboolean:()=>Ks,onumber:()=>Bs,optional:()=>zs,ostring:()=>qs,pipeline:()=>Vs,preprocess:()=>Us,promise:()=>Ms,quotelessJson:()=>Za,record:()=>js,set:()=>Cs,setErrorMap:()=>Ta,strictObject:()=>As,string:()=>ds,symbol:()=>gs,transformer:()=>Fs,tuple:()=>Ps,undefined:()=>ys,union:()=>Ss,unknown:()=>bs,util:()=>ra,void:()=>xs}),(sa=ra||(ra={})).assertEqual=e=>{},sa.assertIs=function(e){},sa.assertNever=function(e){throw new Error},sa.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},sa.getValidEnumValues=e=>{const t=sa.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return sa.objectValues(n)},sa.objectValues=e=>sa.objectKeys(e).map(function(t){return e[t]}),sa.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},sa.find=(e,t)=>{for(const n of e)if(t(n))return n},sa.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,sa.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},sa.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ia||(ia={})).mergeShapes=(e,t)=>({...e,...t});var ka=ra.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xa=e=>{switch(typeof e){case"undefined":return ka.undefined;case"string":return ka.string;case"number":return Number.isNaN(e)?ka.nan:ka.number;case"boolean":return ka.boolean;case"function":return ka.function;case"bigint":return ka.bigint;case"symbol":return ka.symbol;case"object":return Array.isArray(e)?ka.array:null===e?ka.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ka.promise:"undefined"!=typeof Map&&e instanceof Map?ka.map:"undefined"!=typeof Set&&e instanceof Set?ka.set:"undefined"!=typeof Date&&e instanceof Date?ka.date:ka.object;default:return ka.unknown}},wa=ra.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"]),Za=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Aa=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,ra.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()}};Aa.create=e=>new Aa(e);var Sa=(e,t)=>{let n;switch(e.code){case wa.invalid_type:n=e.received===ka.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case wa.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ra.jsonStringifyReplacer)}`;break;case wa.unrecognized_keys:n=`Unrecognized key(s) in object: ${ra.joinValues(e.keys,", ")}`;break;case wa.invalid_union:n="Invalid input";break;case wa.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ra.joinValues(e.options)}`;break;case wa.invalid_enum_value:n=`Invalid enum value. Expected ${ra.joinValues(e.options)}, received '${e.received}'`;break;case wa.invalid_arguments:n="Invalid function arguments";break;case wa.invalid_return_type:n="Invalid function return type";break;case wa.invalid_date:n="Invalid date";break;case wa.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}"`:ra.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case wa.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 wa.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 wa.custom:n="Invalid input";break;case wa.invalid_intersection_types:n="Intersection results could not be merged";break;case wa.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case wa.not_finite:n="Number must be finite";break;default:n=t.defaultError,ra.assertNever(e)}return{message:n}},Oa=Sa;function Ta(e){Oa=e}function Pa(){return Oa}var ja,Na,Ca=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},Ea=[];function $a(e,t){const n=Pa(),a=Ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Sa?void 0:Sa].filter(e=>!!e)});e.common.issues.push(a)}var Ia=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 Ra;"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 Ra;if("aborted"===r.status)return Ra;"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}}},Ra=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),Ma=e=>({status:"valid",value:e}),Fa=e=>"aborted"===e.status,za=e=>"dirty"===e.status,Da=e=>"valid"===e.status,Ua=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Na=ja||(ja={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Na.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Va,qa=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}},Ba=(e,t)=>{if(Da(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 Aa(e.common.issues);return this._error=t,this._error}}};function Ka(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.');return t?{errorMap:t,description:r}:{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(s=null!=o?o:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var Wa=class{get description(){return this._def.description}_getType(e){return xa(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ua(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:xa(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ba(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:xa(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Da(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=>Da(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:xa(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Ua(a)?a:Promise.resolve(a));return Ba(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),s=()=>{return a.addIssue({code:wa.custom,...(e=n,"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t)});var e};return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!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 Xr({schema:this,typeName:es.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 Jr.create(this,this._def)}nullable(){return Hr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return Wr.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Rr.create(this,e,this._def)}transform(e){return new Xr({...Ka(this._def),schema:this,typeName:es.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Yr({...Ka(this._def),innerType:this,defaultValue:t,typeName:es.ZodDefault})}brand(){return new as({typeName:es.ZodBranded,type:this,...Ka(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Gr({...Ka(this._def),innerType:this,catchValue:t,typeName:es.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return rs.create(this,e)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xa=/^c[^\s-]{8,}$/i,Ja=/^[0-9a-z]+$/,Ha=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ya=/^[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,Ga=/^[a-z0-9_-]{21}$/i,Qa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,er=/^[-+]?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)?)??$/,tr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nr=/^(?:(?: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])$/,ar=/^(?:(?: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])$/,rr=/^(([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]))$/,sr=/^(([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])$/,ir=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,or=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cr="((\\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])))",ur=new RegExp(`^${cr}$`);function dr(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function lr(e){return new RegExp(`^${dr(e)}$`)}function pr(e){let t=`${cr}T${dr(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 mr(e,t){return!("v4"!==t&&t||!nr.test(e))||!("v6"!==t&&t||!rr.test(e))}function fr(e,t){if(!Qa.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 hr(e,t){return!("v4"!==t&&t||!ar.test(e))||!("v6"!==t&&t||!sr.test(e))}var gr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ka.string){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.string,received:t.parsedType}),Ra}const t=new Ia;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.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,s=e.data.length<a.value;(r||s)&&(n=this._getOrReturnCtx(e,n),r?$a(n,{code:wa.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&$a(n,{code:wa.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)tr.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"email",code:wa.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Va||(Va=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Va.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"emoji",code:wa.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ya.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"uuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"nanoid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Xa.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid2",code:wa.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ulid",code:wa.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),$a(n,{validation:"url",code:wa.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"regex",code:wa.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?pr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?ur.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?lr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?er.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"duration",code:wa.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?mr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ip",code:wa.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?fr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"jwt",code:wa.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?hr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cidr",code:wa.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?ir.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64",code:wa.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?or.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64url",code:wa.invalid_string,message:a.message}),t.dirty()):ra.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:wa.invalid_string,...ja.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...ja.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ja.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ja.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ja.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ja.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ja.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ja.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ja.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ja.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ja.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ja.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ja.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ja.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,...ja.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,...ja.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ja.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ja.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ja.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ja.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ja.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ja.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ja.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ja.errToObj(t)})}nonempty(e){return this.min(1,ja.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 yr(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}gr.create=e=>{var t;return new gr({checks:[],typeName:es.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var vr=class e extends Wa{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ka.number){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.number,received:t.parsedType}),Ra}let t;const n=new Ia;for(const a of this._def.checks)"int"===a.kind?ra.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==yr(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_finite,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:ja.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ja.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ja.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ja.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&&ra.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)}};vr.create=e=>new vr({checks:[],typeName:es.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var _r=class e extends Wa{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)!==ka.bigint)return this._getInvalidInput(e);let t;const n=new Ia;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.bigint,received:t.parsedType}),Ra}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.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:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.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}};_r.create=e=>{var t;return new _r({checks:[],typeName:es.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var br=class extends Wa{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ka.boolean){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.boolean,received:t.parsedType}),Ra}return Ma(e.data)}};br.create=e=>new br({typeName:es.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var kr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ka.date){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.date,received:t.parsedType}),Ra}if(Number.isNaN(e.data.getTime()))return $a(this._getOrReturnCtx(e),{code:wa.invalid_date}),Ra;const t=new Ia;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ra.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:ja.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ja.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}};kr.create=e=>new kr({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:es.ZodDate,...Ka(e)});var xr=class extends Wa{_parse(e){if(this._getType(e)!==ka.symbol){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.symbol,received:t.parsedType}),Ra}return Ma(e.data)}};xr.create=e=>new xr({typeName:es.ZodSymbol,...Ka(e)});var wr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.undefined,received:t.parsedType}),Ra}return Ma(e.data)}};wr.create=e=>new wr({typeName:es.ZodUndefined,...Ka(e)});var Zr=class extends Wa{_parse(e){if(this._getType(e)!==ka.null){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.null,received:t.parsedType}),Ra}return Ma(e.data)}};Zr.create=e=>new Zr({typeName:es.ZodNull,...Ka(e)});var Ar=class extends Wa{constructor(){super(...arguments),this._any=!0}_parse(e){return Ma(e.data)}};Ar.create=e=>new Ar({typeName:es.ZodAny,...Ka(e)});var Sr=class extends Wa{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ma(e.data)}};Sr.create=e=>new Sr({typeName:es.ZodUnknown,...Ka(e)});var Or=class extends Wa{_parse(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.never,received:t.parsedType}),Ra}};Or.create=e=>new Or({typeName:es.ZodNever,...Ka(e)});var Tr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.void,received:t.parsedType}),Ra}return Ma(e.data)}};Tr.create=e=>new Tr({typeName:es.ZodVoid,...Ka(e)});var Pr=class e extends Wa{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==ka.array)return $a(t,{code:wa.invalid_type,expected:ka.array,received:t.parsedType}),Ra;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&($a(t,{code:e?wa.too_big:wa.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&&($a(t,{code:wa.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&&($a(t,{code:wa.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 qa(t,e,t.path,n)))).then(e=>Ia.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new qa(t,e,t.path,n)));return Ia.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ja.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ja.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:ja.toString(n)}})}nonempty(e){return this.min(1,e)}};function jr(e){if(e instanceof Nr){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Jr.create(jr(a))}return new Nr({...e._def,shape:()=>t})}return e instanceof Pr?new Pr({...e._def,type:jr(e.element)}):e instanceof Jr?Jr.create(jr(e.unwrap())):e instanceof Hr?Hr.create(jr(e.unwrap())):e instanceof Lr?Lr.create(e.items.map(e=>jr(e))):e}Pr.create=(e,t)=>new Pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:es.ZodArray,...Ka(t)});var Nr=class e extends Wa{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=ra.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ka.object){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Or&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=a[e],r=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new qa(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Or){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&($a(n,{code:wa.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const a=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new qa(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>Ia.mergeObjectSync(t,e)):Ia.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return ja.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?s:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=ja.errToObj(t).message)?i: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:es.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 ra.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 ra.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return jr(this)}partial(t){const n={};for(const e of ra.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 ra.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Jr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qr(ra.objectKeys(this.shape))}};Nr.create=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.strictCreate=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.lazycreate=(e,t)=>new Nr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)});var Cr=class extends Wa{_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 Aa(e.ctx.common.issues));return $a(t,{code:wa.invalid_union,unionErrors:n}),Ra});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new Aa(e));return $a(t,{code:wa.invalid_union,unionErrors:r}),Ra}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:es.ZodUnion,...Ka(t)});var Er=e=>e instanceof Ur?Er(e.schema):e instanceof Xr?Er(e.innerType()):e instanceof Vr?[e.value]:e instanceof Br?e.options:e instanceof Kr?ra.objectValues(e.enum):e instanceof Yr?Er(e._def.innerType):e instanceof wr?[void 0]:e instanceof Zr?[null]:e instanceof Jr?[void 0,...Er(e.unwrap())]:e instanceof Hr?[null,...Er(e.unwrap())]:e instanceof as||e instanceof ss?Er(e.unwrap()):e instanceof Gr?Er(e._def.innerType):[],$r=class e extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.object)return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra;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}):($a(t,{code:wa.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ra)}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=Er(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:es.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ka(a)})}};function Ir(e,t){const n=xa(e),a=xa(t);if(e===t)return{valid:!0,data:e};if(n===ka.object&&a===ka.object){const n=ra.objectKeys(t),a=ra.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Ir(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===ka.array&&a===ka.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Ir(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===ka.date&&a===ka.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Rr=class extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Fa(e)||Fa(a))return Ra;const r=Ir(e.value,a.value);return r.valid?((za(e)||za(a))&&t.dirty(),{status:t.value,value:r.data}):($a(n,{code:wa.invalid_intersection_types}),Ra)};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}))}};Rr.create=(e,t,n)=>new Rr({left:e,right:t,typeName:es.ZodIntersection,...Ka(n)});var Lr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.array)return $a(n,{code:wa.invalid_type,expected:ka.array,received:n.parsedType}),Ra;if(n.data.length<this._def.items.length)return $a(n,{code:wa.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ra;!this._def.rest&&n.data.length>this._def.items.length&&($a(n,{code:wa.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 qa(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ia.mergeArray(t,e)):Ia.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Lr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lr({items:e,typeName:es.ZodTuple,rest:null,...Ka(t)})};var Mr=class e extends Wa{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!==ka.object)return $a(n,{code:wa.invalid_type,expected:ka.object,received:n.parsedType}),Ra;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new qa(n,e,n.path,e)),value:s._parse(new qa(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ia.mergeObjectAsync(t,a):Ia.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Wa?{keyType:t,valueType:n,typeName:es.ZodRecord,...Ka(a)}:{keyType:gr.create(),valueType:t,typeName:es.ZodRecord,...Ka(n)})}},Fr=class extends Wa{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!==ka.map)return $a(n,{code:wa.invalid_type,expected:ka.map,received:n.parsedType}),Ra;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new qa(n,e,n.path,[s,"key"])),value:r._parse(new qa(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of s){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return Ra;"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 s){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return Ra;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Fr.create=(e,t,n)=>new Fr({valueType:t,keyType:e,typeName:es.ZodMap,...Ka(n)});var zr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.set)return $a(n,{code:wa.invalid_type,expected:ka.set,received:n.parsedType}),Ra;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&($a(n,{code:wa.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&&($a(n,{code:wa.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const n=new Set;for(const a of e){if("aborted"===a.status)return Ra;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>r._parse(new qa(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,n){return new e({...this._def,minSize:{value:t,message:ja.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ja.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zr.create=(e,t)=>new zr({valueType:e,minSize:null,maxSize:null,typeName:es.ZodSet,...Ka(t)});var Dr=class e extends Wa{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.function)return $a(t,{code:wa.invalid_type,expected:ka.function,received:t.parsedType}),Ra;function n(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_arguments,argumentsError:n}})}function a(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Wr){const e=this;return Ma(async function(...t){const i=new Aa([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw i.addIssue(n(t,e)),i}),c=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw i.addIssue(a(c,e)),i})})}{const e=this;return Ma(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new Aa([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new Aa([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:Lr.create(t).rest(Sr.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||Lr.create([]).rest(Sr.create()),returns:n||Sr.create(),typeName:es.ZodFunction,...Ka(a)})}},Ur=class extends Wa{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})}};Ur.create=(e,t)=>new Ur({getter:e,typeName:es.ZodLazy,...Ka(t)});var Vr=class extends Wa{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return $a(t,{received:t.data,code:wa.invalid_literal,expected:this._def.value}),Ra}return{status:"valid",value:e.data}}get value(){return this._def.value}};function qr(e,t){return new Br({values:e,typeName:es.ZodEnum,...Ka(t)})}Vr.create=(e,t)=>new Vr({value:e,typeName:es.ZodLiteral,...Ka(t)});var Br=class e extends Wa{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return $a(t,{expected:ra.joinValues(n),received:t.parsedType,code:wa.invalid_type}),Ra}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 $a(t,{received:t.data,code:wa.invalid_enum_value,options:n}),Ra}return Ma(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})}};Br.create=qr;var Kr=class extends Wa{_parse(e){const t=ra.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ka.string&&n.parsedType!==ka.number){const e=ra.objectValues(t);return $a(n,{expected:ra.joinValues(e),received:n.parsedType,code:wa.invalid_type}),Ra}if(this._cache||(this._cache=new Set(ra.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ra.objectValues(t);return $a(n,{received:n.data,code:wa.invalid_enum_value,options:e}),Ra}return Ma(e.data)}get enum(){return this._def.values}};Kr.create=(e,t)=>new Kr({values:e,typeName:es.ZodNativeEnum,...Ka(t)});var Wr=class extends Wa{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.promise&&!1===t.common.async)return $a(t,{code:wa.invalid_type,expected:ka.promise,received:t.parsedType}),Ra;const n=t.parsedType===ka.promise?t.data:Promise.resolve(t.data);return Ma(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Wr.create=(e,t)=>new Wr({type:e,typeName:es.ZodPromise,...Ka(t)});var Xr=class extends Wa{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===es.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=>{$a(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 Ra;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(a.value):a});{if("aborted"===t.value)return Ra;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(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?Ra:("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?Ra:("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(!Da(e))return Ra;const s=a.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Da(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):Ra)}ra.assertNever(a)}};Xr.create=(e,t,n)=>new Xr({schema:e,typeName:es.ZodEffects,effect:t,...Ka(n)}),Xr.createWithPreprocess=(e,t,n)=>new Xr({schema:t,effect:{type:"preprocess",transform:e},typeName:es.ZodEffects,...Ka(n)});var Jr=class extends Wa{_parse(e){return this._getType(e)===ka.undefined?Ma(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:es.ZodOptional,...Ka(t)});var Hr=class extends Wa{_parse(e){return this._getType(e)===ka.null?Ma(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:es.ZodNullable,...Ka(t)});var Yr=class extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ka.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:es.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Ka(t)});var Gr=class extends Wa{_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 Ua(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:es.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Ka(t)});var Qr=class extends Wa{_parse(e){if(this._getType(e)!==ka.nan){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.nan,received:t.parsedType}),Ra}return{status:"valid",value:e.data}}};Qr.create=e=>new Qr({typeName:es.ZodNaN,...Ka(e)});var es,ts,ns=Symbol("zod_brand"),as=class extends Wa{_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}},rs=class e extends Wa{_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?Ra:"dirty"===e.status?(t.dirty(),La(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?Ra:"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:es.ZodPipeline})}},ss=class extends Wa{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Da(e)&&(e.value=Object.freeze(e.value)),e);return Ua(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function is(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function os(e,t={},n){return e?Ar.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):Ar.create()}ss.create=(e,t)=>new ss({innerType:e,typeName:es.ZodReadonly,...Ka(t)});var cs={object:Nr.lazycreate};(ts=es||(es={})).ZodString="ZodString",ts.ZodNumber="ZodNumber",ts.ZodNaN="ZodNaN",ts.ZodBigInt="ZodBigInt",ts.ZodBoolean="ZodBoolean",ts.ZodDate="ZodDate",ts.ZodSymbol="ZodSymbol",ts.ZodUndefined="ZodUndefined",ts.ZodNull="ZodNull",ts.ZodAny="ZodAny",ts.ZodUnknown="ZodUnknown",ts.ZodNever="ZodNever",ts.ZodVoid="ZodVoid",ts.ZodArray="ZodArray",ts.ZodObject="ZodObject",ts.ZodUnion="ZodUnion",ts.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ts.ZodIntersection="ZodIntersection",ts.ZodTuple="ZodTuple",ts.ZodRecord="ZodRecord",ts.ZodMap="ZodMap",ts.ZodSet="ZodSet",ts.ZodFunction="ZodFunction",ts.ZodLazy="ZodLazy",ts.ZodLiteral="ZodLiteral",ts.ZodEnum="ZodEnum",ts.ZodEffects="ZodEffects",ts.ZodNativeEnum="ZodNativeEnum",ts.ZodOptional="ZodOptional",ts.ZodNullable="ZodNullable",ts.ZodDefault="ZodDefault",ts.ZodCatch="ZodCatch",ts.ZodPromise="ZodPromise",ts.ZodBranded="ZodBranded",ts.ZodPipeline="ZodPipeline",ts.ZodReadonly="ZodReadonly";var us=(e,t={message:`Input not instance of ${e.name}`})=>os(t=>t instanceof e,t),ds=gr.create,ls=vr.create,ps=Qr.create,ms=_r.create,fs=br.create,hs=kr.create,gs=xr.create,ys=wr.create,vs=Zr.create,_s=Ar.create,bs=Sr.create,ks=Or.create,xs=Tr.create,ws=Pr.create,Zs=Nr.create,As=Nr.strictCreate,Ss=Cr.create,Os=$r.create,Ts=Rr.create,Ps=Lr.create,js=Mr.create,Ns=Fr.create,Cs=zr.create,Es=Dr.create,$s=Ur.create,Is=Vr.create,Rs=Br.create,Ls=Kr.create,Ms=Wr.create,Fs=Xr.create,zs=Jr.create,Ds=Hr.create,Us=Xr.createWithPreprocess,Vs=rs.create,qs=()=>ds().optional(),Bs=()=>ls().optional(),Ks=()=>fs().optional(),Ws={string:e=>gr.create({...e,coerce:!0}),number:e=>vr.create({...e,coerce:!0}),boolean:e=>br.create({...e,coerce:!0}),bigint:e=>_r.create({...e,coerce:!0}),date:e=>kr.create({...e,coerce:!0})},Xs=Ra,Js=Symbol("Let zodToJsonSchema decide on which parser to use"),Hs={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"};function Ys(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Gs(e,t,n,a,r){e[t]=n,Ys(e,t,a,r)}var Qs=(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 ei(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Qs(t,e.currentPath):t.join("/")}}function ti(e,t){return Oi(e.type._def,t)}function ni(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ni(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 ai(e,t)}}var ai=(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":Gs(n,"minimum",a.value,a.message,t);break;case"max":Gs(n,"maximum",a.value,a.message,t)}return n},ri=void 0,si=/^[cC][^\s-]{8,}$/,ii=/^[0-9a-z]+$/,oi=/^[0-9A-HJKMNP-TV-Z]{26}$/,ci=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ui=()=>(void 0===ri&&(ri=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ri),di=/^(?:(?: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])$/,li=/^(([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])$/,pi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fi=/^[a-zA-Z0-9_-]{21}$/,hi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function gi(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Gs(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":_i(n,"email",a.message,t);break;case"format:idn-email":_i(n,"idn-email",a.message,t);break;case"pattern:zod":bi(n,ci,a.message,t)}break;case"url":_i(n,"uri",a.message,t);break;case"uuid":_i(n,"uuid",a.message,t);break;case"regex":bi(n,a.regex,a.message,t);break;case"cuid":bi(n,si,a.message,t);break;case"cuid2":bi(n,ii,a.message,t);break;case"startsWith":bi(n,RegExp(`^${yi(a.value,t)}`),a.message,t);break;case"endsWith":bi(n,RegExp(`${yi(a.value,t)}$`),a.message,t);break;case"datetime":_i(n,"date-time",a.message,t);break;case"date":_i(n,"date",a.message,t);break;case"time":_i(n,"time",a.message,t);break;case"duration":_i(n,"duration",a.message,t);break;case"length":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Gs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":bi(n,RegExp(yi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&_i(n,"ipv4",a.message,t),"v4"!==a.version&&_i(n,"ipv6",a.message,t);break;case"base64url":bi(n,mi,a.message,t);break;case"jwt":bi(n,hi,a.message,t);break;case"cidr":"v6"!==a.version&&bi(n,di,a.message,t),"v4"!==a.version&&bi(n,li,a.message,t);break;case"emoji":bi(n,ui(),a.message,t);break;case"ulid":bi(n,oi,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":_i(n,"binary",a.message,t);break;case"contentEncoding:base64":Gs(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":bi(n,pi,a.message,t)}break;case"nanoid":bi(n,fi,a.message,t)}return n}function yi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)vi.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var vi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _i(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}}})):Gs(e,"format",t,n,a)}function bi(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:ki(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Gs(e,"pattern",ki(t,a),n,a)}function ki(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(r){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function xi(e,t){var n,a,r,s,i,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===es.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:ei(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===es.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=gi(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===es.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===es.ZodBranded&&e.keyType._def.type._def.typeName===es.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=ti(e.keyType._def,t);return{...u,propertyNames:a}}return u}var wi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},Zi=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Oi(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 Ai(e){try{return e.isOptional()}catch(e){return!0}}var Si=(e,t,n)=>{switch(t){case es.ZodString:return gi(e,n);case es.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",Ys(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.ZodObject:return function(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=Ai(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=Oi(i._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 i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Oi(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(a.additionalProperties=i),a}(e,n);case es.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?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.ZodBoolean:return{type:"boolean"};case es.ZodDate:return ni(e,n);case es.ZodUndefined:return{not:ei(n)};case es.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case es.ZodArray:return function(e,t){var n,a,r;const s={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)!==es.ZodAny&&(s.items=Oi(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Gs(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Gs(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Gs(s,"minItems",e.exactLength.value,e.exactLength.message,t),Gs(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case es.ZodUnion:case es.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return Zi(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in wi&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=wi[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 Zi(e,t)}(e,n);case es.ZodIntersection:return function(e,t){const n=[Oi(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Oi(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 es.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Oi(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case es.ZodRecord:return xi(e,n);case es.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 es.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case es.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 es.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:wi[e.innerType._def.typeName],nullable:!0}:{type:[wi[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case es.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Oi(e.innerType._def,t);const a=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ei(t)},a]}:ei(t)})(e,n);case es.ZodMap:return function(e,t){return"record"===t.mapStrategy?xi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Oi(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ei(t),Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ei(t)],minItems:2,maxItems:2}}}(e,n);case es.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Gs(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Gs(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case es.ZodLazy:return()=>e.getter()._def;case es.ZodPromise:return function(e,t){return Oi(e.type._def,t)}(e,n);case es.ZodNaN:case es.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:ei({...e,currentPath:[...e.currentPath,"not"]})}}(n);case es.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Oi(e.schema._def,t):ei(t)}(e,n);case es.ZodAny:return ei(n);case es.ZodUnknown:return function(e){return ei(e)}(n);case es.ZodDefault:return function(e,t){return{...Oi(e.innerType._def,t),default:e.defaultValue()}}(e,n);case es.ZodBranded:return ti(e,n);case es.ZodReadonly:case es.ZodCatch:return((e,t)=>Oi(e.innerType._def,t))(e,n);case es.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Oi(e.in._def,t);if("output"===t.pipeStrategy)return Oi(e.out._def,t);const n=Oi(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Oi(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case es.ZodFunction:case es.ZodVoid:case es.ZodSymbol:default:return}};function Oi(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Js)return s}if(r&&!n){const e=Ti(r,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=Si(e,e.typeName,t),o="function"==typeof i?Oi(i(),t):i;if(o&&Pi(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Ti=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Qs(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`),ei(t)):"seen"===t.$refStrategy?ei(t):void 0}},Pi=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),ji=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Hs,name:a}:{...Hs,...a},n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;var a;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}]))}})(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=Oi(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:ei(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=Oi(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:ei(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.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===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};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},Ni=ba.record(ba.string(),ba.boolean()).describe("Consent requirement mapping"),Ci=ba.lazy(()=>ba.union([ba.string(),ba.number(),ba.boolean(),Ri,ba.array(Ci)])),Ei=ba.tuple([Ci,Ci]).describe("Loop: [source, transform] tuple for array transformations"),$i=ba.array(Ci).describe("Set: Array of values"),Ii=ba.record(ba.string(),Ci).describe("Map: Object mapping keys to values"),Ri=ba.object({key:ba.string().optional().describe('Property path (e.g., "data.id")'),value:ba.union([ba.string(),ba.number(),ba.boolean()]).optional().describe("Static primitive value"),fn:ba.string().optional().describe("Function string for custom transformation"),map:Ii.optional().describe("Object with key-value mappings"),loop:Ei.optional().describe("Tuple [source, transform]"),set:$i.optional().describe("Array of values"),consent:Ni.optional().describe("Required consent states"),condition:ba.string().optional().describe("Condition function string"),validate:ba.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),Li=Ei,Mi=$i,Fi=Ii,zi=(ji(Ri,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ji(Li,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),ji(Mi,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ji(Fi,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Di(e,t={},n={}){n={...zi,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function Ui(e){return Array.isArray(e)}function Vi(e){return e===document||e instanceof Element}function qi(e){return"object"==typeof e&&null!==e&&!Ui(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Bi(e){return"string"==typeof e}function Ki(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Wi(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Xi(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Ji(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Hi(e,t,n,a=!0){return so(Xn(t,Ji(e,n,a))||"").reduce((e,n)=>{let[a,r]=io(n);if(!a)return e;if(r||(a.endsWith(":")&&(a=a.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return a.endsWith("[]")?(a=a.slice(0,-2),Ui(e[a])||(e[a]=[]),e[a].push(Ki(r))):e[a]=Ki(r),e},{})}function Yi(e=oa.Prefix,t=document){const n=Ji(e,oa.Globals,!1);let a={};return ro(t,`[${n}]`,t=>{a=Di(a,Hi(e,t,oa.Globals,!1))}),a}function Gi(e,t){const n=window.location,a="page",r=t===document?document.body:t,[s,i]=ao(r,`[${Ji(e,a)}]`,e,a);return s.domain=n.hostname,s.title=document.title,s.referrer=document.referrer,n.search&&(s.search=n.search),n.hash&&(s.hash=n.hash),[s,i]}function Qi(e){const t={};return so(e).forEach(e=>{const[n,a]=io(e),[r,s]=oo(n);if(!r)return;let[i,o]=oo(a||"");i=i||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:s,action:i,actionParams:o})}),t}function eo(e,t,n,a=!1){const r=[];let s=t;for(n=0!==Object.keys(n||{}).length?n:void 0;s;){const i=to(e,s,t,n);if(i&&(r.push(i),a))break;s=no(e,s)}return r}function to(e,t,n,a){const r=Xn(t,Ji(e));if(!r||a&&!a[r])return null;const s=[t],i=`[${Ji(e,r)}],[${Ji(e,"")}]`,o=Ji(e,oa.Link,!1);let c={};const u=[],[d,l]=ao(n||t,i,e,r);ro(t,`[${o}]`,t=>{const[n,a]=io(Xn(t,o));"parent"===a&&ro(document.body,`[${o}="${n}:child"]`,t=>{s.push(t);const n=to(e,t);n&&u.push(n)})});const p=[];s.forEach(e=>{e.matches(i)&&p.push(e),ro(e,i,e=>p.push(e))});let m={};return p.forEach(t=>{m=Di(m,Hi(e,t,"")),c=Di(c,Hi(e,t,r))}),c=Di(Di(m,c),d),s.forEach(t=>{ro(t,`[${Ji(e)}]`,t=>{const n=to(e,t);n&&u.push(n)})}),{entity:r,data:c,context:l,nested:u}}function no(e,t){const n=Ji(e,oa.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=io(Xn(t,n));if("child"===a)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ao(e,t,n,a){let r={};const s={};let i=e;const o=`[${Ji(n,oa.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(r=Di(Hi(n,i,""),r),r=Di(Hi(n,i,a),r)),i.matches(o)&&(Object.entries(Hi(n,i,oa.Context,!1)).forEach(([e,t])=>{t&&!s[e]&&(s[e]=[t,c])}),++c),i=no(n,i);return[r,s]}function ro(e,t,n){e.querySelectorAll(t).forEach(n)}function so(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function io(e){const[t,n]=e.split(/:(.+)/,2);return[Xi(t),Xi(n)]}function oo(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var co,uo=new WeakMap,lo=new WeakMap,po=new WeakMap;function mo(e){const t=Date.now();let n=lo.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:Yn(e),lastChecked:t},lo.set(e,n)),n.isVisible}function fo(e){if(window.IntersectionObserver)return Wi(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,a;const r=t.target,s=po.get(e);if(!s)return;const i=s.timers.get(r);if(t.intersectionRatio>0){const a=Date.now();let o=uo.get(r);if((!o||a-o.lastChecked>1e3)&&(o={isLarge:r.offsetHeight>window.innerHeight,lastChecked:a},uo.set(r,o)),t.intersectionRatio>=.5||o.isLarge&&mo(r)){const t=null==(n=s.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!i){const t=window.setTimeout(async()=>{var t,n;if(mo(r)){const a=null==(t=s.elementConfigs)?void 0:t.get(r);(null==a?void 0:a.context)&&await Oo(a.context,r,a.trigger);const i=null==(n=s.elementConfigs)?void 0:n.get(r);(null==i?void 0:i.multiple)?i.blocked=!0:function(e,t){const n=po.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const a=n.timers.get(t);a&&(clearTimeout(a),n.timers.delete(t)),uo.delete(t),lo.delete(t)}(e,r)}},s.duration);s.timers.set(r,t)}return}}i&&(clearTimeout(i),s.timers.delete(r));const o=null==(a=s.elementConfigs)?void 0:a.get(r);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function ho(e,t,n={multiple:!1}){var a;const r=e.settings.scope||document,s=po.get(r);(null==s?void 0:s.observer)&&t&&(s.elementConfigs||(s.elementConfigs=new WeakMap),s.elementConfigs.set(t,{multiple:null!=(a=n.multiple)&&a,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),s.observer.observe(t))}function go(e){if(!e)return;const t=po.get(e);t&&(t.observer&&t.observer.disconnect(),po.delete(e))}function yo(e,t,n,a,r,s,i){const{elb:o,settings:c}=e;if(Bi(t)&&t.startsWith("walker "))return o(t,n);if(qi(t)){const e=t;return e.source||(e.source=vo()),e.globals||(e.globals=Yi(c.prefix,c.scope||document)),o(e)}const[u]=String(qi(t)?t.name:t).split(" ");let d,l=qi(n)?n:{},p={},m=!1;if(Vi(n)&&(d=n,m=!0),Vi(r)?d=r:qi(r)&&Object.keys(r).length&&(p=r),d){const e=eo(c.prefix||"data-elb",d).find(e=>e.entity===u);e&&(m&&(l=e.data),p=e.context)}"page"===u&&(l.id=l.id||window.location.pathname);const f=Yi(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:s,custom:i,trigger:Bi(a)?a:"",source:vo()})}function vo(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var _o=[],bo="hover",ko="load",xo="pulse",wo="scroll",Zo="wait";function Ao(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",Wi(function(t){Po.call(this,e,t)})),n.addEventListener("submit",Wi(function(t){jo.call(this,e,t)})))}(e,t)}function So(e,t){t.scope&&function(e,t){const n=t.scope;_o=[];const a=n||document;go(a),function(e,t=1e3){po.has(e)||po.set(e,{observer:fo(e),timers:new WeakMap,duration:t})}(a,1e3);const r=Ji(t.prefix,oa.Action,!1);a!==document&&To(e,a,r,t),a.querySelectorAll(`[${r}]`).forEach(n=>{To(e,n,r,t)}),_o.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const a=window.scrollY+window.innerHeight,r=e.offsetTop;if(a<r)return!0;const s=e.clientHeight;return!(100*(1-(r+s-a)/(s||1))>=n&&(Oo(t,e,wo),1))});co||(co=function(e,t=1e3){let n=null;return function(...a){if(null===n)return n=setTimeout(()=>{n=null},t),e(...a)}}(function(){_o=n.call(t,_o,e)}),t.addEventListener("scroll",co))}(e,a)}(e,t)}async function Oo(e,t,n){const a=function(e,t,n=oa.Prefix){const a=[],{actions:r,nearestOnly:s}=function(e,t,n){let a=t;for(;a;){const t=Xn(a,Ji(e,oa.Actions,!1));if(t){const e=Qi(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=Xn(a,Ji(e,oa.Action,!1));if(r){const e=Qi(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}a=no(e,a)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const i=so(r.actionParams||"",",").reduce((e,t)=>(e[Xi(t)]=!0,e),{}),o=eo(n,e,i,s);if(!o.length){const t="page",a=`[${Ji(n,t)}]`,[r,s]=ao(e,a,n,t);o.push({entity:t,data:r,nested:[],context:s})}o.forEach(e=>{a.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),a):a}(t,n,e.settings.prefix);return Promise.all(a.map(t=>yo(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function To(e,t,n,a){const r=Xn(t,n);r&&Object.values(Qi(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case bo:a=e,t.addEventListener("mouseenter",Wi(function(e){e.target instanceof Element&&Oo(a,e.target,bo)}));break;case ko:!function(e,t){Oo(e,t,ko)}(e,t);break;case xo:!function(e,t,n=""){setInterval(()=>{document.hidden||Oo(e,t,xo)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case wo:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||_o.push([e,n])}(t,n.triggerParams);break;case"impression":ho(e,t);break;case"visible":ho(e,t,{multiple:!0});break;case Zo:!function(e,t,n=""){setTimeout(()=>Oo(e,t,Zo),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var a}))}function Po(e,t){Oo(e,t.target,"click")}function jo(e,t){t.target&&Oo(e,t.target,"submit")}function No(e,t,n,a){const r=[];let s=!0;n.forEach(e=>{const t=Eo(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const i=t[0],o=!qi(i)&&Bi(i)&&i.startsWith("walker ");if(qi(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Bi(e[0])||""===e[0].trim())return;const n="walker run";s&&e[0]===n&&(s=!1)}(a&&o||!a&&!o)&&r.push(t)}),r.forEach(n=>{Co(e,t,n)})}function Co(e,t="data-elb",n){Wi(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Bi(a)&&""===a.trim())return;if(Bi(a)&&a.startsWith("walker "))return void e(a,r[0]);yo({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},a,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Eo(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function $o(e,t={}){return function(e={}){const{cb:t,consent:n,collector:a,storage:r}=e;if(!n)return Gn((r?na:aa)(e),a,t);{const r=function(e,t){let n;return(a,r)=>{if(Nn(n)&&n===(null==a?void 0:a.group))return;n=null==a?void 0:a.group;let s=()=>aa(e);return e.consent&&Ln((jn(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(s=()=>na(e)),Gn(s(),a,t)}}(e,t),s=(jn(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",s):Hn("walker on","consent",s)}}({...t,collector:{push:e,group:void 0}})}_a({},{env:()=>Io});var Io={};_a(Io,{push:()=>Mo});var Ro=()=>{},Lo=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Mo={get push(){return Lo()},get command(){return Lo()},get elb(){return Lo()},get window(){return{addEventListener:Ro,removeEventListener:Ro,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ro,removeEventListener:Ro,querySelector:Ro,querySelectorAll:()=>[],getElementById:Ro,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ro,getAttribute:Ro,addEventListener:Ro,removeEventListener:Ro}),body:{appendChild:Ro,removeChild:Ro},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}},Fo=async(e,t)=>{const{elb:n,window:a,document:r}=t,s=(null==e?void 0:e.settings)||{},i=a||(void 0!==globalThis.window?globalThis.window:void 0),o=r||(void 0!==globalThis.document?globalThis.document:void 0),c=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,o),u={settings:c},d={elb:n,settings:c};if(i&&o){if(!1!==c.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",a=t.window||window;if(!a)return;const r=a;r[n]||(r[n]=[]);const s=r[n];s.push=function(...n){if(Eo(n[0])){const a=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[a]);return Co(e,t.prefix,a),r}const a=Array.prototype.push.apply(this,n);return n.forEach(n=>{Co(e,t.prefix,n)}),a},Array.isArray(s)&&s.length>0&&function(e,t="data-elb",n){No(e,t,n,!0),No(e,t,n,!1),n.length=0}(e,t.prefix,s)}(n,{name:Bi(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:i}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}await async function(e,t,n){const a=()=>{e(t,n)};"loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)}(Ao,d,c),(()=>{if(So(d,c),c.pageview){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}})(),Bi(c.elb)&&c.elb&&(i[c.elb]=(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)},destroy:async()=>{o&&go(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&i&&(So(d,c),c.pageview)){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}}}}},zo=Object.defineProperty,Do=(e,t)=>{for(var n in t)zo(e,n,{get:t[n],enumerable:!0})},Uo=!1;function Vo(e,t={},n){if(t.filter&&!0===Dn(()=>t.filter(n),()=>!1)())return;const a=function(e){if(Cn(e)&&En(e.event)){const{event:t,...n}=e;return{name:t,...n}}return jn(e)&&e.length>=2?qo(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?qo(Array.from(e)):null;var t}(n);if(!a)return;const r=`${t.prefix||"dataLayer"} ${a.name}`,{name:s,...i}=a,o={name:r,data:i};Dn(()=>e(o),()=>{})()}function qo(e){const[t,n,a]=e;if(!En(t))return null;let r,s={};switch(t){case"consent":if(!En(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!Cn(a)||null===a)return null;r=`${t} ${n}`,s={...a};break;case"event":if(!En(n))return null;r=n,Cn(a)&&(s={...a});break;case"config":if(!En(n))return null;r=`${t} ${n}`,Cn(a)&&(s={...a});break;case"set":if(En(n))r=`${t} ${n}`,Cn(a)&&(s={...a});else{if(!Cn(n))return null;r=`${t} custom`,s={...n}}break;default:return null}return{name:r,...s}}Do({},{push:()=>Wo});var Bo=()=>{},Ko=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Wo={get push(){return Ko()},get command(){return Ko()},get elb(){return Ko()},get window(){return{dataLayer:[],addEventListener:Bo,removeEventListener:Bo}}};function Xo(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function Jo(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function Ho(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function Yo(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function Go(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function Qo(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function ec(){return["set",{currency:"EUR",country:"DE"}]}function tc(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Do({},{add_to_cart:()=>Yo,config:()=>Qo,consentDefault:()=>Jo,consentUpdate:()=>Xo,directDataLayerEvent:()=>tc,purchase:()=>Ho,setCustom:()=>ec,view_item:()=>Go});Do({},{add_to_cart:()=>rc,config:()=>cc,configGA4:()=>ic,consentOnlyMapping:()=>uc,consentUpdate:()=>nc,customEvent:()=>oc,purchase:()=>ac,view_item:()=>sc});var nc={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},ac={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},rc={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},sc={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},ic={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},oc={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},cc={consent:{update:nc},purchase:ac,add_to_cart:rc,view_item:sc,"config G-XXXXXXXXXX":ic,custom_event:oc,"*":{data:{}}},uc={consent:{update:nc}},dc=async(e,t)=>{const{elb:n,window:a}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},s={settings:r};return a&&(function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer",r=window[a];if(Array.isArray(r)&&!Uo){Uo=!0;try{for(const t of r)Vo(e,n,t)}finally{Uo=!1}}}(n,s),function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer";window[a]||(window[a]=[]);const r=window[a];if(!Array.isArray(r))return;const s=r.push.bind(r);r.push=function(...t){if(Uo)return s(...t);Uo=!0;try{for(const a of t)Vo(e,n,a)}finally{Uo=!1}return s(...t)}}(n,s)),{type:"dataLayer",config:s,push:n,destroy:async()=>{const e=r.name||"dataLayer";a&&a[e]&&Array.isArray(a[e])}}};function lc(){window.dataLayer=window.dataLayer||[];const e=e=>{Cn(e)&&Cn(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=Jn(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(e={}){const t=Pn({collector:{destinations:{dataLayer:{code:lc()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),n={...t.collector,sources:{browser:{code:Fo,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=Cn(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:dc,config:{settings:e}})}const a=await ya(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();