@milaboratories/milaboratories.monetization-test.ui 1.1.136 → 1.1.138

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.
@@ -14,7 +14,7 @@ var B3=Object.defineProperty;var dw=A=>{throw TypeError(A)};var w3=(A,e,t)=>e in
14
14
  * @vue/runtime-dom v3.5.24
15
15
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
16
  * @license MIT
17
- **/let pC;const Rw=typeof window<"u"&&window.trustedTypes;if(Rw)try{pC=Rw.createPolicy("vue",{createHTML:A=>A})}catch{}const CQ=pC?A=>pC.createHTML(A):A=>A,BS="http://www.w3.org/2000/svg",wS="http://www.w3.org/1998/Math/MathML",cr=typeof document<"u"?document:null,Yw=cr&&cr.createElement("template"),mS={insert:(A,e,t)=>{e.insertBefore(A,t||null)},remove:A=>{const e=A.parentNode;e&&e.removeChild(A)},createElement:(A,e,t,i)=>{const o=e==="svg"?cr.createElementNS(BS,A):e==="mathml"?cr.createElementNS(wS,A):t?cr.createElement(A,{is:t}):cr.createElement(A);return A==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:A=>cr.createTextNode(A),createComment:A=>cr.createComment(A),setText:(A,e)=>{A.nodeValue=e},setElementText:(A,e)=>{A.textContent=e},parentNode:A=>A.parentNode,nextSibling:A=>A.nextSibling,querySelector:A=>cr.querySelector(A),setScopeId(A,e){A.setAttribute(e,"")},insertStaticContent(A,e,t,i,o,r){const s=t?t.previousSibling:e.lastChild;if(o&&(o===r||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),t),!(o===r||!(o=o.nextSibling)););else{Yw.innerHTML=CQ(i==="svg"?`<svg>${A}</svg>`:i==="mathml"?`<math>${A}</math>`:A);const n=Yw.content;if(i==="svg"||i==="mathml"){const a=n.firstChild;for(;a.firstChild;)n.appendChild(a.firstChild);n.removeChild(a)}e.insertBefore(n,t)}return[s?s.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Nr="transition",_a="animation",ng=Symbol("_vtc"),fQ={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},ES=_e({},SI,fQ),vS=A=>(A.displayName="Transition",A.props=ES,A),sB=vS((A,{slots:e})=>CS(fy,IS(A),e)),Ts=(A,e=[])=>{SA(A)?A.forEach(t=>t(...e)):A&&A(...e)},kw=A=>A?SA(A)?A.some(e=>e.length>1):A.length>1:!1;function IS(A){const e={};for(const F in A)F in fQ||(e[F]=A[F]);if(A.css===!1)return e;const{name:t="v",type:i,duration:o,enterFromClass:r=`${t}-enter-from`,enterActiveClass:s=`${t}-enter-active`,enterToClass:n=`${t}-enter-to`,appearFromClass:a=r,appearActiveClass:l=s,appearToClass:g=n,leaveFromClass:c=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:h=`${t}-leave-to`}=A,u=QS(o),p=u&&u[0],C=u&&u[1],{onBeforeEnter:f,onEnter:B,onEnterCancelled:w,onLeave:m,onLeaveCancelled:E,onBeforeAppear:v=f,onAppear:x=B,onAppearCancelled:I=w}=e,b=(F,AA,U,N)=>{F._enterCancelled=N,Ls(F,AA?g:n),Ls(F,AA?l:s),U&&U()},G=(F,AA)=>{F._isLeaving=!1,Ls(F,c),Ls(F,h),Ls(F,d),AA&&AA()},k=F=>(AA,U)=>{const N=F?x:B,Y=()=>b(AA,F,U);Ts(N,[AA,Y]),Gw(()=>{Ls(AA,F?a:r),nr(AA,F?g:n),kw(N)||Tw(AA,i,p,Y)})};return _e(e,{onBeforeEnter(F){Ts(f,[F]),nr(F,r),nr(F,s)},onBeforeAppear(F){Ts(v,[F]),nr(F,a),nr(F,l)},onEnter:k(!1),onAppear:k(!0),onLeave(F,AA){F._isLeaving=!0;const U=()=>G(F,AA);nr(F,c),F._enterCancelled?(nr(F,d),Hw(F)):(Hw(F),nr(F,d)),Gw(()=>{F._isLeaving&&(Ls(F,c),nr(F,h),kw(m)||Tw(F,i,C,U))}),Ts(m,[F,U])},onEnterCancelled(F){b(F,!1,void 0,!0),Ts(w,[F])},onAppearCancelled(F){b(F,!0,void 0,!0),Ts(I,[F])},onLeaveCancelled(F){G(F),Ts(E,[F])}})}function QS(A){if(A==null)return null;if(Ce(A))return[ep(A.enter),ep(A.leave)];{const e=ep(A);return[e,e]}}function ep(A){return Q3(A)}function nr(A,e){e.split(/\s+/).forEach(t=>t&&A.classList.add(t)),(A[ng]||(A[ng]=new Set)).add(e)}function Ls(A,e){e.split(/\s+/).forEach(i=>i&&A.classList.remove(i));const t=A[ng];t&&(t.delete(e),t.size||(A[ng]=void 0))}function Gw(A){requestAnimationFrame(()=>{requestAnimationFrame(A)})}let bS=0;function Tw(A,e,t,i){const o=A._endId=++bS,r=()=>{o===A._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:s,timeout:n,propCount:a}=DS(A,e);if(!s)return i();const l=s+"end";let g=0;const c=()=>{A.removeEventListener(l,d),r()},d=h=>{h.target===A&&++g>=a&&c()};setTimeout(()=>{g<a&&c()},n+1),A.addEventListener(l,d)}function DS(A,e){const t=window.getComputedStyle(A),i=u=>(t[u]||"").split(", "),o=i(`${Nr}Delay`),r=i(`${Nr}Duration`),s=Lw(o,r),n=i(`${_a}Delay`),a=i(`${_a}Duration`),l=Lw(n,a);let g=null,c=0,d=0;e===Nr?s>0&&(g=Nr,c=s,d=r.length):e===_a?l>0&&(g=_a,c=l,d=a.length):(c=Math.max(s,l),g=c>0?s>l?Nr:_a:null,d=g?g===Nr?r.length:a.length:0);const h=g===Nr&&/\b(?:transform|all)(?:,|$)/.test(i(`${Nr}Property`).toString());return{type:g,timeout:c,propCount:d,hasTransform:h}}function Lw(A,e){for(;A.length<e.length;)A=A.concat(A);return Math.max(...e.map((t,i)=>Uw(t)+Uw(A[i])))}function Uw(A){return A==="auto"?0:Number(A.slice(0,-1).replace(",","."))*1e3}function Hw(A){return(A?A.ownerDocument:document).body.offsetHeight}function xS(A,e,t){const i=A[ng];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?A.removeAttribute("class"):t?A.setAttribute("class",e):A.className=e}const Td=Symbol("_vod"),BQ=Symbol("_vsh"),MS={name:"show",beforeMount(A,{value:e},{transition:t}){A[Td]=A.style.display==="none"?"":A.style.display,t&&e?t.beforeEnter(A):$a(A,e)},mounted(A,{value:e},{transition:t}){t&&e&&t.enter(A)},updated(A,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(A),$a(A,!0),i.enter(A)):i.leave(A,()=>{$a(A,!1)}):$a(A,e))},beforeUnmount(A,{value:e}){$a(A,e)}};function $a(A,e){A.style.display=e?A[Td]:"none",A[BQ]=!e}const wQ=Symbol("");function mQ(A){const e=Sn();if(!e)return;const t=e.ut=(o=A(e.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${e.uid}"]`)).forEach(r=>Ld(r,o))},i=()=>{const o=A(e.proxy);e.ce?Ld(e.ce,o):CC(e.subTree,o),t(o)};LI(()=>{II(i)}),$o(()=>{le(i,ao,{flush:"post"});const o=new MutationObserver(i);o.observe(e.subTree.el.parentNode,{childList:!0}),Zg(()=>o.disconnect())})}function CC(A,e){if(A.shapeFlag&128){const t=A.suspense;A=t.activeBranch,t.pendingBranch&&!t.isHydrating&&t.effects.push(()=>{CC(t.activeBranch,e)})}for(;A.component;)A=A.component.subTree;if(A.shapeFlag&1&&A.el)Ld(A.el,e);else if(A.type===ie)A.children.forEach(t=>CC(t,e));else if(A.type===Gl){let{el:t,anchor:i}=A;for(;t&&(Ld(t,e),t!==i);)t=t.nextSibling}}function Ld(A,e){if(A.nodeType===1){const t=A.style;let i="";for(const o in e){const r=P3(e[o]);t.setProperty(`--${o}`,r),i+=`--${o}: ${r};`}t[wQ]=i}}const FS=/(?:^|;)\s*display\s*:/;function yS(A,e,t){const i=A.style,o=Pe(t);let r=!1;if(t&&!o){if(e)if(Pe(e))for(const s of e.split(";")){const n=s.slice(0,s.indexOf(":")).trim();t[n]==null&&sd(i,n,"")}else for(const s in e)t[s]==null&&sd(i,s,"");for(const s in t)s==="display"&&(r=!0),sd(i,s,t[s])}else if(o){if(e!==t){const s=i[wQ];s&&(t+=";"+s),i.cssText=t,r=FS.test(t)}}else e&&A.removeAttribute("style");Td in A&&(A[Td]=r?i.display:"",A[BQ]&&(i.display="none"))}const Nw=/\s*!important$/;function sd(A,e,t){if(SA(t))t.forEach(i=>sd(A,e,i));else if(t==null&&(t=""),e.startsWith("--"))A.setProperty(e,t);else{const i=SS(A,e);Nw.test(t)?A.setProperty(kr(i),t.replace(Nw,""),"important"):A[i]=t}}const zw=["Webkit","Moz","ms"],tp={};function SS(A,e){const t=tp[e];if(t)return t;let i=Di(e);if(i!=="filter"&&i in A)return tp[e]=i;i=Gh(i);for(let o=0;o<zw.length;o++){const r=zw[o]+i;if(r in A)return tp[e]=r}return e}const Ow="http://www.w3.org/1999/xlink";function Vw(A,e,t,i,o,r=y3(e)){i&&e.startsWith("xlink:")?t==null?A.removeAttributeNS(Ow,e.slice(6,e.length)):A.setAttributeNS(Ow,e,t):t==null||r&&!_v(t)?A.removeAttribute(e):A.setAttribute(e,r?"":Co(t)?String(t):t)}function jw(A,e,t,i,o){if(e==="innerHTML"||e==="textContent"){t!=null&&(A[e]=e==="innerHTML"?CQ(t):t);return}const r=A.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const n=r==="OPTION"?A.getAttribute("value")||"":A.value,a=t==null?A.type==="checkbox"?"on":"":String(t);(n!==a||!("_value"in A))&&(A.value=a),t==null&&A.removeAttribute(e),A._value=t;return}let s=!1;if(t===""||t==null){const n=typeof A[e];n==="boolean"?t=_v(t):t==null&&n==="string"?(t="",s=!0):n==="number"&&(t=0,s=!0)}try{A[e]=t}catch{}s&&A.removeAttribute(o||e)}function wr(A,e,t,i){A.addEventListener(e,t,i)}function PS(A,e,t,i){A.removeEventListener(e,t,i)}const Jw=Symbol("_vei");function RS(A,e,t,i,o=null){const r=A[Jw]||(A[Jw]={}),s=r[e];if(i&&s)s.value=i;else{const[n,a]=YS(e);if(i){const l=r[e]=TS(i,o);wr(A,n,l,a)}else s&&(PS(A,n,s,a),r[e]=void 0)}}const Ww=/(?:Once|Passive|Capture)$/;function YS(A){let e;if(Ww.test(A)){e={};let i;for(;i=A.match(Ww);)A=A.slice(0,A.length-i[0].length),e[i[0].toLowerCase()]=!0}return[A[2]===":"?A.slice(3):kr(A.slice(2)),e]}let ip=0;const kS=Promise.resolve(),GS=()=>ip||(kS.then(()=>ip=0),ip=Date.now());function TS(A,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;fo(LS(i,t.value),e,5,[i])};return t.value=A,t.attached=GS(),t}function LS(A,e){if(SA(e)){const t=A.stopImmediatePropagation;return A.stopImmediatePropagation=()=>{t.call(A),A._stopped=!0},e.map(i=>o=>!o._stopped&&i&&i(o))}else return e}const Kw=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&A.charCodeAt(2)>96&&A.charCodeAt(2)<123,US=(A,e,t,i,o,r)=>{const s=o==="svg";e==="class"?xS(A,i,s):e==="style"?yS(A,t,i):Yh(e)?Of(e)||RS(A,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):HS(A,e,i,s))?(jw(A,e,i),!A.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Vw(A,e,i,s,r,e!=="value")):A._isVueCE&&(/[A-Z]/.test(e)||!Pe(i))?jw(A,Di(e),i,r,e):(e==="true-value"?A._trueValue=i:e==="false-value"&&(A._falseValue=i),Vw(A,e,i,s))};function HS(A,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in A&&Kw(e)&&jA(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&A.tagName==="IFRAME"||e==="form"||e==="list"&&A.tagName==="INPUT"||e==="type"&&A.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const o=A.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Kw(e)&&Pe(t)?!1:e in A}function EQ(A="$style"){{const e=Sn();if(!e)return ee;const t=e.type.__cssModules;if(!t)return ee;const i=t[A];return i||ee}}const vs=A=>{const e=A.props["onUpdate:modelValue"]||!1;return SA(e)?t=>id(e,t):e};function NS(A){A.target.composing=!0}function Xw(A){const e=A.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ui=Symbol("_assign");function qw(A,e,t){return e&&(A=A.trim()),t&&(A=Th(A)),A}const ag={created(A,{modifiers:{lazy:e,trim:t,number:i}},o){A[Ui]=vs(o);const r=i||o.props&&o.props.type==="number";wr(A,e?"change":"input",s=>{s.target.composing||A[Ui](qw(A.value,t,r))}),(t||r)&&wr(A,"change",()=>{A.value=qw(A.value,t,r)}),e||(wr(A,"compositionstart",NS),wr(A,"compositionend",Xw),wr(A,"change",Xw))},mounted(A,{value:e}){A.value=e??""},beforeUpdate(A,{value:e,oldValue:t,modifiers:{lazy:i,trim:o,number:r}},s){if(A[Ui]=vs(s),A.composing)return;const n=(r||A.type==="number")&&!/^0\d/.test(A.value)?Th(A.value):A.value,a=e??"";n!==a&&(document.activeElement===A&&A.type!=="range"&&(i&&e===t||o&&A.value.trim()===a)||(A.value=a))}},zS={deep:!0,created(A,e,t){A[Ui]=vs(t),wr(A,"change",()=>{const i=A._modelValue,o=Ia(A),r=A.checked,s=A[Ui];if(SA(i)){const n=Jf(i,o),a=n!==-1;if(r&&!a)s(i.concat(o));else if(!r&&a){const l=[...i];l.splice(n,1),s(l)}}else if(Ga(i)){const n=new Set(i);r?n.add(o):n.delete(o),s(n)}else s(vQ(A,r))})},mounted:Zw,beforeUpdate(A,e,t){A[Ui]=vs(t),Zw(A,e,t)}};function Zw(A,{value:e,oldValue:t},i){A._modelValue=e;let o;if(SA(e))o=Jf(e,i.props.value)>-1;else if(Ga(e))o=e.has(i.props.value);else{if(e===t)return;o=dn(e,vQ(A,!0))}A.checked!==o&&(A.checked=o)}const OS={created(A,{value:e},t){A.checked=dn(e,t.props.value),A[Ui]=vs(t),wr(A,"change",()=>{A[Ui](Ia(A))})},beforeUpdate(A,{value:e,oldValue:t},i){A[Ui]=vs(i),e!==t&&(A.checked=dn(e,i.props.value))}},VS={deep:!0,created(A,{value:e,modifiers:{number:t}},i){const o=Ga(e);wr(A,"change",()=>{const r=Array.prototype.filter.call(A.options,s=>s.selected).map(s=>t?Th(Ia(s)):Ia(s));A[Ui](A.multiple?o?new Set(r):r:r[0]),A._assigning=!0,Vh(()=>{A._assigning=!1})}),A[Ui]=vs(i)},mounted(A,{value:e}){_w(A,e)},beforeUpdate(A,e,t){A[Ui]=vs(t)},updated(A,{value:e}){A._assigning||_w(A,e)}};function _w(A,e){const t=A.multiple,i=SA(e);if(!(t&&!i&&!Ga(e))){for(let o=0,r=A.options.length;o<r;o++){const s=A.options[o],n=Ia(s);if(t)if(i){const a=typeof n;a==="string"||a==="number"?s.selected=e.some(l=>String(l)===String(n)):s.selected=Jf(e,n)>-1}else s.selected=e.has(n);else if(dn(Ia(s),e)){A.selectedIndex!==o&&(A.selectedIndex=o);return}}!t&&A.selectedIndex!==-1&&(A.selectedIndex=-1)}}function Ia(A){return"_value"in A?A._value:A.value}function vQ(A,e){const t=e?"_trueValue":"_falseValue";return t in A?A[t]:e}const jS={created(A,e,t){Mc(A,e,t,null,"created")},mounted(A,e,t){Mc(A,e,t,null,"mounted")},beforeUpdate(A,e,t,i){Mc(A,e,t,i,"beforeUpdate")},updated(A,e,t,i){Mc(A,e,t,i,"updated")}};function JS(A,e){switch(A){case"SELECT":return VS;case"TEXTAREA":return ag;default:switch(e){case"checkbox":return zS;case"radio":return OS;default:return ag}}}function Mc(A,e,t,i,o){const s=JS(A.tagName,t.props&&t.props.type)[o];s&&s(A,e,t,i)}const WS=["ctrl","shift","alt","meta"],KS={stop:A=>A.stopPropagation(),prevent:A=>A.preventDefault(),self:A=>A.target!==A.currentTarget,ctrl:A=>!A.ctrlKey,shift:A=>!A.shiftKey,alt:A=>!A.altKey,meta:A=>!A.metaKey,left:A=>"button"in A&&A.button!==0,middle:A=>"button"in A&&A.button!==1,right:A=>"button"in A&&A.button!==2,exact:(A,e)=>WS.some(t=>A[`${t}Key`]&&!e.includes(t))},we=(A,e)=>{const t=A._withMods||(A._withMods={}),i=e.join(".");return t[i]||(t[i]=(o,...r)=>{for(let s=0;s<e.length;s++){const n=KS[e[s]];if(n&&n(o,e))return}return A(o,...r)})},XS={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Qa=(A,e)=>{const t=A._withKeys||(A._withKeys={}),i=e.join(".");return t[i]||(t[i]=o=>{if(!("key"in o))return;const r=kr(o.key);if(e.some(s=>s===r||XS[s]===r))return A(o)})},qS=_e({patchProp:US},mS);let $w;function ZS(){return $w||($w=Oy(qS))}const _S=(...A)=>{const e=ZS().createApp(...A),{mount:t}=e;return e.mount=i=>{const o=A5(i);if(!o)return;const r=e._component;!jA(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=t(o,!1,$S(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},e};function $S(A){if(A instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&A instanceof MathMLElement)return"mathml"}function A5(A){return Pe(A)?document.querySelector(A):A}var e5=Object.defineProperty,t5=(A,e,t)=>e in A?e5(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,i5=(A,e,t)=>t5(A,e+"",t);function o5(A,e){if(A==null)throw Error(e);return A}function wl(A){return new Promise(e=>setTimeout(e,A))}function r5(A,e){return e(A)}let s5=class{constructor(){i5(this,"promises",new Map)}fetch(e,t){if(this.promises.has(e))return this.promises.get(e);const i=t().finally(()=>{this.promises.delete(e)});return this.promises.set(e,i),i}};function op(A){return{type:"Immediate",value:A}}function n5(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function IQ(A){if(A&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(A);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function a5(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function ce(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function Al(A,e){const t=a5();if(t===void 0)return!1;if(A in t.callbackRegistry)throw new Error(`Callback with key ${A} already registered.`);return t.callbackRegistry[A]=e,!0}const rp=new Map;function l5(A,e){A in ce().callbackRegistry||(ce().callbackRegistry[A]=t=>{for(const i of rp.get(A))i(t)},rp.set(A,[])),rp.get(A).push(e)}var oe;(function(A){A.assertEqual=o=>o;function e(o){}A.assertIs=e;function t(o){throw new Error}A.assertNever=t,A.arrayToEnum=o=>{const r={};for(const s of o)r[s]=s;return r},A.getValidEnumValues=o=>{const r=A.objectKeys(o).filter(n=>typeof o[o[n]]!="number"),s={};for(const n of r)s[n]=o[n];return A.objectValues(s)},A.objectValues=o=>A.objectKeys(o).map(function(r){return o[r]}),A.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const r=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&r.push(s);return r},A.find=(o,r)=>{for(const s of o)if(r(s))return s},A.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function i(o,r=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(r)}A.joinValues=i,A.jsonStringifyReplacer=(o,r)=>typeof r=="bigint"?r.toString():r})(oe||(oe={}));var fC;(function(A){A.mergeShapes=(e,t)=>({...e,...t})})(fC||(fC={}));const IA=oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rs=A=>{switch(typeof A){case"undefined":return IA.undefined;case"string":return IA.string;case"number":return isNaN(A)?IA.nan:IA.number;case"boolean":return IA.boolean;case"function":return IA.function;case"bigint":return IA.bigint;case"symbol":return IA.symbol;case"object":return Array.isArray(A)?IA.array:A===null?IA.null:A.then&&typeof A.then=="function"&&A.catch&&typeof A.catch=="function"?IA.promise:typeof Map<"u"&&A instanceof Map?IA.map:typeof Set<"u"&&A instanceof Set?IA.set:typeof Date<"u"&&A instanceof Date?IA.date:IA.object;default:return IA.unknown}},rA=oe.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"]),g5=A=>JSON.stringify(A,null,2).replace(/"([^"]+)":/g,"$1:");class Ii extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},i={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)i._errors.push(t(s));else{let n=i,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(t(s))):n[l]=n[l]||{_errors:[]},n=n[l],a++}}};return o(this),i}static assert(e){if(!(e instanceof Ii))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}Ii.create=A=>new Ii(A);const ba=(A,e)=>{let t;switch(A.code){case rA.invalid_type:A.received===IA.undefined?t="Required":t=`Expected ${A.expected}, received ${A.received}`;break;case rA.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(A.expected,oe.jsonStringifyReplacer)}`;break;case rA.unrecognized_keys:t=`Unrecognized key(s) in object: ${oe.joinValues(A.keys,", ")}`;break;case rA.invalid_union:t="Invalid input";break;case rA.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${oe.joinValues(A.options)}`;break;case rA.invalid_enum_value:t=`Invalid enum value. Expected ${oe.joinValues(A.options)}, received '${A.received}'`;break;case rA.invalid_arguments:t="Invalid function arguments";break;case rA.invalid_return_type:t="Invalid function return type";break;case rA.invalid_date:t="Invalid date";break;case rA.invalid_string:typeof A.validation=="object"?"includes"in A.validation?(t=`Invalid input: must include "${A.validation.includes}"`,typeof A.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${A.validation.position}`)):"startsWith"in A.validation?t=`Invalid input: must start with "${A.validation.startsWith}"`:"endsWith"in A.validation?t=`Invalid input: must end with "${A.validation.endsWith}"`:oe.assertNever(A.validation):A.validation!=="regex"?t=`Invalid ${A.validation}`:t="Invalid";break;case rA.too_small:A.type==="array"?t=`Array must contain ${A.exact?"exactly":A.inclusive?"at least":"more than"} ${A.minimum} element(s)`:A.type==="string"?t=`String must contain ${A.exact?"exactly":A.inclusive?"at least":"over"} ${A.minimum} character(s)`:A.type==="number"?t=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`:A.type==="date"?t=`Date must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(A.minimum))}`:t="Invalid input";break;case rA.too_big:A.type==="array"?t=`Array must contain ${A.exact?"exactly":A.inclusive?"at most":"less than"} ${A.maximum} element(s)`:A.type==="string"?t=`String must contain ${A.exact?"exactly":A.inclusive?"at most":"under"} ${A.maximum} character(s)`:A.type==="number"?t=`Number must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`:A.type==="bigint"?t=`BigInt must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`:A.type==="date"?t=`Date must be ${A.exact?"exactly":A.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(A.maximum))}`:t="Invalid input";break;case rA.custom:t="Invalid input";break;case rA.invalid_intersection_types:t="Intersection results could not be merged";break;case rA.not_multiple_of:t=`Number must be a multiple of ${A.multipleOf}`;break;case rA.not_finite:t="Number must be finite";break;default:t=e.defaultError,oe.assertNever(A)}return{message:t}};let QQ=ba;function c5(A){QQ=A}function Ud(){return QQ}const Hd=A=>{const{data:e,path:t,errorMaps:i,issueData:o}=A,r=[...t,...o.path||[]],s={...o,path:r};if(o.message!==void 0)return{...o,path:r,message:o.message};let n="";const a=i.filter(l=>!!l).slice().reverse();for(const l of a)n=l(s,{data:e,defaultError:n}).message;return{...o,path:r,message:n}},d5=[];function mA(A,e){const t=Ud(),i=Hd({issueData:e,data:A.data,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,t,t===ba?void 0:ba].filter(o=>!!o)});A.common.issues.push(i)}class xt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const o of t){if(o.status==="aborted")return OA;o.status==="dirty"&&e.dirty(),i.push(o.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const o of t){const r=await o.key,s=await o.value;i.push({key:r,value:s})}return xt.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const o of t){const{key:r,value:s}=o;if(r.status==="aborted"||s.status==="aborted")return OA;r.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(i[r.value]=s.value)}return{status:e.value,value:i}}}const OA=Object.freeze({status:"aborted"}),Kn=A=>({status:"dirty",value:A}),Vt=A=>({status:"valid",value:A}),BC=A=>A.status==="aborted",wC=A=>A.status==="dirty",lg=A=>A.status==="valid",gg=A=>typeof Promise<"u"&&A instanceof Promise;function Nd(A,e,t,i){if(typeof e=="function"?A!==e||!0:!e.has(A))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(A)}function bQ(A,e,t,i,o){if(typeof e=="function"?A!==e||!0:!e.has(A))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(A,t),t}var yA;(function(A){A.errToObj=e=>typeof e=="string"?{message:e}:e||{},A.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(yA||(yA={}));var ml,El;class Vo{constructor(e,t,i,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Am=(A,e)=>{if(lg(e))return{success:!0,data:e.value};if(!A.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 Ii(A.common.issues);return this._error=t,this._error}}};function ZA(A){if(!A)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:o}=A;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,n)=>{var a,l;const{message:g}=A;return s.code==="invalid_enum_value"?{message:g??n.defaultError}:typeof n.data>"u"?{message:(a=g??i)!==null&&a!==void 0?a:n.defaultError}:s.code!=="invalid_type"?{message:n.defaultError}:{message:(l=g??t)!==null&&l!==void 0?l:n.defaultError}},description:o}}class _A{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)}get description(){return this._def.description}_getType(e){return rs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xt,ctx:{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(gg(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 i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const o={common:{issues:[],async:(i=t==null?void 0:t.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},r=this._parseSync({data:e,path:o.path,parent:o});return Am(o,r)}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},o=this._parse({data:e,path:i.path,parent:i}),r=await(gg(o)?o:Promise.resolve(o));return Am(i,r)}refine(e,t){const i=o=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(o):t;return this._refinement((o,r)=>{const s=e(o),n=()=>r.addIssue({code:rA.custom,...i(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(a=>a?!0:(n(),!1)):s?!0:(n(),!1)})}refinement(e,t){return this._refinement((i,o)=>e(i)?!0:(o.addIssue(typeof t=="function"?t(i,o):t),!1))}_refinement(e){return new Bo({schema:this,typeName:zA.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Lo.create(this,this._def)}nullable(){return Ds.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return go.create(this,this._def)}promise(){return xa.create(this,this._def)}or(e){return ug.create([this,e],this._def)}and(e){return pg.create(this,e,this._def)}transform(e){return new Bo({...ZA(this._def),schema:this,typeName:zA.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new mg({...ZA(this._def),innerType:this,defaultValue:t,typeName:zA.ZodDefault})}brand(){return new nB({typeName:zA.ZodBranded,type:this,...ZA(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Eg({...ZA(this._def),innerType:this,catchValue:t,typeName:zA.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ac.create(this,e)}readonly(){return vg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const h5=/^c[^\s-]{8,}$/i,u5=/^[0-9a-z]+$/,p5=/^[0-9A-HJKMNP-TV-Z]{26}$/,C5=/^[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,f5=/^[a-z0-9_-]{21}$/i,B5=/^[-+]?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)?)??$/,w5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,m5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sp;const E5=/^(?:(?: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])$/,v5=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,I5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DQ="((\\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])))",Q5=new RegExp(`^${DQ}$`);function xQ(A){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return A.precision?e=`${e}\\.\\d{${A.precision}}`:A.precision==null&&(e=`${e}(\\.\\d+)?`),e}function b5(A){return new RegExp(`^${xQ(A)}$`)}function MQ(A){let e=`${DQ}T${xQ(A)}`;const t=[];return t.push(A.local?"Z?":"Z"),A.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function D5(A,e){return!!((e==="v4"||!e)&&E5.test(A)||(e==="v6"||!e)&&v5.test(A))}class no extends _A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==IA.string){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.string,received:r.parsedType}),OA}const i=new xt;let o;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="max")e.data.length>r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="length"){const s=e.data.length>r.value,n=e.data.length<r.value;(s||n)&&(o=this._getOrReturnCtx(e,o),s?mA(o,{code:rA.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):n&&mA(o,{code:rA.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),i.dirty())}else if(r.kind==="email")w5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"email",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="emoji")sp||(sp=new RegExp(m5,"u")),sp.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"emoji",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="uuid")C5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"uuid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="nanoid")f5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"nanoid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid")h5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"cuid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid2")u5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"cuid2",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="ulid")p5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"ulid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),mA(o,{validation:"url",code:rA.invalid_string,message:r.message}),i.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"regex",code:rA.invalid_string,message:r.message}),i.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),i.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{startsWith:r.value},message:r.message}),i.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{endsWith:r.value},message:r.message}),i.dirty()):r.kind==="datetime"?MQ(r).test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"datetime",message:r.message}),i.dirty()):r.kind==="date"?Q5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"date",message:r.message}),i.dirty()):r.kind==="time"?b5(r).test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"time",message:r.message}),i.dirty()):r.kind==="duration"?B5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"duration",code:rA.invalid_string,message:r.message}),i.dirty()):r.kind==="ip"?D5(e.data,r.version)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"ip",code:rA.invalid_string,message:r.message}),i.dirty()):r.kind==="base64"?I5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"base64",code:rA.invalid_string,message:r.message}),i.dirty()):oe.assertNever(r);return{status:i.value,value:e.data}}_regex(e,t,i){return this.refinement(o=>e.test(o),{validation:t,code:rA.invalid_string,...yA.errToObj(i)})}_addCheck(e){return new no({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...yA.errToObj(e)})}url(e){return this._addCheck({kind:"url",...yA.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...yA.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...yA.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...yA.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...yA.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...yA.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...yA.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...yA.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...yA.errToObj(e)})}datetime(e){var t,i;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(i=e==null?void 0:e.local)!==null&&i!==void 0?i:!1,...yA.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...yA.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...yA.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...yA.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...yA.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...yA.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...yA.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...yA.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...yA.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...yA.errToObj(t)})}nonempty(e){return this.min(1,yA.errToObj(e))}trim(){return new no({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new no({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new no({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}no.create=A=>{var e;return new no({checks:[],typeName:zA.ZodString,coerce:(e=A==null?void 0:A.coerce)!==null&&e!==void 0?e:!1,...ZA(A)})};function x5(A,e){const t=(A.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,o=t>i?t:i,r=parseInt(A.toFixed(o).replace(".","")),s=parseInt(e.toFixed(o).replace(".",""));return r%s/Math.pow(10,o)}class Is extends _A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==IA.number){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.number,received:r.parsedType}),OA}let i;const o=new xt;for(const r of this._def.checks)r.kind==="int"?oe.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.invalid_type,expected:"integer",received:"float",message:r.message}),o.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),o.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),o.dirty()):r.kind==="multipleOf"?x5(e.data,r.value)!==0&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_multiple_of,multipleOf:r.value,message:r.message}),o.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_finite,message:r.message}),o.dirty()):oe.assertNever(r);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,yA.toString(t))}gt(e,t){return this.setLimit("min",e,!1,yA.toString(t))}lte(e,t){return this.setLimit("max",e,!0,yA.toString(t))}lt(e,t){return this.setLimit("max",e,!1,yA.toString(t))}setLimit(e,t,i,o){return new Is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:yA.toString(o)}]})}_addCheck(e){return new Is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:yA.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:yA.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:yA.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:yA.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:yA.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:yA.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:yA.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:yA.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:yA.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&oe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Is.create=A=>new Is({checks:[],typeName:zA.ZodNumber,coerce:(A==null?void 0:A.coerce)||!1,...ZA(A)});class Qs extends _A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==IA.bigint){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.bigint,received:r.parsedType}),OA}let i;const o=new xt;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),o.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),o.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_multiple_of,multipleOf:r.value,message:r.message}),o.dirty()):oe.assertNever(r);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,yA.toString(t))}gt(e,t){return this.setLimit("min",e,!1,yA.toString(t))}lte(e,t){return this.setLimit("max",e,!0,yA.toString(t))}lt(e,t){return this.setLimit("max",e,!1,yA.toString(t))}setLimit(e,t,i,o){return new Qs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:yA.toString(o)}]})}_addCheck(e){return new Qs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:yA.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:yA.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:yA.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:yA.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:yA.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Qs.create=A=>{var e;return new Qs({checks:[],typeName:zA.ZodBigInt,coerce:(e=A==null?void 0:A.coerce)!==null&&e!==void 0?e:!1,...ZA(A)})};class cg extends _A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==IA.boolean){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.boolean,received:i.parsedType}),OA}return Vt(e.data)}}cg.create=A=>new cg({typeName:zA.ZodBoolean,coerce:(A==null?void 0:A.coerce)||!1,...ZA(A)});class hn extends _A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==IA.date){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.date,received:r.parsedType}),OA}if(isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_date}),OA}const i=new xt;let o;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),i.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),i.dirty()):oe.assertNever(r);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:yA.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:yA.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}hn.create=A=>new hn({checks:[],coerce:(A==null?void 0:A.coerce)||!1,typeName:zA.ZodDate,...ZA(A)});class zd extends _A{_parse(e){if(this._getType(e)!==IA.symbol){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.symbol,received:i.parsedType}),OA}return Vt(e.data)}}zd.create=A=>new zd({typeName:zA.ZodSymbol,...ZA(A)});class dg extends _A{_parse(e){if(this._getType(e)!==IA.undefined){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.undefined,received:i.parsedType}),OA}return Vt(e.data)}}dg.create=A=>new dg({typeName:zA.ZodUndefined,...ZA(A)});class hg extends _A{_parse(e){if(this._getType(e)!==IA.null){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.null,received:i.parsedType}),OA}return Vt(e.data)}}hg.create=A=>new hg({typeName:zA.ZodNull,...ZA(A)});class Da extends _A{constructor(){super(...arguments),this._any=!0}_parse(e){return Vt(e.data)}}Da.create=A=>new Da({typeName:zA.ZodAny,...ZA(A)});class tn extends _A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Vt(e.data)}}tn.create=A=>new tn({typeName:zA.ZodUnknown,...ZA(A)});class Fr extends _A{_parse(e){const t=this._getOrReturnCtx(e);return mA(t,{code:rA.invalid_type,expected:IA.never,received:t.parsedType}),OA}}Fr.create=A=>new Fr({typeName:zA.ZodNever,...ZA(A)});class Od extends _A{_parse(e){if(this._getType(e)!==IA.undefined){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.void,received:i.parsedType}),OA}return Vt(e.data)}}Od.create=A=>new Od({typeName:zA.ZodVoid,...ZA(A)});class go extends _A{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),o=this._def;if(t.parsedType!==IA.array)return mA(t,{code:rA.invalid_type,expected:IA.array,received:t.parsedType}),OA;if(o.exactLength!==null){const s=t.data.length>o.exactLength.value,n=t.data.length<o.exactLength.value;(s||n)&&(mA(t,{code:s?rA.too_big:rA.too_small,minimum:n?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&t.data.length<o.minLength.value&&(mA(t,{code:rA.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&t.data.length>o.maxLength.value&&(mA(t,{code:rA.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((s,n)=>o.type._parseAsync(new Vo(t,s,t.path,n)))).then(s=>xt.mergeArray(i,s));const r=[...t.data].map((s,n)=>o.type._parseSync(new Vo(t,s,t.path,n)));return xt.mergeArray(i,r)}get element(){return this._def.type}min(e,t){return new go({...this._def,minLength:{value:e,message:yA.toString(t)}})}max(e,t){return new go({...this._def,maxLength:{value:e,message:yA.toString(t)}})}length(e,t){return new go({...this._def,exactLength:{value:e,message:yA.toString(t)}})}nonempty(e){return this.min(1,e)}}go.create=(A,e)=>new go({type:A,minLength:null,maxLength:null,exactLength:null,typeName:zA.ZodArray,...ZA(e)});function On(A){if(A instanceof Re){const e={};for(const t in A.shape){const i=A.shape[t];e[t]=Lo.create(On(i))}return new Re({...A._def,shape:()=>e})}else return A instanceof go?new go({...A._def,type:On(A.element)}):A instanceof Lo?Lo.create(On(A.unwrap())):A instanceof Ds?Ds.create(On(A.unwrap())):A instanceof jo?jo.create(A.items.map(e=>On(e))):A}class Re extends _A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=oe.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==IA.object){const l=this._getOrReturnCtx(e);return mA(l,{code:rA.invalid_type,expected:IA.object,received:l.parsedType}),OA}const{status:i,ctx:o}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),n=[];if(!(this._def.catchall instanceof Fr&&this._def.unknownKeys==="strip"))for(const l in o.data)s.includes(l)||n.push(l);const a=[];for(const l of s){const g=r[l],c=o.data[l];a.push({key:{status:"valid",value:l},value:g._parse(new Vo(o,c,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Fr){const l=this._def.unknownKeys;if(l==="passthrough")for(const g of n)a.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(l==="strict")n.length>0&&(mA(o,{code:rA.unrecognized_keys,keys:n}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const g of n){const c=o.data[g];a.push({key:{status:"valid",value:g},value:l._parse(new Vo(o,c,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const l=[];for(const g of a){const c=await g.key,d=await g.value;l.push({key:c,value:d,alwaysSet:g.alwaysSet})}return l}).then(l=>xt.mergeObjectSync(i,l)):xt.mergeObjectSync(i,a)}get shape(){return this._def.shape()}strict(e){return yA.errToObj,new Re({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var o,r,s,n;const a=(s=(r=(o=this._def).errorMap)===null||r===void 0?void 0:r.call(o,t,i).message)!==null&&s!==void 0?s:i.defaultError;return t.code==="unrecognized_keys"?{message:(n=yA.errToObj(e).message)!==null&&n!==void 0?n:a}:{message:a}}}:{}})}strip(){return new Re({...this._def,unknownKeys:"strip"})}passthrough(){return new Re({...this._def,unknownKeys:"passthrough"})}extend(e){return new Re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:zA.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Re({...this._def,catchall:e})}pick(e){const t={};return oe.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new Re({...this._def,shape:()=>t})}omit(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new Re({...this._def,shape:()=>t})}deepPartial(){return On(this)}partial(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{const o=this.shape[i];e&&!e[i]?t[i]=o:t[i]=o.optional()}),new Re({...this._def,shape:()=>t})}required(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof Lo;)r=r._def.innerType;t[i]=r}}),new Re({...this._def,shape:()=>t})}keyof(){return FQ(oe.objectKeys(this.shape))}}Re.create=(A,e)=>new Re({shape:()=>A,unknownKeys:"strip",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});Re.strictCreate=(A,e)=>new Re({shape:()=>A,unknownKeys:"strict",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});Re.lazycreate=(A,e)=>new Re({shape:A,unknownKeys:"strip",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});class ug extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function o(r){for(const n of r)if(n.result.status==="valid")return n.result;for(const n of r)if(n.result.status==="dirty")return t.common.issues.push(...n.ctx.common.issues),n.result;const s=r.map(n=>new Ii(n.ctx.common.issues));return mA(t,{code:rA.invalid_union,unionErrors:s}),OA}if(t.common.async)return Promise.all(i.map(async r=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(o);{let r;const s=[];for(const a of i){const l={...t,common:{...t.common,issues:[]},parent:null},g=a._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!r&&(r={result:g,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=s.map(a=>new Ii(a));return mA(t,{code:rA.invalid_union,unionErrors:n}),OA}}get options(){return this._def.options}}ug.create=(A,e)=>new ug({options:A,typeName:zA.ZodUnion,...ZA(e)});const lr=A=>A instanceof fg?lr(A.schema):A instanceof Bo?lr(A.innerType()):A instanceof Bg?[A.value]:A instanceof bs?A.options:A instanceof wg?oe.objectValues(A.enum):A instanceof mg?lr(A._def.innerType):A instanceof dg?[void 0]:A instanceof hg?[null]:A instanceof Lo?[void 0,...lr(A.unwrap())]:A instanceof Ds?[null,...lr(A.unwrap())]:A instanceof nB||A instanceof vg?lr(A.unwrap()):A instanceof Eg?lr(A._def.innerType):[];class Zh extends _A{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.object)return mA(t,{code:rA.invalid_type,expected:IA.object,received:t.parsedType}),OA;const i=this.discriminator,o=t.data[i],r=this.optionsMap.get(o);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(mA(t,{code:rA.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),OA)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const o=new Map;for(const r of t){const s=lr(r.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of s){if(o.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);o.set(n,r)}}return new Zh({typeName:zA.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...ZA(i)})}}function mC(A,e){const t=rs(A),i=rs(e);if(A===e)return{valid:!0,data:A};if(t===IA.object&&i===IA.object){const o=oe.objectKeys(e),r=oe.objectKeys(A).filter(n=>o.indexOf(n)!==-1),s={...A,...e};for(const n of r){const a=mC(A[n],e[n]);if(!a.valid)return{valid:!1};s[n]=a.data}return{valid:!0,data:s}}else if(t===IA.array&&i===IA.array){if(A.length!==e.length)return{valid:!1};const o=[];for(let r=0;r<A.length;r++){const s=A[r],n=e[r],a=mC(s,n);if(!a.valid)return{valid:!1};o.push(a.data)}return{valid:!0,data:o}}else return t===IA.date&&i===IA.date&&+A==+e?{valid:!0,data:A}:{valid:!1}}class pg extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),o=(r,s)=>{if(BC(r)||BC(s))return OA;const n=mC(r.value,s.value);return n.valid?((wC(r)||wC(s))&&t.dirty(),{status:t.value,value:n.data}):(mA(i,{code:rA.invalid_intersection_types}),OA)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,s])=>o(r,s)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}pg.create=(A,e,t)=>new pg({left:A,right:e,typeName:zA.ZodIntersection,...ZA(t)});class jo extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.array)return mA(i,{code:rA.invalid_type,expected:IA.array,received:i.parsedType}),OA;if(i.data.length<this._def.items.length)return mA(i,{code:rA.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),OA;!this._def.rest&&i.data.length>this._def.items.length&&(mA(i,{code:rA.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...i.data].map((s,n)=>{const a=this._def.items[n]||this._def.rest;return a?a._parse(new Vo(i,s,i.path,n)):null}).filter(s=>!!s);return i.common.async?Promise.all(r).then(s=>xt.mergeArray(t,s)):xt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new jo({...this._def,rest:e})}}jo.create=(A,e)=>{if(!Array.isArray(A))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jo({items:A,typeName:zA.ZodTuple,rest:null,...ZA(e)})};class Cg extends _A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.object)return mA(i,{code:rA.invalid_type,expected:IA.object,received:i.parsedType}),OA;const o=[],r=this._def.keyType,s=this._def.valueType;for(const n in i.data)o.push({key:r._parse(new Vo(i,n,i.path,n)),value:s._parse(new Vo(i,i.data[n],i.path,n)),alwaysSet:n in i.data});return i.common.async?xt.mergeObjectAsync(t,o):xt.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof _A?new Cg({keyType:e,valueType:t,typeName:zA.ZodRecord,...ZA(i)}):new Cg({keyType:no.create(),valueType:e,typeName:zA.ZodRecord,...ZA(t)})}}class Vd extends _A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.map)return mA(i,{code:rA.invalid_type,expected:IA.map,received:i.parsedType}),OA;const o=this._def.keyType,r=this._def.valueType,s=[...i.data.entries()].map(([n,a],l)=>({key:o._parse(new Vo(i,n,i.path,[l,"key"])),value:r._parse(new Vo(i,a,i.path,[l,"value"]))}));if(i.common.async){const n=new Map;return Promise.resolve().then(async()=>{for(const a of s){const l=await a.key,g=await a.value;if(l.status==="aborted"||g.status==="aborted")return OA;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),n.set(l.value,g.value)}return{status:t.value,value:n}})}else{const n=new Map;for(const a of s){const l=a.key,g=a.value;if(l.status==="aborted"||g.status==="aborted")return OA;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),n.set(l.value,g.value)}return{status:t.value,value:n}}}}Vd.create=(A,e,t)=>new Vd({valueType:e,keyType:A,typeName:zA.ZodMap,...ZA(t)});class un extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.set)return mA(i,{code:rA.invalid_type,expected:IA.set,received:i.parsedType}),OA;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(mA(i,{code:rA.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(mA(i,{code:rA.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());const r=this._def.valueType;function s(a){const l=new Set;for(const g of a){if(g.status==="aborted")return OA;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}const n=[...i.data.values()].map((a,l)=>r._parse(new Vo(i,a,i.path,l)));return i.common.async?Promise.all(n).then(a=>s(a)):s(n)}min(e,t){return new un({...this._def,minSize:{value:e,message:yA.toString(t)}})}max(e,t){return new un({...this._def,maxSize:{value:e,message:yA.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}un.create=(A,e)=>new un({valueType:A,minSize:null,maxSize:null,typeName:zA.ZodSet,...ZA(e)});class ra extends _A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.function)return mA(t,{code:rA.invalid_type,expected:IA.function,received:t.parsedType}),OA;function i(n,a){return Hd({data:n,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ud(),ba].filter(l=>!!l),issueData:{code:rA.invalid_arguments,argumentsError:a}})}function o(n,a){return Hd({data:n,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ud(),ba].filter(l=>!!l),issueData:{code:rA.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof xa){const n=this;return Vt(async function(...a){const l=new Ii([]),g=await n._def.args.parseAsync(a,r).catch(h=>{throw l.addIssue(i(a,h)),l}),c=await Reflect.apply(s,this,g);return await n._def.returns._def.type.parseAsync(c,r).catch(h=>{throw l.addIssue(o(c,h)),l})})}else{const n=this;return Vt(function(...a){const l=n._def.args.safeParse(a,r);if(!l.success)throw new Ii([i(a,l.error)]);const g=Reflect.apply(s,this,l.data),c=n._def.returns.safeParse(g,r);if(!c.success)throw new Ii([o(g,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ra({...this._def,args:jo.create(e).rest(tn.create())})}returns(e){return new ra({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ra({args:e||jo.create([]).rest(tn.create()),returns:t||tn.create(),typeName:zA.ZodFunction,...ZA(i)})}}class fg extends _A{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})}}fg.create=(A,e)=>new fg({getter:A,typeName:zA.ZodLazy,...ZA(e)});class Bg extends _A{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return mA(t,{received:t.data,code:rA.invalid_literal,expected:this._def.value}),OA}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bg.create=(A,e)=>new Bg({value:A,typeName:zA.ZodLiteral,...ZA(e)});function FQ(A,e){return new bs({values:A,typeName:zA.ZodEnum,...ZA(e)})}class bs extends _A{constructor(){super(...arguments),ml.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return mA(t,{expected:oe.joinValues(i),received:t.parsedType,code:rA.invalid_type}),OA}if(Nd(this,ml)||bQ(this,ml,new Set(this._def.values)),!Nd(this,ml).has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return mA(t,{received:t.data,code:rA.invalid_enum_value,options:i}),OA}return Vt(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(e,t=this._def){return bs.create(e,{...this._def,...t})}exclude(e,t=this._def){return bs.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}}ml=new WeakMap;bs.create=FQ;class wg extends _A{constructor(){super(...arguments),El.set(this,void 0)}_parse(e){const t=oe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==IA.string&&i.parsedType!==IA.number){const o=oe.objectValues(t);return mA(i,{expected:oe.joinValues(o),received:i.parsedType,code:rA.invalid_type}),OA}if(Nd(this,El)||bQ(this,El,new Set(oe.getValidEnumValues(this._def.values))),!Nd(this,El).has(e.data)){const o=oe.objectValues(t);return mA(i,{received:i.data,code:rA.invalid_enum_value,options:o}),OA}return Vt(e.data)}get enum(){return this._def.values}}El=new WeakMap;wg.create=(A,e)=>new wg({values:A,typeName:zA.ZodNativeEnum,...ZA(e)});class xa extends _A{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.promise&&t.common.async===!1)return mA(t,{code:rA.invalid_type,expected:IA.promise,received:t.parsedType}),OA;const i=t.parsedType===IA.promise?t.data:Promise.resolve(t.data);return Vt(i.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}xa.create=(A,e)=>new xa({type:A,typeName:zA.ZodPromise,...ZA(e)});class Bo extends _A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zA.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),o=this._def.effect||null,r={addIssue:s=>{mA(i,s),s.fatal?t.abort():t.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),o.type==="preprocess"){const s=o.transform(i.data,r);if(i.common.async)return Promise.resolve(s).then(async n=>{if(t.value==="aborted")return OA;const a=await this._def.schema._parseAsync({data:n,path:i.path,parent:i});return a.status==="aborted"?OA:a.status==="dirty"||t.value==="dirty"?Kn(a.value):a});{if(t.value==="aborted")return OA;const n=this._def.schema._parseSync({data:s,path:i.path,parent:i});return n.status==="aborted"?OA:n.status==="dirty"||t.value==="dirty"?Kn(n.value):n}}if(o.type==="refinement"){const s=n=>{const a=o.refinement(n,r);if(i.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return n};if(i.common.async===!1){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?OA:(n.status==="dirty"&&t.dirty(),s(n.value),{status:t.value,value:n.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(n=>n.status==="aborted"?OA:(n.status==="dirty"&&t.dirty(),s(n.value).then(()=>({status:t.value,value:n.value}))))}if(o.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!lg(s))return s;const n=o.transform(s.value,r);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>lg(s)?Promise.resolve(o.transform(s.value,r)).then(n=>({status:t.value,value:n})):s);oe.assertNever(o)}}Bo.create=(A,e,t)=>new Bo({schema:A,typeName:zA.ZodEffects,effect:e,...ZA(t)});Bo.createWithPreprocess=(A,e,t)=>new Bo({schema:e,effect:{type:"preprocess",transform:A},typeName:zA.ZodEffects,...ZA(t)});class Lo extends _A{_parse(e){return this._getType(e)===IA.undefined?Vt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Lo.create=(A,e)=>new Lo({innerType:A,typeName:zA.ZodOptional,...ZA(e)});class Ds extends _A{_parse(e){return this._getType(e)===IA.null?Vt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ds.create=(A,e)=>new Ds({innerType:A,typeName:zA.ZodNullable,...ZA(e)});class mg extends _A{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===IA.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}mg.create=(A,e)=>new mg({innerType:A,typeName:zA.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ZA(e)});class Eg extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return gg(o)?o.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ii(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ii(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Eg.create=(A,e)=>new Eg({innerType:A,typeName:zA.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ZA(e)});class jd extends _A{_parse(e){if(this._getType(e)!==IA.nan){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.nan,received:i.parsedType}),OA}return{status:"valid",value:e.data}}}jd.create=A=>new jd({typeName:zA.ZodNaN,...ZA(A)});const M5=Symbol("zod_brand");class nB extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ac extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?OA:r.status==="dirty"?(t.dirty(),Kn(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?OA:o.status==="dirty"?(t.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(e,t){return new Ac({in:e,out:t,typeName:zA.ZodPipeline})}}class vg extends _A{_parse(e){const t=this._def.innerType._parse(e),i=o=>(lg(o)&&(o.value=Object.freeze(o.value)),o);return gg(t)?t.then(o=>i(o)):i(t)}unwrap(){return this._def.innerType}}vg.create=(A,e)=>new vg({innerType:A,typeName:zA.ZodReadonly,...ZA(e)});function yQ(A,e={},t){return A?Da.create().superRefine((i,o)=>{var r,s;if(!A(i)){const n=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,a=(s=(r=n.fatal)!==null&&r!==void 0?r:t)!==null&&s!==void 0?s:!0,l=typeof n=="string"?{message:n}:n;o.addIssue({code:"custom",...l,fatal:a})}}):Da.create()}const F5={object:Re.lazycreate};var zA;(function(A){A.ZodString="ZodString",A.ZodNumber="ZodNumber",A.ZodNaN="ZodNaN",A.ZodBigInt="ZodBigInt",A.ZodBoolean="ZodBoolean",A.ZodDate="ZodDate",A.ZodSymbol="ZodSymbol",A.ZodUndefined="ZodUndefined",A.ZodNull="ZodNull",A.ZodAny="ZodAny",A.ZodUnknown="ZodUnknown",A.ZodNever="ZodNever",A.ZodVoid="ZodVoid",A.ZodArray="ZodArray",A.ZodObject="ZodObject",A.ZodUnion="ZodUnion",A.ZodDiscriminatedUnion="ZodDiscriminatedUnion",A.ZodIntersection="ZodIntersection",A.ZodTuple="ZodTuple",A.ZodRecord="ZodRecord",A.ZodMap="ZodMap",A.ZodSet="ZodSet",A.ZodFunction="ZodFunction",A.ZodLazy="ZodLazy",A.ZodLiteral="ZodLiteral",A.ZodEnum="ZodEnum",A.ZodEffects="ZodEffects",A.ZodNativeEnum="ZodNativeEnum",A.ZodOptional="ZodOptional",A.ZodNullable="ZodNullable",A.ZodDefault="ZodDefault",A.ZodCatch="ZodCatch",A.ZodPromise="ZodPromise",A.ZodBranded="ZodBranded",A.ZodPipeline="ZodPipeline",A.ZodReadonly="ZodReadonly"})(zA||(zA={}));const y5=(A,e={message:`Input not instance of ${A.name}`})=>yQ(t=>t instanceof A,e),SQ=no.create,PQ=Is.create,S5=jd.create,P5=Qs.create,RQ=cg.create,R5=hn.create,Y5=zd.create,k5=dg.create,G5=hg.create,T5=Da.create,L5=tn.create,U5=Fr.create,H5=Od.create,N5=go.create,z5=Re.create,O5=Re.strictCreate,V5=ug.create,j5=Zh.create,J5=pg.create,W5=jo.create,K5=Cg.create,X5=Vd.create,q5=un.create,Z5=ra.create,_5=fg.create,$5=Bg.create,AP=bs.create,eP=wg.create,tP=xa.create,em=Bo.create,iP=Lo.create,oP=Ds.create,rP=Bo.createWithPreprocess,sP=Ac.create,nP=()=>SQ().optional(),aP=()=>PQ().optional(),lP=()=>RQ().optional(),gP={string:A=>no.create({...A,coerce:!0}),number:A=>Is.create({...A,coerce:!0}),boolean:A=>cg.create({...A,coerce:!0}),bigint:A=>Qs.create({...A,coerce:!0}),date:A=>hn.create({...A,coerce:!0})},cP=OA;var q=Object.freeze({__proto__:null,defaultErrorMap:ba,setErrorMap:c5,getErrorMap:Ud,makeIssue:Hd,EMPTY_PATH:d5,addIssueToContext:mA,ParseStatus:xt,INVALID:OA,DIRTY:Kn,OK:Vt,isAborted:BC,isDirty:wC,isValid:lg,isAsync:gg,get util(){return oe},get objectUtil(){return fC},ZodParsedType:IA,getParsedType:rs,ZodType:_A,datetimeRegex:MQ,ZodString:no,ZodNumber:Is,ZodBigInt:Qs,ZodBoolean:cg,ZodDate:hn,ZodSymbol:zd,ZodUndefined:dg,ZodNull:hg,ZodAny:Da,ZodUnknown:tn,ZodNever:Fr,ZodVoid:Od,ZodArray:go,ZodObject:Re,ZodUnion:ug,ZodDiscriminatedUnion:Zh,ZodIntersection:pg,ZodTuple:jo,ZodRecord:Cg,ZodMap:Vd,ZodSet:un,ZodFunction:ra,ZodLazy:fg,ZodLiteral:Bg,ZodEnum:bs,ZodNativeEnum:wg,ZodPromise:xa,ZodEffects:Bo,ZodTransformer:Bo,ZodOptional:Lo,ZodNullable:Ds,ZodDefault:mg,ZodCatch:Eg,ZodNaN:jd,BRAND:M5,ZodBranded:nB,ZodPipeline:Ac,ZodReadonly:vg,custom:yQ,Schema:_A,ZodSchema:_A,late:F5,get ZodFirstPartyTypeKind(){return zA},coerce:gP,any:T5,array:N5,bigint:P5,boolean:RQ,date:R5,discriminatedUnion:j5,effect:em,enum:AP,function:Z5,instanceof:y5,intersection:J5,lazy:_5,literal:$5,map:X5,nan:S5,nativeEnum:eP,never:U5,null:G5,nullable:oP,number:PQ,object:z5,oboolean:lP,onumber:aP,optional:iP,ostring:nP,pipeline:sP,preprocess:rP,promise:tP,record:K5,set:q5,strictObject:O5,string:SQ,symbol:Y5,transformer:em,tuple:W5,undefined:k5,union:V5,unknown:L5,void:H5,NEVER:cP,ZodIssueCode:rA,quotelessJson:g5,ZodError:Ii});q.object({type:q.literal("plain"),content:q.string()});q.object({from:q.number().min(0),to:q.number().min(1)});function ec(A){throw new Error("Unexpected object: "+A)}const YQ="upload://upload/",kQ="index://index/";function dP(A){return A.startsWith(YQ)}function hP(A){return A.startsWith(kQ)}function GQ(A){if(hP(A)){const e=A.slice(kQ.length);return JSON.parse(decodeURIComponent(e)).path}else if(dP(A)){const e=A.slice(YQ.length);return JSON.parse(decodeURIComponent(e)).localPath}ec(A)}function uP(A){return A.replace(/^.*[\\/]/,"")}function TQ(A){return uP(GQ(A))}function _h(A){if(!A||typeof A!="object")return!1;const e=A;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&e.data!==void 0&&typeof e.data=="object";case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";default:return!1}}function pP(A,e){if(A!==void 0)switch(A.type){case"Json":return A;case"JsonPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]=e(o);return{...A,parts:t}}case"BinaryPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]={index:e(o.index),values:e(o.values)};return{...A,parts:t}}case"ParquetPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]=e(o);return{...A,parts:t}}}}function CP(A,e){switch(A.type){case"Json":break;case"JsonPartitioned":{Object.values(A.parts).forEach(e);break}case"BinaryPartitioned":{Object.values(A.parts).forEach(t=>{e(t.index),e(t.values)});break}case"ParquetPartitioned":{Object.values(A.parts).forEach(e);break}}}function aB(A){if(!A||typeof A!="object")return!1;const e=A;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&Array.isArray(e.data);case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);default:return!1}}function fP(A){if(!aB(A))return!1;switch(A.type){case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return!0;default:return!1}}function BP(A){switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength,data:Object.entries(A.data).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};default:ec(A)}}function wP(A){switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength,data:Object.fromEntries(A.data.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};default:ec(A)}}function lB(A){return A instanceof Error?A.name==="AbortError"||lB(A.cause):!1}function mP(A){if(typeof A=="string")return`String value was thrown: ${A}`;if(A&&typeof A=="object")try{return`Plain object was thrown: ${JSON.stringify(A)}`}catch(e){return`Non-serializable object was thrown (JSON.stringify failed: ${e instanceof Error?e.message:String(e)}): ${String(A)}`}return`Non-Error value (${typeof A}) was thrown: ${A}`}function EP(A){return A instanceof Error?A:new Error(mP(A))}function LQ(A){const e=A.cause?LQ(A.cause):void 0,t=new Error(A.message,e!==void 0?{cause:e}:void 0);return t.name=A.name||"Error",t.stack=A.stack,t}function gr(A){if(A.error)throw A.error instanceof Error?A.error:LQ(A.error);return A.value}function vP(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var np,tm;function IP(){return tm||(tm=1,np=function A(e){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");return e===null||typeof e!="object"?JSON.stringify(e):e.toJSON instanceof Function?A(e.toJSON()):Array.isArray(e)?`[${e.reduce((o,r,s)=>`${o}${s===0?"":","}${A(r===void 0||typeof r=="symbol"?null:r)}`,"")}]`:`{${Object.keys(e).sort().reduce((i,o)=>{if(e[o]===void 0||typeof e[o]=="symbol")return i;const r=i.length===0?"":",";return`${i}${r}${A(o)}:${A(e[o])}`},"")}}`}),np}var QP=IP();const Ta=vP(QP);function et(A){return Ta(A)}function UQ(A){return JSON.parse(A)}function HQ(A,e){return A==null?void 0:A[e]}function bP(A,e,t,i="readMetadataJsonOrThrow"){const o=HQ(A,t);if(o===void 0)return;const r=e[t];try{const s=JSON.parse(o);return r.parse(s)}catch(s){throw new Error(`${i} failed, key: ${String(t)}, value: ${o}, error: ${EP(s)}`)}}function DP(A,e,t){try{return bP(A,e,t)}catch{return}}const de={DiscreteValues:"pl7.app/discreteValues",Graph:{Axis:{HighCardinality:"pl7.app/graph/axis/highCardinality",LowerLimit:"pl7.app/graph/axis/lowerLimit",SymmetricRange:"pl7.app/graph/axis/symmetricRange",UpperLimit:"pl7.app/graph/axis/upperLimit"},IsDenseAxis:"pl7.app/graph/isDenseAxis",IsVirtual:"pl7.app/graph/isVirtual",Palette:"pl7.app/graph/palette",Thresholds:"pl7.app/graph/thresholds",TreatAbsentValuesAs:"pl7.app/graph/treatAbsentValuesAs"},HideDataFromUi:"pl7.app/hideDataFromUi",HideDataFromGraphs:"pl7.app/hideDataFromGraphs",IsDiscreteFilter:"pl7.app/isDiscreteFilter",IsLinkerColumn:"pl7.app/isLinkerColumn",IsSubset:"pl7.app/isSubset",Label:"pl7.app/label",Max:"pl7.app/max",Min:"pl7.app/min",MultipliesBy:"pl7.app/multipliesBy",Parents:"pl7.app/parents",Sequence:{Annotation:{Mapping:"pl7.app/sequence/annotation/mapping"},IsAnnotation:"pl7.app/sequence/isAnnotation"},Table:{OrderPriority:"pl7.app/table/orderPriority"},Trace:"pl7.app/trace"},xP=q.enum(["Int","Long","Float","Double","String"]),MP={[de.DiscreteValues]:q.array(q.string()).or(q.array(q.number())),[de.Graph.Axis.HighCardinality]:q.boolean(),[de.Graph.Axis.LowerLimit]:q.number(),[de.Graph.Axis.UpperLimit]:q.number(),[de.Graph.Axis.SymmetricRange]:q.boolean(),[de.Graph.IsDenseAxis]:q.boolean(),[de.Graph.Palette]:q.object({mapping:q.record(q.number()),name:q.string()}),[de.Graph.Thresholds]:q.array(q.object({columnId:q.object({valueType:xP,name:q.string()}),value:q.number()})),[de.Graph.TreatAbsentValuesAs]:q.number(),[de.Graph.IsVirtual]:q.boolean(),[de.HideDataFromUi]:q.boolean(),[de.HideDataFromGraphs]:q.boolean(),[de.IsDiscreteFilter]:q.boolean(),[de.IsLinkerColumn]:q.boolean(),[de.IsSubset]:q.boolean(),[de.Max]:q.number(),[de.Min]:q.number(),[de.MultipliesBy]:q.array(q.string()),[de.Parents]:q.array(q.string()),[de.Sequence.Annotation.Mapping]:q.record(q.string(),q.string()),[de.Sequence.IsAnnotation]:q.boolean(),[de.Table.OrderPriority]:q.number(),[de.Trace]:q.record(q.string(),q.unknown())};function EC(A,e){return HQ(A==null?void 0:A.annotations,e)}function gB(A,e){return DP(A==null?void 0:A.annotations,MP,e)}function im(A){return!!gB(A,de.IsLinkerColumn)}function Jd(A){return{axis:A,children:[]}}function Vn(A){const e=Jd(A);let t=[e];for(;t.length;){const i=[];for(const o of t)o.children=o.axis.parentAxesSpec.map(Jd),i.push(...o.children);t=i}return e}function jn(A){const e=[A.axis];let t=[A];for(;t.length;){const i=[];for(const o of t)for(const r of o.children)e.push(r.axis),i.push(r);t=i}return e}function om(A){return et(jn(Vn(A)).map(Ye))}function FP(A,e){if(A.name!==e.name)return A.name<e.name?1:-1;if(A.type!==e.type)return A.type<e.type?1:-1;const t=et(A.domain??{}),i=et(e.domain??{});if(t!==i)return t<i?1:-1;const o=om(A),r=om(e);if(o!==r)return o<r?1:-1;const s=et(A.annotations??{}),n=et(e.annotations??{});return s!==n?s<n?1:-1:0}function yP(A){const e=gB(A,de.Parents);return e===void 0?[]:e}function NQ(A){A.parentAxesSpec.forEach(NQ),A.parentAxesSpec.sort(FP)}function SP(A){let t=[Jd(A)];const i=new Set(et(Ye(A)));for(;t.length;){const o=[],r=new Set;for(const s of t){s.children=s.axis.parentAxesSpec.map(Jd);for(const n of s.children){const a=et(Ye(n.axis));if(!r.has(a)){if(o.push(n),r.add(a),i.has(a))return!0;i.add(a)}}}t=o}return!1}function rm(A){if(!A.length)return[];const e=A.map(t=>{const{parentAxes:i,...o}=t;return{...o,annotations:{...o.annotations},parentAxesSpec:[]}});return A.forEach((t,i)=>{var r;const o=e[i];if(t.parentAxes)o.parentAxesSpec=t.parentAxes.map(s=>e[s]);else{const s=yP(t).map(n=>e.find(a=>a.name===n));o.parentAxesSpec=s.some(n=>n===void 0)?[]:s,(r=o.annotations)==null||delete r[de.Parents]}}),e.some(SP)?e.forEach(t=>{t.parentAxesSpec=[]}):e.forEach(t=>{NQ(t)}),e}const PP={Label:"pl7.app/label"};function RP(A){return{columnId:A.id,spec:A.spec}}function Ye(A){const{type:e,name:t,domain:i}=A,o={type:e,name:t};return i&&Object.entries(i).length>0&&Object.assign(o,{domain:i}),o}function YP(A){return A.map(Ye)}function kP(A){return et(Ye(A))}function GP(A,e){if(A===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(A[t]!==e[t])return!1;return!0}function vC(A,e){return A.name===e.name&&GP(A.domain,e.domain)}function TP(A,e){return{...A,src:nd(A.src,e)}}function nd(A,e){switch(A.type){case"column":return{type:"column",column:e(A.column)};case"slicedColumn":return{type:"slicedColumn",column:e(A.column),newId:A.newId,axisFilters:A.axisFilters};case"artificialColumn":return{type:"artificialColumn",column:e(A.column),newId:A.newId,axesIndices:A.axesIndices};case"inlineColumn":return A;case"inner":case"full":return{type:A.type,entries:A.entries.map(t=>nd(t,e))};case"outer":return{type:"outer",primary:nd(A.primary,e),secondary:A.secondary.map(t=>nd(t,e))};default:ec(A)}}function LP(A){return Ta(A)}function sm(A){return Ta(Ye(A))}function nm(A,e){return JSON.stringify([A,e])}class am{constructor(e){PA(this,"anchors");PA(this,"domains",new Map);PA(this,"axes",new Map);PA(this,"domainPacks",[]);PA(this,"domainPackToAnchor",new Map);this.anchors=e;const t=Object.entries(e);t.sort((i,o)=>i[0].localeCompare(o[0]));for(const[i,o]of t){for(let r=0;r<o.axesSpec.length;r++){const s=o.axesSpec[r],n=sm(s);this.axes.set(n,{anchor:i,idx:r})}if(o.domain!==void 0){const r=Object.entries(o.domain);r.sort((s,n)=>s[0].localeCompare(n[0])),this.domainPackToAnchor.set(JSON.stringify(r),i),this.domainPacks.push(r.map(([s])=>s));for(const[s,n]of r){const a=nm(s,n);this.domains.set(a,i)}}}}derive(e,t){const i={name:e.name,axes:[]};let o;if(e.domain!==void 0)A:for(const s of this.domainPacks){const n=[];for(const l of s){const g=e.domain[l];if(g!==void 0)n.push([l,g]);else break A}const a=this.domainPackToAnchor.get(JSON.stringify(n));if(a!==void 0){i.domainAnchor=a,o=new Set(s);break}}for(const[s,n]of Object.entries(e.domain??{})){if(o!==void 0&&o.has(s))continue;const a=nm(s,n),l=this.domains.get(a);i.domain??(i.domain={}),i.domain[s]=l?{anchor:l}:n}if(i.axes=e.axesSpec.map(s=>{const n=sm(s),a=this.axes.get(n);return a===void 0?Ye(s):a}),!t||t.length===0)return i;const r=[];for(const s of t){const[n,a]=s;if(typeof n=="number"){if(n<0||n>=e.axesSpec.length)throw new Error(`Axis index ${n} is out of bounds (0-${e.axesSpec.length-1})`);r.push([n,a])}else{const l=e.axesSpec.findIndex(g=>g.name===n);if(l===-1)throw new Error(`Axis with name "${n}" not found in the column specification`);r.push([l,a])}}return r.sort((s,n)=>s[0]-n[0]),{source:i,axisFilters:r}}deriveS(e,t){return LP(this.derive(e,t))}}function lm(A,e,t){const i={...e},o=(t==null?void 0:t.ignoreMissingDomains)??!1;if(i.domainAnchor!==void 0){const r=A[i.domainAnchor];if(!r)throw new Error(`Anchor "${i.domainAnchor}" not found`);const s=r.domain||{};i.domain={...s,...i.domain},delete i.domainAnchor}if(i.domain){const r={};for(const[s,n]of Object.entries(i.domain))if(typeof n=="string")r[s]=n;else{const a=A[n.anchor];if(!a)throw new Error(`Anchor "${n.anchor}" not found for domain key "${s}"`);if(!a.domain||a.domain[s]===void 0){if(!o)throw new Error(`Domain key "${s}" not found in anchor "${n.anchor}"`);continue}r[s]=a.domain[s]}i.domain=r}return i.axes&&(i.axes=i.axes.map(r=>UP(A,r))),i}function UP(A,e){if(!HP(e))return e;const t=e.anchor,i=A[t];if(!i)throw new Error(`Anchor "${t}" not found for axis reference`);if("idx"in e){if(e.idx<0||e.idx>=i.axesSpec.length)throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);return i.axesSpec[e.idx]}else if("name"in e){const o=i.axesSpec.filter(r=>r.name===e.name);if(o.length>1)throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);if(o.length===0)throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);return o[0]}else if("id"in e){const o=i.axesSpec.filter(r=>vC(e.id,Ye(r)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${t}"`);return o[0]}throw new Error("Unsupported axis reference type")}function HP(A){return typeof A=="object"&&"anchor"in A}function cs(A){return A.kind==="PColumn"}function cB(A){return cs(A.spec)}function NP(A){if(!cB(A))throw new Error(`not a PColumn (kind = ${A.spec.kind})`);return A}function dB(A,e){return A===void 0?void 0:{...A,data:e(typeof A.data=="function"?A.data():A.data)}}function zP(A){const e=new Map,t=i=>{switch(i.type){case"column":e.set(i.column.id,i.column);return;case"slicedColumn":e.set(i.column.id,i.column);return;case"artificialColumn":e.set(i.column.id,i.column);return;case"inlineColumn":return;case"full":case"inner":for(const o of i.entries)t(o);return;case"outer":t(i.primary);for(const o of i.secondary)t(o);return;default:ec(i)}};return t(A),[...e.values()]}function gm(A,e){if(A.name!==void 0&&A.name!==e.name)return!1;if(A.type!==void 0){if(Array.isArray(A.type)){if(!A.type.includes(e.type))return!1}else if(A.type!==e.type)return!1}if(A.domain!==void 0){const t=e.domain||{};for(const[i,o]of Object.entries(A.domain))if(t[i]!==o)return!1}return!0}function cm(A,e){if(e.name!==void 0&&A.name!==e.name||e.namePattern!==void 0&&!new RegExp(e.namePattern).test(A.name))return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(A.valueType))return!1}else if(e.type!==A.valueType)return!1}if(e.domain!==void 0){const t=A.domain||{};for(const[i,o]of Object.entries(e.domain))if(t[i]!==o)return!1}if(e.axes!==void 0){const t=A.axesSpec.map(Ye);if(e.partialAxesMatch){for(const i of e.axes)if(!t.some(o=>gm(i,o)))return!1}else{if(t.length!==e.axes.length)return!1;for(let i=0;i<e.axes.length;i++)if(!gm(e.axes[i],t[i]))return!1}}if(e.annotations!==void 0){const t=A.annotations||{};for(const[i,o]of Object.entries(e.annotations))if(t[i]!==o)return!1}if(e.annotationPatterns!==void 0){const t=A.annotations||{};for(const[i,o]of Object.entries(e.annotationPatterns)){const r=t[i];if(r===void 0||!new RegExp(o).test(r))return!1}}return!0}function Ig(A){return Array.isArray(A)?e=>A.some(t=>cs(e)&&cm(e,t)):e=>cs(e)&&cm(e,A)}function OP(A){const e={kind:A.kind,name:A.name};return A.domain!==void 0&&(e.domain=A.domain),cs(A)&&(e.axesSpec=YP(A.axesSpec)),Ta(e)}class Ki{constructor(e){PA(this,"data");this.data=e}get keys(){return this.data.keys()}get keyAxesIds(){return[...this.data.keys()].map(UQ)}static fromColumns(e){var i,o;const t=new Map;for(const r of e.filter(s=>!!gB(s.spec,de.IsLinkerColumn))){const s=Ki.getAxesGroups(rm(r.spec.axesSpec));if(s.length!==2)continue;const[n,a]=s,l=Ki.getAxesRoots(n).map(c=>{const d=jn(Vn(c));return[et(d.map(Ye)),d]}),g=Ki.getAxesRoots(a).map(c=>{const d=jn(Vn(c));return[et(d.map(Ye)),d]});for(const[c,d]of l)t.has(c)||t.set(c,{keyAxesSpec:d,linkWith:new Map});for(const[c,d]of g)t.has(c)||t.set(c,{keyAxesSpec:d,linkWith:new Map});for(const[c]of l)for(const[d]of g)(i=t.get(c))==null||i.linkWith.set(d,r),(o=t.get(d))==null||o.linkWith.set(c,r)}return new this(t)}searchAvailableAxesKeys(e){const t=new Set(e),i=new Set;let o=e;for(;o.length;){const r=[];for(const s of o){const n=this.data.get(s);if(n)for(const a of n.linkWith.keys())!i.has(a)&&!t.has(a)&&(r.push(a),i.add(a))}o=r}return i}searchLinkerPath(e,t){const i={};let o=new Set([e]);const r=new Set([e]);for(;o.size;){const s=new Set;for(const n of o){const a=this.data.get(n);if(a)for(const l of a.linkWith.keys())if(i[l]=n,l===t){const g=[];let c=t;for(;i[c]!==e;)g.push(c),c=i[c];return g.push(c),g.map(d=>this.data.get(d).linkWith.get(i[d]))}else r.has(l)||(s.add(l),r.add(l))}o=s}return[]}getLinkerColumnsForAxes({from:e,to:t,throwWhenNoLinkExists:i=!0}){const o=e.map(Ki.getLinkerKeyFromAxisSpec);return Array.from(new Map(Ki.getAxesRoots(t).map(Ki.getLinkerKeyFromAxisSpec).flatMap(r=>{const s=o.map(n=>this.searchLinkerPath(n,r)).reduce((n,a)=>n.length&&n.length<a.length||!a.length?n:a,[]).map(n=>[n.columnId,n]);if(!s.length&&i)throw Error(`Unable to find linker column for ${r}`);return s})).values())}getAxesListFromKeysList(e){return Array.from(new Map(e.flatMap(t=>{var i;return((i=this.data.get(t))==null?void 0:i.keyAxesSpec)??[]}).map(t=>[et(Ye(t)),t])).values())}getNonLinkableAxes(e,t){const i=e.map(Ki.getLinkerKeyFromAxisSpec),o=t.map(Ki.getLinkerKeyFromAxisSpec);return Array.from(new Map(t.filter((s,n)=>{const a=o[n];return!i.some(l=>this.searchLinkerPath(l,a).length)}).flatMap(s=>jn(Vn(s)).map(n=>[et(Ye(n)),n]))).values())}getReachableByLinkersAxesFromAxesNormalized(e,t){let i=[];if(t){const r=e.map(s=>jn(Vn(s)).map(Ye));for(const s of r){const n=this.keyAxesIds.find(a=>a.every(l=>s.find(g=>t(l,g))));n&&i.push(et(n))}}else i=e.map(Ki.getLinkerKeyFromAxisSpec);const o=this.searchAvailableAxesKeys(i);return this.getAxesListFromKeysList([...o])}getReachableByLinkersAxesFromAxes(e,t){return this.getReachableByLinkersAxesFromAxesNormalized(rm(e),t)}static getLinkerKeyFromAxisSpec(e){return et(jn(Vn(e)).map(Ye))}static getAxesGroups(e){switch(e.length){case 0:return[];case 1:return[[e[0]]]}const t=e.map(a=>et(Ye(a))),i=e.map(a=>new Set(a.parentAxesSpec.map(l=>et(Ye(l))).map(l=>{const g=t.indexOf(l);if(g===-1)throw new Error(`malformed axesSpec: ${JSON.stringify(e)}, unable to locate parent ${l}`);return g}))),o=[...e.keys()],r=[],s=new Set;let n=o.find(a=>!s.has(a));for(;n!==void 0;){const a=[n];s.add(n);let l=[n];for(;l.length;){const g=new Set;for(const c of l){const d=i[c];o.forEach(h=>{if(h===c||s.has(h))return;(i[h].has(c)||d.has(h))&&(a.push(h),g.add(h),s.add(h))})}l=[...g]}r.push([...a]),n=o.find(g=>!s.has(g))}return r.map(a=>a.map(l=>e[l]))}static getAxesRoots(e){const t=new Set(e.flatMap(i=>i.parentAxesSpec).map(i=>et(Ye(i))));return e.filter(i=>!t.has(et(Ye(i))))}}const VP=24;q.string().length(VP).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");q.object({__isRef:q.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:q.string().describe("Upstream block id"),name:q.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:q.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function jP(A){return typeof A=="object"&&A!==null&&"__isRef"in A&&A.__isRef===!0&&"blockId"in A&&"name"in A}function dm(A,e=!0){if(e)return{...A,requireEnrichments:!0};{const{requireEnrichments:t,...i}=A;return i}}function JP(A,e){return A.ok?{ok:!0,value:e(A.value)}:A}class ei{constructor(e,t=i=>i){PA(this,"handle");PA(this,"postProcess");PA(this,"isResolved",!1);PA(this,"resolvedValue");this.handle=e,this.postProcess=t,l5(e,i=>{this.resolvedValue=t(i),this.isResolved=!0})}map(e){return new ei(this.handle,t=>e(this.postProcess(t)))}mapDefined(e){return new ei(this.handle,t=>{const i=this.postProcess(t);return i?e(i):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function IC(A,e){return A===void 0?void 0:e(A)}class Hi{constructor(e,t){PA(this,"handle");PA(this,"resolvePath");this.handle=e,this.resolvePath=t}resolve(...e){const t=e.map(i=>({assertFieldType:"Input",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveOutput(...e){const t=e.map(i=>({assertFieldType:"Output",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveInput(...e){const t=e.map(i=>({assertFieldType:"Input",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...t){const i=[...this.resolvePath,...t.map(o=>typeof o=="string"?o:o.field)];return IC(ce().resolveWithCommon(this.handle,e,...t),o=>new Hi(o,i))}get resourceType(){return ce().getResourceType(this.handle)}getInputsLocked(){return ce().getInputsLocked(this.handle)}getOutputsLocked(){return ce().getOutputsLocked(this.handle)}getIsReadyOrError(){return ce().getIsReadyOrError(this.handle)}getIsFinal(){return ce().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return IC(ce().getError(this.handle),t=>new Hi(t,e))}listInputFields(){return ce().listInputFields(this.handle)}listOutputFields(){return ce().listOutputFields(this.handle)}listDynamicFields(){return ce().listDynamicFields(this.handle)}getKeyValueBase64(e){return ce().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return ce().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const t=this.getKeyValueAsString(e);if(t==null)throw new Error("Resource has no content.");return JSON.parse(t)}getDataBase64(){return ce().getDataBase64(this.handle)}getDataAsString(){return ce().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,t=""){const i=this.parsePObjectCollection(e,t);return i===void 0?void 0:Object.entries(i).map(([,r])=>{if(!cB(r))throw new Error(`not a PColumn (kind = ${r.spec.kind})`);return r})}parsePObjectCollection(e=!1,t=""){const i=ce().parsePObjectCollection(this.handle,e,t,...this.resolvePath);if(i===void 0)return;const o={};for(const[r,s]of Object.entries(i)){const n=[...this.resolvePath,r];o[r]=dB(s,a=>new Hi(a,n))}return o}getFileContentAsBase64(e){return new ei(ce().getBlobContentAsBase64(this.handle,e))}getFileContentAsString(e){return new ei(ce().getBlobContentAsString(this.handle,e))}getFileContentAsJson(e){return new ei(ce().getBlobContentAsString(this.handle,e)).mapDefined(t=>JSON.parse(t))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new ei(ce().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new ei(ce().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new ei(ce().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new ei(ce().getImportProgress(this.handle))}getLastLogs(e){return new ei(ce().getLastLogs(this.handle,e))}getProgressLog(e){return new ei(ce().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new ei(ce().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new ei(ce().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(t=>this.resolve({field:t,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(t=>this.resolve({field:t,assertFieldType:"Output"})!==void 0)}}mapFields(e,t){const{fieldType:i,requireLocked:o,skipUnresolved:r}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...t},s=e;if(o&&(i==="Input"&&!this.getInputsLocked()||i==="Output"&&!this.getOutputsLocked()))return;let a=(i==="Input"?this.listInputFields():i==="Output"?this.listOutputFields():this.listDynamicFields()).map(l=>[l,this.resolve({field:l,assertFieldType:i})]);return r&&(a=a.filter(l=>l[1]!==void 0)),a.map(([l,g])=>s(l,g))}}const WP="staging",KP="main";function XP(A,e){const t=[...e].sort((s,n)=>n[0]-s[0]),{type:i}=A;switch(i){case"Json":{const{keyLength:s}=A;for(const[n]of e)if(n>=s)throw new Error(`Can't filter on non-data axis ${n}. Must be >= ${s}`);break}case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":{const{partitionKeyLength:s}=A;for(const[n]of e)if(n>=s)throw new Error(`Can't filter on non-partitioned axis ${n}. Must be >= ${s}`);break}default:throw new Error(`Unsupported data info type: ${i}`)}const o=s=>{for(const[n,a]of t)if(s[n]!==a)return!1;return!0},r=s=>{const n=[...s];for(const[a]of t)n.splice(a,1);return n};switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength-e.length,data:A.data.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))}}}const qP=q.object({type:q.string(),importance:q.number().optional(),id:q.string().optional(),label:q.string()}),ZP=q.array(qP),_P=.001,$P="__LABEL__",hm="__LABEL__@1";function zQ(A,e,t={}){const i=new Map,o=t.forceTraceElements!==void 0&&t.forceTraceElements.length>0?new Set(t.forceTraceElements):void 0,r=new Map,s=A.map(h=>{const u=e(h);let p,C,f;"spec"in u&&typeof u.spec=="object"?(p=u.spec,C=u.prefixTrace,f=u.suffixTrace):p=u;const B=EC(p,de.Label),w=EC(p,de.Trace),m=(w?ZP.safeParse(UQ(w)).data:void 0)??[],E=[...C??[],...m,...f??[]];if(B!==void 0){const I={label:B,type:$P,importance:-2};t.addLabelAsSuffix?E.push(I):E.splice(0,0,I)}const v=[],x=new Map;for(let I=E.length-1;I>=0;--I){const{type:b}=E[I],G=E[I].importance??0,k=(x.get(b)??0)+1;x.set(b,k);const F=`${b}@${k}`;r.set(F,(r.get(F)??0)+1),i.set(F,Math.max(i.get(F)??Number.NEGATIVE_INFINITY,G-(E.length-I)*_P)),v.push({...E[I],fullType:F,occurrenceIndex:k})}return v.reverse(),{value:h,spec:p,label:B,fullTrace:v}}),n=[],a=[],l=[...i];l.sort(([,h],[,u])=>u-h);for(const[h]of l)h.endsWith("@1")||r.get(h)===A.length?n.push(h):a.push(h);const g=(h,u=!1)=>{const p=[];for(let C=0;C<s.length;C++){const f=s[C],B=f.fullTrace.filter(E=>h.has(E.fullType)||o&&o.has(E.type));if(B.length===0)if(u)p.push({label:"Unlabeled",value:f.value});else return;const w=B.map(E=>E.label),m=t.separator??" / ";p.push({label:w.join(m),value:f.value})}return p};if(n.length===0){if(a.length!==0)throw new Error("Non-empty secondary types list while main types list is empty.");return g(new Set(hm),!0)}let c=0,d=-1;for(;c<n.length;){const h=new Set;t.includeNativeLabel&&h.add(hm);for(let p=0;p<c;++p)h.add(n[p]);d>=0&&h.add(n[d]);const u=g(h);if(u!==void 0&&new Set(u.map(p=>p.label)).size===A.length)return u;d++,d>=n.length&&(c++,d=c)}return g(new Set([...n,...a]),!0)}const La="PColumnData/",QC=La+"ResourceMap",bC=La+"Partitioned/ResourceMap",Ll=La+"JsonPartitioned",sa=La+"BinaryPartitioned",Ul=La+"ParquetPartitioned",hB=La+"Partitioned/",Wd=hB+"JsonPartitioned",Hl=hB+"BinaryPartitioned",Kd=hB+"ParquetPartitioned",DC=A=>{if(A.endsWith(".index"))return{baseKey:A.substring(0,A.length-6),type:"index"};if(A.endsWith(".values"))return{baseKey:A.substring(0,A.length-7),type:"values"};throw new Error(`key must ends on .index/.values for binary p-column, got: ${A}`)};function AR(A){if(!A)return;const e=A.resourceType.name,t=A.getDataAsJson(),i=[];let o=0;switch(e){case QC:o=t.keyLength;break;case bC:o=t.partitionKeyLength+t.keyLength;break;case Ll:case sa:case Ul:o=t.partitionKeyLength;break;case Hl:case Wd:case Kd:o=t.superPartitionKeyLength+t.partitionKeyLength;break}switch(e){case QC:case Ll:case sa:case Ul:for(let r of A.listInputFields()){e===sa&&(r=DC(r).baseKey);const s=[...JSON.parse(r)];i.push(s)}break;case bC:case Hl:case Wd:case Kd:for(const r of A.listInputFields()){const s=[...JSON.parse(r)],n=A.resolve({field:r,assertFieldType:"Input"});if(n!==void 0)for(let a of n.listInputFields()){e===Hl&&(a=DC(a).baseKey);const l=[...s,...JSON.parse(a)];i.push(l)}}break}return{data:i,keyLength:o}}function eR(A){if(A.type!=="JsonPartitioned"&&A.type!=="BinaryPartitioned"&&A.type!=="ParquetPartitioned")throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${A.type}`);const{parts:e,partitionKeyLength:t}=A,i=[];for(let o=0;o<t;++o)i.push(new Set);for(const o of e){const r=o.key;if(r.length!==t)throw new Error(`Key length (${r.length}) does not match partition length (${t}) for key: ${JSON.stringify(r)}`);for(let s=0;s<t;++s)i[s].add(r[s])}return i.map(o=>Array.from(o.values()))}function tR(A){if(A===void 0)return;if(aB(A))return eR(A);const e=AR(A);if(!e)return;const{data:t,keyLength:i}=e,o=[];for(let r=0;r<i;++r)o.push(new Set);for(const r of t){if(r.length!==i)throw new Error("key length does not match partition length");for(let s=0;s<i;++s)o[s].add(r[s])}return o.map(r=>Array.from(r.values()))}function ad(A,e=[]){if(A===void 0||!A.getIsReadyOrError())return;const t=A.resourceType.name,i=A.getDataAsJson();if(e.length>0&&(t===Wd||t===Hl||t===Kd))throw new Error(`Unexpected nested super-partitioned resource: ${t}`);switch(t){case QC:case bC:throw new Error(`Only data columns are supported, got: ${t}`);case Ll:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[];for(const r of A.listInputFields()){const s=A.resolve({field:r,assertFieldType:"Input"});if(s===void 0)return;const n=[...e,...JSON.parse(r)];o.push({key:n,value:s})}return{type:"JsonPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case sa:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[],r=new Map;for(const s of A.listInputFields()){const n=DC(s),a=A.resolve({field:s,assertFieldType:"Input"});if(a===void 0)return;let l=r.get(n.baseKey);l||(l={},r.set(n.baseKey,l)),n.type==="index"?l.index=a:l.values=a}for(const[s,n]of r.entries()){if(!n.index||!n.values)return;const a=[...e,...JSON.parse(s)];o.push({key:a,value:{index:n.index,values:n.values}})}return{type:"BinaryPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case Ul:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[];for(const r of A.listInputFields()){const s=A.resolve({field:r,assertFieldType:"Input"});if(s===void 0)return;const n=[...e,...JSON.parse(r)];o.push({key:n,value:s})}return{type:"ParquetPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case Wd:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==Ll)throw new Error(`Expected ${Ll} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="JsonPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"JsonPartitioned",partitionKeyLength:o,parts:r}}case Hl:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==sa)throw new Error(`Expected ${sa} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="BinaryPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"BinaryPartitioned",partitionKeyLength:o,parts:r}}case Kd:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==Ul)throw new Error(`Expected ${Ul} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="ParquetPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"ParquetPartitioned",partitionKeyLength:o,parts:r}}default:throw new Error(`Unknown resource type: ${t}`)}}function iR(A){if(A!==void 0){if(aB(A))return A;if(_h(A))return BP(A);if(A instanceof Hi)return ad(A);throw new Error(`Unexpected input type: ${typeof A}`)}}function oR(A){const e=r=>Array.isArray(r),t=r=>r instanceof Hi;let i=!0;const o=typeof A.data=="function"?A.data():A.data;if(o==null)return!1;if(t(o))i&&(i=o.getIsReadyOrError());else if(_h(o))CP(o,r=>i&&(i=r.getIsReadyOrError()));else if(!e(o))throw Error(`unsupported column data type: ${o}`);return i}function um(A){return A.every(oR)}function rR(A){if(!Array.isArray(A))return!1;if(A.length===0)return!0;const e=A[0];return typeof e=="object"&&e!==null&&"key"in e&&"val"in e}class sR{constructor(e){PA(this,"columns");this.columns=e}selectColumns(e){const t=typeof e=="function"?e:Ig(e);return this.columns.filter(i=>t(i.spec))}}function nR(A){if(A)return A.map(e=>({type:`split:${kP(e.axisId)}`,label:e.label,importance:1e6}))}function aR(A){if(A)return A.map(e=>[e.axisIdx,e.value])}function lR(A,e){if(!e||e.length===0)return A;const t=[...e].sort((i,o)=>i[0]-o[0]);return Ta({id:A,axisFilters:t})}function pm(A){if(!A||typeof A!="object")return!1;const e=A,t=e.domain&&typeof e.domain=="object"&&Object.values(e.domain).some(o=>typeof o=="object"&&o!==null&&"anchor"in o),i=e.axes&&Array.isArray(e.axes)&&e.axes.some(o=>typeof o=="object"&&o!==null&&"anchor"in o);return!!e.domainAnchor||t||i}function gR(A){if(typeof A!="object"||!("axes"in A)||A.axes===void 0)return[];const e=A.axes.map((t,i)=>typeof t=="object"&&"split"in t&&t.split===!0?i:-1).filter(t=>t!==-1);if(e.length>0&&A.partialAxesMatch!==void 0)throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");return e.sort((t,i)=>t-i),e}class Cm{constructor(){PA(this,"defaultProviderStore",[]);PA(this,"providers",[new sR(this.defaultProviderStore)]);PA(this,"axisLabelProviders",[])}addColumnProvider(e){return this.providers.push(e),this}addAxisLabelProvider(e){return this.axisLabelProviders.push(e),this}addColumns(e){return this.defaultProviderStore.push(...e),this}addColumn(e){return this.defaultProviderStore.push(e),this}findLabels(e){for(const t of this.axisLabelProviders){const i=t.findLabels(e);if(i)return i}}getUniversalEntries(e,t){const{anchorCtx:i,labelOps:o,dontWaitAllData:r=!1,overrideLabelAnnotation:s=!1,exclude:n,enrichByLinkers:a=!1}=t??{},l={...s&&(o==null?void 0:o.includeNativeLabel)!==!1?{includeNativeLabel:!0}:{},...o??{}};let g=()=>!1;if(n){const f=(Array.isArray(n)?n:[n]).map(B=>{if(pm(B)){if(!i)throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");return Ig(lm(i.anchors,B,t))}else return Ig(B)});g=B=>f.some(w=>w(B))}const c=typeof e=="function"?[e]:Array.isArray(e)?e:[e],d=[],h=new Set;for(const f of c){const B=pm(f);let w;if(B){if(!i)throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");w=lm(i.anchors,f,t)}else w=f;const m=new Set,E=[];for(const I of this.providers){const b=I.selectColumns(w);for(const G of b){if(g(G.spec))continue;if(m.has(G.id))throw new Error(`Duplicate column id ${G.id} in provider ${I.constructor.name}`);const k=OP(G.spec);h.has(k)||(m.add(G.id),h.add(k),E.push(G))}}if(E.length===0)continue;const v=gR(f),x=v.length>0;for(const I of E){if(!cs(I.spec))continue;const b=I.spec;if(x){if(rR(I.data))throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${I.id}`);const G=iR(I.data);if(!G){if(r)continue;return}if(!fP(G))throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${G.type} for column ${I.id}`);const k=tR(G),F=v[v.length-1];if(F>=G.partitionKeyLength)throw new Error(`Not enough partition keys (${G.partitionKeyLength}) for requested split axes (max index ${F}) in column ${b.name}`);const AA=v.map(Z=>this.findLabels(Ye(b.axesSpec[Z]))),U=[],N=(Z,gA)=>{if(gA>=v.length){if(U.push([...Z]),U.length>1e4)throw new Error("Too many key combinations, aborting.");return}const EA=v[gA];if(EA>=k.length)throw new Error(`Axis index ${EA} out of bounds for unique keys array (length ${k.length}) during split key generation for column ${I.id}`);const fA=k[EA];if(!fA||fA.length===0){U.length=0;return}for(const RA of fA)Z.push(RA),N(Z,gA+1),Z.pop()};if(N([],0),U.length===0)continue;const Y=[...b.axesSpec],z=v.map(Z=>Z);for(let Z=v.length-1;Z>=0;Z--)Y.splice(v[Z],1);const X={...b,axesSpec:Y};for(const Z of U){const gA=Z.map((EA,fA)=>{const RA=z[fA],pA=Ye(b.axesSpec[RA]),Ee=AA[fA],re=(Ee==null?void 0:Ee[EA])??String(EA);return{axisIdx:RA,axisId:pA,value:EA,label:re}});d.push({type:"split",originalColumn:I,spec:b,adjustedSpec:X,dataEntries:G,axisFilters:gA})}}else d.push({type:"direct",originalColumn:I,spec:b,adjustedSpec:b})}}if(d.length===0)return[];const u=zQ(d,f=>({spec:f.spec,suffixTrace:f.type==="split"?nR(f.axisFilters):void 0}),l),p=[];for(const{value:f,label:B}of u){const{originalColumn:w,spec:m}=f,E=f.type==="split"?f.axisFilters:void 0,v=aR(E);let x;i?x=i.deriveS(m,v):x=lR(w.id,v);let I={...f.adjustedSpec};s&&(I={...I,annotations:{...I.annotations??{},[de.Label]:B}}),p.push({id:x,spec:I,data:()=>f.type==="split"?wP(XP(f.dataEntries,v)):f.originalColumn.data,label:B})}const C=new Set(p.map(f=>f.id));if(a&&i){let m=function(x,I){return vC(x,I)||vC(I,x)};const f=p.filter(x=>im(x.spec));if(f.length===0)return p;const B=Object.values(i.anchors).flatMap(x=>x.axesSpec),E=Ki.fromColumns(f.map(RP)).getReachableByLinkersAxesFromAxes(B,m),v=this.getUniversalEntries(x=>!im(x)&&x.axesSpec.some(I=>{const b=Ye(I);return E.some(G=>m(Ye(G),b))}),{anchorCtx:i,labelOps:l,dontWaitAllData:r,overrideLabelAnnotation:s,exclude:n});v&&p.push(...v.filter(x=>!C.has(x.id)))}return p}getColumns(e,t){const i=this.getUniversalEntries(e,{overrideLabelAnnotation:!0,...t??{}});if(!i)return;const o=[];for(const r of i){const s=r.data();if(!s){if(t!=null&&t.dontWaitAllData)continue;return}o.push({id:r.id,spec:r.spec,data:s})}return o}}function fm(A){const e=o=>o.operator!=="InSet"?o:{operator:"Or",operands:o.references.map(r=>({operator:"Equal",reference:r}))},t=(o,r)=>{switch(o.operator){case"And":return{...o,operands:o.operands.map(n=>t(n,r))};case"Or":return{...o,operands:o.operands.map(n=>t(n,r))};case"Not":return{...o,operand:t(o.operand,r)};default:return r(o)}},i=(o,r)=>({...o,predicate:t(o.predicate,r)});return A.map(o=>i(o,e))}function ap(A,e){if(A===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(A[t]!==e[t])return!1;return!0}function Bm(A){return dB(A,e=>e instanceof Hi?e.handle:_h(e)?pP(e,t=>t.handle):e)}class cR{constructor(){PA(this,"ctx",ce())}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,t){const i=typeof e=="function"?e:Ig(e),o=this.getSpecs().entries.filter(n=>i(n.obj));let r={},s=!1;return typeof t<"u"&&(typeof t=="function"?r=t:typeof t=="object"&&("includeNativeLabel"in t||"separator"in t||"addLabelAsSuffix"in t?r=t:(t=t,r=t.label??{},s=t.refsWithEnrichments??!1))),typeof r=="object"?zQ(o,n=>n.obj,r??{}).map(({value:{ref:n},label:a})=>({ref:dm(n,s),label:a})):o.map(({ref:n,obj:a})=>({ref:dm(n,s),label:r(a,n)}))}resolveAnchorCtx(e){if(e instanceof am)return e;const t={};for(const[i,o]of Object.entries(e))if(jP(o)){const r=this.getPColumnSpecByRef(o);if(!r)return;t[i]=r}else t[i]=o;return new am(t)}getAnchoredPColumns(e,t,i){const o=this.resolveAnchorCtx(e);if(o)return new Cm().addColumnProvider(this).addAxisLabelProvider(this).getColumns(t,{...i,anchorCtx:o})}getCanonicalOptions(e,t,i){const o=this.resolveAnchorCtx(e);if(!o)return;const r=new Cm().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(t,{...i,anchorCtx:o});if(r)return r.map(s=>({value:s.id,label:s.label}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(t=>({ref:t.ref,obj:{...t.obj,data:new Hi(t.obj.data,[t.ref.blockId,t.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(t=>({ref:t.ref,obj:{...t.obj,data:JP(t.obj.data,i=>new Hi(i,[t.ref.blockId,t.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var i;if(typeof this.ctx.getDataFromResultPoolByRef>"u")return(i=this.getData().entries.find(o=>o.ref.blockId===e.blockId&&o.ref.name===e.name))==null?void 0:i.obj;const t=this.ctx.getDataFromResultPoolByRef(e.blockId,e.name);if(t)return dB(t,o=>new Hi(o,[e.blockId,e.name]))}getPColumnByRef(e){const t=this.getDataByRef(e);if(t)return NP(t)}getPColumnSpecByRef(e){const t=this.getSpecByRef(e);if(t){if(!cs(t))throw new Error(`not a PColumn spec (kind = ${t.kind})`);return t}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const t=[];A:for(const i of this.getData().entries){if(!cs(i.obj.spec))continue;const o=i.obj.spec;if(e.name===o.name&&e.valueType===o.valueType&&e.axesSpec.length===o.axesSpec.length&&ap(e.domain,o.domain)){for(let r=0;r<e.axesSpec.length;++r){const s=e.axesSpec[r],n=o.axesSpec[r];if(s.name!==n.name||s.type!==n.type||!ap(s.domain,n.domain))continue A}t.push(i.obj)}}return t}findLabels(e){const t=this.getData();for(const i of t.entries){if(!cB(i.obj))continue;const o=i.obj.spec;if(o.name===PP.Label&&o.axesSpec.length===1&&o.axesSpec[0].name===e.name&&o.axesSpec[0].type===e.type&&ap(e.domain,o.axesSpec[0].domain)){if(i.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${i.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(i.obj.data.getDataAsJson().data).map(s=>[JSON.parse(s[0])[0],s[1]]))}}}selectColumns(e){const t=typeof e=="function"?e:Ig(e);return this.getSpecs().entries.filter(({obj:o})=>cs(o)?t(o):!1).map(({ref:o,obj:r})=>{const s=r;let n=null;const a=this;return{id:Ta(o),spec:s,get data(){var l;return n!==null||(n=(l=a.getPColumnByRef(o))==null?void 0:l.data),n}}})}findLabelsForColumnAxis(e,t){const i=this.findLabels(e.axesSpec[t]);if(!i)return;const o=EC(e,`pl7.app/axisKeys/${t}`);if(o!==void 0){const r=JSON.parse(o);return Object.fromEntries(r.map(s=>[s,i[s]??"Unlabelled"]))}else return i}}class Fc{constructor(){PA(this,"ctx");PA(this,"_argsCache");PA(this,"_uiStateCache");PA(this,"_activeArgsCache");PA(this,"resultPool",new cR);this.ctx=ce()}get args(){if(this._argsCache===void 0){const e=this.ctx.args,t=typeof e=="function"?e():e;this._argsCache={v:JSON.parse(t)}}return this._argsCache.v}get uiState(){if(this._uiStateCache===void 0){const e=this.ctx.uiState,t=typeof e=="function"?e():e;this._uiStateCache={v:t?JSON.parse(t):{}}}return this._uiStateCache.v}get activeArgs(){if(this._activeArgsCache===void 0){const e=this.ctx.activeArgs,t=typeof e=="function"?e():e;this._activeArgsCache={v:t?JSON.parse(t):void 0}}return this._activeArgsCache.v}getNamedAccessor(e){return IC(this.ctx.getAccessorHandleByName(e),t=>new Hi(t,[e]))}get prerun(){return this.getNamedAccessor(WP)}get outputs(){return this.getNamedAccessor(KP)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineAndExplicitColumnsSupport(e){var o;const t=e.some(r=>!(r.data instanceof Hi)||_h(r.data)),i=((o=this.ctx.featureFlags)==null?void 0:o.inlineColumnsSupport)===!0;if(t&&!i)throw Error("Inline or explicit columns not supported")}patchPTableDef(e){var t,i;return(t=this.ctx.featureFlags)!=null&&t.pTablePartitionFiltersSupport||(e={...e,partitionFilters:[],filters:[...e.partitionFilters,...e.filters]}),(i=this.ctx.featureFlags)!=null&&i.pFrameInSetFilterSupport||(e={...e,partitionFilters:fm(e.partitionFilters),filters:fm(e.filters)}),e}createPFrame(e){if(this.verifyInlineAndExplicitColumnsSupport(e),!!um(e))return this.ctx.createPFrame(e.map(t=>Bm(t)))}createPTable(e){let t;"columns"in e?t=this.patchPTableDef({src:{type:"full",entries:e.columns.map(o=>({type:"column",column:o}))},partitionFilters:e.filters??[],filters:[],sorting:e.sorting??[]}):t=this.patchPTableDef(e);const i=zP(t.src);if(this.verifyInlineAndExplicitColumnsSupport(i),!!um(i))return this.ctx.createPTable(TP(t,o=>Bm(o)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){return this.ctx.getCurrentUnstableMarker()}logInfo(e){this.ctx.logInfo(e)}logWarn(e){this.ctx.logWarn(e)}logError(e){this.ctx.logError(e)}}var dR="1.47.5";const ld=dR;function hR(A){return A.__renderLambda===!0}function lp(A){if(A!==void 0)return hR(A)?A.handle:A}const nt=class nt{constructor(e,t,i,o,r,s,n,a,l){PA(this,"_renderingMode");PA(this,"_initialArgs");PA(this,"_initialUiState");PA(this,"_outputs");PA(this,"_inputsValid");PA(this,"_sections");PA(this,"_title");PA(this,"_enrichmentTargets");PA(this,"_featureFlags");this._renderingMode=e,this._initialArgs=t,this._initialUiState=i,this._outputs=o,this._inputsValid=r,this._sections=s,this._title=n,this._enrichmentTargets=a,this._featureFlags=l}static create(e="Heavy"){return new nt(e,void 0,{},{},op(!0),op([]),void 0,void 0,{...nt.INITIAL_BLOCK_FEATURE_FLAGS})}output(e,t,i={}){if(typeof t=="function"){const o=`output#${e}`;return Al(o,()=>t(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:o,...i}},this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}else return new nt(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:t},this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}retentiveOutput(e,t){return this.output(e,t,{retentive:!0})}argsValid(e){return typeof e=="function"?(Al("inputsValid",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title,this._enrichmentTargets,this._featureFlags)):new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}sections(e){return Array.isArray(e)?this.sections(op(e)):typeof e=="function"?(Al("sections",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title,this._enrichmentTargets,this._featureFlags)):new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title,this._enrichmentTargets,this._featureFlags)}title(e){return Al("title",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"},this._enrichmentTargets,this._featureFlags)}initialArgs(e){return new nt(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withArgs(e){return new nt(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withUiState(e){return new nt(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withFeatureFlags(e){return new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,{...this._featureFlags,...e})}enriches(e){return Al("enrichmentTargets",e),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,{__renderLambda:!0,handle:"enrichmentTargets"},this._featureFlags)}done(e){const t=e??1;return this.withFeatureFlags({...this._featureFlags,requiresUIAPIVersion:t})._done(t)}_done(e){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const t={v3:{sdkVersion:ld,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs,enrichmentTargets:this._enrichmentTargets,featureFlags:this._featureFlags},sdkVersion:ld,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:lp(this._inputsValid),sections:lp(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([i,o])=>[i,lp(o)]))};return globalThis.platformaApiVersion=e,n5()?IQ({sdkVersion:ld,apiVersion:platformaApiVersion}):{config:t}}};PA(nt,"INITIAL_BLOCK_FEATURE_FLAGS",{supportsLazyState:!0,requiresUIAPIVersion:1,requiresModelAPIVersion:1});let xC=nt;function uR(){return platformaApiVersion??1}function ns(){return IQ({sdkVersion:ld,apiVersion:platformaApiVersion})}var yc={exports:{}},wm;function pR(){return wm||(wm=1,function(A,e){e=A.exports=t,e.getSerialize=i;function t(o,r,s,n){return JSON.stringify(o,i(r,n),s)}function i(o,r){var s=[],n=[];return r==null&&(r=function(a,l){return s[0]===l?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(l)).join(".")+"]"}),function(a,l){if(s.length>0){var g=s.indexOf(this);~g?s.splice(g+1):s.push(this),~g?n.splice(g,1/0,a):n.push(a),~s.indexOf(l)&&(l=r.call(this,a,l))}else s.push(l);return o==null?l:o.call(this,a,l)}}}(yc,yc.exports)),yc.exports}pR();const CR=q.object({type:q.literal("PlError"),name:q.string(),message:q.string(),fullMessage:q.string().optional(),stack:q.string().optional()}),fR=CR.extend({cause:q.lazy(()=>Xd).optional(),errors:q.lazy(()=>Xd.array()).optional()}),BR=q.object({type:q.literal("StandardError"),name:q.string(),message:q.string(),stack:q.string().optional()}),wR=BR.extend({cause:q.lazy(()=>Xd).optional(),errors:q.lazy(()=>Xd.array()).optional()}),Xd=q.union([wR,fR]),mR=q.object({name:q.string(),message:q.string(),fullMessage:q.string().optional(),stack:q.string().optional()}),mm=mR.extend({cause:q.lazy(()=>mm).optional(),errors:q.lazy(()=>mm.array()).optional()});function ER(A){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(A)}const Em=Array.isArray;function vm(A){return A!==null&&typeof A=="object"}function vR(A){return typeof A=="object"&&A!==null}function MC(A){if(!vR(A))return!1;const e=Object.getPrototypeOf(A);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null}function Im(A){return Object.values(A).reduce((e,t)=>t!==void 0?e+1:e,0)}function Yi(A,e){if(!(vm(A)&&vm(e)))return A===e;if(Em(A)&&Em(e))return A.length!==e.length?!1:[...A.keys()].every(t=>Yi(A[t],e[t]));if(MC(A)&&MC(e))return Im(A)!==Im(e)?!1:Object.keys(A).every(t=>Yi(A[t],e[t]));throw Error(`Cannot compare a ${String(A)} and b ${String(e)}`)}function at(A){if(Array.isArray(A)){const e=[];for(let t=0;t<A.length;t++)e[t]=at(A[t]);return e}else if(MC(A)){const e={};return Object.keys(A).forEach(t=>{e[t]=at(A[t])}),e}else return A}var IR=Object.defineProperty,QR=(A,e,t)=>e in A?IR(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,FC=(A,e,t)=>QR(A,typeof e!="symbol"?e+"":e,t);let bR=class extends Error{constructor(){super(...arguments),FC(this,"name","UnresolvedError")}};const DR=A=>Array.isArray(A)?A:A?[A]:[];let uB=class extends Error{constructor(e){e=DR(e),super(e.map(t=>typeof t=="string"?t:t.message).join(`
17
+ **/let pC;const Rw=typeof window<"u"&&window.trustedTypes;if(Rw)try{pC=Rw.createPolicy("vue",{createHTML:A=>A})}catch{}const CQ=pC?A=>pC.createHTML(A):A=>A,BS="http://www.w3.org/2000/svg",wS="http://www.w3.org/1998/Math/MathML",cr=typeof document<"u"?document:null,Yw=cr&&cr.createElement("template"),mS={insert:(A,e,t)=>{e.insertBefore(A,t||null)},remove:A=>{const e=A.parentNode;e&&e.removeChild(A)},createElement:(A,e,t,i)=>{const o=e==="svg"?cr.createElementNS(BS,A):e==="mathml"?cr.createElementNS(wS,A):t?cr.createElement(A,{is:t}):cr.createElement(A);return A==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:A=>cr.createTextNode(A),createComment:A=>cr.createComment(A),setText:(A,e)=>{A.nodeValue=e},setElementText:(A,e)=>{A.textContent=e},parentNode:A=>A.parentNode,nextSibling:A=>A.nextSibling,querySelector:A=>cr.querySelector(A),setScopeId(A,e){A.setAttribute(e,"")},insertStaticContent(A,e,t,i,o,r){const s=t?t.previousSibling:e.lastChild;if(o&&(o===r||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),t),!(o===r||!(o=o.nextSibling)););else{Yw.innerHTML=CQ(i==="svg"?`<svg>${A}</svg>`:i==="mathml"?`<math>${A}</math>`:A);const n=Yw.content;if(i==="svg"||i==="mathml"){const a=n.firstChild;for(;a.firstChild;)n.appendChild(a.firstChild);n.removeChild(a)}e.insertBefore(n,t)}return[s?s.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Nr="transition",_a="animation",ng=Symbol("_vtc"),fQ={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},ES=_e({},SI,fQ),vS=A=>(A.displayName="Transition",A.props=ES,A),sB=vS((A,{slots:e})=>CS(fy,IS(A),e)),Ts=(A,e=[])=>{SA(A)?A.forEach(t=>t(...e)):A&&A(...e)},kw=A=>A?SA(A)?A.some(e=>e.length>1):A.length>1:!1;function IS(A){const e={};for(const F in A)F in fQ||(e[F]=A[F]);if(A.css===!1)return e;const{name:t="v",type:i,duration:o,enterFromClass:r=`${t}-enter-from`,enterActiveClass:s=`${t}-enter-active`,enterToClass:n=`${t}-enter-to`,appearFromClass:a=r,appearActiveClass:l=s,appearToClass:g=n,leaveFromClass:c=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:h=`${t}-leave-to`}=A,u=QS(o),p=u&&u[0],C=u&&u[1],{onBeforeEnter:f,onEnter:B,onEnterCancelled:w,onLeave:m,onLeaveCancelled:E,onBeforeAppear:v=f,onAppear:x=B,onAppearCancelled:I=w}=e,b=(F,AA,U,N)=>{F._enterCancelled=N,Ls(F,AA?g:n),Ls(F,AA?l:s),U&&U()},G=(F,AA)=>{F._isLeaving=!1,Ls(F,c),Ls(F,h),Ls(F,d),AA&&AA()},k=F=>(AA,U)=>{const N=F?x:B,Y=()=>b(AA,F,U);Ts(N,[AA,Y]),Gw(()=>{Ls(AA,F?a:r),nr(AA,F?g:n),kw(N)||Tw(AA,i,p,Y)})};return _e(e,{onBeforeEnter(F){Ts(f,[F]),nr(F,r),nr(F,s)},onBeforeAppear(F){Ts(v,[F]),nr(F,a),nr(F,l)},onEnter:k(!1),onAppear:k(!0),onLeave(F,AA){F._isLeaving=!0;const U=()=>G(F,AA);nr(F,c),F._enterCancelled?(nr(F,d),Hw(F)):(Hw(F),nr(F,d)),Gw(()=>{F._isLeaving&&(Ls(F,c),nr(F,h),kw(m)||Tw(F,i,C,U))}),Ts(m,[F,U])},onEnterCancelled(F){b(F,!1,void 0,!0),Ts(w,[F])},onAppearCancelled(F){b(F,!0,void 0,!0),Ts(I,[F])},onLeaveCancelled(F){G(F),Ts(E,[F])}})}function QS(A){if(A==null)return null;if(Ce(A))return[ep(A.enter),ep(A.leave)];{const e=ep(A);return[e,e]}}function ep(A){return Q3(A)}function nr(A,e){e.split(/\s+/).forEach(t=>t&&A.classList.add(t)),(A[ng]||(A[ng]=new Set)).add(e)}function Ls(A,e){e.split(/\s+/).forEach(i=>i&&A.classList.remove(i));const t=A[ng];t&&(t.delete(e),t.size||(A[ng]=void 0))}function Gw(A){requestAnimationFrame(()=>{requestAnimationFrame(A)})}let bS=0;function Tw(A,e,t,i){const o=A._endId=++bS,r=()=>{o===A._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:s,timeout:n,propCount:a}=DS(A,e);if(!s)return i();const l=s+"end";let g=0;const c=()=>{A.removeEventListener(l,d),r()},d=h=>{h.target===A&&++g>=a&&c()};setTimeout(()=>{g<a&&c()},n+1),A.addEventListener(l,d)}function DS(A,e){const t=window.getComputedStyle(A),i=u=>(t[u]||"").split(", "),o=i(`${Nr}Delay`),r=i(`${Nr}Duration`),s=Lw(o,r),n=i(`${_a}Delay`),a=i(`${_a}Duration`),l=Lw(n,a);let g=null,c=0,d=0;e===Nr?s>0&&(g=Nr,c=s,d=r.length):e===_a?l>0&&(g=_a,c=l,d=a.length):(c=Math.max(s,l),g=c>0?s>l?Nr:_a:null,d=g?g===Nr?r.length:a.length:0);const h=g===Nr&&/\b(?:transform|all)(?:,|$)/.test(i(`${Nr}Property`).toString());return{type:g,timeout:c,propCount:d,hasTransform:h}}function Lw(A,e){for(;A.length<e.length;)A=A.concat(A);return Math.max(...e.map((t,i)=>Uw(t)+Uw(A[i])))}function Uw(A){return A==="auto"?0:Number(A.slice(0,-1).replace(",","."))*1e3}function Hw(A){return(A?A.ownerDocument:document).body.offsetHeight}function xS(A,e,t){const i=A[ng];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?A.removeAttribute("class"):t?A.setAttribute("class",e):A.className=e}const Td=Symbol("_vod"),BQ=Symbol("_vsh"),MS={name:"show",beforeMount(A,{value:e},{transition:t}){A[Td]=A.style.display==="none"?"":A.style.display,t&&e?t.beforeEnter(A):$a(A,e)},mounted(A,{value:e},{transition:t}){t&&e&&t.enter(A)},updated(A,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(A),$a(A,!0),i.enter(A)):i.leave(A,()=>{$a(A,!1)}):$a(A,e))},beforeUnmount(A,{value:e}){$a(A,e)}};function $a(A,e){A.style.display=e?A[Td]:"none",A[BQ]=!e}const wQ=Symbol("");function mQ(A){const e=Sn();if(!e)return;const t=e.ut=(o=A(e.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${e.uid}"]`)).forEach(r=>Ld(r,o))},i=()=>{const o=A(e.proxy);e.ce?Ld(e.ce,o):CC(e.subTree,o),t(o)};LI(()=>{II(i)}),$o(()=>{le(i,ao,{flush:"post"});const o=new MutationObserver(i);o.observe(e.subTree.el.parentNode,{childList:!0}),Zg(()=>o.disconnect())})}function CC(A,e){if(A.shapeFlag&128){const t=A.suspense;A=t.activeBranch,t.pendingBranch&&!t.isHydrating&&t.effects.push(()=>{CC(t.activeBranch,e)})}for(;A.component;)A=A.component.subTree;if(A.shapeFlag&1&&A.el)Ld(A.el,e);else if(A.type===ie)A.children.forEach(t=>CC(t,e));else if(A.type===Gl){let{el:t,anchor:i}=A;for(;t&&(Ld(t,e),t!==i);)t=t.nextSibling}}function Ld(A,e){if(A.nodeType===1){const t=A.style;let i="";for(const o in e){const r=P3(e[o]);t.setProperty(`--${o}`,r),i+=`--${o}: ${r};`}t[wQ]=i}}const FS=/(?:^|;)\s*display\s*:/;function yS(A,e,t){const i=A.style,o=Pe(t);let r=!1;if(t&&!o){if(e)if(Pe(e))for(const s of e.split(";")){const n=s.slice(0,s.indexOf(":")).trim();t[n]==null&&sd(i,n,"")}else for(const s in e)t[s]==null&&sd(i,s,"");for(const s in t)s==="display"&&(r=!0),sd(i,s,t[s])}else if(o){if(e!==t){const s=i[wQ];s&&(t+=";"+s),i.cssText=t,r=FS.test(t)}}else e&&A.removeAttribute("style");Td in A&&(A[Td]=r?i.display:"",A[BQ]&&(i.display="none"))}const Nw=/\s*!important$/;function sd(A,e,t){if(SA(t))t.forEach(i=>sd(A,e,i));else if(t==null&&(t=""),e.startsWith("--"))A.setProperty(e,t);else{const i=SS(A,e);Nw.test(t)?A.setProperty(kr(i),t.replace(Nw,""),"important"):A[i]=t}}const zw=["Webkit","Moz","ms"],tp={};function SS(A,e){const t=tp[e];if(t)return t;let i=Di(e);if(i!=="filter"&&i in A)return tp[e]=i;i=Gh(i);for(let o=0;o<zw.length;o++){const r=zw[o]+i;if(r in A)return tp[e]=r}return e}const Ow="http://www.w3.org/1999/xlink";function Vw(A,e,t,i,o,r=y3(e)){i&&e.startsWith("xlink:")?t==null?A.removeAttributeNS(Ow,e.slice(6,e.length)):A.setAttributeNS(Ow,e,t):t==null||r&&!_v(t)?A.removeAttribute(e):A.setAttribute(e,r?"":Co(t)?String(t):t)}function jw(A,e,t,i,o){if(e==="innerHTML"||e==="textContent"){t!=null&&(A[e]=e==="innerHTML"?CQ(t):t);return}const r=A.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const n=r==="OPTION"?A.getAttribute("value")||"":A.value,a=t==null?A.type==="checkbox"?"on":"":String(t);(n!==a||!("_value"in A))&&(A.value=a),t==null&&A.removeAttribute(e),A._value=t;return}let s=!1;if(t===""||t==null){const n=typeof A[e];n==="boolean"?t=_v(t):t==null&&n==="string"?(t="",s=!0):n==="number"&&(t=0,s=!0)}try{A[e]=t}catch{}s&&A.removeAttribute(o||e)}function wr(A,e,t,i){A.addEventListener(e,t,i)}function PS(A,e,t,i){A.removeEventListener(e,t,i)}const Jw=Symbol("_vei");function RS(A,e,t,i,o=null){const r=A[Jw]||(A[Jw]={}),s=r[e];if(i&&s)s.value=i;else{const[n,a]=YS(e);if(i){const l=r[e]=TS(i,o);wr(A,n,l,a)}else s&&(PS(A,n,s,a),r[e]=void 0)}}const Ww=/(?:Once|Passive|Capture)$/;function YS(A){let e;if(Ww.test(A)){e={};let i;for(;i=A.match(Ww);)A=A.slice(0,A.length-i[0].length),e[i[0].toLowerCase()]=!0}return[A[2]===":"?A.slice(3):kr(A.slice(2)),e]}let ip=0;const kS=Promise.resolve(),GS=()=>ip||(kS.then(()=>ip=0),ip=Date.now());function TS(A,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;fo(LS(i,t.value),e,5,[i])};return t.value=A,t.attached=GS(),t}function LS(A,e){if(SA(e)){const t=A.stopImmediatePropagation;return A.stopImmediatePropagation=()=>{t.call(A),A._stopped=!0},e.map(i=>o=>!o._stopped&&i&&i(o))}else return e}const Kw=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&A.charCodeAt(2)>96&&A.charCodeAt(2)<123,US=(A,e,t,i,o,r)=>{const s=o==="svg";e==="class"?xS(A,i,s):e==="style"?yS(A,t,i):Yh(e)?Of(e)||RS(A,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):HS(A,e,i,s))?(jw(A,e,i),!A.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Vw(A,e,i,s,r,e!=="value")):A._isVueCE&&(/[A-Z]/.test(e)||!Pe(i))?jw(A,Di(e),i,r,e):(e==="true-value"?A._trueValue=i:e==="false-value"&&(A._falseValue=i),Vw(A,e,i,s))};function HS(A,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in A&&Kw(e)&&jA(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&A.tagName==="IFRAME"||e==="form"||e==="list"&&A.tagName==="INPUT"||e==="type"&&A.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const o=A.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Kw(e)&&Pe(t)?!1:e in A}function EQ(A="$style"){{const e=Sn();if(!e)return ee;const t=e.type.__cssModules;if(!t)return ee;const i=t[A];return i||ee}}const vs=A=>{const e=A.props["onUpdate:modelValue"]||!1;return SA(e)?t=>id(e,t):e};function NS(A){A.target.composing=!0}function Xw(A){const e=A.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ui=Symbol("_assign");function qw(A,e,t){return e&&(A=A.trim()),t&&(A=Th(A)),A}const ag={created(A,{modifiers:{lazy:e,trim:t,number:i}},o){A[Ui]=vs(o);const r=i||o.props&&o.props.type==="number";wr(A,e?"change":"input",s=>{s.target.composing||A[Ui](qw(A.value,t,r))}),(t||r)&&wr(A,"change",()=>{A.value=qw(A.value,t,r)}),e||(wr(A,"compositionstart",NS),wr(A,"compositionend",Xw),wr(A,"change",Xw))},mounted(A,{value:e}){A.value=e??""},beforeUpdate(A,{value:e,oldValue:t,modifiers:{lazy:i,trim:o,number:r}},s){if(A[Ui]=vs(s),A.composing)return;const n=(r||A.type==="number")&&!/^0\d/.test(A.value)?Th(A.value):A.value,a=e??"";n!==a&&(document.activeElement===A&&A.type!=="range"&&(i&&e===t||o&&A.value.trim()===a)||(A.value=a))}},zS={deep:!0,created(A,e,t){A[Ui]=vs(t),wr(A,"change",()=>{const i=A._modelValue,o=Ia(A),r=A.checked,s=A[Ui];if(SA(i)){const n=Jf(i,o),a=n!==-1;if(r&&!a)s(i.concat(o));else if(!r&&a){const l=[...i];l.splice(n,1),s(l)}}else if(Ga(i)){const n=new Set(i);r?n.add(o):n.delete(o),s(n)}else s(vQ(A,r))})},mounted:Zw,beforeUpdate(A,e,t){A[Ui]=vs(t),Zw(A,e,t)}};function Zw(A,{value:e,oldValue:t},i){A._modelValue=e;let o;if(SA(e))o=Jf(e,i.props.value)>-1;else if(Ga(e))o=e.has(i.props.value);else{if(e===t)return;o=dn(e,vQ(A,!0))}A.checked!==o&&(A.checked=o)}const OS={created(A,{value:e},t){A.checked=dn(e,t.props.value),A[Ui]=vs(t),wr(A,"change",()=>{A[Ui](Ia(A))})},beforeUpdate(A,{value:e,oldValue:t},i){A[Ui]=vs(i),e!==t&&(A.checked=dn(e,i.props.value))}},VS={deep:!0,created(A,{value:e,modifiers:{number:t}},i){const o=Ga(e);wr(A,"change",()=>{const r=Array.prototype.filter.call(A.options,s=>s.selected).map(s=>t?Th(Ia(s)):Ia(s));A[Ui](A.multiple?o?new Set(r):r:r[0]),A._assigning=!0,Vh(()=>{A._assigning=!1})}),A[Ui]=vs(i)},mounted(A,{value:e}){_w(A,e)},beforeUpdate(A,e,t){A[Ui]=vs(t)},updated(A,{value:e}){A._assigning||_w(A,e)}};function _w(A,e){const t=A.multiple,i=SA(e);if(!(t&&!i&&!Ga(e))){for(let o=0,r=A.options.length;o<r;o++){const s=A.options[o],n=Ia(s);if(t)if(i){const a=typeof n;a==="string"||a==="number"?s.selected=e.some(l=>String(l)===String(n)):s.selected=Jf(e,n)>-1}else s.selected=e.has(n);else if(dn(Ia(s),e)){A.selectedIndex!==o&&(A.selectedIndex=o);return}}!t&&A.selectedIndex!==-1&&(A.selectedIndex=-1)}}function Ia(A){return"_value"in A?A._value:A.value}function vQ(A,e){const t=e?"_trueValue":"_falseValue";return t in A?A[t]:e}const jS={created(A,e,t){Mc(A,e,t,null,"created")},mounted(A,e,t){Mc(A,e,t,null,"mounted")},beforeUpdate(A,e,t,i){Mc(A,e,t,i,"beforeUpdate")},updated(A,e,t,i){Mc(A,e,t,i,"updated")}};function JS(A,e){switch(A){case"SELECT":return VS;case"TEXTAREA":return ag;default:switch(e){case"checkbox":return zS;case"radio":return OS;default:return ag}}}function Mc(A,e,t,i,o){const s=JS(A.tagName,t.props&&t.props.type)[o];s&&s(A,e,t,i)}const WS=["ctrl","shift","alt","meta"],KS={stop:A=>A.stopPropagation(),prevent:A=>A.preventDefault(),self:A=>A.target!==A.currentTarget,ctrl:A=>!A.ctrlKey,shift:A=>!A.shiftKey,alt:A=>!A.altKey,meta:A=>!A.metaKey,left:A=>"button"in A&&A.button!==0,middle:A=>"button"in A&&A.button!==1,right:A=>"button"in A&&A.button!==2,exact:(A,e)=>WS.some(t=>A[`${t}Key`]&&!e.includes(t))},we=(A,e)=>{const t=A._withMods||(A._withMods={}),i=e.join(".");return t[i]||(t[i]=(o,...r)=>{for(let s=0;s<e.length;s++){const n=KS[e[s]];if(n&&n(o,e))return}return A(o,...r)})},XS={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Qa=(A,e)=>{const t=A._withKeys||(A._withKeys={}),i=e.join(".");return t[i]||(t[i]=o=>{if(!("key"in o))return;const r=kr(o.key);if(e.some(s=>s===r||XS[s]===r))return A(o)})},qS=_e({patchProp:US},mS);let $w;function ZS(){return $w||($w=Oy(qS))}const _S=(...A)=>{const e=ZS().createApp(...A),{mount:t}=e;return e.mount=i=>{const o=A5(i);if(!o)return;const r=e._component;!jA(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=t(o,!1,$S(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},e};function $S(A){if(A instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&A instanceof MathMLElement)return"mathml"}function A5(A){return Pe(A)?document.querySelector(A):A}var e5=Object.defineProperty,t5=(A,e,t)=>e in A?e5(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,i5=(A,e,t)=>t5(A,e+"",t);function o5(A,e){if(A==null)throw Error(e);return A}function wl(A){return new Promise(e=>setTimeout(e,A))}function r5(A,e){return e(A)}let s5=class{constructor(){i5(this,"promises",new Map)}fetch(e,t){if(this.promises.has(e))return this.promises.get(e);const i=t().finally(()=>{this.promises.delete(e)});return this.promises.set(e,i),i}};function op(A){return{type:"Immediate",value:A}}function n5(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function IQ(A){if(A&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(A);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function a5(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function ce(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function Al(A,e){const t=a5();if(t===void 0)return!1;if(A in t.callbackRegistry)throw new Error(`Callback with key ${A} already registered.`);return t.callbackRegistry[A]=e,!0}const rp=new Map;function l5(A,e){A in ce().callbackRegistry||(ce().callbackRegistry[A]=t=>{for(const i of rp.get(A))i(t)},rp.set(A,[])),rp.get(A).push(e)}var oe;(function(A){A.assertEqual=o=>o;function e(o){}A.assertIs=e;function t(o){throw new Error}A.assertNever=t,A.arrayToEnum=o=>{const r={};for(const s of o)r[s]=s;return r},A.getValidEnumValues=o=>{const r=A.objectKeys(o).filter(n=>typeof o[o[n]]!="number"),s={};for(const n of r)s[n]=o[n];return A.objectValues(s)},A.objectValues=o=>A.objectKeys(o).map(function(r){return o[r]}),A.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const r=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&r.push(s);return r},A.find=(o,r)=>{for(const s of o)if(r(s))return s},A.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function i(o,r=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(r)}A.joinValues=i,A.jsonStringifyReplacer=(o,r)=>typeof r=="bigint"?r.toString():r})(oe||(oe={}));var fC;(function(A){A.mergeShapes=(e,t)=>({...e,...t})})(fC||(fC={}));const IA=oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rs=A=>{switch(typeof A){case"undefined":return IA.undefined;case"string":return IA.string;case"number":return isNaN(A)?IA.nan:IA.number;case"boolean":return IA.boolean;case"function":return IA.function;case"bigint":return IA.bigint;case"symbol":return IA.symbol;case"object":return Array.isArray(A)?IA.array:A===null?IA.null:A.then&&typeof A.then=="function"&&A.catch&&typeof A.catch=="function"?IA.promise:typeof Map<"u"&&A instanceof Map?IA.map:typeof Set<"u"&&A instanceof Set?IA.set:typeof Date<"u"&&A instanceof Date?IA.date:IA.object;default:return IA.unknown}},rA=oe.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"]),g5=A=>JSON.stringify(A,null,2).replace(/"([^"]+)":/g,"$1:");class Ii extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},i={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)i._errors.push(t(s));else{let n=i,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(t(s))):n[l]=n[l]||{_errors:[]},n=n[l],a++}}};return o(this),i}static assert(e){if(!(e instanceof Ii))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}Ii.create=A=>new Ii(A);const ba=(A,e)=>{let t;switch(A.code){case rA.invalid_type:A.received===IA.undefined?t="Required":t=`Expected ${A.expected}, received ${A.received}`;break;case rA.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(A.expected,oe.jsonStringifyReplacer)}`;break;case rA.unrecognized_keys:t=`Unrecognized key(s) in object: ${oe.joinValues(A.keys,", ")}`;break;case rA.invalid_union:t="Invalid input";break;case rA.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${oe.joinValues(A.options)}`;break;case rA.invalid_enum_value:t=`Invalid enum value. Expected ${oe.joinValues(A.options)}, received '${A.received}'`;break;case rA.invalid_arguments:t="Invalid function arguments";break;case rA.invalid_return_type:t="Invalid function return type";break;case rA.invalid_date:t="Invalid date";break;case rA.invalid_string:typeof A.validation=="object"?"includes"in A.validation?(t=`Invalid input: must include "${A.validation.includes}"`,typeof A.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${A.validation.position}`)):"startsWith"in A.validation?t=`Invalid input: must start with "${A.validation.startsWith}"`:"endsWith"in A.validation?t=`Invalid input: must end with "${A.validation.endsWith}"`:oe.assertNever(A.validation):A.validation!=="regex"?t=`Invalid ${A.validation}`:t="Invalid";break;case rA.too_small:A.type==="array"?t=`Array must contain ${A.exact?"exactly":A.inclusive?"at least":"more than"} ${A.minimum} element(s)`:A.type==="string"?t=`String must contain ${A.exact?"exactly":A.inclusive?"at least":"over"} ${A.minimum} character(s)`:A.type==="number"?t=`Number must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${A.minimum}`:A.type==="date"?t=`Date must be ${A.exact?"exactly equal to ":A.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(A.minimum))}`:t="Invalid input";break;case rA.too_big:A.type==="array"?t=`Array must contain ${A.exact?"exactly":A.inclusive?"at most":"less than"} ${A.maximum} element(s)`:A.type==="string"?t=`String must contain ${A.exact?"exactly":A.inclusive?"at most":"under"} ${A.maximum} character(s)`:A.type==="number"?t=`Number must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`:A.type==="bigint"?t=`BigInt must be ${A.exact?"exactly":A.inclusive?"less than or equal to":"less than"} ${A.maximum}`:A.type==="date"?t=`Date must be ${A.exact?"exactly":A.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(A.maximum))}`:t="Invalid input";break;case rA.custom:t="Invalid input";break;case rA.invalid_intersection_types:t="Intersection results could not be merged";break;case rA.not_multiple_of:t=`Number must be a multiple of ${A.multipleOf}`;break;case rA.not_finite:t="Number must be finite";break;default:t=e.defaultError,oe.assertNever(A)}return{message:t}};let QQ=ba;function c5(A){QQ=A}function Ud(){return QQ}const Hd=A=>{const{data:e,path:t,errorMaps:i,issueData:o}=A,r=[...t,...o.path||[]],s={...o,path:r};if(o.message!==void 0)return{...o,path:r,message:o.message};let n="";const a=i.filter(l=>!!l).slice().reverse();for(const l of a)n=l(s,{data:e,defaultError:n}).message;return{...o,path:r,message:n}},d5=[];function mA(A,e){const t=Ud(),i=Hd({issueData:e,data:A.data,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,t,t===ba?void 0:ba].filter(o=>!!o)});A.common.issues.push(i)}class xt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const o of t){if(o.status==="aborted")return OA;o.status==="dirty"&&e.dirty(),i.push(o.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const o of t){const r=await o.key,s=await o.value;i.push({key:r,value:s})}return xt.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const o of t){const{key:r,value:s}=o;if(r.status==="aborted"||s.status==="aborted")return OA;r.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(i[r.value]=s.value)}return{status:e.value,value:i}}}const OA=Object.freeze({status:"aborted"}),Kn=A=>({status:"dirty",value:A}),Vt=A=>({status:"valid",value:A}),BC=A=>A.status==="aborted",wC=A=>A.status==="dirty",lg=A=>A.status==="valid",gg=A=>typeof Promise<"u"&&A instanceof Promise;function Nd(A,e,t,i){if(typeof e=="function"?A!==e||!0:!e.has(A))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(A)}function bQ(A,e,t,i,o){if(typeof e=="function"?A!==e||!0:!e.has(A))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(A,t),t}var yA;(function(A){A.errToObj=e=>typeof e=="string"?{message:e}:e||{},A.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(yA||(yA={}));var ml,El;class Vo{constructor(e,t,i,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Am=(A,e)=>{if(lg(e))return{success:!0,data:e.value};if(!A.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 Ii(A.common.issues);return this._error=t,this._error}}};function ZA(A){if(!A)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:o}=A;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,n)=>{var a,l;const{message:g}=A;return s.code==="invalid_enum_value"?{message:g??n.defaultError}:typeof n.data>"u"?{message:(a=g??i)!==null&&a!==void 0?a:n.defaultError}:s.code!=="invalid_type"?{message:n.defaultError}:{message:(l=g??t)!==null&&l!==void 0?l:n.defaultError}},description:o}}class _A{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)}get description(){return this._def.description}_getType(e){return rs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xt,ctx:{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(gg(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 i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const o={common:{issues:[],async:(i=t==null?void 0:t.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},r=this._parseSync({data:e,path:o.path,parent:o});return Am(o,r)}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},o=this._parse({data:e,path:i.path,parent:i}),r=await(gg(o)?o:Promise.resolve(o));return Am(i,r)}refine(e,t){const i=o=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(o):t;return this._refinement((o,r)=>{const s=e(o),n=()=>r.addIssue({code:rA.custom,...i(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(a=>a?!0:(n(),!1)):s?!0:(n(),!1)})}refinement(e,t){return this._refinement((i,o)=>e(i)?!0:(o.addIssue(typeof t=="function"?t(i,o):t),!1))}_refinement(e){return new Bo({schema:this,typeName:zA.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Lo.create(this,this._def)}nullable(){return Ds.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return go.create(this,this._def)}promise(){return xa.create(this,this._def)}or(e){return ug.create([this,e],this._def)}and(e){return pg.create(this,e,this._def)}transform(e){return new Bo({...ZA(this._def),schema:this,typeName:zA.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new mg({...ZA(this._def),innerType:this,defaultValue:t,typeName:zA.ZodDefault})}brand(){return new nB({typeName:zA.ZodBranded,type:this,...ZA(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Eg({...ZA(this._def),innerType:this,catchValue:t,typeName:zA.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ac.create(this,e)}readonly(){return vg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const h5=/^c[^\s-]{8,}$/i,u5=/^[0-9a-z]+$/,p5=/^[0-9A-HJKMNP-TV-Z]{26}$/,C5=/^[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,f5=/^[a-z0-9_-]{21}$/i,B5=/^[-+]?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)?)??$/,w5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,m5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sp;const E5=/^(?:(?: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])$/,v5=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,I5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DQ="((\\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])))",Q5=new RegExp(`^${DQ}$`);function xQ(A){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return A.precision?e=`${e}\\.\\d{${A.precision}}`:A.precision==null&&(e=`${e}(\\.\\d+)?`),e}function b5(A){return new RegExp(`^${xQ(A)}$`)}function MQ(A){let e=`${DQ}T${xQ(A)}`;const t=[];return t.push(A.local?"Z?":"Z"),A.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function D5(A,e){return!!((e==="v4"||!e)&&E5.test(A)||(e==="v6"||!e)&&v5.test(A))}class no extends _A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==IA.string){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.string,received:r.parsedType}),OA}const i=new xt;let o;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="max")e.data.length>r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="length"){const s=e.data.length>r.value,n=e.data.length<r.value;(s||n)&&(o=this._getOrReturnCtx(e,o),s?mA(o,{code:rA.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):n&&mA(o,{code:rA.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),i.dirty())}else if(r.kind==="email")w5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"email",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="emoji")sp||(sp=new RegExp(m5,"u")),sp.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"emoji",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="uuid")C5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"uuid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="nanoid")f5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"nanoid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid")h5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"cuid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid2")u5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"cuid2",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="ulid")p5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"ulid",code:rA.invalid_string,message:r.message}),i.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),mA(o,{validation:"url",code:rA.invalid_string,message:r.message}),i.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"regex",code:rA.invalid_string,message:r.message}),i.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),i.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{startsWith:r.value},message:r.message}),i.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:{endsWith:r.value},message:r.message}),i.dirty()):r.kind==="datetime"?MQ(r).test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"datetime",message:r.message}),i.dirty()):r.kind==="date"?Q5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"date",message:r.message}),i.dirty()):r.kind==="time"?b5(r).test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.invalid_string,validation:"time",message:r.message}),i.dirty()):r.kind==="duration"?B5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"duration",code:rA.invalid_string,message:r.message}),i.dirty()):r.kind==="ip"?D5(e.data,r.version)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"ip",code:rA.invalid_string,message:r.message}),i.dirty()):r.kind==="base64"?I5.test(e.data)||(o=this._getOrReturnCtx(e,o),mA(o,{validation:"base64",code:rA.invalid_string,message:r.message}),i.dirty()):oe.assertNever(r);return{status:i.value,value:e.data}}_regex(e,t,i){return this.refinement(o=>e.test(o),{validation:t,code:rA.invalid_string,...yA.errToObj(i)})}_addCheck(e){return new no({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...yA.errToObj(e)})}url(e){return this._addCheck({kind:"url",...yA.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...yA.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...yA.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...yA.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...yA.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...yA.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...yA.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...yA.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...yA.errToObj(e)})}datetime(e){var t,i;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(i=e==null?void 0:e.local)!==null&&i!==void 0?i:!1,...yA.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...yA.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...yA.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...yA.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...yA.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...yA.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...yA.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...yA.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...yA.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...yA.errToObj(t)})}nonempty(e){return this.min(1,yA.errToObj(e))}trim(){return new no({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new no({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new no({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}no.create=A=>{var e;return new no({checks:[],typeName:zA.ZodString,coerce:(e=A==null?void 0:A.coerce)!==null&&e!==void 0?e:!1,...ZA(A)})};function x5(A,e){const t=(A.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,o=t>i?t:i,r=parseInt(A.toFixed(o).replace(".","")),s=parseInt(e.toFixed(o).replace(".",""));return r%s/Math.pow(10,o)}class Is extends _A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==IA.number){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.number,received:r.parsedType}),OA}let i;const o=new xt;for(const r of this._def.checks)r.kind==="int"?oe.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.invalid_type,expected:"integer",received:"float",message:r.message}),o.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),o.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),o.dirty()):r.kind==="multipleOf"?x5(e.data,r.value)!==0&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_multiple_of,multipleOf:r.value,message:r.message}),o.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_finite,message:r.message}),o.dirty()):oe.assertNever(r);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,yA.toString(t))}gt(e,t){return this.setLimit("min",e,!1,yA.toString(t))}lte(e,t){return this.setLimit("max",e,!0,yA.toString(t))}lt(e,t){return this.setLimit("max",e,!1,yA.toString(t))}setLimit(e,t,i,o){return new Is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:yA.toString(o)}]})}_addCheck(e){return new Is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:yA.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:yA.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:yA.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:yA.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:yA.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:yA.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:yA.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:yA.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:yA.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&oe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Is.create=A=>new Is({checks:[],typeName:zA.ZodNumber,coerce:(A==null?void 0:A.coerce)||!1,...ZA(A)});class Qs extends _A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==IA.bigint){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.bigint,received:r.parsedType}),OA}let i;const o=new xt;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),o.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),o.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),mA(i,{code:rA.not_multiple_of,multipleOf:r.value,message:r.message}),o.dirty()):oe.assertNever(r);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,yA.toString(t))}gt(e,t){return this.setLimit("min",e,!1,yA.toString(t))}lte(e,t){return this.setLimit("max",e,!0,yA.toString(t))}lt(e,t){return this.setLimit("max",e,!1,yA.toString(t))}setLimit(e,t,i,o){return new Qs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:yA.toString(o)}]})}_addCheck(e){return new Qs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:yA.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:yA.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:yA.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:yA.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:yA.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Qs.create=A=>{var e;return new Qs({checks:[],typeName:zA.ZodBigInt,coerce:(e=A==null?void 0:A.coerce)!==null&&e!==void 0?e:!1,...ZA(A)})};class cg extends _A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==IA.boolean){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.boolean,received:i.parsedType}),OA}return Vt(e.data)}}cg.create=A=>new cg({typeName:zA.ZodBoolean,coerce:(A==null?void 0:A.coerce)||!1,...ZA(A)});class hn extends _A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==IA.date){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_type,expected:IA.date,received:r.parsedType}),OA}if(isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return mA(r,{code:rA.invalid_date}),OA}const i=new xt;let o;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),i.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(o=this._getOrReturnCtx(e,o),mA(o,{code:rA.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),i.dirty()):oe.assertNever(r);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:yA.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:yA.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}hn.create=A=>new hn({checks:[],coerce:(A==null?void 0:A.coerce)||!1,typeName:zA.ZodDate,...ZA(A)});class zd extends _A{_parse(e){if(this._getType(e)!==IA.symbol){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.symbol,received:i.parsedType}),OA}return Vt(e.data)}}zd.create=A=>new zd({typeName:zA.ZodSymbol,...ZA(A)});class dg extends _A{_parse(e){if(this._getType(e)!==IA.undefined){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.undefined,received:i.parsedType}),OA}return Vt(e.data)}}dg.create=A=>new dg({typeName:zA.ZodUndefined,...ZA(A)});class hg extends _A{_parse(e){if(this._getType(e)!==IA.null){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.null,received:i.parsedType}),OA}return Vt(e.data)}}hg.create=A=>new hg({typeName:zA.ZodNull,...ZA(A)});class Da extends _A{constructor(){super(...arguments),this._any=!0}_parse(e){return Vt(e.data)}}Da.create=A=>new Da({typeName:zA.ZodAny,...ZA(A)});class tn extends _A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Vt(e.data)}}tn.create=A=>new tn({typeName:zA.ZodUnknown,...ZA(A)});class Fr extends _A{_parse(e){const t=this._getOrReturnCtx(e);return mA(t,{code:rA.invalid_type,expected:IA.never,received:t.parsedType}),OA}}Fr.create=A=>new Fr({typeName:zA.ZodNever,...ZA(A)});class Od extends _A{_parse(e){if(this._getType(e)!==IA.undefined){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.void,received:i.parsedType}),OA}return Vt(e.data)}}Od.create=A=>new Od({typeName:zA.ZodVoid,...ZA(A)});class go extends _A{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),o=this._def;if(t.parsedType!==IA.array)return mA(t,{code:rA.invalid_type,expected:IA.array,received:t.parsedType}),OA;if(o.exactLength!==null){const s=t.data.length>o.exactLength.value,n=t.data.length<o.exactLength.value;(s||n)&&(mA(t,{code:s?rA.too_big:rA.too_small,minimum:n?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&t.data.length<o.minLength.value&&(mA(t,{code:rA.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&t.data.length>o.maxLength.value&&(mA(t,{code:rA.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((s,n)=>o.type._parseAsync(new Vo(t,s,t.path,n)))).then(s=>xt.mergeArray(i,s));const r=[...t.data].map((s,n)=>o.type._parseSync(new Vo(t,s,t.path,n)));return xt.mergeArray(i,r)}get element(){return this._def.type}min(e,t){return new go({...this._def,minLength:{value:e,message:yA.toString(t)}})}max(e,t){return new go({...this._def,maxLength:{value:e,message:yA.toString(t)}})}length(e,t){return new go({...this._def,exactLength:{value:e,message:yA.toString(t)}})}nonempty(e){return this.min(1,e)}}go.create=(A,e)=>new go({type:A,minLength:null,maxLength:null,exactLength:null,typeName:zA.ZodArray,...ZA(e)});function On(A){if(A instanceof Re){const e={};for(const t in A.shape){const i=A.shape[t];e[t]=Lo.create(On(i))}return new Re({...A._def,shape:()=>e})}else return A instanceof go?new go({...A._def,type:On(A.element)}):A instanceof Lo?Lo.create(On(A.unwrap())):A instanceof Ds?Ds.create(On(A.unwrap())):A instanceof jo?jo.create(A.items.map(e=>On(e))):A}class Re extends _A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=oe.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==IA.object){const l=this._getOrReturnCtx(e);return mA(l,{code:rA.invalid_type,expected:IA.object,received:l.parsedType}),OA}const{status:i,ctx:o}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),n=[];if(!(this._def.catchall instanceof Fr&&this._def.unknownKeys==="strip"))for(const l in o.data)s.includes(l)||n.push(l);const a=[];for(const l of s){const g=r[l],c=o.data[l];a.push({key:{status:"valid",value:l},value:g._parse(new Vo(o,c,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Fr){const l=this._def.unknownKeys;if(l==="passthrough")for(const g of n)a.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(l==="strict")n.length>0&&(mA(o,{code:rA.unrecognized_keys,keys:n}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const g of n){const c=o.data[g];a.push({key:{status:"valid",value:g},value:l._parse(new Vo(o,c,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const l=[];for(const g of a){const c=await g.key,d=await g.value;l.push({key:c,value:d,alwaysSet:g.alwaysSet})}return l}).then(l=>xt.mergeObjectSync(i,l)):xt.mergeObjectSync(i,a)}get shape(){return this._def.shape()}strict(e){return yA.errToObj,new Re({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var o,r,s,n;const a=(s=(r=(o=this._def).errorMap)===null||r===void 0?void 0:r.call(o,t,i).message)!==null&&s!==void 0?s:i.defaultError;return t.code==="unrecognized_keys"?{message:(n=yA.errToObj(e).message)!==null&&n!==void 0?n:a}:{message:a}}}:{}})}strip(){return new Re({...this._def,unknownKeys:"strip"})}passthrough(){return new Re({...this._def,unknownKeys:"passthrough"})}extend(e){return new Re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:zA.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Re({...this._def,catchall:e})}pick(e){const t={};return oe.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new Re({...this._def,shape:()=>t})}omit(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new Re({...this._def,shape:()=>t})}deepPartial(){return On(this)}partial(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{const o=this.shape[i];e&&!e[i]?t[i]=o:t[i]=o.optional()}),new Re({...this._def,shape:()=>t})}required(e){const t={};return oe.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof Lo;)r=r._def.innerType;t[i]=r}}),new Re({...this._def,shape:()=>t})}keyof(){return FQ(oe.objectKeys(this.shape))}}Re.create=(A,e)=>new Re({shape:()=>A,unknownKeys:"strip",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});Re.strictCreate=(A,e)=>new Re({shape:()=>A,unknownKeys:"strict",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});Re.lazycreate=(A,e)=>new Re({shape:A,unknownKeys:"strip",catchall:Fr.create(),typeName:zA.ZodObject,...ZA(e)});class ug extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function o(r){for(const n of r)if(n.result.status==="valid")return n.result;for(const n of r)if(n.result.status==="dirty")return t.common.issues.push(...n.ctx.common.issues),n.result;const s=r.map(n=>new Ii(n.ctx.common.issues));return mA(t,{code:rA.invalid_union,unionErrors:s}),OA}if(t.common.async)return Promise.all(i.map(async r=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(o);{let r;const s=[];for(const a of i){const l={...t,common:{...t.common,issues:[]},parent:null},g=a._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!r&&(r={result:g,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=s.map(a=>new Ii(a));return mA(t,{code:rA.invalid_union,unionErrors:n}),OA}}get options(){return this._def.options}}ug.create=(A,e)=>new ug({options:A,typeName:zA.ZodUnion,...ZA(e)});const lr=A=>A instanceof fg?lr(A.schema):A instanceof Bo?lr(A.innerType()):A instanceof Bg?[A.value]:A instanceof bs?A.options:A instanceof wg?oe.objectValues(A.enum):A instanceof mg?lr(A._def.innerType):A instanceof dg?[void 0]:A instanceof hg?[null]:A instanceof Lo?[void 0,...lr(A.unwrap())]:A instanceof Ds?[null,...lr(A.unwrap())]:A instanceof nB||A instanceof vg?lr(A.unwrap()):A instanceof Eg?lr(A._def.innerType):[];class Zh extends _A{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.object)return mA(t,{code:rA.invalid_type,expected:IA.object,received:t.parsedType}),OA;const i=this.discriminator,o=t.data[i],r=this.optionsMap.get(o);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(mA(t,{code:rA.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),OA)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const o=new Map;for(const r of t){const s=lr(r.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of s){if(o.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);o.set(n,r)}}return new Zh({typeName:zA.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...ZA(i)})}}function mC(A,e){const t=rs(A),i=rs(e);if(A===e)return{valid:!0,data:A};if(t===IA.object&&i===IA.object){const o=oe.objectKeys(e),r=oe.objectKeys(A).filter(n=>o.indexOf(n)!==-1),s={...A,...e};for(const n of r){const a=mC(A[n],e[n]);if(!a.valid)return{valid:!1};s[n]=a.data}return{valid:!0,data:s}}else if(t===IA.array&&i===IA.array){if(A.length!==e.length)return{valid:!1};const o=[];for(let r=0;r<A.length;r++){const s=A[r],n=e[r],a=mC(s,n);if(!a.valid)return{valid:!1};o.push(a.data)}return{valid:!0,data:o}}else return t===IA.date&&i===IA.date&&+A==+e?{valid:!0,data:A}:{valid:!1}}class pg extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),o=(r,s)=>{if(BC(r)||BC(s))return OA;const n=mC(r.value,s.value);return n.valid?((wC(r)||wC(s))&&t.dirty(),{status:t.value,value:n.data}):(mA(i,{code:rA.invalid_intersection_types}),OA)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,s])=>o(r,s)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}pg.create=(A,e,t)=>new pg({left:A,right:e,typeName:zA.ZodIntersection,...ZA(t)});class jo extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.array)return mA(i,{code:rA.invalid_type,expected:IA.array,received:i.parsedType}),OA;if(i.data.length<this._def.items.length)return mA(i,{code:rA.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),OA;!this._def.rest&&i.data.length>this._def.items.length&&(mA(i,{code:rA.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...i.data].map((s,n)=>{const a=this._def.items[n]||this._def.rest;return a?a._parse(new Vo(i,s,i.path,n)):null}).filter(s=>!!s);return i.common.async?Promise.all(r).then(s=>xt.mergeArray(t,s)):xt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new jo({...this._def,rest:e})}}jo.create=(A,e)=>{if(!Array.isArray(A))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jo({items:A,typeName:zA.ZodTuple,rest:null,...ZA(e)})};class Cg extends _A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.object)return mA(i,{code:rA.invalid_type,expected:IA.object,received:i.parsedType}),OA;const o=[],r=this._def.keyType,s=this._def.valueType;for(const n in i.data)o.push({key:r._parse(new Vo(i,n,i.path,n)),value:s._parse(new Vo(i,i.data[n],i.path,n)),alwaysSet:n in i.data});return i.common.async?xt.mergeObjectAsync(t,o):xt.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof _A?new Cg({keyType:e,valueType:t,typeName:zA.ZodRecord,...ZA(i)}):new Cg({keyType:no.create(),valueType:e,typeName:zA.ZodRecord,...ZA(t)})}}class Vd extends _A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.map)return mA(i,{code:rA.invalid_type,expected:IA.map,received:i.parsedType}),OA;const o=this._def.keyType,r=this._def.valueType,s=[...i.data.entries()].map(([n,a],l)=>({key:o._parse(new Vo(i,n,i.path,[l,"key"])),value:r._parse(new Vo(i,a,i.path,[l,"value"]))}));if(i.common.async){const n=new Map;return Promise.resolve().then(async()=>{for(const a of s){const l=await a.key,g=await a.value;if(l.status==="aborted"||g.status==="aborted")return OA;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),n.set(l.value,g.value)}return{status:t.value,value:n}})}else{const n=new Map;for(const a of s){const l=a.key,g=a.value;if(l.status==="aborted"||g.status==="aborted")return OA;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),n.set(l.value,g.value)}return{status:t.value,value:n}}}}Vd.create=(A,e,t)=>new Vd({valueType:e,keyType:A,typeName:zA.ZodMap,...ZA(t)});class un extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==IA.set)return mA(i,{code:rA.invalid_type,expected:IA.set,received:i.parsedType}),OA;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(mA(i,{code:rA.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(mA(i,{code:rA.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());const r=this._def.valueType;function s(a){const l=new Set;for(const g of a){if(g.status==="aborted")return OA;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}const n=[...i.data.values()].map((a,l)=>r._parse(new Vo(i,a,i.path,l)));return i.common.async?Promise.all(n).then(a=>s(a)):s(n)}min(e,t){return new un({...this._def,minSize:{value:e,message:yA.toString(t)}})}max(e,t){return new un({...this._def,maxSize:{value:e,message:yA.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}un.create=(A,e)=>new un({valueType:A,minSize:null,maxSize:null,typeName:zA.ZodSet,...ZA(e)});class ra extends _A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.function)return mA(t,{code:rA.invalid_type,expected:IA.function,received:t.parsedType}),OA;function i(n,a){return Hd({data:n,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ud(),ba].filter(l=>!!l),issueData:{code:rA.invalid_arguments,argumentsError:a}})}function o(n,a){return Hd({data:n,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ud(),ba].filter(l=>!!l),issueData:{code:rA.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof xa){const n=this;return Vt(async function(...a){const l=new Ii([]),g=await n._def.args.parseAsync(a,r).catch(h=>{throw l.addIssue(i(a,h)),l}),c=await Reflect.apply(s,this,g);return await n._def.returns._def.type.parseAsync(c,r).catch(h=>{throw l.addIssue(o(c,h)),l})})}else{const n=this;return Vt(function(...a){const l=n._def.args.safeParse(a,r);if(!l.success)throw new Ii([i(a,l.error)]);const g=Reflect.apply(s,this,l.data),c=n._def.returns.safeParse(g,r);if(!c.success)throw new Ii([o(g,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ra({...this._def,args:jo.create(e).rest(tn.create())})}returns(e){return new ra({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ra({args:e||jo.create([]).rest(tn.create()),returns:t||tn.create(),typeName:zA.ZodFunction,...ZA(i)})}}class fg extends _A{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})}}fg.create=(A,e)=>new fg({getter:A,typeName:zA.ZodLazy,...ZA(e)});class Bg extends _A{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return mA(t,{received:t.data,code:rA.invalid_literal,expected:this._def.value}),OA}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bg.create=(A,e)=>new Bg({value:A,typeName:zA.ZodLiteral,...ZA(e)});function FQ(A,e){return new bs({values:A,typeName:zA.ZodEnum,...ZA(e)})}class bs extends _A{constructor(){super(...arguments),ml.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return mA(t,{expected:oe.joinValues(i),received:t.parsedType,code:rA.invalid_type}),OA}if(Nd(this,ml)||bQ(this,ml,new Set(this._def.values)),!Nd(this,ml).has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return mA(t,{received:t.data,code:rA.invalid_enum_value,options:i}),OA}return Vt(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(e,t=this._def){return bs.create(e,{...this._def,...t})}exclude(e,t=this._def){return bs.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}}ml=new WeakMap;bs.create=FQ;class wg extends _A{constructor(){super(...arguments),El.set(this,void 0)}_parse(e){const t=oe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==IA.string&&i.parsedType!==IA.number){const o=oe.objectValues(t);return mA(i,{expected:oe.joinValues(o),received:i.parsedType,code:rA.invalid_type}),OA}if(Nd(this,El)||bQ(this,El,new Set(oe.getValidEnumValues(this._def.values))),!Nd(this,El).has(e.data)){const o=oe.objectValues(t);return mA(i,{received:i.data,code:rA.invalid_enum_value,options:o}),OA}return Vt(e.data)}get enum(){return this._def.values}}El=new WeakMap;wg.create=(A,e)=>new wg({values:A,typeName:zA.ZodNativeEnum,...ZA(e)});class xa extends _A{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==IA.promise&&t.common.async===!1)return mA(t,{code:rA.invalid_type,expected:IA.promise,received:t.parsedType}),OA;const i=t.parsedType===IA.promise?t.data:Promise.resolve(t.data);return Vt(i.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}xa.create=(A,e)=>new xa({type:A,typeName:zA.ZodPromise,...ZA(e)});class Bo extends _A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zA.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),o=this._def.effect||null,r={addIssue:s=>{mA(i,s),s.fatal?t.abort():t.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),o.type==="preprocess"){const s=o.transform(i.data,r);if(i.common.async)return Promise.resolve(s).then(async n=>{if(t.value==="aborted")return OA;const a=await this._def.schema._parseAsync({data:n,path:i.path,parent:i});return a.status==="aborted"?OA:a.status==="dirty"||t.value==="dirty"?Kn(a.value):a});{if(t.value==="aborted")return OA;const n=this._def.schema._parseSync({data:s,path:i.path,parent:i});return n.status==="aborted"?OA:n.status==="dirty"||t.value==="dirty"?Kn(n.value):n}}if(o.type==="refinement"){const s=n=>{const a=o.refinement(n,r);if(i.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return n};if(i.common.async===!1){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?OA:(n.status==="dirty"&&t.dirty(),s(n.value),{status:t.value,value:n.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(n=>n.status==="aborted"?OA:(n.status==="dirty"&&t.dirty(),s(n.value).then(()=>({status:t.value,value:n.value}))))}if(o.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!lg(s))return s;const n=o.transform(s.value,r);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>lg(s)?Promise.resolve(o.transform(s.value,r)).then(n=>({status:t.value,value:n})):s);oe.assertNever(o)}}Bo.create=(A,e,t)=>new Bo({schema:A,typeName:zA.ZodEffects,effect:e,...ZA(t)});Bo.createWithPreprocess=(A,e,t)=>new Bo({schema:e,effect:{type:"preprocess",transform:A},typeName:zA.ZodEffects,...ZA(t)});class Lo extends _A{_parse(e){return this._getType(e)===IA.undefined?Vt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Lo.create=(A,e)=>new Lo({innerType:A,typeName:zA.ZodOptional,...ZA(e)});class Ds extends _A{_parse(e){return this._getType(e)===IA.null?Vt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ds.create=(A,e)=>new Ds({innerType:A,typeName:zA.ZodNullable,...ZA(e)});class mg extends _A{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===IA.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}mg.create=(A,e)=>new mg({innerType:A,typeName:zA.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ZA(e)});class Eg extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return gg(o)?o.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ii(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ii(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Eg.create=(A,e)=>new Eg({innerType:A,typeName:zA.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ZA(e)});class jd extends _A{_parse(e){if(this._getType(e)!==IA.nan){const i=this._getOrReturnCtx(e);return mA(i,{code:rA.invalid_type,expected:IA.nan,received:i.parsedType}),OA}return{status:"valid",value:e.data}}}jd.create=A=>new jd({typeName:zA.ZodNaN,...ZA(A)});const M5=Symbol("zod_brand");class nB extends _A{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ac extends _A{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?OA:r.status==="dirty"?(t.dirty(),Kn(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?OA:o.status==="dirty"?(t.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(e,t){return new Ac({in:e,out:t,typeName:zA.ZodPipeline})}}class vg extends _A{_parse(e){const t=this._def.innerType._parse(e),i=o=>(lg(o)&&(o.value=Object.freeze(o.value)),o);return gg(t)?t.then(o=>i(o)):i(t)}unwrap(){return this._def.innerType}}vg.create=(A,e)=>new vg({innerType:A,typeName:zA.ZodReadonly,...ZA(e)});function yQ(A,e={},t){return A?Da.create().superRefine((i,o)=>{var r,s;if(!A(i)){const n=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,a=(s=(r=n.fatal)!==null&&r!==void 0?r:t)!==null&&s!==void 0?s:!0,l=typeof n=="string"?{message:n}:n;o.addIssue({code:"custom",...l,fatal:a})}}):Da.create()}const F5={object:Re.lazycreate};var zA;(function(A){A.ZodString="ZodString",A.ZodNumber="ZodNumber",A.ZodNaN="ZodNaN",A.ZodBigInt="ZodBigInt",A.ZodBoolean="ZodBoolean",A.ZodDate="ZodDate",A.ZodSymbol="ZodSymbol",A.ZodUndefined="ZodUndefined",A.ZodNull="ZodNull",A.ZodAny="ZodAny",A.ZodUnknown="ZodUnknown",A.ZodNever="ZodNever",A.ZodVoid="ZodVoid",A.ZodArray="ZodArray",A.ZodObject="ZodObject",A.ZodUnion="ZodUnion",A.ZodDiscriminatedUnion="ZodDiscriminatedUnion",A.ZodIntersection="ZodIntersection",A.ZodTuple="ZodTuple",A.ZodRecord="ZodRecord",A.ZodMap="ZodMap",A.ZodSet="ZodSet",A.ZodFunction="ZodFunction",A.ZodLazy="ZodLazy",A.ZodLiteral="ZodLiteral",A.ZodEnum="ZodEnum",A.ZodEffects="ZodEffects",A.ZodNativeEnum="ZodNativeEnum",A.ZodOptional="ZodOptional",A.ZodNullable="ZodNullable",A.ZodDefault="ZodDefault",A.ZodCatch="ZodCatch",A.ZodPromise="ZodPromise",A.ZodBranded="ZodBranded",A.ZodPipeline="ZodPipeline",A.ZodReadonly="ZodReadonly"})(zA||(zA={}));const y5=(A,e={message:`Input not instance of ${A.name}`})=>yQ(t=>t instanceof A,e),SQ=no.create,PQ=Is.create,S5=jd.create,P5=Qs.create,RQ=cg.create,R5=hn.create,Y5=zd.create,k5=dg.create,G5=hg.create,T5=Da.create,L5=tn.create,U5=Fr.create,H5=Od.create,N5=go.create,z5=Re.create,O5=Re.strictCreate,V5=ug.create,j5=Zh.create,J5=pg.create,W5=jo.create,K5=Cg.create,X5=Vd.create,q5=un.create,Z5=ra.create,_5=fg.create,$5=Bg.create,AP=bs.create,eP=wg.create,tP=xa.create,em=Bo.create,iP=Lo.create,oP=Ds.create,rP=Bo.createWithPreprocess,sP=Ac.create,nP=()=>SQ().optional(),aP=()=>PQ().optional(),lP=()=>RQ().optional(),gP={string:A=>no.create({...A,coerce:!0}),number:A=>Is.create({...A,coerce:!0}),boolean:A=>cg.create({...A,coerce:!0}),bigint:A=>Qs.create({...A,coerce:!0}),date:A=>hn.create({...A,coerce:!0})},cP=OA;var q=Object.freeze({__proto__:null,defaultErrorMap:ba,setErrorMap:c5,getErrorMap:Ud,makeIssue:Hd,EMPTY_PATH:d5,addIssueToContext:mA,ParseStatus:xt,INVALID:OA,DIRTY:Kn,OK:Vt,isAborted:BC,isDirty:wC,isValid:lg,isAsync:gg,get util(){return oe},get objectUtil(){return fC},ZodParsedType:IA,getParsedType:rs,ZodType:_A,datetimeRegex:MQ,ZodString:no,ZodNumber:Is,ZodBigInt:Qs,ZodBoolean:cg,ZodDate:hn,ZodSymbol:zd,ZodUndefined:dg,ZodNull:hg,ZodAny:Da,ZodUnknown:tn,ZodNever:Fr,ZodVoid:Od,ZodArray:go,ZodObject:Re,ZodUnion:ug,ZodDiscriminatedUnion:Zh,ZodIntersection:pg,ZodTuple:jo,ZodRecord:Cg,ZodMap:Vd,ZodSet:un,ZodFunction:ra,ZodLazy:fg,ZodLiteral:Bg,ZodEnum:bs,ZodNativeEnum:wg,ZodPromise:xa,ZodEffects:Bo,ZodTransformer:Bo,ZodOptional:Lo,ZodNullable:Ds,ZodDefault:mg,ZodCatch:Eg,ZodNaN:jd,BRAND:M5,ZodBranded:nB,ZodPipeline:Ac,ZodReadonly:vg,custom:yQ,Schema:_A,ZodSchema:_A,late:F5,get ZodFirstPartyTypeKind(){return zA},coerce:gP,any:T5,array:N5,bigint:P5,boolean:RQ,date:R5,discriminatedUnion:j5,effect:em,enum:AP,function:Z5,instanceof:y5,intersection:J5,lazy:_5,literal:$5,map:X5,nan:S5,nativeEnum:eP,never:U5,null:G5,nullable:oP,number:PQ,object:z5,oboolean:lP,onumber:aP,optional:iP,ostring:nP,pipeline:sP,preprocess:rP,promise:tP,record:K5,set:q5,strictObject:O5,string:SQ,symbol:Y5,transformer:em,tuple:W5,undefined:k5,union:V5,unknown:L5,void:H5,NEVER:cP,ZodIssueCode:rA,quotelessJson:g5,ZodError:Ii});q.object({type:q.literal("plain"),content:q.string()});q.object({from:q.number().min(0),to:q.number().min(1)});function ec(A){throw new Error("Unexpected object: "+A)}const YQ="upload://upload/",kQ="index://index/";function dP(A){return A.startsWith(YQ)}function hP(A){return A.startsWith(kQ)}function GQ(A){if(hP(A)){const e=A.slice(kQ.length);return JSON.parse(decodeURIComponent(e)).path}else if(dP(A)){const e=A.slice(YQ.length);return JSON.parse(decodeURIComponent(e)).localPath}ec(A)}function uP(A){return A.replace(/^.*[\\/]/,"")}function TQ(A){return uP(GQ(A))}function _h(A){if(!A||typeof A!="object")return!1;const e=A;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&e.data!==void 0&&typeof e.data=="object";case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";default:return!1}}function pP(A,e){if(A!==void 0)switch(A.type){case"Json":return A;case"JsonPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]=e(o);return{...A,parts:t}}case"BinaryPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]={index:e(o.index),values:e(o.values)};return{...A,parts:t}}case"ParquetPartitioned":{const t={};for(const[i,o]of Object.entries(A.parts))t[i]=e(o);return{...A,parts:t}}}}function CP(A,e){switch(A.type){case"Json":break;case"JsonPartitioned":{Object.values(A.parts).forEach(e);break}case"BinaryPartitioned":{Object.values(A.parts).forEach(t=>{e(t.index),e(t.values)});break}case"ParquetPartitioned":{Object.values(A.parts).forEach(e);break}}}function aB(A){if(!A||typeof A!="object")return!1;const e=A;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&Array.isArray(e.data);case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);default:return!1}}function fP(A){if(!aB(A))return!1;switch(A.type){case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return!0;default:return!1}}function BP(A){switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength,data:Object.entries(A.data).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.entries(A.parts).map(([e,t])=>({key:JSON.parse(e),value:t}))};default:ec(A)}}function wP(A){switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength,data:Object.fromEntries(A.data.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength,parts:Object.fromEntries(A.parts.map(({key:e,value:t})=>[JSON.stringify(e),t]))};default:ec(A)}}function lB(A){return A instanceof Error?A.name==="AbortError"||lB(A.cause):!1}function mP(A){if(typeof A=="string")return`String value was thrown: ${A}`;if(A&&typeof A=="object")try{return`Plain object was thrown: ${JSON.stringify(A)}`}catch(e){return`Non-serializable object was thrown (JSON.stringify failed: ${e instanceof Error?e.message:String(e)}): ${String(A)}`}return`Non-Error value (${typeof A}) was thrown: ${A}`}function EP(A){return A instanceof Error?A:new Error(mP(A))}function LQ(A){const e=A.cause?LQ(A.cause):void 0,t=new Error(A.message,e!==void 0?{cause:e}:void 0);return t.name=A.name||"Error",t.stack=A.stack,t}function gr(A){if(A.error)throw A.error instanceof Error?A.error:LQ(A.error);return A.value}function vP(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var np,tm;function IP(){return tm||(tm=1,np=function A(e){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");return e===null||typeof e!="object"?JSON.stringify(e):e.toJSON instanceof Function?A(e.toJSON()):Array.isArray(e)?`[${e.reduce((o,r,s)=>`${o}${s===0?"":","}${A(r===void 0||typeof r=="symbol"?null:r)}`,"")}]`:`{${Object.keys(e).sort().reduce((i,o)=>{if(e[o]===void 0||typeof e[o]=="symbol")return i;const r=i.length===0?"":",";return`${i}${r}${A(o)}:${A(e[o])}`},"")}}`}),np}var QP=IP();const Ta=vP(QP);function et(A){return Ta(A)}function UQ(A){return JSON.parse(A)}function HQ(A,e){return A==null?void 0:A[e]}function bP(A,e,t,i="readMetadataJsonOrThrow"){const o=HQ(A,t);if(o===void 0)return;const r=e[t];try{const s=JSON.parse(o);return r.parse(s)}catch(s){throw new Error(`${i} failed, key: ${String(t)}, value: ${o}, error: ${EP(s)}`)}}function DP(A,e,t){try{return bP(A,e,t)}catch{return}}const de={DiscreteValues:"pl7.app/discreteValues",Graph:{Axis:{HighCardinality:"pl7.app/graph/axis/highCardinality",LowerLimit:"pl7.app/graph/axis/lowerLimit",SymmetricRange:"pl7.app/graph/axis/symmetricRange",UpperLimit:"pl7.app/graph/axis/upperLimit"},IsDenseAxis:"pl7.app/graph/isDenseAxis",IsVirtual:"pl7.app/graph/isVirtual",Palette:"pl7.app/graph/palette",Thresholds:"pl7.app/graph/thresholds",TreatAbsentValuesAs:"pl7.app/graph/treatAbsentValuesAs"},HideDataFromUi:"pl7.app/hideDataFromUi",HideDataFromGraphs:"pl7.app/hideDataFromGraphs",IsDiscreteFilter:"pl7.app/isDiscreteFilter",IsLinkerColumn:"pl7.app/isLinkerColumn",IsSubset:"pl7.app/isSubset",Label:"pl7.app/label",Max:"pl7.app/max",Min:"pl7.app/min",MultipliesBy:"pl7.app/multipliesBy",Parents:"pl7.app/parents",Sequence:{Annotation:{Mapping:"pl7.app/sequence/annotation/mapping"},IsAnnotation:"pl7.app/sequence/isAnnotation"},Table:{OrderPriority:"pl7.app/table/orderPriority"},Trace:"pl7.app/trace"},xP=q.enum(["Int","Long","Float","Double","String"]),MP={[de.DiscreteValues]:q.array(q.string()).or(q.array(q.number())),[de.Graph.Axis.HighCardinality]:q.boolean(),[de.Graph.Axis.LowerLimit]:q.number(),[de.Graph.Axis.UpperLimit]:q.number(),[de.Graph.Axis.SymmetricRange]:q.boolean(),[de.Graph.IsDenseAxis]:q.boolean(),[de.Graph.Palette]:q.object({mapping:q.record(q.number()),name:q.string()}),[de.Graph.Thresholds]:q.array(q.object({columnId:q.object({valueType:xP,name:q.string()}),value:q.number()})),[de.Graph.TreatAbsentValuesAs]:q.number(),[de.Graph.IsVirtual]:q.boolean(),[de.HideDataFromUi]:q.boolean(),[de.HideDataFromGraphs]:q.boolean(),[de.IsDiscreteFilter]:q.boolean(),[de.IsLinkerColumn]:q.boolean(),[de.IsSubset]:q.boolean(),[de.Max]:q.number(),[de.Min]:q.number(),[de.MultipliesBy]:q.array(q.string()),[de.Parents]:q.array(q.string()),[de.Sequence.Annotation.Mapping]:q.record(q.string(),q.string()),[de.Sequence.IsAnnotation]:q.boolean(),[de.Table.OrderPriority]:q.number(),[de.Trace]:q.record(q.string(),q.unknown())};function EC(A,e){return HQ(A==null?void 0:A.annotations,e)}function gB(A,e){return DP(A==null?void 0:A.annotations,MP,e)}function im(A){return!!gB(A,de.IsLinkerColumn)}function Jd(A){return{axis:A,children:[]}}function Vn(A){const e=Jd(A);let t=[e];for(;t.length;){const i=[];for(const o of t)o.children=o.axis.parentAxesSpec.map(Jd),i.push(...o.children);t=i}return e}function jn(A){const e=[A.axis];let t=[A];for(;t.length;){const i=[];for(const o of t)for(const r of o.children)e.push(r.axis),i.push(r);t=i}return e}function om(A){return et(jn(Vn(A)).map(Ye))}function FP(A,e){if(A.name!==e.name)return A.name<e.name?1:-1;if(A.type!==e.type)return A.type<e.type?1:-1;const t=et(A.domain??{}),i=et(e.domain??{});if(t!==i)return t<i?1:-1;const o=om(A),r=om(e);if(o!==r)return o<r?1:-1;const s=et(A.annotations??{}),n=et(e.annotations??{});return s!==n?s<n?1:-1:0}function yP(A){const e=gB(A,de.Parents);return e===void 0?[]:e}function NQ(A){A.parentAxesSpec.forEach(NQ),A.parentAxesSpec.sort(FP)}function SP(A){let t=[Jd(A)];const i=new Set(et(Ye(A)));for(;t.length;){const o=[],r=new Set;for(const s of t){s.children=s.axis.parentAxesSpec.map(Jd);for(const n of s.children){const a=et(Ye(n.axis));if(!r.has(a)){if(o.push(n),r.add(a),i.has(a))return!0;i.add(a)}}}t=o}return!1}function rm(A){if(!A.length)return[];const e=A.map(t=>{const{parentAxes:i,...o}=t;return{...o,annotations:{...o.annotations},parentAxesSpec:[]}});return A.forEach((t,i)=>{var r;const o=e[i];if(t.parentAxes)o.parentAxesSpec=t.parentAxes.map(s=>e[s]);else{const s=yP(t).map(n=>e.find(a=>a.name===n));o.parentAxesSpec=s.some(n=>n===void 0)?[]:s,(r=o.annotations)==null||delete r[de.Parents]}}),e.some(SP)?e.forEach(t=>{t.parentAxesSpec=[]}):e.forEach(t=>{NQ(t)}),e}const PP={Label:"pl7.app/label"};function RP(A){return{columnId:A.id,spec:A.spec}}function Ye(A){const{type:e,name:t,domain:i}=A,o={type:e,name:t};return i&&Object.entries(i).length>0&&Object.assign(o,{domain:i}),o}function YP(A){return A.map(Ye)}function kP(A){return et(Ye(A))}function GP(A,e){if(A===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(A[t]!==e[t])return!1;return!0}function vC(A,e){return A.name===e.name&&GP(A.domain,e.domain)}function TP(A,e){return{...A,src:nd(A.src,e)}}function nd(A,e){switch(A.type){case"column":return{type:"column",column:e(A.column)};case"slicedColumn":return{type:"slicedColumn",column:e(A.column),newId:A.newId,axisFilters:A.axisFilters};case"artificialColumn":return{type:"artificialColumn",column:e(A.column),newId:A.newId,axesIndices:A.axesIndices};case"inlineColumn":return A;case"inner":case"full":return{type:A.type,entries:A.entries.map(t=>nd(t,e))};case"outer":return{type:"outer",primary:nd(A.primary,e),secondary:A.secondary.map(t=>nd(t,e))};default:ec(A)}}function LP(A){return Ta(A)}function sm(A){return Ta(Ye(A))}function nm(A,e){return JSON.stringify([A,e])}class am{constructor(e){PA(this,"anchors");PA(this,"domains",new Map);PA(this,"axes",new Map);PA(this,"domainPacks",[]);PA(this,"domainPackToAnchor",new Map);this.anchors=e;const t=Object.entries(e);t.sort((i,o)=>i[0].localeCompare(o[0]));for(const[i,o]of t){for(let r=0;r<o.axesSpec.length;r++){const s=o.axesSpec[r],n=sm(s);this.axes.set(n,{anchor:i,idx:r})}if(o.domain!==void 0){const r=Object.entries(o.domain);r.sort((s,n)=>s[0].localeCompare(n[0])),this.domainPackToAnchor.set(JSON.stringify(r),i),this.domainPacks.push(r.map(([s])=>s));for(const[s,n]of r){const a=nm(s,n);this.domains.set(a,i)}}}}derive(e,t){const i={name:e.name,axes:[]};let o;if(e.domain!==void 0)A:for(const s of this.domainPacks){const n=[];for(const l of s){const g=e.domain[l];if(g!==void 0)n.push([l,g]);else break A}const a=this.domainPackToAnchor.get(JSON.stringify(n));if(a!==void 0){i.domainAnchor=a,o=new Set(s);break}}for(const[s,n]of Object.entries(e.domain??{})){if(o!==void 0&&o.has(s))continue;const a=nm(s,n),l=this.domains.get(a);i.domain??(i.domain={}),i.domain[s]=l?{anchor:l}:n}if(i.axes=e.axesSpec.map(s=>{const n=sm(s),a=this.axes.get(n);return a===void 0?Ye(s):a}),!t||t.length===0)return i;const r=[];for(const s of t){const[n,a]=s;if(typeof n=="number"){if(n<0||n>=e.axesSpec.length)throw new Error(`Axis index ${n} is out of bounds (0-${e.axesSpec.length-1})`);r.push([n,a])}else{const l=e.axesSpec.findIndex(g=>g.name===n);if(l===-1)throw new Error(`Axis with name "${n}" not found in the column specification`);r.push([l,a])}}return r.sort((s,n)=>s[0]-n[0]),{source:i,axisFilters:r}}deriveS(e,t){return LP(this.derive(e,t))}}function lm(A,e,t){const i={...e},o=(t==null?void 0:t.ignoreMissingDomains)??!1;if(i.domainAnchor!==void 0){const r=A[i.domainAnchor];if(!r)throw new Error(`Anchor "${i.domainAnchor}" not found`);const s=r.domain||{};i.domain={...s,...i.domain},delete i.domainAnchor}if(i.domain){const r={};for(const[s,n]of Object.entries(i.domain))if(typeof n=="string")r[s]=n;else{const a=A[n.anchor];if(!a)throw new Error(`Anchor "${n.anchor}" not found for domain key "${s}"`);if(!a.domain||a.domain[s]===void 0){if(!o)throw new Error(`Domain key "${s}" not found in anchor "${n.anchor}"`);continue}r[s]=a.domain[s]}i.domain=r}return i.axes&&(i.axes=i.axes.map(r=>UP(A,r))),i}function UP(A,e){if(!HP(e))return e;const t=e.anchor,i=A[t];if(!i)throw new Error(`Anchor "${t}" not found for axis reference`);if("idx"in e){if(e.idx<0||e.idx>=i.axesSpec.length)throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);return i.axesSpec[e.idx]}else if("name"in e){const o=i.axesSpec.filter(r=>r.name===e.name);if(o.length>1)throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);if(o.length===0)throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);return o[0]}else if("id"in e){const o=i.axesSpec.filter(r=>vC(e.id,Ye(r)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${t}"`);return o[0]}throw new Error("Unsupported axis reference type")}function HP(A){return typeof A=="object"&&"anchor"in A}function cs(A){return A.kind==="PColumn"}function cB(A){return cs(A.spec)}function NP(A){if(!cB(A))throw new Error(`not a PColumn (kind = ${A.spec.kind})`);return A}function dB(A,e){return A===void 0?void 0:{...A,data:e(typeof A.data=="function"?A.data():A.data)}}function zP(A){const e=new Map,t=i=>{switch(i.type){case"column":e.set(i.column.id,i.column);return;case"slicedColumn":e.set(i.column.id,i.column);return;case"artificialColumn":e.set(i.column.id,i.column);return;case"inlineColumn":return;case"full":case"inner":for(const o of i.entries)t(o);return;case"outer":t(i.primary);for(const o of i.secondary)t(o);return;default:ec(i)}};return t(A),[...e.values()]}function gm(A,e){if(A.name!==void 0&&A.name!==e.name)return!1;if(A.type!==void 0){if(Array.isArray(A.type)){if(!A.type.includes(e.type))return!1}else if(A.type!==e.type)return!1}if(A.domain!==void 0){const t=e.domain||{};for(const[i,o]of Object.entries(A.domain))if(t[i]!==o)return!1}return!0}function cm(A,e){if(e.name!==void 0&&A.name!==e.name||e.namePattern!==void 0&&!new RegExp(e.namePattern).test(A.name))return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(A.valueType))return!1}else if(e.type!==A.valueType)return!1}if(e.domain!==void 0){const t=A.domain||{};for(const[i,o]of Object.entries(e.domain))if(t[i]!==o)return!1}if(e.axes!==void 0){const t=A.axesSpec.map(Ye);if(e.partialAxesMatch){for(const i of e.axes)if(!t.some(o=>gm(i,o)))return!1}else{if(t.length!==e.axes.length)return!1;for(let i=0;i<e.axes.length;i++)if(!gm(e.axes[i],t[i]))return!1}}if(e.annotations!==void 0){const t=A.annotations||{};for(const[i,o]of Object.entries(e.annotations))if(t[i]!==o)return!1}if(e.annotationPatterns!==void 0){const t=A.annotations||{};for(const[i,o]of Object.entries(e.annotationPatterns)){const r=t[i];if(r===void 0||!new RegExp(o).test(r))return!1}}return!0}function Ig(A){return Array.isArray(A)?e=>A.some(t=>cs(e)&&cm(e,t)):e=>cs(e)&&cm(e,A)}function OP(A){const e={kind:A.kind,name:A.name};return A.domain!==void 0&&(e.domain=A.domain),cs(A)&&(e.axesSpec=YP(A.axesSpec)),Ta(e)}class Ki{constructor(e){PA(this,"data");this.data=e}get keys(){return this.data.keys()}get keyAxesIds(){return[...this.data.keys()].map(UQ)}static fromColumns(e){var i,o;const t=new Map;for(const r of e.filter(s=>!!gB(s.spec,de.IsLinkerColumn))){const s=Ki.getAxesGroups(rm(r.spec.axesSpec));if(s.length!==2)continue;const[n,a]=s,l=Ki.getAxesRoots(n).map(c=>{const d=jn(Vn(c));return[et(d.map(Ye)),d]}),g=Ki.getAxesRoots(a).map(c=>{const d=jn(Vn(c));return[et(d.map(Ye)),d]});for(const[c,d]of l)t.has(c)||t.set(c,{keyAxesSpec:d,linkWith:new Map});for(const[c,d]of g)t.has(c)||t.set(c,{keyAxesSpec:d,linkWith:new Map});for(const[c]of l)for(const[d]of g)(i=t.get(c))==null||i.linkWith.set(d,r),(o=t.get(d))==null||o.linkWith.set(c,r)}return new this(t)}searchAvailableAxesKeys(e){const t=new Set(e),i=new Set;let o=e;for(;o.length;){const r=[];for(const s of o){const n=this.data.get(s);if(n)for(const a of n.linkWith.keys())!i.has(a)&&!t.has(a)&&(r.push(a),i.add(a))}o=r}return i}searchLinkerPath(e,t){const i={};let o=new Set([e]);const r=new Set([e]);for(;o.size;){const s=new Set;for(const n of o){const a=this.data.get(n);if(a)for(const l of a.linkWith.keys())if(i[l]=n,l===t){const g=[];let c=t;for(;i[c]!==e;)g.push(c),c=i[c];return g.push(c),g.map(d=>this.data.get(d).linkWith.get(i[d]))}else r.has(l)||(s.add(l),r.add(l))}o=s}return[]}getLinkerColumnsForAxes({from:e,to:t,throwWhenNoLinkExists:i=!0}){const o=e.map(Ki.getLinkerKeyFromAxisSpec);return Array.from(new Map(Ki.getAxesRoots(t).map(Ki.getLinkerKeyFromAxisSpec).flatMap(r=>{const s=o.map(n=>this.searchLinkerPath(n,r)).reduce((n,a)=>n.length&&n.length<a.length||!a.length?n:a,[]).map(n=>[n.columnId,n]);if(!s.length&&i)throw Error(`Unable to find linker column for ${r}`);return s})).values())}getAxesListFromKeysList(e){return Array.from(new Map(e.flatMap(t=>{var i;return((i=this.data.get(t))==null?void 0:i.keyAxesSpec)??[]}).map(t=>[et(Ye(t)),t])).values())}getNonLinkableAxes(e,t){const i=e.map(Ki.getLinkerKeyFromAxisSpec),o=t.map(Ki.getLinkerKeyFromAxisSpec);return Array.from(new Map(t.filter((s,n)=>{const a=o[n];return!i.some(l=>this.searchLinkerPath(l,a).length)}).flatMap(s=>jn(Vn(s)).map(n=>[et(Ye(n)),n]))).values())}getReachableByLinkersAxesFromAxesNormalized(e,t){let i=[];if(t){const r=e.map(s=>jn(Vn(s)).map(Ye));for(const s of r){const n=this.keyAxesIds.find(a=>a.every(l=>s.find(g=>t(l,g))));n&&i.push(et(n))}}else i=e.map(Ki.getLinkerKeyFromAxisSpec);const o=this.searchAvailableAxesKeys(i);return this.getAxesListFromKeysList([...o])}getReachableByLinkersAxesFromAxes(e,t){return this.getReachableByLinkersAxesFromAxesNormalized(rm(e),t)}static getLinkerKeyFromAxisSpec(e){return et(jn(Vn(e)).map(Ye))}static getAxesGroups(e){switch(e.length){case 0:return[];case 1:return[[e[0]]]}const t=e.map(a=>et(Ye(a))),i=e.map(a=>new Set(a.parentAxesSpec.map(l=>et(Ye(l))).map(l=>{const g=t.indexOf(l);if(g===-1)throw new Error(`malformed axesSpec: ${JSON.stringify(e)}, unable to locate parent ${l}`);return g}))),o=[...e.keys()],r=[],s=new Set;let n=o.find(a=>!s.has(a));for(;n!==void 0;){const a=[n];s.add(n);let l=[n];for(;l.length;){const g=new Set;for(const c of l){const d=i[c];o.forEach(h=>{if(h===c||s.has(h))return;(i[h].has(c)||d.has(h))&&(a.push(h),g.add(h),s.add(h))})}l=[...g]}r.push([...a]),n=o.find(g=>!s.has(g))}return r.map(a=>a.map(l=>e[l]))}static getAxesRoots(e){const t=new Set(e.flatMap(i=>i.parentAxesSpec).map(i=>et(Ye(i))));return e.filter(i=>!t.has(et(Ye(i))))}}const VP=24;q.string().length(VP).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");q.object({__isRef:q.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:q.string().describe("Upstream block id"),name:q.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:q.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function jP(A){return typeof A=="object"&&A!==null&&"__isRef"in A&&A.__isRef===!0&&"blockId"in A&&"name"in A}function dm(A,e=!0){if(e)return{...A,requireEnrichments:!0};{const{requireEnrichments:t,...i}=A;return i}}function JP(A,e){return A.ok?{ok:!0,value:e(A.value)}:A}class ei{constructor(e,t=i=>i){PA(this,"handle");PA(this,"postProcess");PA(this,"isResolved",!1);PA(this,"resolvedValue");this.handle=e,this.postProcess=t,l5(e,i=>{this.resolvedValue=t(i),this.isResolved=!0})}map(e){return new ei(this.handle,t=>e(this.postProcess(t)))}mapDefined(e){return new ei(this.handle,t=>{const i=this.postProcess(t);return i?e(i):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function IC(A,e){return A===void 0?void 0:e(A)}class Hi{constructor(e,t){PA(this,"handle");PA(this,"resolvePath");this.handle=e,this.resolvePath=t}resolve(...e){const t=e.map(i=>({assertFieldType:"Input",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveOutput(...e){const t=e.map(i=>({assertFieldType:"Output",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveInput(...e){const t=e.map(i=>({assertFieldType:"Input",...typeof i=="string"?{field:i}:i}));return this.resolveWithCommon({},...t)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...t){const i=[...this.resolvePath,...t.map(o=>typeof o=="string"?o:o.field)];return IC(ce().resolveWithCommon(this.handle,e,...t),o=>new Hi(o,i))}get resourceType(){return ce().getResourceType(this.handle)}getInputsLocked(){return ce().getInputsLocked(this.handle)}getOutputsLocked(){return ce().getOutputsLocked(this.handle)}getIsReadyOrError(){return ce().getIsReadyOrError(this.handle)}getIsFinal(){return ce().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return IC(ce().getError(this.handle),t=>new Hi(t,e))}listInputFields(){return ce().listInputFields(this.handle)}listOutputFields(){return ce().listOutputFields(this.handle)}listDynamicFields(){return ce().listDynamicFields(this.handle)}getKeyValueBase64(e){return ce().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return ce().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const t=this.getKeyValueAsString(e);if(t==null)throw new Error("Resource has no content.");return JSON.parse(t)}getDataBase64(){return ce().getDataBase64(this.handle)}getDataAsString(){return ce().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,t=""){const i=this.parsePObjectCollection(e,t);return i===void 0?void 0:Object.entries(i).map(([,r])=>{if(!cB(r))throw new Error(`not a PColumn (kind = ${r.spec.kind})`);return r})}parsePObjectCollection(e=!1,t=""){const i=ce().parsePObjectCollection(this.handle,e,t,...this.resolvePath);if(i===void 0)return;const o={};for(const[r,s]of Object.entries(i)){const n=[...this.resolvePath,r];o[r]=dB(s,a=>new Hi(a,n))}return o}getFileContentAsBase64(e){return new ei(ce().getBlobContentAsBase64(this.handle,e))}getFileContentAsString(e){return new ei(ce().getBlobContentAsString(this.handle,e))}getFileContentAsJson(e){return new ei(ce().getBlobContentAsString(this.handle,e)).mapDefined(t=>JSON.parse(t))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new ei(ce().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new ei(ce().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new ei(ce().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new ei(ce().getImportProgress(this.handle))}getLastLogs(e){return new ei(ce().getLastLogs(this.handle,e))}getProgressLog(e){return new ei(ce().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new ei(ce().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new ei(ce().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(t=>this.resolve({field:t,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(t=>this.resolve({field:t,assertFieldType:"Output"})!==void 0)}}mapFields(e,t){const{fieldType:i,requireLocked:o,skipUnresolved:r}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...t},s=e;if(o&&(i==="Input"&&!this.getInputsLocked()||i==="Output"&&!this.getOutputsLocked()))return;let a=(i==="Input"?this.listInputFields():i==="Output"?this.listOutputFields():this.listDynamicFields()).map(l=>[l,this.resolve({field:l,assertFieldType:i})]);return r&&(a=a.filter(l=>l[1]!==void 0)),a.map(([l,g])=>s(l,g))}}const WP="staging",KP="main";function XP(A,e){const t=[...e].sort((s,n)=>n[0]-s[0]),{type:i}=A;switch(i){case"Json":{const{keyLength:s}=A;for(const[n]of e)if(n>=s)throw new Error(`Can't filter on non-data axis ${n}. Must be >= ${s}`);break}case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":{const{partitionKeyLength:s}=A;for(const[n]of e)if(n>=s)throw new Error(`Can't filter on non-partitioned axis ${n}. Must be >= ${s}`);break}default:throw new Error(`Unsupported data info type: ${i}`)}const o=s=>{for(const[n,a]of t)if(s[n]!==a)return!1;return!0},r=s=>{const n=[...s];for(const[a]of t)n.splice(a,1);return n};switch(A.type){case"Json":return{type:"Json",keyLength:A.keyLength-e.length,data:A.data.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:A.partitionKeyLength-e.length,parts:A.parts.filter(s=>o(s.key)).map(s=>({key:r(s.key),value:s.value}))}}}const qP=q.object({type:q.string(),importance:q.number().optional(),id:q.string().optional(),label:q.string()}),ZP=q.array(qP),_P=.001,$P="__LABEL__",hm="__LABEL__@1";function zQ(A,e,t={}){const i=new Map,o=t.forceTraceElements!==void 0&&t.forceTraceElements.length>0?new Set(t.forceTraceElements):void 0,r=new Map,s=A.map(h=>{const u=e(h);let p,C,f;"spec"in u&&typeof u.spec=="object"?(p=u.spec,C=u.prefixTrace,f=u.suffixTrace):p=u;const B=EC(p,de.Label),w=EC(p,de.Trace),m=(w?ZP.safeParse(UQ(w)).data:void 0)??[],E=[...C??[],...m,...f??[]];if(B!==void 0){const I={label:B,type:$P,importance:-2};t.addLabelAsSuffix?E.push(I):E.splice(0,0,I)}const v=[],x=new Map;for(let I=E.length-1;I>=0;--I){const{type:b}=E[I],G=E[I].importance??0,k=(x.get(b)??0)+1;x.set(b,k);const F=`${b}@${k}`;r.set(F,(r.get(F)??0)+1),i.set(F,Math.max(i.get(F)??Number.NEGATIVE_INFINITY,G-(E.length-I)*_P)),v.push({...E[I],fullType:F,occurrenceIndex:k})}return v.reverse(),{value:h,spec:p,label:B,fullTrace:v}}),n=[],a=[],l=[...i];l.sort(([,h],[,u])=>u-h);for(const[h]of l)h.endsWith("@1")||r.get(h)===A.length?n.push(h):a.push(h);const g=(h,u=!1)=>{const p=[];for(let C=0;C<s.length;C++){const f=s[C],B=f.fullTrace.filter(E=>h.has(E.fullType)||o&&o.has(E.type));if(B.length===0)if(u)p.push({label:"Unlabeled",value:f.value});else return;const w=B.map(E=>E.label),m=t.separator??" / ";p.push({label:w.join(m),value:f.value})}return p};if(n.length===0){if(a.length!==0)throw new Error("Non-empty secondary types list while main types list is empty.");return g(new Set(hm),!0)}let c=0,d=-1;for(;c<n.length;){const h=new Set;t.includeNativeLabel&&h.add(hm);for(let p=0;p<c;++p)h.add(n[p]);d>=0&&h.add(n[d]);const u=g(h);if(u!==void 0&&new Set(u.map(p=>p.label)).size===A.length)return u;d++,d>=n.length&&(c++,d=c)}return g(new Set([...n,...a]),!0)}const La="PColumnData/",QC=La+"ResourceMap",bC=La+"Partitioned/ResourceMap",Ll=La+"JsonPartitioned",sa=La+"BinaryPartitioned",Ul=La+"ParquetPartitioned",hB=La+"Partitioned/",Wd=hB+"JsonPartitioned",Hl=hB+"BinaryPartitioned",Kd=hB+"ParquetPartitioned",DC=A=>{if(A.endsWith(".index"))return{baseKey:A.substring(0,A.length-6),type:"index"};if(A.endsWith(".values"))return{baseKey:A.substring(0,A.length-7),type:"values"};throw new Error(`key must ends on .index/.values for binary p-column, got: ${A}`)};function AR(A){if(!A)return;const e=A.resourceType.name,t=A.getDataAsJson(),i=[];let o=0;switch(e){case QC:o=t.keyLength;break;case bC:o=t.partitionKeyLength+t.keyLength;break;case Ll:case sa:case Ul:o=t.partitionKeyLength;break;case Hl:case Wd:case Kd:o=t.superPartitionKeyLength+t.partitionKeyLength;break}switch(e){case QC:case Ll:case sa:case Ul:for(let r of A.listInputFields()){e===sa&&(r=DC(r).baseKey);const s=[...JSON.parse(r)];i.push(s)}break;case bC:case Hl:case Wd:case Kd:for(const r of A.listInputFields()){const s=[...JSON.parse(r)],n=A.resolve({field:r,assertFieldType:"Input"});if(n!==void 0)for(let a of n.listInputFields()){e===Hl&&(a=DC(a).baseKey);const l=[...s,...JSON.parse(a)];i.push(l)}}break}return{data:i,keyLength:o}}function eR(A){if(A.type!=="JsonPartitioned"&&A.type!=="BinaryPartitioned"&&A.type!=="ParquetPartitioned")throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${A.type}`);const{parts:e,partitionKeyLength:t}=A,i=[];for(let o=0;o<t;++o)i.push(new Set);for(const o of e){const r=o.key;if(r.length!==t)throw new Error(`Key length (${r.length}) does not match partition length (${t}) for key: ${JSON.stringify(r)}`);for(let s=0;s<t;++s)i[s].add(r[s])}return i.map(o=>Array.from(o.values()))}function tR(A){if(A===void 0)return;if(aB(A))return eR(A);const e=AR(A);if(!e)return;const{data:t,keyLength:i}=e,o=[];for(let r=0;r<i;++r)o.push(new Set);for(const r of t){if(r.length!==i)throw new Error("key length does not match partition length");for(let s=0;s<i;++s)o[s].add(r[s])}return o.map(r=>Array.from(r.values()))}function ad(A,e=[]){if(A===void 0||!A.getIsReadyOrError())return;const t=A.resourceType.name,i=A.getDataAsJson();if(e.length>0&&(t===Wd||t===Hl||t===Kd))throw new Error(`Unexpected nested super-partitioned resource: ${t}`);switch(t){case QC:case bC:throw new Error(`Only data columns are supported, got: ${t}`);case Ll:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[];for(const r of A.listInputFields()){const s=A.resolve({field:r,assertFieldType:"Input"});if(s===void 0)return;const n=[...e,...JSON.parse(r)];o.push({key:n,value:s})}return{type:"JsonPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case sa:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[],r=new Map;for(const s of A.listInputFields()){const n=DC(s),a=A.resolve({field:s,assertFieldType:"Input"});if(a===void 0)return;let l=r.get(n.baseKey);l||(l={},r.set(n.baseKey,l)),n.type==="index"?l.index=a:l.values=a}for(const[s,n]of r.entries()){if(!n.index||!n.values)return;const a=[...e,...JSON.parse(s)];o.push({key:a,value:{index:n.index,values:n.values}})}return{type:"BinaryPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case Ul:{if(typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${t}`);const o=[];for(const r of A.listInputFields()){const s=A.resolve({field:r,assertFieldType:"Input"});if(s===void 0)return;const n=[...e,...JSON.parse(r)];o.push({key:n,value:s})}return{type:"ParquetPartitioned",partitionKeyLength:i.partitionKeyLength,parts:o}}case Wd:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==Ll)throw new Error(`Expected ${Ll} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="JsonPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"JsonPartitioned",partitionKeyLength:o,parts:r}}case Hl:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==sa)throw new Error(`Expected ${sa} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="BinaryPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"BinaryPartitioned",partitionKeyLength:o,parts:r}}case Kd:{if(typeof(i==null?void 0:i.superPartitionKeyLength)!="number"||typeof(i==null?void 0:i.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);const o=i.superPartitionKeyLength+i.partitionKeyLength,r=[];for(const s of A.listInputFields()){const n=A.resolve({field:s,assertFieldType:"Input"});if(n===void 0)return;if(n.resourceType.name!==Ul)throw new Error(`Expected ${Ul} inside ${t}, but got ${n.resourceType.name}`);const a=ad(n,JSON.parse(s));if(a===void 0)return;if(a.type!=="ParquetPartitioned")throw new Error(`Unexpected inner result type for ${t}: ${a.type}`);r.push(...a.parts)}return{type:"ParquetPartitioned",partitionKeyLength:o,parts:r}}default:throw new Error(`Unknown resource type: ${t}`)}}function iR(A){if(A!==void 0){if(aB(A))return A;if(_h(A))return BP(A);if(A instanceof Hi)return ad(A);throw new Error(`Unexpected input type: ${typeof A}`)}}function oR(A){const e=r=>Array.isArray(r),t=r=>r instanceof Hi;let i=!0;const o=typeof A.data=="function"?A.data():A.data;if(o==null)return!1;if(t(o))i&&(i=o.getIsReadyOrError());else if(_h(o))CP(o,r=>i&&(i=r.getIsReadyOrError()));else if(!e(o))throw Error(`unsupported column data type: ${o}`);return i}function um(A){return A.every(oR)}function rR(A){if(!Array.isArray(A))return!1;if(A.length===0)return!0;const e=A[0];return typeof e=="object"&&e!==null&&"key"in e&&"val"in e}class sR{constructor(e){PA(this,"columns");this.columns=e}selectColumns(e){const t=typeof e=="function"?e:Ig(e);return this.columns.filter(i=>t(i.spec))}}function nR(A){if(A)return A.map(e=>({type:`split:${kP(e.axisId)}`,label:e.label,importance:1e6}))}function aR(A){if(A)return A.map(e=>[e.axisIdx,e.value])}function lR(A,e){if(!e||e.length===0)return A;const t=[...e].sort((i,o)=>i[0]-o[0]);return Ta({id:A,axisFilters:t})}function pm(A){if(!A||typeof A!="object")return!1;const e=A,t=e.domain&&typeof e.domain=="object"&&Object.values(e.domain).some(o=>typeof o=="object"&&o!==null&&"anchor"in o),i=e.axes&&Array.isArray(e.axes)&&e.axes.some(o=>typeof o=="object"&&o!==null&&"anchor"in o);return!!e.domainAnchor||t||i}function gR(A){if(typeof A!="object"||!("axes"in A)||A.axes===void 0)return[];const e=A.axes.map((t,i)=>typeof t=="object"&&"split"in t&&t.split===!0?i:-1).filter(t=>t!==-1);if(e.length>0&&A.partialAxesMatch!==void 0)throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");return e.sort((t,i)=>t-i),e}class Cm{constructor(){PA(this,"defaultProviderStore",[]);PA(this,"providers",[new sR(this.defaultProviderStore)]);PA(this,"axisLabelProviders",[])}addColumnProvider(e){return this.providers.push(e),this}addAxisLabelProvider(e){return this.axisLabelProviders.push(e),this}addColumns(e){return this.defaultProviderStore.push(...e),this}addColumn(e){return this.defaultProviderStore.push(e),this}findLabels(e){for(const t of this.axisLabelProviders){const i=t.findLabels(e);if(i)return i}}getUniversalEntries(e,t){const{anchorCtx:i,labelOps:o,dontWaitAllData:r=!1,overrideLabelAnnotation:s=!1,exclude:n,enrichByLinkers:a=!1}=t??{},l={...s&&(o==null?void 0:o.includeNativeLabel)!==!1?{includeNativeLabel:!0}:{},...o??{}};let g=()=>!1;if(n){const f=(Array.isArray(n)?n:[n]).map(B=>{if(pm(B)){if(!i)throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");return Ig(lm(i.anchors,B,t))}else return Ig(B)});g=B=>f.some(w=>w(B))}const c=typeof e=="function"?[e]:Array.isArray(e)?e:[e],d=[],h=new Set;for(const f of c){const B=pm(f);let w;if(B){if(!i)throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");w=lm(i.anchors,f,t)}else w=f;const m=new Set,E=[];for(const I of this.providers){const b=I.selectColumns(w);for(const G of b){if(g(G.spec))continue;if(m.has(G.id))throw new Error(`Duplicate column id ${G.id} in provider ${I.constructor.name}`);const k=OP(G.spec);h.has(k)||(m.add(G.id),h.add(k),E.push(G))}}if(E.length===0)continue;const v=gR(f),x=v.length>0;for(const I of E){if(!cs(I.spec))continue;const b=I.spec;if(x){if(rR(I.data))throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${I.id}`);const G=iR(I.data);if(!G){if(r)continue;return}if(!fP(G))throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${G.type} for column ${I.id}`);const k=tR(G),F=v[v.length-1];if(F>=G.partitionKeyLength)throw new Error(`Not enough partition keys (${G.partitionKeyLength}) for requested split axes (max index ${F}) in column ${b.name}`);const AA=v.map(Z=>this.findLabels(Ye(b.axesSpec[Z]))),U=[],N=(Z,gA)=>{if(gA>=v.length){if(U.push([...Z]),U.length>1e4)throw new Error("Too many key combinations, aborting.");return}const EA=v[gA];if(EA>=k.length)throw new Error(`Axis index ${EA} out of bounds for unique keys array (length ${k.length}) during split key generation for column ${I.id}`);const fA=k[EA];if(!fA||fA.length===0){U.length=0;return}for(const RA of fA)Z.push(RA),N(Z,gA+1),Z.pop()};if(N([],0),U.length===0)continue;const Y=[...b.axesSpec],z=v.map(Z=>Z);for(let Z=v.length-1;Z>=0;Z--)Y.splice(v[Z],1);const X={...b,axesSpec:Y};for(const Z of U){const gA=Z.map((EA,fA)=>{const RA=z[fA],pA=Ye(b.axesSpec[RA]),Ee=AA[fA],re=(Ee==null?void 0:Ee[EA])??String(EA);return{axisIdx:RA,axisId:pA,value:EA,label:re}});d.push({type:"split",originalColumn:I,spec:b,adjustedSpec:X,dataEntries:G,axisFilters:gA})}}else d.push({type:"direct",originalColumn:I,spec:b,adjustedSpec:b})}}if(d.length===0)return[];const u=zQ(d,f=>({spec:f.spec,suffixTrace:f.type==="split"?nR(f.axisFilters):void 0}),l),p=[];for(const{value:f,label:B}of u){const{originalColumn:w,spec:m}=f,E=f.type==="split"?f.axisFilters:void 0,v=aR(E);let x;i?x=i.deriveS(m,v):x=lR(w.id,v);let I={...f.adjustedSpec};s&&(I={...I,annotations:{...I.annotations??{},[de.Label]:B}}),p.push({id:x,spec:I,data:()=>f.type==="split"?wP(XP(f.dataEntries,v)):f.originalColumn.data,label:B})}const C=new Set(p.map(f=>f.id));if(a&&i){let m=function(x,I){return vC(x,I)||vC(I,x)};const f=p.filter(x=>im(x.spec));if(f.length===0)return p;const B=Object.values(i.anchors).flatMap(x=>x.axesSpec),E=Ki.fromColumns(f.map(RP)).getReachableByLinkersAxesFromAxes(B,m),v=this.getUniversalEntries(x=>!im(x)&&x.axesSpec.some(I=>{const b=Ye(I);return E.some(G=>m(Ye(G),b))}),{anchorCtx:i,labelOps:l,dontWaitAllData:r,overrideLabelAnnotation:s,exclude:n});v&&p.push(...v.filter(x=>!C.has(x.id)))}return p}getColumns(e,t){const i=this.getUniversalEntries(e,{overrideLabelAnnotation:!0,...t??{}});if(!i)return;const o=[];for(const r of i){const s=r.data();if(!s){if(t!=null&&t.dontWaitAllData)continue;return}o.push({id:r.id,spec:r.spec,data:s})}return o}}function fm(A){const e=o=>o.operator!=="InSet"?o:{operator:"Or",operands:o.references.map(r=>({operator:"Equal",reference:r}))},t=(o,r)=>{switch(o.operator){case"And":return{...o,operands:o.operands.map(n=>t(n,r))};case"Or":return{...o,operands:o.operands.map(n=>t(n,r))};case"Not":return{...o,operand:t(o.operand,r)};default:return r(o)}},i=(o,r)=>({...o,predicate:t(o.predicate,r)});return A.map(o=>i(o,e))}function ap(A,e){if(A===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(A[t]!==e[t])return!1;return!0}function Bm(A){return dB(A,e=>e instanceof Hi?e.handle:_h(e)?pP(e,t=>t.handle):e)}class cR{constructor(){PA(this,"ctx",ce())}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,t){const i=typeof e=="function"?e:Ig(e),o=this.getSpecs().entries.filter(n=>i(n.obj));let r={},s=!1;return typeof t<"u"&&(typeof t=="function"?r=t:typeof t=="object"&&("includeNativeLabel"in t||"separator"in t||"addLabelAsSuffix"in t?r=t:(t=t,r=t.label??{},s=t.refsWithEnrichments??!1))),typeof r=="object"?zQ(o,n=>n.obj,r??{}).map(({value:{ref:n},label:a})=>({ref:dm(n,s),label:a})):o.map(({ref:n,obj:a})=>({ref:dm(n,s),label:r(a,n)}))}resolveAnchorCtx(e){if(e instanceof am)return e;const t={};for(const[i,o]of Object.entries(e))if(jP(o)){const r=this.getPColumnSpecByRef(o);if(!r)return;t[i]=r}else t[i]=o;return new am(t)}getAnchoredPColumns(e,t,i){const o=this.resolveAnchorCtx(e);if(o)return new Cm().addColumnProvider(this).addAxisLabelProvider(this).getColumns(t,{...i,anchorCtx:o})}getCanonicalOptions(e,t,i){const o=this.resolveAnchorCtx(e);if(!o)return;const r=new Cm().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(t,{...i,anchorCtx:o});if(r)return r.map(s=>({value:s.id,label:s.label}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(t=>({ref:t.ref,obj:{...t.obj,data:new Hi(t.obj.data,[t.ref.blockId,t.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(t=>({ref:t.ref,obj:{...t.obj,data:JP(t.obj.data,i=>new Hi(i,[t.ref.blockId,t.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var i;if(typeof this.ctx.getDataFromResultPoolByRef>"u")return(i=this.getData().entries.find(o=>o.ref.blockId===e.blockId&&o.ref.name===e.name))==null?void 0:i.obj;const t=this.ctx.getDataFromResultPoolByRef(e.blockId,e.name);if(t)return dB(t,o=>new Hi(o,[e.blockId,e.name]))}getPColumnByRef(e){const t=this.getDataByRef(e);if(t)return NP(t)}getPColumnSpecByRef(e){const t=this.getSpecByRef(e);if(t){if(!cs(t))throw new Error(`not a PColumn spec (kind = ${t.kind})`);return t}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const t=[];A:for(const i of this.getData().entries){if(!cs(i.obj.spec))continue;const o=i.obj.spec;if(e.name===o.name&&e.valueType===o.valueType&&e.axesSpec.length===o.axesSpec.length&&ap(e.domain,o.domain)){for(let r=0;r<e.axesSpec.length;++r){const s=e.axesSpec[r],n=o.axesSpec[r];if(s.name!==n.name||s.type!==n.type||!ap(s.domain,n.domain))continue A}t.push(i.obj)}}return t}findLabels(e){const t=this.getData();for(const i of t.entries){if(!cB(i.obj))continue;const o=i.obj.spec;if(o.name===PP.Label&&o.axesSpec.length===1&&o.axesSpec[0].name===e.name&&o.axesSpec[0].type===e.type&&ap(e.domain,o.axesSpec[0].domain)){if(i.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${i.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(i.obj.data.getDataAsJson().data).map(s=>[JSON.parse(s[0])[0],s[1]]))}}}selectColumns(e){const t=typeof e=="function"?e:Ig(e);return this.getSpecs().entries.filter(({obj:o})=>cs(o)?t(o):!1).map(({ref:o,obj:r})=>{const s=r;let n=null;const a=this;return{id:Ta(o),spec:s,get data(){var l;return n!==null||(n=(l=a.getPColumnByRef(o))==null?void 0:l.data),n}}})}findLabelsForColumnAxis(e,t){const i=this.findLabels(e.axesSpec[t]);if(!i)return;const o=EC(e,`pl7.app/axisKeys/${t}`);if(o!==void 0){const r=JSON.parse(o);return Object.fromEntries(r.map(s=>[s,i[s]??"Unlabelled"]))}else return i}}class Fc{constructor(){PA(this,"ctx");PA(this,"_argsCache");PA(this,"_uiStateCache");PA(this,"_activeArgsCache");PA(this,"resultPool",new cR);this.ctx=ce()}get args(){if(this._argsCache===void 0){const e=this.ctx.args,t=typeof e=="function"?e():e;this._argsCache={v:JSON.parse(t)}}return this._argsCache.v}get uiState(){if(this._uiStateCache===void 0){const e=this.ctx.uiState,t=typeof e=="function"?e():e;this._uiStateCache={v:t?JSON.parse(t):{}}}return this._uiStateCache.v}get activeArgs(){if(this._activeArgsCache===void 0){const e=this.ctx.activeArgs,t=typeof e=="function"?e():e;this._activeArgsCache={v:t?JSON.parse(t):void 0}}return this._activeArgsCache.v}getNamedAccessor(e){return IC(this.ctx.getAccessorHandleByName(e),t=>new Hi(t,[e]))}get prerun(){return this.getNamedAccessor(WP)}get outputs(){return this.getNamedAccessor(KP)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineAndExplicitColumnsSupport(e){var o;const t=e.some(r=>!(r.data instanceof Hi)||_h(r.data)),i=((o=this.ctx.featureFlags)==null?void 0:o.inlineColumnsSupport)===!0;if(t&&!i)throw Error("Inline or explicit columns not supported")}patchPTableDef(e){var t,i;return(t=this.ctx.featureFlags)!=null&&t.pTablePartitionFiltersSupport||(e={...e,partitionFilters:[],filters:[...e.partitionFilters,...e.filters]}),(i=this.ctx.featureFlags)!=null&&i.pFrameInSetFilterSupport||(e={...e,partitionFilters:fm(e.partitionFilters),filters:fm(e.filters)}),e}createPFrame(e){if(this.verifyInlineAndExplicitColumnsSupport(e),!!um(e))return this.ctx.createPFrame(e.map(t=>Bm(t)))}createPTable(e){let t;"columns"in e?t=this.patchPTableDef({src:{type:"full",entries:e.columns.map(o=>({type:"column",column:o}))},partitionFilters:e.filters??[],filters:[],sorting:e.sorting??[]}):t=this.patchPTableDef(e);const i=zP(t.src);if(this.verifyInlineAndExplicitColumnsSupport(i),!!um(i))return this.ctx.createPTable(TP(t,o=>Bm(o)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){return this.ctx.getCurrentUnstableMarker()}logInfo(e){this.ctx.logInfo(e)}logWarn(e){this.ctx.logWarn(e)}logError(e){this.ctx.logError(e)}}var dR="1.48.2";const ld=dR;function hR(A){return A.__renderLambda===!0}function lp(A){if(A!==void 0)return hR(A)?A.handle:A}const nt=class nt{constructor(e,t,i,o,r,s,n,a,l){PA(this,"_renderingMode");PA(this,"_initialArgs");PA(this,"_initialUiState");PA(this,"_outputs");PA(this,"_inputsValid");PA(this,"_sections");PA(this,"_title");PA(this,"_enrichmentTargets");PA(this,"_featureFlags");this._renderingMode=e,this._initialArgs=t,this._initialUiState=i,this._outputs=o,this._inputsValid=r,this._sections=s,this._title=n,this._enrichmentTargets=a,this._featureFlags=l}static create(e="Heavy"){return new nt(e,void 0,{},{},op(!0),op([]),void 0,void 0,{...nt.INITIAL_BLOCK_FEATURE_FLAGS})}output(e,t,i={}){if(typeof t=="function"){const o=`output#${e}`;return Al(o,()=>t(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:o,...i}},this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}else return new nt(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:t},this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}retentiveOutput(e,t){return this.output(e,t,{retentive:!0})}argsValid(e){return typeof e=="function"?(Al("inputsValid",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title,this._enrichmentTargets,this._featureFlags)):new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}sections(e){return Array.isArray(e)?this.sections(op(e)):typeof e=="function"?(Al("sections",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title,this._enrichmentTargets,this._featureFlags)):new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title,this._enrichmentTargets,this._featureFlags)}title(e){return Al("title",()=>e(new Fc)),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"},this._enrichmentTargets,this._featureFlags)}initialArgs(e){return new nt(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withArgs(e){return new nt(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withUiState(e){return new nt(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,this._featureFlags)}withFeatureFlags(e){return new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets,{...this._featureFlags,...e})}enriches(e){return Al("enrichmentTargets",e),new nt(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,{__renderLambda:!0,handle:"enrichmentTargets"},this._featureFlags)}done(e){const t=e??1;return this.withFeatureFlags({...this._featureFlags,requiresUIAPIVersion:t})._done(t)}_done(e){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const t={v3:{sdkVersion:ld,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs,enrichmentTargets:this._enrichmentTargets,featureFlags:this._featureFlags},sdkVersion:ld,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:lp(this._inputsValid),sections:lp(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([i,o])=>[i,lp(o)]))};return globalThis.platformaApiVersion=e,n5()?IQ({sdkVersion:ld,apiVersion:platformaApiVersion}):{config:t}}};PA(nt,"INITIAL_BLOCK_FEATURE_FLAGS",{supportsLazyState:!0,requiresUIAPIVersion:1,requiresModelAPIVersion:1});let xC=nt;function uR(){return platformaApiVersion??1}function ns(){return IQ({sdkVersion:ld,apiVersion:platformaApiVersion})}var yc={exports:{}},wm;function pR(){return wm||(wm=1,function(A,e){e=A.exports=t,e.getSerialize=i;function t(o,r,s,n){return JSON.stringify(o,i(r,n),s)}function i(o,r){var s=[],n=[];return r==null&&(r=function(a,l){return s[0]===l?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(l)).join(".")+"]"}),function(a,l){if(s.length>0){var g=s.indexOf(this);~g?s.splice(g+1):s.push(this),~g?n.splice(g,1/0,a):n.push(a),~s.indexOf(l)&&(l=r.call(this,a,l))}else s.push(l);return o==null?l:o.call(this,a,l)}}}(yc,yc.exports)),yc.exports}pR();const CR=q.object({type:q.literal("PlError"),name:q.string(),message:q.string(),fullMessage:q.string().optional(),stack:q.string().optional()}),fR=CR.extend({cause:q.lazy(()=>Xd).optional(),errors:q.lazy(()=>Xd.array()).optional()}),BR=q.object({type:q.literal("StandardError"),name:q.string(),message:q.string(),stack:q.string().optional()}),wR=BR.extend({cause:q.lazy(()=>Xd).optional(),errors:q.lazy(()=>Xd.array()).optional()}),Xd=q.union([wR,fR]),mR=q.object({name:q.string(),message:q.string(),fullMessage:q.string().optional(),stack:q.string().optional()}),mm=mR.extend({cause:q.lazy(()=>mm).optional(),errors:q.lazy(()=>mm.array()).optional()});function ER(A){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(A)}const Em=Array.isArray;function vm(A){return A!==null&&typeof A=="object"}function vR(A){return typeof A=="object"&&A!==null}function MC(A){if(!vR(A))return!1;const e=Object.getPrototypeOf(A);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null}function Im(A){return Object.values(A).reduce((e,t)=>t!==void 0?e+1:e,0)}function Yi(A,e){if(!(vm(A)&&vm(e)))return A===e;if(Em(A)&&Em(e))return A.length!==e.length?!1:[...A.keys()].every(t=>Yi(A[t],e[t]));if(MC(A)&&MC(e))return Im(A)!==Im(e)?!1:Object.keys(A).every(t=>Yi(A[t],e[t]));throw Error(`Cannot compare a ${String(A)} and b ${String(e)}`)}function at(A){if(Array.isArray(A)){const e=[];for(let t=0;t<A.length;t++)e[t]=at(A[t]);return e}else if(MC(A)){const e={};return Object.keys(A).forEach(t=>{e[t]=at(A[t])}),e}else return A}var IR=Object.defineProperty,QR=(A,e,t)=>e in A?IR(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,FC=(A,e,t)=>QR(A,typeof e!="symbol"?e+"":e,t);let bR=class extends Error{constructor(){super(...arguments),FC(this,"name","UnresolvedError")}};const DR=A=>Array.isArray(A)?A:A?[A]:[];let uB=class extends Error{constructor(e){e=DR(e),super(e.map(t=>typeof t=="string"?t:t.message).join(`
18
18
  `)),FC(this,"name","MultiError"),FC(this,"fullMessage"),this.errors=e,this.fullMessage=e.map(t=>typeof t=="string"?t:t.type=="PlError"&&"fullMessage"in t?t.fullMessage:t.message).join(`
19
19
  `)}};function OQ(A){if(!A)throw new bR;if(!A.ok)throw new uB(A.errors);return A.value}const VQ=A=>A,jQ=A=>A instanceof Error?A:Error(String(A)),JQ=A=>A.name==="ZodError",WQ=A=>{const{formErrors:e,fieldErrors:t}=A.flatten(),i=Object.entries(t).map(([o,r])=>o+":"+(r==null?void 0:r.join(",")));return e.concat(i).join("; ")};function qd(A){const e=A.validate??VQ,{autoSave:t}=A,i=TA(),o=TA(),r=u=>{o.value={model:at(u)}};le(()=>A.get(),u=>r(u),{immediate:!0});const s=()=>{var u;A.onSave(e(at((u=o.value)==null?void 0:u.model)))},n=()=>{r(A.get()),i.value=void 0},a=u=>{const p=jQ(u);JQ(p)?i.value=Error(WQ(p)):i.value=p},l=u=>{i.value=void 0;try{e(u),t&&s()}catch(p){a(p)}},g=W({get:()=>{var u;return(u=o.value)==null?void 0:u.model},set(u){r(u),l(u)}});le(o,(u,p)=>{u&&u===p&&l(u.model)},{deep:!0});const c=W(()=>!i.value),d=W(()=>!Yi(A.get(),H(o))),h=W(()=>i.value?i.value.message:"");return Ge({model:g,valid:c,isChanged:d,error:i,errorString:h,save:s,revert:n,setError:a})}function xR(A,e,t){const i=A.validate??VQ,{autoSave:o}=A,r=TA(),s=TA(),n=C=>{s.value={model:Object.assign(at(C),e??{}),stage:Symbol()}};le(()=>A.get(),C=>n(C),{immediate:!0});const a=()=>{var C;return A.onSave(i(at((C=s.value)==null?void 0:C.model)))},l=()=>{n(A.get()),r.value=void 0},g=C=>{const f=jQ(C);JQ(f)?r.value=Error(WQ(f)):r.value=f},c=C=>{r.value=void 0;try{i(C),o&&a()}catch(f){g(f)}},d=W({get:()=>{var C;return(C=s.value)==null?void 0:C.model},set(){throw Error("Cannot replace base model")}});le([()=>({args:d.value.args,ui:d.value.ui}),()=>{var C;return(C=s.value)==null?void 0:C.stage}],([C,f],[B,w])=>{f===w&&c(C)},{deep:!0});const h=W(()=>!r.value),u=W(()=>{var C;const{args:f,ui:B}=((C=H(s))==null?void 0:C.model)??{};return!Yi(A.get(),{args:f,ui:B})}),p=W(()=>r.value?r.value.message:"");return Ge({model:d,valid:h,isChanged:u,error:r,errorString:p,save:a,revert:l,setError:g})}const KQ=A=>Object.fromEntries(new URL(A,"http://dummy").searchParams);function Zd(A){return eI()?(Y3(A),!0):!1}const _d=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const yC=()=>{};function XQ(A,e){function t(...i){return new Promise((o,r)=>{Promise.resolve(A(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(o).catch(r)})}return t}const MR=A=>A();function FR(A,e={}){let t,i,o=yC;const r=a=>{clearTimeout(a),o(),o=yC};let s;return a=>{const l=Fd(A),g=Fd(e.maxWait);return t&&r(t),l<=0||g!==void 0&&g<=0?(i&&(r(i),i=null),Promise.resolve(a())):new Promise((c,d)=>{o=e.rejectOnCancel?d:c,s=a,g&&!i&&(i=setTimeout(()=>{t&&r(t),i=null,c(s())},g)),t=setTimeout(()=>{i&&r(i),i=null,c(a())},l)})}}function gp(A,e=200,t={}){return XQ(FR(e,t),A)}function yR(A,e=1e3,t={}){const{immediate:i=!0,immediateCallback:o=!1}=t;let r=null;const s=br(!1);function n(){r&&(clearInterval(r),r=null)}function a(){s.value=!1,n()}function l(){const g=Fd(e);g<=0||(s.value=!0,o&&A(),n(),s.value&&(r=setInterval(A,g)))}if(i&&_d&&l(),je(e)||typeof e=="function"){const g=le(e,()=>{s.value&&_d&&l()});Zd(g)}return Zd(a),{isActive:BI(s),pause:a,resume:l}}function SR(A,e,t={}){const{immediate:i=!0,immediateCallback:o=!1}=t,r=br(!1);let s=null;function n(){s&&(clearTimeout(s),s=null)}function a(){r.value=!1,n()}function l(...g){o&&A(),n(),r.value=!0,s=setTimeout(()=>{r.value=!1,s=null,A(...g)},Fd(e))}return i&&(r.value=!0,_d&&l()),Zd(a),{isPending:BI(r),start:l,stop:a}}function PR(A,e,t={}){const{eventFilter:i=MR,...o}=t,r=XQ(i,e);let s,n,a;if(o.flush==="sync"){const l=br(!1);n=()=>{},s=g=>{l.value=!0,g(),l.value=!1},a=le(A,(...g)=>{l.value||r(...g)},o)}else{const l=[],g=br(0),c=br(0);n=()=>{g.value=c.value},l.push(le(A,()=>{c.value++},{...o,flush:"sync"})),s=d=>{const h=c.value;d(),g.value+=c.value-h},l.push(le(A,(...d)=>{const h=g.value>0&&g.value===c.value;g.value=0,c.value=0,!h&&r(...d)},o)),a=()=>{l.forEach(d=>d())}}return{stop:a,ignoreUpdates:s,ignorePrevAsyncUpdates:n}}function RR(A,e,t){return le(A,(o,r,s)=>{o&&e(o,r,s)},{...t,once:!1})}function YR(A,e,t){let i;je(t)?i={evaluating:t}:i={};const{lazy:o=!1,flush:r="pre",evaluating:s=void 0,shallow:n=!0,onError:a=yC}=i,l=br(!o),g=n?br(e):TA(e);let c=0;return Xy(async d=>{if(!l.value)return;c++;const h=c;let u=!1;s&&Promise.resolve().then(()=>{s.value=!0});try{const p=await A(C=>{d(()=>{s&&(s.value=!1),u||C()})});h===c&&(g.value=p)}catch(p){a(p)}finally{s&&h===c&&(s.value=!1),u=!0}},{flush:r}),o?W(()=>(l.value=!0,g.value)):g}function kR(A,e,t={}){const{immediate:i=!0,immediateCallback:o=!1}=t,{start:r}=SR(n,e,{immediate:i}),s=br(!1);async function n(){s.value&&(await A(),r())}function a(){s.value||(s.value=!0,o&&A(),r())}function l(){s.value=!1}return i&&_d&&a(),Zd(l),{isActive:s,pause:l,resume:a}}function GR(A,e,t){const i=(B,...w)=>{t.debug&&console.log(`%c>>> %c${B}`,"color: orange; font-weight: bold","color: orange",...w)},o=Ge({args:Object.freeze(A.args),outputs:Object.freeze(A.outputs),ui:Object.freeze(A.ui),navigationState:Object.freeze(A.navigationState)}),r=t.debounceSpan??200,s=r5(t.debounceMaxWait??0,B=>B<2e4?2e4:B<r?r*100:B),n=gp(B=>{Yi(B,o.args)||e.setBlockArgs(B)},r,{maxWait:s}),a=gp(B=>{Yi(B,o.ui)||e.setBlockUiState(B)},r,{maxWait:s}),l=gp((B,w)=>{(!Yi(B,o.args)||!Yi(w,o.ui))&&e.setBlockArgsAndUiState(B,w)},r,{maxWait:s});e.onStateUpdates(async B=>{B.forEach(w=>{w.key==="args"&&!Yi(o.args,w.value)&&(o.args=Object.freeze(w.value),i("args patch",o.args)),w.key==="ui"&&!Yi(o.ui,w.value)&&(o.ui=Object.freeze(w.value),i("ui patch",o.ui)),w.key==="outputs"&&!Yi(o.outputs,w.value)&&(o.outputs=Object.freeze(w.value),i("outputs patch",o.outputs)),w.key==="navigationState"&&!Yi(o.navigationState,w.value)&&(o.navigationState=Object.freeze(w.value),i("navigationState patch",o.navigationState))}),await Vh()});const g=()=>at(o.args),c=()=>at(o.ui),d=()=>at(o.navigationState),h={createArgsModel(B={}){return qd({get(){return B.transform?B.transform(o.args):o.args},validate:B.validate,autoSave:!0,onSave(w){n(w)}})},createUiModel(B={},w){return qd({get(){return B.transform?B.transform(o.ui):o.ui??w()},validate:B.validate,autoSave:!0,onSave(m){a(m)}})},useOutputs(...B){const w=Ge({errors:void 0,value:void 0});return le(()=>o.outputs,()=>{try{Object.assign(w,{value:this.unwrapOutputs(...B),errors:void 0})}catch(m){Object.assign(w,{value:void 0,errors:[String(m)]})}},{immediate:!0,deep:!0}),w},unwrapOutputs(...B){const w=o.outputs,m=B.map(E=>[E,OQ(w[E])]);return Object.fromEntries(m)},updateArgs(B){const w=g();return B(w),e.setBlockArgs(w)},updateUiState(B){const w=c();return e.setBlockUiState(B(w))},updateNavigationState(B){const w=d();return B(w),e.setNavigationState(w)},navigateTo(B){const w=d();return w.href=B,e.setNavigationState(w)}},u=W(()=>{const B=Object.entries(o.outputs).map(([w,m])=>[w,m.ok&&m.value!==void 0?m.value:void 0]);return Object.fromEntries(B)}),p=W(()=>{const B=Object.entries(o.outputs).map(([w,m])=>[w,m&&m.ok===!1?new uB(m.errors):void 0]);return Object.fromEntries(B)}),C={snapshot:o,queryParams:W(()=>KQ(o.navigationState.href)),href:W(()=>o.navigationState.href),hasErrors:W(()=>Object.values(o.outputs).some(B=>!(B!=null&&B.ok)))},f=xR({get(){return{args:o.args,ui:o.ui}},autoSave:!0,onSave(B){l(B.args,B.ui)}},{outputs:u,outputErrors:p});return Ge(Object.assign(f,h,C))}function TR(A,e){return A=Math.ceil(A),e=Math.floor(e),Math.floor(Math.random()*(e-A))+A}function LR(A){let e="";for(let t=0;t<A;t++)e+=String.fromCharCode(TR(65,91));return e}function qQ(A=42){return LR(A)}/*!
20
20
  * https://github.com/Starcounter-Jack/JSON-Patch
@@ -465,4 +465,4 @@ ${JSON.stringify(PuA(h.value),null,2)}
465
465
 
466
466
  `}))??[])).join(`
467
467
  `)??""});const c=[{label:"Rabbit (no limits)",value:"PRODUCT:YAGRKKGRBYLCGDLCDVYINUSHYWGYWXWHGIINXYBQBZKMSIRC"},{label:"Crow (limit 10GB monthly)",value:"PRODUCT:JLVOZAOIOBZMLCIWQKUYZWLBAEPDHUJPHRHYAOBPDGWPVTJC"},{label:"Behemoth (1000 runs, 100GB monthly)",value:"PRODUCT:ZHJBTZESZONNVEFPGWWPDYESVYGXQOOSHYVUBWDXUHSILLDH"},{label:"Kolibri (100 runs)",value:"PRODUCT:EBVGZXPBYZLGKQHLFDVCCVFRLKTZZTJSWMNJGXNHVTMKNSPA"}];return(d,h)=>(L(),J(ie,null,[uA(H(SaA),null,{title:DA(()=>[...h[9]||(h[9]=[se(" Monetization test ",-1)])]),default:DA(()=>[uA(H(ed),null,{default:DA(()=>[uA(H(OaA),{width:"400px"},{default:DA(()=>[uA(H(Z2),{modelValue:H(e).model.args.productKey,"onUpdate:modelValue":h[0]||(h[0]=u=>H(e).model.args.productKey=u),label:"Select product",options:c},null,8,["modelValue"]),uA(H(l0),{modelValue:H(e).model.args.productKey,"onUpdate:modelValue":h[1]||(h[1]=u=>H(e).model.args.productKey=u),label:"or enter product key",clearable:"",parse:t},null,8,["modelValue"])]),_:1})]),_:1}),uA(H(klA),{modelValue:H(e).model.args.shouldAddRunPerFile,"onUpdate:modelValue":h[2]||(h[2]=u=>H(e).model.args.shouldAddRunPerFile=u)},{default:DA(()=>[...h[10]||(h[10]=[se(" Add run per file ",-1)])]),_:1},8,["modelValue"]),uA(H(ed),{width:"400px"},{default:DA(()=>[uA(H(Zl),{onClick:h[3]||(h[3]=u=>o.isMultiDialogFileOpen=!0)},{default:DA(()=>[...h[11]||(h[11]=[se(" Open multiple files to monetize ",-1)])]),_:1}),uA(H(Zl),{disabled:!H(e).model.outputs.__mnzInfo,onClick:h[4]||(h[4]=u=>a.value=!0)},{default:DA(()=>[...h[12]||(h[12]=[se(" Show mnz info ",-1)])]),_:1},8,["disabled"])]),_:1}),(L(!0),J(ie,null,vi(H(e).model.args.inputHandles,({handle:u},p)=>(L(),wA(H(ed),{key:p},{default:DA(()=>[uA(H(l0),{modelValue:H(e).model.args.inputHandles[p].fileName,"onUpdate:modelValue":C=>H(e).model.args.inputHandles[p].fileName=C,label:"Type file name"},null,8,["modelValue","onUpdate:modelValue"]),uA(H(l0),{modelValue:H(e).model.args.inputHandles[p].argName,"onUpdate:modelValue":C=>H(e).model.args.inputHandles[p].argName=C,label:"Type argument name"},null,8,["modelValue","onUpdate:modelValue"]),uA(H(JcA),{"model-value":u,"onUpdate:modelValue":C=>r(C,p)},null,8,["model-value","onUpdate:modelValue"]),uA(H(QgA),{modelValue:H(e).model.args.inputHandles[p].options,"onUpdate:modelValue":C=>H(e).model.args.inputHandles[p].options=C,label:"Metrics to monetize",options:i},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024))),128)),uA(H(ed),null,{default:DA(()=>[uA(H(Zl),{onClick:h[5]||(h[5]=u=>l.value=!0)},{default:DA(()=>[...h[13]||(h[13]=[se(" Show tokens ",-1)])]),_:1})]),_:1}),n.value?(L(),wA(H(RF),{key:0,label:"token verification"},{default:DA(()=>[se(MA(n.value),1)]),_:1})):aA("",!0)]),_:1}),uA(H(HF),{modelValue:o.isMultiDialogFileOpen,"onUpdate:modelValue":h[6]||(h[6]=u=>o.isMultiDialogFileOpen=u),multi:"","onImport:files":s},null,8,["modelValue"]),uA(H(Sh),{modelValue:a.value,"onUpdate:modelValue":h[7]||(h[7]=u=>a.value=u),size:"medium"},{title:DA(()=>[...h[14]||(h[14]=[se(" Monetization info ",-1)])]),default:DA(()=>[uA(H(Pf),{value:JSON.stringify(H(e).model.outputs.__mnzInfo,null,2)},null,8,["value"])]),_:1},8,["modelValue"]),uA(H(Sh),{modelValue:l.value,"onUpdate:modelValue":h[8]||(h[8]=u=>l.value=u),size:"medium"},{title:DA(()=>[...h[15]||(h[15]=[se(" Tokens ",-1)])]),default:DA(()=>[uA(H(Pf),{value:g.value},null,8,["value"])]),_:1},8,["modelValue"])],64))}}),f3=onA(yuA,()=>({routes:{"/":()=>kuA}})),GuA=f3.useApp;_S(mhA).use(f3).mount("#app");
468
- //# sourceMappingURL=index-K2Ta70b6.js.map
468
+ //# sourceMappingURL=index-3JWmNDX3.js.map