@walkeros/web-source-browser 0.2.0 → 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.
@@ -1 +1 @@
1
- "use strict";var Source=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})},i={};r(i,{SourceBrowser:()=>ke,createTagger:()=>Ce,default:()=>$e,examples:()=>Se,getAllEvents:()=>I,getElbAttributeName:()=>L,getElbValues:()=>$,getEvents:()=>P,getGlobals:()=>W,sourceBrowser:()=>Le});var s={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},c={merge:!0,shallow:!0,extend:!0};function a(e,t={},n={}){n={...c,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function l(e){return Array.isArray(e)}function u(e){return void 0!==e}function f(e){return e===document||e instanceof Element}function d(e){return"object"==typeof e&&null!==e&&!l(e)&&"[object Object]"===Object.prototype.toString.call(e)}function g(e){return"string"==typeof e}function m(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function p(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function h(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function b(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}var y={Commands:{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"},Utils:{Storage:{Cookie:"cookie",Local:"local",Session:"session"}}};function w(e,t){return(e.getAttribute(t)||"").trim()}var v=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function k(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 o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,c=s+i,a={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(a.x<0)return!1;if(a.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(a.y<0)return!1;if(a.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(a.x,a.y)}else{const e=o/2;if(s<0&&c<e)return!1;if(c>o&&s>e)return!1;n=document.elementFromPoint(a.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function S(e={}){const{cb:t,consent:n,collector:o,storage:r}=e,i=(null==o?void 0:o.push)||v;if(!n)return j((r?C:A)(e),o,t);{const o=function(e,t){let n;return(o,r)=>{if(u(n)&&n===(null==o?void 0:o.group))return;n=null==o?void 0:o.group;let i=()=>A(e);if(e.consent){(function(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r})((l(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>C(e))}return j(i(),o,t)}}(e,t);i("walker on","consent",(l(n)?n:[n]).reduce((e,t)=>({...e,[t]:o}),{}))}}function j(e,t,n){return!1===n?e:(n||(n=O),n(e,t,O))}var O=(e,t)=>{const n=(null==t?void 0:t.push)||v,o={};return e.id&&(o.session=e.id),e.storage&&e.device&&(o.device=e.device),n("walker user",o),e.isStart&&n({name:"session start",data:e}),e};function x(e,t=s.Storage.Session){var n;function o(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let r,i;switch(t){case s.Storage.Cookie:r=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case s.Storage.Local:i=o(window.localStorage.getItem(e));break;case s.Storage.Session:i=o(window.sessionStorage.getItem(e))}return i&&(r=i.v,0!=i.e&&i.e<Date.now()&&(function(e,t=s.Storage.Session){switch(t){case s.Storage.Cookie:E(e,"",0,t);break;case s.Storage.Local:window.localStorage.removeItem(e);break;case s.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),r="")),m(r||"")}function E(e,t,n=30,o=s.Storage.Session,r){const i={e:Date.now()+6e4*n,v:String(t)},c=JSON.stringify(i);switch(o){case s.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let o=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;r&&(o+="; domain="+r),document.cookie=o;break}case s.Storage.Local:window.localStorage.setItem(e,c);break;case s.Storage.Session:window.sessionStorage.setItem(e,c)}return x(e,o)}function C(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:c="local",pulse:a=!1}=e,l=A(e);let u=!1;const f=h((e,t,n)=>{let o=x(e,n);return o||(o=p(8),E(e,o,1440*t,n)),String(o)})(o,i,r),d=h((e,o)=>{const r=JSON.parse(String(x(e,o)));return a||(r.isNew=!1,l.marketing&&(Object.assign(r,l),u=!0),u||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,u=!0):r.runs++),r},()=>{u=!0})(s,c)||{},g={id:p(12),start:t,isNew:!0,count:1,runs:1},m=Object.assign(g,l,d,{device:f},{isStart:u,storage:!0,updated:t},e.data);return E(s,JSON.stringify(m),2*n,c),m}function A(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 o=new URL(e.url||window.location.href),r=e.referrer||document.referrer,i=r&&new URL(r).hostname,s=function(e,t={}){const n="clickId",o={},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(a(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}(o,e.parameters);if(Object.keys(s).length&&(s.marketing||(s.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(o.hostname),t=!n.includes(i)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:p(12),referrer:i},s,e.data):n}function L(e,t,n=!0){return e+(t=null!=t?(n?"-":"")+t:"")}function $(e,t,n,o=!0){return B(w(t,L(e,n,o))||"").reduce((e,n)=>{let[o,r]=U(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.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 o.endsWith("[]")?(o=o.slice(0,-2),l(e[o])||(e[o]=[]),e[o].push(m(r))):e[o]=m(r),e},{})}function I(e,t=y.Commands.Prefix){var n;const o=e||("undefined"!=typeof document?document.body:void 0);if(!o)return[];let r=[];const i=y.Commands.Action,s=`[${L(t,i,!1)}]`,c=e=>{Object.keys($(t,e,i,!1)).forEach(n=>{r=r.concat(P(e,n,t))})};return o!==("undefined"!=typeof document?document:null)&&(null==(n=o.matches)?void 0:n.call(o,s))&&c(o),_(o,s,c),r}function P(e,t,n=y.Commands.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=w(o,L(e,y.Commands.Actions,!1));if(t){const e=T(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=w(o,L(e,y.Commands.Action,!1));if(r){const e=T(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=D(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=B(r.actionParams||"",",").reduce((e,t)=>(e[b(t)]=!0,e),{}),c=R(n,e,s,i);if(!c.length){const t="page",o=`[${L(n,t)}]`,[r,i]=M(e,o,n,t);c.push({entity:t,data:r,nested:[],context:i})}c.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}function W(e=y.Commands.Prefix,t=document){const n=L(e,y.Commands.Globals,!1);let o={};return _(t,`[${n}]`,t=>{o=a(o,$(e,t,y.Commands.Globals,!1))}),o}function N(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=M(r,`[${L(e,o)}]`,e,o);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 T(e){const t={};return B(e).forEach(e=>{const[n,o]=U(e),[r,i]=q(n);if(!r)return;let[s,c]=q(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:c})}),t}function R(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=H(e,i,t,n);if(s&&(r.push(s),o))break;i=D(e,i)}return r}function H(e,t,n,o){const r=w(t,L(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${L(e,r)}],[${L(e,"")}]`,c=L(e,y.Commands.Link,!1);let l={};const u=[],[f,d]=M(n||t,s,e,r);_(t,`[${c}]`,t=>{const[n,o]=U(w(t,c));"parent"===o&&_(document.body,`[${c}="${n}:child"]`,t=>{i.push(t);const n=H(e,t);n&&u.push(n)})});const g=[];i.forEach(e=>{e.matches(s)&&g.push(e),_(e,s,e=>g.push(e))});let m={};return g.forEach(t=>{m=a(m,$(e,t,"")),l=a(l,$(e,t,r))}),l=a(a(m,l),f),i.forEach(t=>{_(t,`[${L(e)}]`,t=>{const n=H(e,t);n&&u.push(n)})}),{entity:r,data:l,context:d,nested:u}}function D(e,t){const n=L(e,y.Commands.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=U(w(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function M(e,t,n,o){let r={};const i={};let s=e;const c=`[${L(n,y.Commands.Context,!1)}]`;let l=0;for(;s;)s.matches(t)&&(r=a($(n,s,""),r),r=a($(n,s,o),r)),s.matches(c)&&(Object.entries($(n,s,y.Commands.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,l])}),++l),s=D(n,s);return[r,i]}function _(e,t,n){e.querySelectorAll(t).forEach(n)}function B(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function U(e){const[t,n]=e.split(/:(.+)/,2);return[b(t),b(n)]}function q(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var J=new WeakMap,G=new WeakMap,V=new WeakMap;function Y(e){const t=Date.now();let n=G.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:k(e),lastChecked:t},G.set(e,n)),n.isVisible}function F(e){if(window.IntersectionObserver)return h(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=V.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let c=J.get(r);(!c||o-c.lastChecked>1e3)&&(c={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},J.set(r,c));if(t.intersectionRatio>=.5||c.isLarge&&Y(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Y(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await de(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=V.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),J.delete(t),G.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const c=null==(o=i.elementConfigs)?void 0:o.get(r);(null==c?void 0:c.multiple)&&(c.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function K(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=V.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function X(e){if(!e)return;const t=V.get(e);t&&(t.observer&&t.observer.disconnect(),V.delete(e))}function z(e,t,n,o,r,i,s){const{elb:c,settings:a}=e;if(g(t)&&t.startsWith("walker ")){return c(t,n)}if(d(t)){const e=t;return e.source||(e.source=Q()),e.globals||(e.globals=W(a.prefix,a.scope||document)),c(e)}const[l]=String(d(t)?t.name:t).split(" ");let u,m=d(n)?n:{},p={},h=!1;if(f(n)&&(u=n,h=!0),f(r)?u=r:d(r)&&Object.keys(r).length&&(p=r),u){const e=R(a.prefix||"data-elb",u).find(e=>e.entity===l);e&&(h&&(m=e.data),p=e.context)}"page"===l&&(m.id=m.id||window.location.pathname);const b=W(a.prefix,a.scope);return c({name:String(t||""),data:m,context:p,globals:b,nested:i,custom:s,trigger:g(o)?o:"",source:Q()})}function Q(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Z,ee=[],te="click",ne="hover",oe="load",re="pulse",ie="scroll",se="submit",ce="impression",ae="visible",le="wait";function ue(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;if(!n)return;n.addEventListener("click",h(function(t){me.call(this,e,t)})),n.addEventListener("submit",h(function(t){pe.call(this,e,t)}))}(e,t)}function fe(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;ee=[];const o=n||document;X(o),function(e,t=1e3){V.has(e)||V.set(e,{observer:F(e),timers:new WeakMap,duration:t})}(o,1e3);const r=L(t.prefix,y.Commands.Action,!1);o!==document&&ge(e,o,r,t);o.querySelectorAll(`[${r}]`).forEach(n=>{ge(e,n,r,t)}),ee.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n)||(de(t,e,ie),!1)});Z||(Z=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){ee=n.call(t,ee,e)}),t.addEventListener("scroll",Z))}(e,o)}(e,t)}async function de(e,t,n){const o=P(t,n,e.settings.prefix);return Promise.all(o.map(t=>z(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function ge(e,t,n,o){const r=w(t,n);r&&Object.values(T(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case ne:!function(e,t){t.addEventListener("mouseenter",h(function(t){t.target instanceof Element&&de(e,t.target,ne)}))}(e,t);break;case oe:!function(e,t){de(e,t,oe)}(e,t);break;case re:!function(e,t,n=""){setInterval(()=>{document.hidden||de(e,t,re)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case ie:!function(e,t=""){const n=parseInt(t||"")||50;if(n<0||n>100)return;ee.push([e,n])}(t,n.triggerParams);break;case ce:K(e,t);break;case ae:K(e,t,{multiple:!0});break;case le:!function(e,t,n=""){setTimeout(()=>de(e,t,le),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}}))}function me(e,t){de(e,t.target,te)}function pe(e,t){t.target&&de(e,t.target,se)}function he(e,t={}){const n=t.name||"elbLayer",o=t.window||("undefined"!=typeof window?window:void 0);if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(we(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return ye(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{ye(e,t.prefix,n)}),o},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)}function be(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=we(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],c=!d(s)&&g(s)&&s.startsWith("walker ");if(d(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!g(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&c||!o&&!c)&&r.push(t)}),r.forEach(n=>{ye(e,t,n)})}function ye(e,t="data-elb",n){h(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||g(o)&&""===o.trim())return;if(g(o)&&o.startsWith("walker "))return void e(o,r[0]);z({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function we(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function ve(e,t={}){return S({...t,collector:{push:e,group:void 0}})}var ke={},Se={};r(Se,{env:()=>je});var je={};r(je,{push:()=>Ee});var Oe={addEventListener:jest.fn(),removeEventListener:jest.fn(),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},xe={addEventListener:jest.fn(),removeEventListener:jest.fn(),querySelector:jest.fn(),querySelectorAll:jest.fn(()=>[]),getElementById:jest.fn(),getElementsByClassName:jest.fn(()=>[]),getElementsByTagName:jest.fn(()=>[]),createElement:jest.fn(()=>({setAttribute:jest.fn(),getAttribute:jest.fn(),addEventListener:jest.fn(),removeEventListener:jest.fn()})),body:{appendChild:jest.fn(),removeChild:jest.fn()},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""},Ee={elb:jest.fn(),window:Oe,document:xe};function Ce(e={}){const t=e.prefix||"data-elb";return function(e){let n,o=e;const r={},i={},s={},c={},a={},l={};function f(e){return Object.entries(e).map(([e,t])=>`${e}:${function(e){if(!u(e)||null===e)return"undefined";let t=String(e);return t=t.replace(/\\/g,"\\\\"),t=t.replace(/;/g,"\\;"),t=t.replace(/:/g,"\\:"),t=t.replace(/'/g,"\\'"),t}(t)}`).join(";")}const d={entity:e=>(n=e,o=e,d),data(e,t){const n=null!=o?o:"";return r[n]||(r[n]={}),g(e)?r[n][e]=t:Object.assign(r[n],e),d},action(e,t){if(g(e))if(u(t))i[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);i[t]=n}else i[e]=e;else Object.assign(i,e);return d},actions(e,t){if(g(e))if(u(t))s[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);s[t]=n}else s[e]=e;else Object.assign(s,e);return d},context:(e,t)=>(g(e)?c[e]=t:Object.assign(c,e),d),globals:(e,t)=>(g(e)?a[e]=t:Object.assign(a,e),d),link:(e,t)=>(g(e)?l[e]=t:Object.assign(l,e),d),get(){const e={};return n&&(e[t]=n),Object.entries(r).forEach(([n,o])=>{if(Object.keys(o).length>0){e[n?`${t}-${n}`:`${t}-`]=f(o)}}),Object.keys(i).length>0&&(e[`${t}action`]=f(i)),Object.keys(s).length>0&&(e[`${t}actions`]=f(s)),Object.keys(c).length>0&&(e[`${t}context`]=f(c)),Object.keys(a).length>0&&(e[`${t}globals`]=f(a)),Object.keys(l).length>0&&(e[`${t}link`]=f(l)),e}};return d}}var Ae,Le=async(e,t)=>{try{const{elb:n,window:o,document:r}=t,i=(null==e?void 0:e.settings)||{},s=o||(void 0!==globalThis.window?globalThis.window:void 0),c=r||(void 0!==globalThis.document?globalThis.document:void 0),a=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(i,c),l={settings:a},u={elb:n,settings:a};if(s&&c){if(!1!==a.elbLayer&&he(n,{name:g(a.elbLayer)?a.elbLayer:"elbLayer",prefix:a.prefix,window:s}),a.session){const e="boolean"==typeof a.session?{}:a.session;ve(n,e)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(ue,u,a);(()=>{if(fe(u,a),a.pageview){const[e,t]=N(a.prefix||"data-elb",a.scope);z(u,"page view",e,"load",t)}})(),g(a.elb)&&a.elb&&(s[a.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return z(u,t,n,o,r,i,s)})}return{type:"browser",config:l,push:(...e)=>{const[t,n,o,r,i,s]=e;return z(u,t,n,o,r,i,s)},destroy:async()=>{c&&X(a.scope||c)},on:async(e,t)=>{switch(e){case"consent":if(a.session&&t){const e="boolean"==typeof a.session?{}:a.session;ve(n,e)}break;case"session":case"ready":default:break;case"run":if(c&&s&&(fe(u,a),a.pageview)){const[e,t]=N(a.prefix||"data-elb",a.scope);z(u,"page view",e,"load",t)}}}}}catch(e){throw e}},$e=Le;return Ae=i,((r,i,s,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of n(i))o.call(r,a)||a===s||e(r,a,{get:()=>i[a],enumerable:!(c=t(i,a))||c.enumerable});return r})(e({},"__esModule",{value:!0}),Ae)})();
1
+ "use strict";var Source=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},s={};a(s,{SourceBrowser:()=>qr,createTagger:()=>Qr,default:()=>na,examples:()=>Hr,getAllEvents:()=>rr,getElbAttributeName:()=>tr,getElbValues:()=>nr,getEvents:()=>ar,getGlobals:()=>sr,sourceBrowser:()=>ta});var i,o,c,u={};a(u,{BRAND:()=>Ve,DIRTY:()=>A,EMPTY_PATH:()=>b,INVALID:()=>S,NEVER:()=>Mt,OK:()=>O,ParseStatus:()=>Z,Schema:()=>L,ZodAny:()=>fe,ZodArray:()=>ve,ZodBigInt:()=>ce,ZodBoolean:()=>ue,ZodBranded:()=>We,ZodCatch:()=>De,ZodDate:()=>de,ZodDefault:()=>ze,ZodDiscriminatedUnion:()=>we,ZodEffects:()=>Me,ZodEnum:()=>$e,ZodError:()=>f,ZodFirstPartyTypeKind:()=>Je,ZodFunction:()=>Pe,ZodIntersection:()=>Se,ZodIssueCode:()=>p,ZodLazy:()=>Ce,ZodLiteral:()=>Ne,ZodMap:()=>Te,ZodNaN:()=>Ue,ZodNativeEnum:()=>Ie,ZodNever:()=>ge,ZodNull:()=>me,ZodNullable:()=>Fe,ZodNumber:()=>oe,ZodObject:()=>be,ZodOptional:()=>Re,ZodParsedType:()=>d,ZodPipeline:()=>Be,ZodPromise:()=>Le,ZodReadonly:()=>Ke,ZodRecord:()=>Oe,ZodSchema:()=>L,ZodSet:()=>je,ZodString:()=>se,ZodSymbol:()=>le,ZodTransformer:()=>Me,ZodTuple:()=>Ae,ZodType:()=>L,ZodUndefined:()=>pe,ZodUnion:()=>ke,ZodUnknown:()=>he,ZodVoid:()=>ye,addIssueToContext:()=>k,any:()=>ct,array:()=>pt,bigint:()=>nt,boolean:()=>rt,coerce:()=>Lt,custom:()=>He,date:()=>at,datetimeRegex:()=>te,defaultErrorMap:()=>h,discriminatedUnion:()=>gt,effect:()=>Tt,enum:()=>St,function:()=>xt,getErrorMap:()=>v,getParsedType:()=>l,instanceof:()=>Xe,intersection:()=>yt,isAborted:()=>T,isAsync:()=>C,isDirty:()=>j,isValid:()=>P,late:()=>Ge,lazy:()=>wt,literal:()=>Zt,makeIssue:()=>_,map:()=>bt,nan:()=>tt,nativeEnum:()=>At,never:()=>dt,null:()=>ot,nullable:()=>Pt,number:()=>et,object:()=>mt,objectUtil:()=>c,oboolean:()=>It,onumber:()=>$t,optional:()=>jt,ostring:()=>Et,pipeline:()=>Nt,preprocess:()=>Ct,promise:()=>Ot,quotelessJson:()=>m,record:()=>_t,set:()=>kt,setErrorMap:()=>y,strictObject:()=>ft,string:()=>Qe,symbol:()=>st,transformer:()=>Tt,tuple:()=>vt,undefined:()=>it,union:()=>ht,unknown:()=>ut,util:()=>i,void:()=>lt}),(o=i||(i={})).assertEqual=e=>{},o.assertIs=function(e){},o.assertNever=function(e){throw new Error},o.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},o.getValidEnumValues=e=>{const t=o.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const r of t)n[r]=e[r];return o.objectValues(n)},o.objectValues=e=>o.objectKeys(e).map(function(t){return e[t]}),o.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},o.find=(e,t)=>{for(const n of e)if(t(n))return n},o.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,o.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},o.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(c||(c={})).mergeShapes=(e,t)=>({...e,...t});var d=i.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),l=e=>{switch(typeof e){case"undefined":return d.undefined;case"string":return d.string;case"number":return Number.isNaN(e)?d.nan:d.number;case"boolean":return d.boolean;case"function":return d.function;case"bigint":return d.bigint;case"symbol":return d.symbol;case"object":return Array.isArray(e)?d.array:null===e?d.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?d.promise:"undefined"!=typeof Map&&e instanceof Map?d.map:"undefined"!=typeof Set&&e instanceof Set?d.set:"undefined"!=typeof Date&&e instanceof Date?d.date:d.object;default:return d.unknown}},p=i.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"]),m=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),f=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:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(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,i.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};f.create=e=>new f(e);var h=(e,t)=>{let n;switch(e.code){case p.invalid_type:n=e.received===d.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,i.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:n=`Unrecognized key(s) in object: ${i.joinValues(e.keys,", ")}`;break;case p.invalid_union:n="Invalid input";break;case p.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${i.joinValues(e.options)}`;break;case p.invalid_enum_value:n=`Invalid enum value. Expected ${i.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:n="Invalid function arguments";break;case p.invalid_return_type:n="Invalid function return type";break;case p.invalid_date:n="Invalid date";break;case p.invalid_string:"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}"`:i.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case p.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 p.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 p.custom:n="Invalid input";break;case p.invalid_intersection_types:n="Intersection results could not be merged";break;case p.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:n="Number must be finite";break;default:n=t.defaultError,i.assertNever(e)}return{message:n}},g=h;function y(e){g=e}function v(){return g}var _=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const c=r.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}},b=[];function k(e,t){const n=v(),r=_({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===h?void 0:h].filter(e=>!!e)});e.common.issues.push(r)}var x,w,Z=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return S;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const r=[];for(const e of n){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return S;if("aborted"===a.status)return S;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}},S=Object.freeze({status:"aborted"}),A=e=>({status:"dirty",value:e}),O=e=>({status:"valid",value:e}),T=e=>"aborted"===e.status,j=e=>"dirty"===e.status,P=e=>"valid"===e.status,C=e=>"undefined"!=typeof Promise&&e instanceof Promise;(w=x||(x={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},w.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var N=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},E=(e,t)=>{if(P(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 f(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!=(s=null!=o?o:r)?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!=(i=null!=o?o:n)?i:a.defaultError}},description:a}}var I,L=class{get description(){return this._def.description}_getType(e){return l(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z,ctx:{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(C(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 r={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:l(e)},a=this._parseSync({data:e,path:r.path,parent:r});return E(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return P(t)?{value:t.value}:{issues:r.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),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>P(e)?{value:e.value}:{issues:r.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:l(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(C(r)?r:Promise.resolve(r));return E(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const a=e(t),s=()=>r.addIssue({code:p.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new Me({schema:this,typeName:Je.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 Re.create(this,this._def)}nullable(){return Fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return Le.create(this,this._def)}or(e){return ke.create([this,e],this._def)}and(e){return Se.create(this,e,this._def)}transform(e){return new Me({...$(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ze({...$(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new We({typeName:Je.ZodBranded,type:this,...$(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new De({...$(this._def),innerType:this,catchValue:t,typeName:Je.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Be.create(this,e)}readonly(){return Ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},M=/^c[^\s-]{8,}$/i,R=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,z=/^[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,D=/^[a-z0-9_-]{21}$/i,U=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,V=/^[-+]?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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B=/^(?:(?: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])$/,K=/^(?:(?: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])$/,q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,H=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Y=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G="((\\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])))",X=new RegExp(`^${G}$`);function Q(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 ee(e){return new RegExp(`^${Q(e)}$`)}function te(e){let t=`${G}T${Q(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 ne(e,t){return!("v4"!==t&&t||!B.test(e))||!("v6"!==t&&t||!q.test(e))}function re(e,t){if(!U.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return"object"==typeof a&&null!==a&&((!("typ"in a)||"JWT"===(null==a?void 0:a.typ))&&(!!a.alg&&(!t||a.alg===t)))}catch(e){return!1}}function ae(e,t){return!("v4"!==t&&t||!K.test(e))||!("v6"!==t&&t||!H.test(e))}var se=class e extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==d.string){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.string,received:t.parsedType}),S}const t=new Z;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:p.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:p.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const a=e.data.length>r.value,s=e.data.length<r.value;(a||s)&&(n=this._getOrReturnCtx(e,n),a?k(n,{code:p.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&k(n,{code:p.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)W.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"email",code:p.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)I||(I=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),I.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"emoji",code:p.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)z.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"uuid",code:p.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)D.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"nanoid",code:p.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)M.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid",code:p.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)R.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid2",code:p.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"ulid",code:p.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(a){n=this._getOrReturnCtx(e,n),k(n,{validation:"url",code:p.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"regex",code:p.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){te(r).test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){X.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){ee(r).test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:p.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?V.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"duration",code:p.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?ne(e.data,r.version)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"ip",code:p.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?re(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"jwt",code:p.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?ae(e.data,r.version)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"cidr",code:p.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?J.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"base64",code:p.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?Y.test(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{validation:"base64url",code:p.invalid_string,message:r.message}),t.dirty()):i.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:p.invalid_string,...x.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.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,...x.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,...x.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...x.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.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 ie(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}se.create=e=>{var t;return new se({checks:[],typeName:Je.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...$(e)})};var oe=class e extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==d.number){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.number,received:t.parsedType}),S}let t;const n=new Z;for(const r of this._def.checks)if("int"===r.kind)i.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),k(t,{code:p.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==ie(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_finite,message:r.message}),n.dirty()):i.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.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&&i.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)}};oe.create=e=>new oe({checks:[],typeName:Je.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});var ce=class e extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==d.bigint)return this._getInvalidInput(e);let t;const n=new Z;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):i.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_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:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.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}};ce.create=e=>{var t;return new ce({checks:[],typeName:Je.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...$(e)})};var ue=class extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==d.boolean){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.boolean,received:t.parsedType}),S}return O(e.data)}};ue.create=e=>new ue({typeName:Je.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});var de=class e extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==d.date){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.date,received:t.parsedType}),S}if(Number.isNaN(e.data.getTime())){return k(this._getOrReturnCtx(e),{code:p.invalid_date}),S}const t=new Z;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:p.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),k(n,{code:p.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):i.assertNever(r);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:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.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}};de.create=e=>new de({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Je.ZodDate,...$(e)});var le=class extends L{_parse(e){if(this._getType(e)!==d.symbol){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.symbol,received:t.parsedType}),S}return O(e.data)}};le.create=e=>new le({typeName:Je.ZodSymbol,...$(e)});var pe=class extends L{_parse(e){if(this._getType(e)!==d.undefined){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.undefined,received:t.parsedType}),S}return O(e.data)}};pe.create=e=>new pe({typeName:Je.ZodUndefined,...$(e)});var me=class extends L{_parse(e){if(this._getType(e)!==d.null){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.null,received:t.parsedType}),S}return O(e.data)}};me.create=e=>new me({typeName:Je.ZodNull,...$(e)});var fe=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};fe.create=e=>new fe({typeName:Je.ZodAny,...$(e)});var he=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};he.create=e=>new he({typeName:Je.ZodUnknown,...$(e)});var ge=class extends L{_parse(e){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.never,received:t.parsedType}),S}};ge.create=e=>new ge({typeName:Je.ZodNever,...$(e)});var ye=class extends L{_parse(e){if(this._getType(e)!==d.undefined){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.void,received:t.parsedType}),S}return O(e.data)}};ye.create=e=>new ye({typeName:Je.ZodVoid,...$(e)});var ve=class e extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==d.array)return k(t,{code:p.invalid_type,expected:d.array,received:t.parsedType}),S;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(k(t,{code:e?p.too_big:p.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(k(t,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(k(t,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new N(t,e,t.path,n)))).then(e=>Z.mergeArray(n,e));const a=[...t.data].map((e,n)=>r.type._parseSync(new N(t,e,t.path,n)));return Z.mergeArray(n,a)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:x.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:x.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:x.toString(n)}})}nonempty(e){return this.min(1,e)}};function _e(e){if(e instanceof be){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Re.create(_e(r))}return new be({...e._def,shape:()=>t})}return e instanceof ve?new ve({...e._def,type:_e(e.element)}):e instanceof Re?Re.create(_e(e.unwrap())):e instanceof Fe?Fe.create(_e(e.unwrap())):e instanceof Ae?Ae.create(e.items.map(e=>_e(e))):e}ve.create=(e,t)=>new ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...$(t)});var be=class e extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=i.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==d.object){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.object,received:t.parsedType}),S}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof ge&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||s.push(e);const i=[];for(const e of a){const t=r[e],a=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new N(n,a,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ge){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&&(k(n,{code:p.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 r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new N(n,r,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,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Z.mergeObjectSync(t,e)):Z.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return x.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var r,a,s,i;const o=null!=(s=null==(a=(r=this._def).errorMap)?void 0:a.call(r,e,n).message)?s:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=x.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:Je.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 i.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 i.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return _e(this)}partial(t){const n={};for(const e of i.objectKeys(this.shape)){const r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){const n={};for(const e of i.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Re;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ee(i.objectKeys(this.shape))}};be.create=(e,t)=>new be({shape:()=>e,unknownKeys:"strip",catchall:ge.create(),typeName:Je.ZodObject,...$(t)}),be.strictCreate=(e,t)=>new be({shape:()=>e,unknownKeys:"strict",catchall:ge.create(),typeName:Je.ZodObject,...$(t)}),be.lazycreate=(e,t)=>new be({shape:e,unknownKeys:"strip",catchall:ge.create(),typeName:Je.ZodObject,...$(t)});var ke=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new f(e.ctx.common.issues));return k(t,{code:p.invalid_union,unionErrors:n}),S});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._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&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map(e=>new f(e));return k(t,{code:p.invalid_union,unionErrors:a}),S}}get options(){return this._def.options}};ke.create=(e,t)=>new ke({options:e,typeName:Je.ZodUnion,...$(t)});var xe=e=>e instanceof Ce?xe(e.schema):e instanceof Me?xe(e.innerType()):e instanceof Ne?[e.value]:e instanceof $e?e.options:e instanceof Ie?i.objectValues(e.enum):e instanceof ze?xe(e._def.innerType):e instanceof pe?[void 0]:e instanceof me?[null]:e instanceof Re?[void 0,...xe(e.unwrap())]:e instanceof Fe?[null,...xe(e.unwrap())]:e instanceof We||e instanceof Ke?xe(e.unwrap()):e instanceof De?xe(e._def.innerType):[],we=class e extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.object)return k(t,{code:p.invalid_type,expected:d.object,received:t.parsedType}),S;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const e of n){const n=xe(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 r of n){if(a.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);a.set(r,e)}}return new e({typeName:Je.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...$(r)})}};function Ze(e,t){const n=l(e),r=l(t);if(e===t)return{valid:!0,data:e};if(n===d.object&&r===d.object){const n=i.objectKeys(t),r=i.objectKeys(e).filter(e=>-1!==n.indexOf(e)),a={...e,...t};for(const n of r){const r=Ze(e[n],t[n]);if(!r.valid)return{valid:!1};a[n]=r.data}return{valid:!0,data:a}}if(n===d.array&&r===d.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=Ze(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===d.date&&r===d.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Se=class extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(T(e)||T(r))return S;const a=Ze(e.value,r.value);return a.valid?((j(e)||j(r))&&t.dirty(),{status:t.value,value:a.data}):(k(n,{code:p.invalid_intersection_types}),S)};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])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Se.create=(e,t,n)=>new Se({left:e,right:t,typeName:Je.ZodIntersection,...$(n)});var Ae=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.array)return k(n,{code:p.invalid_type,expected:d.array,received:n.parsedType}),S;if(n.data.length<this._def.items.length)return k(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new N(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Z.mergeArray(t,e)):Z.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ae.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ae({items:e,typeName:Je.ZodTuple,rest:null,...$(t)})};var Oe=class e extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.object)return k(n,{code:p.invalid_type,expected:d.object,received:n.parsedType}),S;const r=[],a=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:a._parse(new N(n,e,n.path,e)),value:s._parse(new N(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Z.mergeObjectAsync(t,r):Z.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return new e(n instanceof L?{keyType:t,valueType:n,typeName:Je.ZodRecord,...$(r)}:{keyType:se.create(),valueType:t,typeName:Je.ZodRecord,...$(n)})}},Te=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.map)return k(n,{code:p.invalid_type,expected:d.map,received:n.parsedType}),S;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new N(n,e,n.path,[s,"key"])),value:a._parse(new N(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 r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return S;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return S;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}};Te.create=(e,t,n)=>new Te({valueType:t,keyType:e,typeName:Je.ZodMap,...$(n)});var je=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==d.set)return k(n,{code:p.invalid_type,expected:d.set,received:n.parsedType}),S;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(k(n,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(k(n,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return S;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>a._parse(new N(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:x.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:x.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};je.create=(e,t)=>new je({valueType:e,minSize:null,maxSize:null,typeName:Je.ZodSet,...$(t)});var Pe=class e extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.function)return k(t,{code:p.invalid_type,expected:d.function,received:t.parsedType}),S;function n(e,n){return _({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),h].filter(e=>!!e),issueData:{code:p.invalid_arguments,argumentsError:n}})}function r(e,n){return _({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),h].filter(e=>!!e),issueData:{code:p.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Le){const e=this;return O(async function(...t){const i=new f([]),o=await e._def.args.parseAsync(t,a).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,a).catch(e=>{throw i.addIssue(r(c,e)),i})})}{const e=this;return O(function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new f([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,a);if(!c.success)throw new f([r(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ae.create(t).rest(he.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,r){return new e({args:t||Ae.create([]).rest(he.create()),returns:n||he.create(),typeName:Je.ZodFunction,...$(r)})}},Ce=class extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ce.create=(e,t)=>new Ce({getter:e,typeName:Je.ZodLazy,...$(t)});var Ne=class extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ee(e,t){return new $e({values:e,typeName:Je.ZodEnum,...$(t)})}Ne.create=(e,t)=>new Ne({value:e,typeName:Je.ZodLiteral,...$(t)});var $e=class e extends L{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return k(t,{expected:i.joinValues(n),received:t.parsedType,code:p.invalid_type}),S}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 k(t,{received:t.data,code:p.invalid_enum_value,options:n}),S}return O(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})}};$e.create=Ee;var Ie=class extends L{_parse(e){const t=i.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==d.string&&n.parsedType!==d.number){const e=i.objectValues(t);return k(n,{expected:i.joinValues(e),received:n.parsedType,code:p.invalid_type}),S}if(this._cache||(this._cache=new Set(i.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=i.objectValues(t);return k(n,{received:n.data,code:p.invalid_enum_value,options:e}),S}return O(e.data)}get enum(){return this._def.values}};Ie.create=(e,t)=>new Ie({values:e,typeName:Je.ZodNativeEnum,...$(t)});var Le=class extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.promise&&!1===t.common.async)return k(t,{code:p.invalid_type,expected:d.promise,received:t.parsedType}),S;const n=t.parsedType===d.promise?t.data:Promise.resolve(t.data);return O(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Le.create=(e,t)=>new Le({type:e,typeName:Je.ZodPromise,...$(t)});var Me=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{k(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return S;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?S:"dirty"===r.status||"dirty"===t.value?A(r.value):r});{if("aborted"===t.value)return S;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?S:"dirty"===r.status||"dirty"===t.value?A(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);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 r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?S:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?S:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!P(e))return S;const s=r.transform(e.value,a);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=>P(e)?Promise.resolve(r.transform(e.value,a)).then(e=>({status:t.value,value:e})):S)}i.assertNever(r)}};Me.create=(e,t,n)=>new Me({schema:e,typeName:Je.ZodEffects,effect:t,...$(n)}),Me.createWithPreprocess=(e,t,n)=>new Me({schema:t,effect:{type:"preprocess",transform:e},typeName:Je.ZodEffects,...$(n)});var Re=class extends L{_parse(e){return this._getType(e)===d.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:Je.ZodOptional,...$(t)});var Fe=class extends L{_parse(e){return this._getType(e)===d.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fe.create=(e,t)=>new Fe({innerType:e,typeName:Je.ZodNullable,...$(t)});var ze=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===d.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ze.create=(e,t)=>new ze({innerType:e,typeName:Je.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});var De=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return C(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new f(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new f(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};De.create=(e,t)=>new De({innerType:e,typeName:Je.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});var Ue=class extends L{_parse(e){if(this._getType(e)!==d.nan){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:d.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}};Ue.create=e=>new Ue({typeName:Je.ZodNaN,...$(e)});var Ve=Symbol("zod_brand"),We=class extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Be=class e extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),A(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?S:"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:Je.ZodPipeline})}},Ke=class extends L{_parse(e){const t=this._def.innerType._parse(e),n=e=>(P(e)&&(e.value=Object.freeze(e.value)),e);return C(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function qe(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function He(e,t={},n){return e?fe.create().superRefine((r,a)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=qe(t,r),o=null==(i=null!=(s=e.fatal)?s:n)||i;a.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=qe(t,r),o=null==(i=null!=(s=e.fatal)?s:n)||i;a.addIssue({code:"custom",...e,fatal:o})}}):fe.create()}Ke.create=(e,t)=>new Ke({innerType:e,typeName:Je.ZodReadonly,...$(t)});var Je,Ye,Ge={object:be.lazycreate};(Ye=Je||(Je={})).ZodString="ZodString",Ye.ZodNumber="ZodNumber",Ye.ZodNaN="ZodNaN",Ye.ZodBigInt="ZodBigInt",Ye.ZodBoolean="ZodBoolean",Ye.ZodDate="ZodDate",Ye.ZodSymbol="ZodSymbol",Ye.ZodUndefined="ZodUndefined",Ye.ZodNull="ZodNull",Ye.ZodAny="ZodAny",Ye.ZodUnknown="ZodUnknown",Ye.ZodNever="ZodNever",Ye.ZodVoid="ZodVoid",Ye.ZodArray="ZodArray",Ye.ZodObject="ZodObject",Ye.ZodUnion="ZodUnion",Ye.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ye.ZodIntersection="ZodIntersection",Ye.ZodTuple="ZodTuple",Ye.ZodRecord="ZodRecord",Ye.ZodMap="ZodMap",Ye.ZodSet="ZodSet",Ye.ZodFunction="ZodFunction",Ye.ZodLazy="ZodLazy",Ye.ZodLiteral="ZodLiteral",Ye.ZodEnum="ZodEnum",Ye.ZodEffects="ZodEffects",Ye.ZodNativeEnum="ZodNativeEnum",Ye.ZodOptional="ZodOptional",Ye.ZodNullable="ZodNullable",Ye.ZodDefault="ZodDefault",Ye.ZodCatch="ZodCatch",Ye.ZodPromise="ZodPromise",Ye.ZodBranded="ZodBranded",Ye.ZodPipeline="ZodPipeline",Ye.ZodReadonly="ZodReadonly";var Xe=(e,t={message:`Input not instance of ${e.name}`})=>He(t=>t instanceof e,t),Qe=se.create,et=oe.create,tt=Ue.create,nt=ce.create,rt=ue.create,at=de.create,st=le.create,it=pe.create,ot=me.create,ct=fe.create,ut=he.create,dt=ge.create,lt=ye.create,pt=ve.create,mt=be.create,ft=be.strictCreate,ht=ke.create,gt=we.create,yt=Se.create,vt=Ae.create,_t=Oe.create,bt=Te.create,kt=je.create,xt=Pe.create,wt=Ce.create,Zt=Ne.create,St=$e.create,At=Ie.create,Ot=Le.create,Tt=Me.create,jt=Re.create,Pt=Fe.create,Ct=Me.createWithPreprocess,Nt=Be.create,Et=()=>Qe().optional(),$t=()=>et().optional(),It=()=>rt().optional(),Lt={string:e=>se.create({...e,coerce:!0}),number:e=>oe.create({...e,coerce:!0}),boolean:e=>ue.create({...e,coerce:!0}),bigint:e=>ce.create({...e,coerce:!0}),date:e=>de.create({...e,coerce:!0})},Mt=S,Rt=Symbol("Let zodToJsonSchema decide on which parser to use"),Ft={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},zt=e=>{const t=(e=>"string"==typeof e?{...Ft,name:e}:{...Ft,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Dt(e,t,n,r){(null==r?void 0:r.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Ut(e,t,n,r,a){e[t]=n,Dt(e,t,r,a)}var Vt=(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 Wt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Vt(t,e.currentPath):t.join("/")}}function Bt(e,t){return _n(e.type._def,t)}function Kt(e,t,n){const r=null!=n?n:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>Kt(e,t,n))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qt(e,t)}}var qt=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const r of e.checks)switch(r.kind){case"min":Ut(n,"minimum",r.value,r.message,t);break;case"max":Ut(n,"maximum",r.value,r.message,t)}return n};var Ht=void 0,Jt=/^[cC][^\s-]{8,}$/,Yt=/^[0-9a-z]+$/,Gt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Xt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Qt=()=>(void 0===Ht&&(Ht=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ht),en=/^(?:(?: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])$/,tn=/^(([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])$/,nn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,an=/^[a-zA-Z0-9_-]{21}$/,sn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function on(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Ut(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Ut(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":dn(n,"email",r.message,t);break;case"format:idn-email":dn(n,"idn-email",r.message,t);break;case"pattern:zod":ln(n,Xt,r.message,t)}break;case"url":dn(n,"uri",r.message,t);break;case"uuid":dn(n,"uuid",r.message,t);break;case"regex":ln(n,r.regex,r.message,t);break;case"cuid":ln(n,Jt,r.message,t);break;case"cuid2":ln(n,Yt,r.message,t);break;case"startsWith":ln(n,RegExp(`^${cn(r.value,t)}`),r.message,t);break;case"endsWith":ln(n,RegExp(`${cn(r.value,t)}$`),r.message,t);break;case"datetime":dn(n,"date-time",r.message,t);break;case"date":dn(n,"date",r.message,t);break;case"time":dn(n,"time",r.message,t);break;case"duration":dn(n,"duration",r.message,t);break;case"length":Ut(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),Ut(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":ln(n,RegExp(cn(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&dn(n,"ipv4",r.message,t),"v4"!==r.version&&dn(n,"ipv6",r.message,t);break;case"base64url":ln(n,rn,r.message,t);break;case"jwt":ln(n,sn,r.message,t);break;case"cidr":"v6"!==r.version&&ln(n,en,r.message,t),"v4"!==r.version&&ln(n,tn,r.message,t);break;case"emoji":ln(n,Qt(),r.message,t);break;case"ulid":ln(n,Gt,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":dn(n,"binary",r.message,t);break;case"contentEncoding:base64":Ut(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":ln(n,nn,r.message,t)}break;case"nanoid":ln(n,an,r.message,t)}return n}function cn(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)un.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var un=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function dn(e,t,n,r){var a;e.format||(null==(a=e.anyOf)?void 0:a.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.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&&r.errorMessages&&{errorMessage:{format:n}}})):Ut(e,"format",t,n,r)}function ln(e,t,n,r){var a;e.pattern||(null==(a=e.allOf)?void 0:a.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.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:pn(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Ut(e,"pattern",pn(t,r),n,r)}function pn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),a=e.flags.includes("m"),s=e.flags.includes("s"),i=r?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(r)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(a){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 mn(e,t){var n,r,a,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)===Je.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>{var a;return{...n,[r]:null!=(a=_n(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?a:Wt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(r=_n(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(a=e.keyType)?void 0:a._def.typeName)===Je.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...r}=on(e.keyType._def,t);return{...u,propertyNames:r}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Je.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Je.ZodBranded&&e.keyType._def.type._def.typeName===Je.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...r}=Bt(e.keyType._def,t);return{...u,propertyNames:r}}return u}var fn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var hn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>_n(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 gn(e,t){const n="openAi"===t.target,r={type:"object",properties:{}},a=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=yn(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=_n(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(r.properties[e]=c,o||a.push(e))}a.length&&(r.required=a);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return _n(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&&(r.additionalProperties=i),r}function yn(e){try{return e.isOptional()}catch(e){return!0}}var vn=(e,t,n)=>{switch(t){case Je.ZodString:return on(e,n);case Je.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",Dt(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Ut(n,"minimum",r.value,r.message,t):Ut(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Ut(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ut(n,"maximum",r.value,r.message,t):Ut(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Ut(n,"maximum",r.value,r.message,t));break;case"multipleOf":Ut(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case Je.ZodObject:return gn(e,n);case Je.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Ut(n,"minimum",r.value,r.message,t):Ut(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Ut(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ut(n,"maximum",r.value,r.message,t):Ut(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Ut(n,"maximum",r.value,r.message,t));break;case"multipleOf":Ut(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case Je.ZodBoolean:return{type:"boolean"};case Je.ZodDate:return Kt(e,n);case Je.ZodUndefined:return function(e){return{not:Wt(e)}}(n);case Je.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Je.ZodArray:return function(e,t){var n,r,a;const s={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(a=null==(r=e.type)?void 0:r._def)?void 0:a.typeName)!==Je.ZodAny&&(s.items=_n(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Ut(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Ut(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Ut(s,"minItems",e.exactLength.value,e.exactLength.message,t),Ut(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case Je.ZodUnion:case Je.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return hn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in fn&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=fn[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 hn(e,t)}(e,n);case Je.ZodIntersection:return function(e,t){const n=[_n(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),_n(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const a=[];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,...r}=e;t=r}else r=void 0;a.push(t)}else a.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),a.length?{allOf:a,...r}:void 0}(e,n);case Je.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>_n(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:_n(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>_n(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Je.ZodRecord:return mn(e,n);case Je.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 Je.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Je.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case Je.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:fn[e.innerType._def.typeName],nullable:!0}:{type:[fn[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=_n(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=_n(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Je.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return _n(e.innerType._def,t);const r=_n(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Wt(t)},r]}:Wt(t)})(e,n);case Je.ZodMap:return function(e,t){return"record"===t.mapStrategy?mn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[_n(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Wt(t),_n(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Wt(t)],minItems:2,maxItems:2}}}(e,n);case Je.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:_n(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Ut(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Ut(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Je.ZodLazy:return()=>e.getter()._def;case Je.ZodPromise:return function(e,t){return _n(e.type._def,t)}(e,n);case Je.ZodNaN:case Je.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Wt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Je.ZodEffects:return function(e,t){return"input"===t.effectStrategy?_n(e.schema._def,t):Wt(t)}(e,n);case Je.ZodAny:return Wt(n);case Je.ZodUnknown:return function(e){return Wt(e)}(n);case Je.ZodDefault:return function(e,t){return{..._n(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Je.ZodBranded:return Bt(e,n);case Je.ZodReadonly:case Je.ZodCatch:return((e,t)=>_n(e.innerType._def,t))(e,n);case Je.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return _n(e.in._def,t);if("output"===t.pipeStrategy)return _n(e.out._def,t);const n=_n(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,_n(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Je.ZodFunction:case Je.ZodVoid:case Je.ZodSymbol:default:return}};function _n(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,a,n);if(s!==Rt)return s}if(a&&!n){const e=bn(a,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=vn(e,e.typeName,t),o="function"==typeof i?_n(i(),t):i;if(o&&kn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var bn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Vt(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`),Wt(t)):"seen"===t.$refStrategy?Wt(t):void 0}},kn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),xn=(e,t)=>{var n;const r=zt(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var a;return{...e,[t]:null!=(a=_n(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?a:Wt(r)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=_n(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?n:Wt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const c=void 0===s?a?{...i,[r.definitionPath]:a}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return"jsonSchema7"===r.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.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},wn={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},Zn=u.record(u.string(),u.boolean()).describe("Consent requirement mapping"),Sn=u.lazy(()=>u.union([u.string(),u.number(),u.boolean(),jn,u.array(Sn)])),An=u.tuple([Sn,Sn]).describe("Loop: [source, transform] tuple for array transformations"),On=u.array(Sn).describe("Set: Array of values"),Tn=u.record(u.string(),Sn).describe("Map: Object mapping keys to values"),jn=u.object({key:u.string().optional().describe('Property path (e.g., "data.id")'),value:u.union([u.string(),u.number(),u.boolean()]).optional().describe("Static primitive value"),fn:u.string().optional().describe("Function string for custom transformation"),map:Tn.optional().describe("Object with key-value mappings"),loop:An.optional().describe("Tuple [source, transform]"),set:On.optional().describe("Array of values"),consent:Zn.optional().describe("Required consent states"),condition:u.string().optional().describe("Condition function string"),validate:u.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"),Pn=An,Cn=On,Nn=Tn,En=(xn(jn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),xn(Pn,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),xn(Cn,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),xn(Nn,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function $n(e,t={},n={}){n={...En,...n};const r=Object.entries(t).reduce((t,[r,a])=>{const s=e[r];return n.merge&&Array.isArray(s)&&Array.isArray(a)?t[r]=a.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||r in e)&&(t[r]=a),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function In(e){return Array.isArray(e)}function Ln(e){return void 0!==e}function Mn(e){return e===document||e instanceof Element}function Rn(e){return"object"==typeof e&&null!==e&&!In(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Fn(e){return"string"==typeof e}function zn(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Dn(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Un(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Vn(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}var Wn={Commands:{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"},Utils:{Storage:{Cookie:"cookie",Local:"local",Session:"session"}}};function Bn(e,t){return(e.getAttribute(t)||"").trim()}var Kn=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function qn(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,a=e.getBoundingClientRect(),s=a.height,i=a.y,o=i+s,c={x:a.x+e.offsetWidth/2,y:a.y+e.offsetHeight/2};if(s<=r){if(e.offsetWidth+a.width===0||e.offsetHeight+a.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(i<0&&o<e)return!1;if(o>r&&i>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 Hn(e={}){const{cb:t,consent:n,collector:r,storage:a}=e;if(!n)return Jn((a?Qn:er)(e),r,t);{const a=function(e,t){let n;return(r,a)=>{if(Ln(n)&&n===(null==r?void 0:r.group))return;n=null==r?void 0:r.group;let s=()=>er(e);if(e.consent){(function(e,t={},n={}){const r={...t,...n},a={};let s=void 0===e;return Object.keys(r).forEach(t=>{r[t]&&(a[t]=!0,e&&e[t]&&(s=!0))}),!!s&&a})((In(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),a)&&(s=()=>Qn(e))}return Jn(s(),r,t)}}(e,t),s=(In(n)?n:[n]).reduce((e,t)=>({...e,[t]:a}),{});r?r.command("on","consent",s):Kn("walker on","consent",s)}}function Jn(e,t,n){return!1===n?e:(n||(n=Yn),n(e,t,Yn))}var Yn=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):Kn("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):Kn({name:"session start",data:e})),e};function Gn(e,t=wn.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 a,s;switch(t){case wn.Storage.Cookie:a=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case wn.Storage.Local:s=r(window.localStorage.getItem(e));break;case wn.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(a=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=wn.Storage.Session){switch(t){case wn.Storage.Cookie:Xn(e,"",0,t);break;case wn.Storage.Local:window.localStorage.removeItem(e);break;case wn.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),a="")),zn(a||"")}function Xn(e,t,n=30,r=wn.Storage.Session,a){const s={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(s);switch(r){case wn.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let r=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;a&&(r+="; domain="+a),document.cookie=r;break}case wn.Storage.Local:window.localStorage.setItem(e,i);break;case wn.Storage.Session:window.sessionStorage.setItem(e,i)}return Gn(e,r)}function Qn(e={}){const t=Date.now(),{length:n=30,deviceKey:r="elbDeviceId",deviceStorage:a="local",deviceAge:s=30,sessionKey:i="elbSessionId",sessionStorage:o="local",pulse:c=!1}=e,u=er(e);let d=!1;const l=Un((e,t,n)=>{let r=Gn(e,n);return r||(r=Dn(8),Xn(e,r,1440*t,n)),String(r)})(r,s,a),p=Un((e,r)=>{const a=JSON.parse(String(Gn(e,r)));return c||(a.isNew=!1,u.marketing&&(Object.assign(a,u),d=!0),d||a.updated+6e4*n<t?(delete a.id,delete a.referrer,a.start=t,a.count++,a.runs=1,d=!0):a.runs++),a},()=>{d=!0})(i,o)||{},m={id:Dn(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 Xn(i,JSON.stringify(f),2*n,o),f}function er(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),a=e.referrer||document.referrer,s=a&&new URL(a).hostname,i=function(e,t={}){const n="clickId",r={},a={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($n(a,t)).forEach(([t,a])=>{const s=e.searchParams.get(t);s&&(a===n&&(a=t,r[n]=t),r[a]=s)}),r}(r,e.parameters);if(Object.keys(i).length&&(i.marketing||(i.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(r.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:Dn(12),referrer:s},i,e.data):n}function tr(e,t,n=!0){return e+(t=null!=t?(n?"-":"")+t:"")}function nr(e,t,n,r=!0){return mr(Bn(t,tr(e,n,r))||"").reduce((e,n)=>{let[r,a]=fr(n);if(!r)return e;if(a||(r.endsWith(":")&&(r=r.slice(0,-1)),a=""),a.startsWith("#")){a=a.slice(1);try{let e=t[a];e||"selected"!==a||(e=t.options[t.selectedIndex].text),a=String(e)}catch(e){a=""}}return r.endsWith("[]")?(r=r.slice(0,-2),In(e[r])||(e[r]=[]),e[r].push(zn(a))):e[r]=zn(a),e},{})}function rr(e,t=Wn.Commands.Prefix){var n;const r=e||document.body;if(!r)return[];let a=[];const s=Wn.Commands.Action,i=`[${tr(t,s,!1)}]`,o=e=>{Object.keys(nr(t,e,s,!1)).forEach(n=>{a=a.concat(ar(e,n,t))})};return r!==document&&(null==(n=r.matches)?void 0:n.call(r,i))&&o(r),pr(r,i,o),a}function ar(e,t,n=Wn.Commands.Prefix){const r=[],{actions:a,nearestOnly:s}=function(e,t,n){let r=t;for(;r;){const t=Bn(r,tr(e,Wn.Commands.Actions,!1));if(t){const e=or(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const a=Bn(r,tr(e,Wn.Commands.Action,!1));if(a){const e=or(a);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}r=dr(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t);return a.length?(a.forEach(a=>{const i=mr(a.actionParams||"",",").reduce((e,t)=>(e[Vn(t)]=!0,e),{}),o=cr(n,e,i,s);if(!o.length){const t="page",r=`[${tr(n,t)}]`,[a,s]=lr(e,r,n,t);o.push({entity:t,data:a,nested:[],context:s})}o.forEach(e=>{r.push({entity:e.entity,action:a.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r}function sr(e=Wn.Commands.Prefix,t=document){const n=tr(e,Wn.Commands.Globals,!1);let r={};return pr(t,`[${n}]`,t=>{r=$n(r,nr(e,t,Wn.Commands.Globals,!1))}),r}function ir(e,t){const n=window.location,r="page",a=t===document?document.body:t,[s,i]=lr(a,`[${tr(e,r)}]`,e,r);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 or(e){const t={};return mr(e).forEach(e=>{const[n,r]=fr(e),[a,s]=hr(n);if(!a)return;let[i,o]=hr(r||"");i=i||a,t[a]||(t[a]=[]),t[a].push({trigger:a,triggerParams:s,action:i,actionParams:o})}),t}function cr(e,t,n,r=!1){const a=[];let s=t;for(n=0!==Object.keys(n||{}).length?n:void 0;s;){const i=ur(e,s,t,n);if(i&&(a.push(i),r))break;s=dr(e,s)}return a}function ur(e,t,n,r){const a=Bn(t,tr(e));if(!a||r&&!r[a])return null;const s=[t],i=`[${tr(e,a)}],[${tr(e,"")}]`,o=tr(e,Wn.Commands.Link,!1);let c={};const u=[],[d,l]=lr(n||t,i,e,a);pr(t,`[${o}]`,t=>{const[n,r]=fr(Bn(t,o));"parent"===r&&pr(document.body,`[${o}="${n}:child"]`,t=>{s.push(t);const n=ur(e,t);n&&u.push(n)})});const p=[];s.forEach(e=>{e.matches(i)&&p.push(e),pr(e,i,e=>p.push(e))});let m={};return p.forEach(t=>{m=$n(m,nr(e,t,"")),c=$n(c,nr(e,t,a))}),c=$n($n(m,c),d),s.forEach(t=>{pr(t,`[${tr(e)}]`,t=>{const n=ur(e,t);n&&u.push(n)})}),{entity:a,data:c,context:l,nested:u}}function dr(e,t){const n=tr(e,Wn.Commands.Link,!1);if(t.matches(`[${n}]`)){const[e,r]=fr(Bn(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 lr(e,t,n,r){let a={};const s={};let i=e;const o=`[${tr(n,Wn.Commands.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(a=$n(nr(n,i,""),a),a=$n(nr(n,i,r),a)),i.matches(o)&&(Object.entries(nr(n,i,Wn.Commands.Context,!1)).forEach(([e,t])=>{t&&!s[e]&&(s[e]=[t,c])}),++c),i=dr(n,i);return[a,s]}function pr(e,t,n){e.querySelectorAll(t).forEach(n)}function mr(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function fr(e){const[t,n]=e.split(/:(.+)/,2);return[Vn(t),Vn(n)]}function hr(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var gr=new WeakMap,yr=new WeakMap,vr=new WeakMap;function _r(e){const t=Date.now();let n=yr.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:qn(e),lastChecked:t},yr.set(e,n)),n.isVisible}function br(e){if(window.IntersectionObserver)return Un(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,r;const a=t.target,s=vr.get(e);if(!s)return;const i=s.timers.get(a);if(t.intersectionRatio>0){const r=Date.now();let o=gr.get(a);(!o||r-o.lastChecked>1e3)&&(o={isLarge:a.offsetHeight>window.innerHeight,lastChecked:r},gr.set(a,o));if(t.intersectionRatio>=.5||o.isLarge&&_r(a)){const t=null==(n=s.elementConfigs)?void 0:n.get(a);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!i){const t=window.setTimeout(async()=>{var t,n;if(_r(a)){const r=null==(t=s.elementConfigs)?void 0:t.get(a);(null==r?void 0:r.context)&&await Rr(r.context,a,r.trigger);const i=null==(n=s.elementConfigs)?void 0:n.get(a);(null==i?void 0:i.multiple)?i.blocked=!0:function(e,t){const n=vr.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),gr.delete(t),yr.delete(t)}(e,a)}},s.duration);s.timers.set(a,t)}return}}i&&(clearTimeout(i),s.timers.delete(a));const o=null==(r=s.elementConfigs)?void 0:r.get(a);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function kr(e,t,n={multiple:!1}){var r;const a=e.settings.scope||document,s=vr.get(a);(null==s?void 0:s.observer)&&t&&(s.elementConfigs||(s.elementConfigs=new WeakMap),s.elementConfigs.set(t,{multiple:null!=(r=n.multiple)&&r,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),s.observer.observe(t))}function xr(e){if(!e)return;const t=vr.get(e);t&&(t.observer&&t.observer.disconnect(),vr.delete(e))}function wr(e,t,n,r,a,s,i){const{elb:o,settings:c}=e;if(Fn(t)&&t.startsWith("walker "))return o(t,n);if(Rn(t)){const e=t;return e.source||(e.source=Zr()),e.globals||(e.globals=sr(c.prefix,c.scope||document)),o(e)}const[u]=String(Rn(t)?t.name:t).split(" ");let d,l=Rn(n)?n:{},p={},m=!1;if(Mn(n)&&(d=n,m=!0),Mn(a)?d=a:Rn(a)&&Object.keys(a).length&&(p=a),d){const e=cr(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=sr(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:s,custom:i,trigger:Fn(r)?r:"",source:Zr()})}function Zr(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Sr,Ar=[],Or="click",Tr="hover",jr="load",Pr="pulse",Cr="scroll",Nr="submit",Er="impression",$r="visible",Ir="wait";function Lr(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;if(!n)return;n.addEventListener("click",Un(function(t){zr.call(this,e,t)})),n.addEventListener("submit",Un(function(t){Dr.call(this,e,t)}))}(e,t)}function Mr(e,t){if(!t.scope)return;!function(e,t){const n=t.scope;Ar=[];const r=n||document;xr(r),function(e,t=1e3){vr.has(e)||vr.set(e,{observer:br(e),timers:new WeakMap,duration:t})}(r,1e3);const a=tr(t.prefix,Wn.Commands.Action,!1);r!==document&&Fr(e,r,a,t);r.querySelectorAll(`[${a}]`).forEach(n=>{Fr(e,n,a,t)}),Ar.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const r=window.scrollY+window.innerHeight,a=e.offsetTop;if(r<a)return!0;const s=e.clientHeight;return!(100*(1-(a+s-r)/(s||1))>=n)||(Rr(t,e,Cr),!1)});Sr||(Sr=function(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}(function(){Ar=n.call(t,Ar,e)}),t.addEventListener("scroll",Sr))}(e,r)}(e,t)}async function Rr(e,t,n){const r=ar(t,n,e.settings.prefix);return Promise.all(r.map(t=>wr(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Fr(e,t,n,r){const a=Bn(t,n);a&&Object.values(or(a)).forEach(n=>n.forEach(n=>{switch(n.trigger){case Tr:!function(e,t){t.addEventListener("mouseenter",Un(function(t){t.target instanceof Element&&Rr(e,t.target,Tr)}))}(e,t);break;case jr:!function(e,t){Rr(e,t,jr)}(e,t);break;case Pr:!function(e,t,n=""){setInterval(()=>{document.hidden||Rr(e,t,Pr)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Cr:!function(e,t=""){const n=parseInt(t||"")||50;if(n<0||n>100)return;Ar.push([e,n])}(t,n.triggerParams);break;case Er:kr(e,t);break;case $r:kr(e,t,{multiple:!0});break;case Ir:!function(e,t,n=""){setTimeout(()=>Rr(e,t,Ir),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}}))}function zr(e,t){Rr(e,t.target,Or)}function Dr(e,t){t.target&&Rr(e,t.target,Nr)}function Ur(e,t={}){const n=t.name||"elbLayer",r=t.window||window;if(!r)return;const a=r;a[n]||(a[n]=[]);const s=a[n];s.push=function(...n){if(Br(n[0])){const r=[...Array.from(n[0])],a=Array.prototype.push.apply(this,[r]);return Wr(e,t.prefix,r),a}const r=Array.prototype.push.apply(this,n);return n.forEach(n=>{Wr(e,t.prefix,n)}),r},Array.isArray(s)&&s.length>0&&function(e,t="data-elb",n){Vr(e,t,n,!0),Vr(e,t,n,!1),n.length=0}(e,t.prefix,s)}function Vr(e,t,n,r){const a=[];let s=!0;n.forEach(e=>{const t=Br(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=!Rn(i)&&Fn(i)&&i.startsWith("walker ");if(Rn(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Fn(e[0])||""===e[0].trim())return;const n="walker run";s&&e[0]===n&&(s=!1)}(r&&o||!r&&!o)&&a.push(t)}),a.forEach(n=>{Wr(e,t,n)})}function Wr(e,t="data-elb",n){Un(()=>{if(Array.isArray(n)){const[r,...a]=n;if(!r||Fn(r)&&""===r.trim())return;if(Fn(r)&&r.startsWith("walker "))return void e(r,a[0]);wr({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},r,...a)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Br(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Kr(e,t={}){return Hn({...t,collector:{push:e,group:void 0}})}var qr={},Hr={};a(Hr,{env:()=>Jr});var Jr={};a(Jr,{push:()=>Xr});var Yr=()=>{},Gr=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Xr={get push(){return Gr()},get command(){return Gr()},get elb(){return Gr()},get window(){return{addEventListener:Yr,removeEventListener:Yr,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:Yr,removeEventListener:Yr,querySelector:Yr,querySelectorAll:()=>[],getElementById:Yr,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Yr,getAttribute:Yr,addEventListener:Yr,removeEventListener:Yr}),body:{appendChild:Yr,removeChild:Yr},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}};function Qr(e={}){const t=e.prefix||"data-elb";return function(e){let n,r=e;const a={},s={},i={},o={},c={},u={};function d(e){return Object.entries(e).map(([e,t])=>`${e}:${function(e){if(!Ln(e)||null===e)return"undefined";let t=String(e);return t=t.replace(/\\/g,"\\\\"),t=t.replace(/;/g,"\\;"),t=t.replace(/:/g,"\\:"),t=t.replace(/'/g,"\\'"),t}(t)}`).join(";")}const l={entity:e=>(n=e,r=e,l),data(e,t){const n=null!=r?r:"";return a[n]||(a[n]={}),Fn(e)?a[n][e]=t:Object.assign(a[n],e),l},action(e,t){if(Fn(e))if(Ln(t))s[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);s[t]=n}else s[e]=e;else Object.assign(s,e);return l},actions(e,t){if(Fn(e))if(Ln(t))i[e]=t;else if(e.includes(":")){const[t,n]=e.split(":",2);i[t]=n}else i[e]=e;else Object.assign(i,e);return l},context:(e,t)=>(Fn(e)?o[e]=t:Object.assign(o,e),l),globals:(e,t)=>(Fn(e)?c[e]=t:Object.assign(c,e),l),link:(e,t)=>(Fn(e)?u[e]=t:Object.assign(u,e),l),get(){const e={};return n&&(e[t]=n),Object.entries(a).forEach(([n,r])=>{if(Object.keys(r).length>0){e[n?`${t}-${n}`:`${t}-`]=d(r)}}),Object.keys(s).length>0&&(e[`${t}action`]=d(s)),Object.keys(i).length>0&&(e[`${t}actions`]=d(i)),Object.keys(o).length>0&&(e[`${t}context`]=d(o)),Object.keys(c).length>0&&(e[`${t}globals`]=d(c)),Object.keys(u).length>0&&(e[`${t}link`]=d(u)),e}};return l}}var ea,ta=async(e,t)=>{const{elb:n,window:r,document:a}=t,s=(null==e?void 0:e.settings)||{},i=r||(void 0!==globalThis.window?globalThis.window:void 0),o=a||(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&&Ur(n,{name:Fn(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:i}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;Kr(n,e)}await async function(e,t,n){const r=()=>{e(t,n)};"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}(Lr,d,c);(()=>{if(Mr(d,c),c.pageview){const[e,t]=ir(c.prefix||"data-elb",c.scope);wr(d,"page view",e,"load",t)}})(),Fn(c.elb)&&c.elb&&(i[c.elb]=(...e)=>{const[t,n,r,a,s,i]=e;return wr(d,t,n,r,a,s,i)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,r,a,s,i]=e;return wr(d,t,n,r,a,s,i)},destroy:async()=>{o&&xr(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;Kr(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&i&&(Mr(d,c),c.pageview)){const[e,t]=ir(c.prefix||"data-elb",c.scope);wr(d,"page view",e,"load",t)}}}}},na=ta;return ea=s,((a,s,i,o)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of n(s))r.call(a,c)||c===i||e(a,c,{get:()=>s[c],enumerable:!(o=t(s,c))||o.enumerable});return a})(e({},"__esModule",{value:!0}),ea)})();
package/dist/index.d.mts CHANGED
@@ -44,8 +44,9 @@ interface Settings extends Record<string, unknown> {
44
44
  }
45
45
  interface Mapping {
46
46
  }
47
- type Push = Elb.Fn;
47
+ type Push = BrowserPush;
48
48
  interface Env extends Source.BaseEnv {
49
+ elb: Elb.Fn;
49
50
  window?: Window & typeof globalThis;
50
51
  document?: Document;
51
52
  }
package/dist/index.d.ts CHANGED
@@ -44,8 +44,9 @@ interface Settings extends Record<string, unknown> {
44
44
  }
45
45
  interface Mapping {
46
46
  }
47
- type Push = Elb.Fn;
47
+ type Push = BrowserPush;
48
48
  interface Env extends Source.BaseEnv {
49
+ elb: Elb.Fn;
49
50
  window?: Window & typeof globalThis;
50
51
  document?: Document;
51
52
  }