@platforma-sdk/ui-vue 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @platforma-sdk/ui-vue
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b1a3abc]
8
+ - @platforma-sdk/model@1.17.0
9
+ - @milaboratories/uikit@2.2.26
10
+
3
11
  ## 1.16.0
4
12
 
5
13
  ### Minor Changes
package/dist/lib.js CHANGED
@@ -3358,7 +3358,7 @@ const kE = gr.object({
3358
3358
  label: gr.string()
3359
3359
  });
3360
3360
  gr.array(kE);
3361
- const AE = "1.15.4";
3361
+ const AE = "1.17.0";
3362
3362
  function vl() {
3363
3363
  return EE({ sdkVersion: AE });
3364
3364
  }
package/dist/lib.umd.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(D,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@ag-grid-enterprise/core"),require("@ag-grid-community/core"),require("@ag-grid-community/client-side-row-model"),require("@ag-grid-community/infinite-row-model"),require("@ag-grid-enterprise/server-side-row-model"),require("@ag-grid-community/csv-export"),require("@ag-grid-enterprise/clipboard"),require("@ag-grid-enterprise/range-selection"),require("@ag-grid-enterprise/rich-select"),require("@ag-grid-enterprise/menu"),require("@ag-grid-enterprise/excel-export"),require("@ag-grid-community/theming"),require("@ag-grid-community/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@ag-grid-enterprise/core","@ag-grid-community/core","@ag-grid-community/client-side-row-model","@ag-grid-community/infinite-row-model","@ag-grid-enterprise/server-side-row-model","@ag-grid-community/csv-export","@ag-grid-enterprise/clipboard","@ag-grid-enterprise/range-selection","@ag-grid-enterprise/rich-select","@ag-grid-enterprise/menu","@ag-grid-enterprise/excel-export","@ag-grid-community/theming","@ag-grid-community/vue3"],r):(D=typeof globalThis<"u"?globalThis:D||self,r(D.SdkVueLib={},D.Vue,D.core$1,D.core,D.clientSideRowModel,D.infiniteRowModel,D.serverSideRowModel,D.csvExport,D.clipboard,D.rangeSelection,D.richSelect,D.menu,D.excelExport,D.theming,D.vue3))})(this,function(D,r,Me,k,hs,Eg,Hd,Tg,qd,Kd,Ng,Vg,Ag,Yd,Bg){"use strict";var $M=Object.defineProperty;var xg=D=>{throw TypeError(D)};var zM=(D,r,Me)=>r in D?$M(D,r,{enumerable:!0,configurable:!0,writable:!0,value:Me}):D[r]=Me;var Ze=(D,r,Me)=>zM(D,typeof r!="symbol"?r+"":r,Me),zd=(D,r,Me)=>r.has(D)||xg("Cannot "+Me);var x=(D,r,Me)=>(zd(D,r,"read from private field"),Me?Me.call(D):r.get(D)),ze=(D,r,Me)=>r.has(D)?xg("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(D):r.set(D,Me),ye=(D,r,Me,k)=>(zd(D,r,"write to private field"),k?k.call(D,Me):r.set(D,Me),Me),ue=(D,r,Me)=>(zd(D,r,"access private method"),Me);var Ka=(D,r,Me,k)=>({set _(hs){ye(D,r,hs,Me)},get _(){return x(D,r,k)}});var zh,Po,Uh,Zh,vn,Ht,wn,bn,Ro,Do,ut,xn,dt,Je,ke,Rt,qt,St,mt,kn,gt,Sn,En,Kt,Tn,Vr,Dt,re,Ud,Qr,Qn,zi,Yt,Sg,eo,Io,Ui,Mr,Gr,Zd,Ya,Xa,et,Wd,ps,$r,jd;function Pg(t,e){if(t==null)throw Error(e??"Empty (null | undefined) value");return t}function Rg(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t))+t}function Dg(t){let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(Rg(65,91));return e}function Ig(){return Dg(42)}const Xd=Array.isArray;function Fg(t){return t!==null&&typeof t=="object"}function Jd(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null}function Dn(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e[n]=Dn(t[n]);return e}else if(Fg(t)){const e={};return Object.keys(t).forEach(n=>{e[n]=Dn(t[n])}),e}else return t}function Qd(t,e){return new Set([...Object.keys(t),...Object.keys(e)]).forEach(n=>{const o=t[n],i=e[n];Jd(o)&&Jd(i)||Xd(o)&&Xd(i)&&o.length===i.length?Qd(o,i):t[n]=i}),t}function Ja(t,e,n=!0){let o=0,i;return function(...l){i=()=>{t.apply(this,l),o=new Date().getTime()+e,i=null,n&&setTimeout(()=>{i&&i()},e)},new Date().getTime()>o&&i()}}function Lg(t){let e=0n,n;return async function(...o){const i=++e;try{await n}catch{}if(e!==i)return{ok:!1};const l=t(...o);return n=l,{ok:!0,value:await l}}}var Xo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Og=function t(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?t(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,l,c)=>`${i}${c===0?"":","}${t(l===void 0||typeof l=="symbol"?null:l)}`,"")}]`:`{${Object.keys(e).sort().reduce((o,i)=>{if(e[i]===void 0||typeof e[i]=="symbol")return o;const l=o.length===0?"":",";return`${o}${l}${t(i)}:${t(e[i])}`},"")}}`};const zr=eu(Og);class Qa extends Error{}class fs extends Error{constructor(e){super(e.join(`
2
2
  `)),this.errors=e}toString(){return this.errors.join(`
3
- `)}}function Mg(t){return{ok:!0,value:t}}function tu(t){if(!t)throw new Qa;if(!t.ok)throw new fs(t.errors);return t.value}function nu(t){return{value:t,errors:void 0}}function Gg(t){if(t.errors)throw new fs(t.errors);if(!t.value)throw new Qa;return t.value}function $g(t){return t!==void 0}function el(t,e){return zr(t)===zr(e)}const tl=t=>t,nl=t=>t instanceof Error?t:Error(String(t)),rl=t=>t.name==="ZodError",ol=t=>{const{formErrors:e,fieldErrors:n}=t.flatten(),o=Object.entries(n).map(([i,l])=>i+":"+(l==null?void 0:l.join(",")));return e.concat(o).join("; ")};function il(t){const e=t.validate??tl,{autoSave:n}=t,o=r.ref(),i=r.ref(),l=E=>{i.value={model:Dn(E)}};r.watch(()=>t.get(),E=>l(E),{immediate:!0});const c=()=>{var E;t.onSave(e(Dn((E=i.value)==null?void 0:E.model)))},d=()=>{l(t.get()),o.value=void 0},p=E=>{const z=nl(E);rl(z)?o.value=Error(ol(z)):o.value=z},h=E=>{o.value=void 0;try{e(E),n&&c()}catch(z){p(z)}},m=r.computed({get:()=>{var E;return(E=i.value)==null?void 0:E.model},set(E){l(E),h(E)}});r.watch(i,(E,z)=>{E&&E===z&&h(E.model)},{deep:!0});const y=r.computed(()=>!o.value),b=r.computed(()=>!el(t.get(),r.unref(i))),w=r.computed(()=>o.value?o.value.message:"");return r.reactive({model:m,valid:y,isChanged:b,error:o,errorString:w,save:c,revert:d,setError:p})}function zg(t,e,n){const o=t.validate??tl,{autoSave:i}=t,l=r.ref(),c=r.ref(),d=$=>{var v;if(n.deepPatchModel){const F=(v=c.value)==null?void 0:v.model,O=Object.assign(Dn($),e??{});c.value={model:F?Qd(F,O):O,stage:Symbol()}}else c.value={model:Object.assign(Dn($),e??{}),stage:Symbol()}};r.watch(()=>t.get(),$=>d($),{immediate:!0});const p=()=>{var $;t.onSave(o(Dn(($=c.value)==null?void 0:$.model)))},h=()=>{d(t.get()),l.value=void 0},m=$=>{const v=nl($);rl(v)?l.value=Error(ol(v)):l.value=v},y=$=>{l.value=void 0;try{o($),i&&p()}catch(v){m(v)}},b=r.computed({get:()=>{var $;return($=c.value)==null?void 0:$.model},set(){throw Error("Cannot replace base model")}});r.watch([()=>({args:b.value.args,ui:b.value.ui}),()=>{var $;return($=c.value)==null?void 0:$.stage}],([$,v],[F,O])=>{v===O&&y($)},{deep:!0});const w=r.computed(()=>!l.value),E=r.computed(()=>{var F;const{args:$,ui:v}=((F=r.unref(c))==null?void 0:F.model)??{};return!el(t.get(),{args:$,ui:v})}),z=r.computed(()=>l.value?l.value.message:"");return r.reactive({model:b,valid:w,isChanged:E,error:l,errorString:z,save:p,revert:h,setError:m})}const Ug=t=>Object.fromEntries(new URL(t,"http://dummy").searchParams);function Zg(t,e,n){const o=(v,...F)=>{n.debug&&console.log(`%c>>> %c${v}`,"color: orange; font-weight: bold","color: orange",...F)},l=Ja(e.setBlockArgs,100),c=Ja(e.setBlockUiState,100),d=Ja(e.setBlockArgsAndUiState,100),p=r.reactive({args:Object.freeze(t.args),outputs:Object.freeze(t.outputs),ui:Object.freeze(t.ui),navigationState:Object.freeze(t.navigationState)});e.onStateUpdates(async v=>{v.forEach(F=>{F.key==="args"&&(p.args=Object.freeze(F.value),o("args patch",p.args)),F.key==="ui"&&(p.ui=Object.freeze(F.value),o("ui patch",p.ui)),F.key==="outputs"&&(p.outputs=Object.freeze(F.value),o("outputs patch",p.outputs)),F.key==="navigationState"&&(p.navigationState=Object.freeze(F.value),o("navigationState patch",p.navigationState))}),await r.nextTick()});const h=()=>Dn(p.args),m=()=>Dn(p.ui),y=()=>Dn(p.navigationState),b={createArgsModel(v={}){return il({get(){return v.transform?v.transform(p.args):p.args},validate:v.validate,autoSave:!0,onSave(F){l(F)}})},createUiModel(v={},F){return il({get(){return v.transform?v.transform(p.ui):p.ui??F()},validate:v.validate,autoSave:!0,onSave(O){c(O)}})},useOutputs(...v){const F=r.reactive({errors:void 0,value:void 0});return r.watch(()=>p.outputs,()=>{try{Object.assign(F,{value:this.unwrapOutputs(...v),errors:void 0})}catch(O){Object.assign(F,{value:void 0,errors:[String(O)]})}},{immediate:!0,deep:!0}),F},unwrapOutputs(...v){const F=p.outputs,O=v.map(j=>[j,tu(F[j])]);return Object.fromEntries(O)},updateArgs(v){const F=h();return v(F),e.setBlockArgs(F)},updateUiState(v){const F=m();return e.setBlockUiState(v(F))},updateNavigationState(v){const F=y();return v(F),e.setNavigationState(F)},navigateTo(v){const F=y();return F.href=v,e.setNavigationState(F)}},w=r.computed(()=>{const v=Object.entries(p.outputs).map(([F,O])=>[F,O.ok&&O.value!==void 0?O.value:void 0]);return Object.fromEntries(v)}),E=r.computed(()=>{const v=Object.entries(p.outputs).map(([F,O])=>[F,O&&!O.ok?new fs(O.errors):void 0]);return Object.fromEntries(v)}),z={snapshot:p,queryParams:r.computed(()=>Ug(p.navigationState.href)),href:r.computed(()=>p.navigationState.href),hasErrors:r.computed(()=>Object.values(p.outputs).some(v=>!(v!=null&&v.ok)))},$=zg({get(){return{args:p.args,ui:p.ui}},autoSave:!0,onSave(v){d(v.args,v.ui)}},{outputs:w,outputErrors:E},n);return r.reactive(Object.assign($,b,z))}var Ge;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const l={};for(const c of i)l[c]=c;return l},t.getValidEnumValues=i=>{const l=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),c={};for(const d of l)c[d]=i[d];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(l){return i[l]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&l.push(c);return l},t.find=(i,l)=>{for(const c of i)if(l(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function o(i,l=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(l)}t.joinValues=o,t.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Ge||(Ge={}));var sl;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(sl||(sl={}));const ae=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=t=>{switch(typeof t){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return isNaN(t)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(t)?ae.array:t===null?ae.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ae.promise:typeof Map<"u"&&t instanceof Map?ae.map:typeof Set<"u"&&t instanceof Set?ae.set:typeof Date<"u"&&t instanceof Date?ae.date:ae.object;default:return ae.unknown}},ee=Ge.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"]),Wg=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Wt extends Error{constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(l){return l.message},o={_errors:[]},i=l=>{for(const c of l.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)o._errors.push(n(c));else{let d=o,p=0;for(;p<c.path.length;){const h=c.path[p];p===c.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(c))):d[h]=d[h]||{_errors:[]},d=d[h],p++}}};return i(this),o}static assert(e){if(!(e instanceof Wt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},o=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):o.push(e(i));return{formErrors:o,fieldErrors:n}}get formErrors(){return this.flatten()}}Wt.create=t=>new Wt(t);const po=(t,e)=>{let n;switch(t.code){case ee.invalid_type:t.received===ae.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ge.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ge.joinValues(t.keys,", ")}`;break;case ee.invalid_union:n="Invalid input";break;case ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ge.joinValues(t.options)}`;break;case ee.invalid_enum_value:n=`Invalid enum value. Expected ${Ge.joinValues(t.options)}, received '${t.received}'`;break;case ee.invalid_arguments:n="Invalid function arguments";break;case ee.invalid_return_type:n="Invalid function return type";break;case ee.invalid_date:n="Invalid date";break;case ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ge.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ee.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ee.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ee.custom:n="Invalid input";break;case ee.invalid_intersection_types:n="Intersection results could not be merged";break;case ee.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ee.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ge.assertNever(t)}return{message:n}};let ru=po;function jg(t){ru=t}function ms(){return ru}const gs=t=>{const{data:e,path:n,errorMaps:o,issueData:i}=t,l=[...n,...i.path||[]],c={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let d="";const p=o.filter(h=>!!h).slice().reverse();for(const h of p)d=h(c,{data:e,defaultError:d}).message;return{...i,path:l,message:d}},Hg=[];function ie(t,e){const n=ms(),o=gs({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===po?void 0:po].filter(i=>!!i)});t.common.issues.push(o)}class bt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const o=[];for(const i of n){if(i.status==="aborted")return be;i.status==="dirty"&&e.dirty(),o.push(i.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,n){const o=[];for(const i of n){const l=await i.key,c=await i.value;o.push({key:l,value:c})}return bt.mergeObjectSync(e,o)}static mergeObjectSync(e,n){const o={};for(const i of n){const{key:l,value:c}=i;if(l.status==="aborted"||c.status==="aborted")return be;l.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),l.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(o[l.value]=c.value)}return{status:e.value,value:o}}}const be=Object.freeze({status:"aborted"}),ho=t=>({status:"dirty",value:t}),Nt=t=>({status:"valid",value:t}),al=t=>t.status==="aborted",ll=t=>t.status==="dirty",Jo=t=>t.status==="valid",Qo=t=>typeof Promise<"u"&&t instanceof Promise;function ys(t,e,n,o){if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function ou(t,e,n,o,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var he;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(he||(he={}));var ei,ti;class In{constructor(e,n,o,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=o,this._key=i}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 iu=(t,e)=>{if(Jo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Wt(t.common.issues);return this._error=n,this._error}}};function Ve(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:o,description:i}=t;if(e&&(n||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,d)=>{var p,h;const{message:m}=t;return c.code==="invalid_enum_value"?{message:m??d.defaultError}:typeof d.data>"u"?{message:(p=m??o)!==null&&p!==void 0?p:d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:(h=m??n)!==null&&h!==void 0?h:d.defaultError}},description:i}}class Pe{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 dr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bt,ctx:{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Qo(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const o=this.safeParse(e,n);if(o.success)return o.data;throw o.error}safeParse(e,n){var o;const i={common:{issues:[],async:(o=n==null?void 0:n.async)!==null&&o!==void 0?o:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},l=this._parseSync({data:e,path:i.path,parent:i});return iu(i,l)}async parseAsync(e,n){const o=await this.safeParseAsync(e,n);if(o.success)return o.data;throw o.error}async safeParseAsync(e,n){const o={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},i=this._parse({data:e,path:o.path,parent:o}),l=await(Qo(i)?i:Promise.resolve(i));return iu(o,l)}refine(e,n){const o=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,l)=>{const c=e(i),d=()=>l.addIssue({code:ee.custom,...o(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(p=>p?!0:(d(),!1)):c?!0:(d(),!1)})}refinement(e,n){return this._refinement((o,i)=>e(o)?!0:(i.addIssue(typeof n=="function"?n(o,i):n),!1))}_refinement(e){return new fn({schema:this,typeName:ve.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ln.create(this,this._def)}nullable(){return fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hn.create(this,this._def)}promise(){return yo.create(this,this._def)}or(e){return ii.create([this,e],this._def)}and(e){return si.create(this,e,this._def)}transform(e){return new fn({...Ve(this._def),schema:this,typeName:ve.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ui({...Ve(this._def),innerType:this,defaultValue:n,typeName:ve.ZodDefault})}brand(){return new ul({typeName:ve.ZodBranded,type:this,...Ve(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new pi({...Ve(this._def),innerType:this,catchValue:n,typeName:ve.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return hi.create(this,e)}readonly(){return fi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const qg=/^c[^\s-]{8,}$/i,Kg=/^[0-9a-z]+$/,Yg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Xg=/^[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,Jg=/^[a-z0-9_-]{21}$/i,Qg=/^[-+]?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)?)??$/,ey=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ty="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let cl;const ny=/^(?:(?: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])$/,ry=/^(([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})))$/,oy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,su="((\\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])))",iy=new RegExp(`^${su}$`);function au(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function sy(t){return new RegExp(`^${au(t)}$`)}function lu(t){let e=`${su}T${au(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ay(t,e){return!!((e==="v4"||!e)&&ny.test(t)||(e==="v6"||!e)&&ry.test(t))}class pn extends Pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ae.string){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.string,received:l.parsedType}),be}const o=new bt;let i;for(const l of this._def.checks)if(l.kind==="min")e.data.length<l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if(l.kind==="max")e.data.length>l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if(l.kind==="length"){const c=e.data.length>l.value,d=e.data.length<l.value;(c||d)&&(i=this._getOrReturnCtx(e,i),c?ie(i,{code:ee.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):d&&ie(i,{code:ee.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if(l.kind==="email")ey.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"email",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="emoji")cl||(cl=new RegExp(ty,"u")),cl.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"emoji",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="uuid")Xg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"uuid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="nanoid")Jg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"nanoid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="cuid")qg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="cuid2")Kg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid2",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="ulid")Yg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ulid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ie(i,{validation:"url",code:ee.invalid_string,message:l.message}),o.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"regex",code:ee.invalid_string,message:l.message}),o.dirty())):l.kind==="trim"?e.data=e.data.trim():l.kind==="includes"?e.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):l.kind==="toLowerCase"?e.data=e.data.toLowerCase():l.kind==="toUpperCase"?e.data=e.data.toUpperCase():l.kind==="startsWith"?e.data.startsWith(l.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):l.kind==="endsWith"?e.data.endsWith(l.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):l.kind==="datetime"?lu(l).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"datetime",message:l.message}),o.dirty()):l.kind==="date"?iy.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"date",message:l.message}),o.dirty()):l.kind==="time"?sy(l).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"time",message:l.message}),o.dirty()):l.kind==="duration"?Qg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"duration",code:ee.invalid_string,message:l.message}),o.dirty()):l.kind==="ip"?ay(e.data,l.version)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ip",code:ee.invalid_string,message:l.message}),o.dirty()):l.kind==="base64"?oy.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"base64",code:ee.invalid_string,message:l.message}),o.dirty()):Ge.assertNever(l);return{status:o.value,value:e.data}}_regex(e,n,o){return this.refinement(i=>e.test(i),{validation:n,code:ee.invalid_string,...he.errToObj(o)})}_addCheck(e){return new pn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...he.errToObj(e)})}url(e){return this._addCheck({kind:"url",...he.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...he.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...he.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...he.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...he.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...he.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...he.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...he.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...he.errToObj(e)})}datetime(e){var n,o;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(o=e==null?void 0:e.local)!==null&&o!==void 0?o:!1,...he.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,...he.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...he.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...he.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...he.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...he.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...he.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...he.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...he.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...he.errToObj(n)})}nonempty(e){return this.min(1,he.errToObj(e))}trim(){return new pn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pn({...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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pn.create=t=>{var e;return new pn({checks:[],typeName:ve.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ve(t)})};function ly(t,e){const n=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,i=n>o?n:o,l=parseInt(t.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return l%c/Math.pow(10,i)}class ur extends Pe{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)!==ae.number){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.number,received:l.parsedType}),be}let o;const i=new bt;for(const l of this._def.checks)l.kind==="int"?Ge.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?ly(e.data,l.value)!==0&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_finite,message:l.message}),i.dirty()):Ge.assertNever(l);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,he.toString(n))}gt(e,n){return this.setLimit("min",e,!1,he.toString(n))}lte(e,n){return this.setLimit("max",e,!0,he.toString(n))}lt(e,n){return this.setLimit("max",e,!1,he.toString(n))}setLimit(e,n,o,i){return new ur({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:he.toString(i)}]})}_addCheck(e){return new ur({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:he.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:he.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:he.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:he.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:he.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(n===null||o.value>n)&&(n=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(n)&&Number.isFinite(e)}}ur.create=t=>new ur({checks:[],typeName:ve.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ve(t)});class pr extends Pe{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)!==ae.bigint){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.bigint,received:l.parsedType}),be}let o;const i=new bt;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?e.data%l.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):Ge.assertNever(l);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,he.toString(n))}gt(e,n){return this.setLimit("min",e,!1,he.toString(n))}lte(e,n){return this.setLimit("max",e,!0,he.toString(n))}lt(e,n){return this.setLimit("max",e,!1,he.toString(n))}setLimit(e,n,o,i){return new pr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:he.toString(i)}]})}_addCheck(e){return new pr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:he.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pr.create=t=>{var e;return new pr({checks:[],typeName:ve.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ve(t)})};class ni extends Pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ae.boolean){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.boolean,received:o.parsedType}),be}return Nt(e.data)}}ni.create=t=>new ni({typeName:ve.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ve(t)});class Ur extends Pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ae.date){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.date,received:l.parsedType}),be}if(isNaN(e.data.getTime())){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_date}),be}const o=new bt;let i;for(const l of this._def.checks)l.kind==="min"?e.data.getTime()<l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),o.dirty()):l.kind==="max"?e.data.getTime()>l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),o.dirty()):Ge.assertNever(l);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ur({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:he.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:he.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ur.create=t=>new Ur({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ve.ZodDate,...Ve(t)});class _s extends Pe{_parse(e){if(this._getType(e)!==ae.symbol){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.symbol,received:o.parsedType}),be}return Nt(e.data)}}_s.create=t=>new _s({typeName:ve.ZodSymbol,...Ve(t)});class ri extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.undefined,received:o.parsedType}),be}return Nt(e.data)}}ri.create=t=>new ri({typeName:ve.ZodUndefined,...Ve(t)});class oi extends Pe{_parse(e){if(this._getType(e)!==ae.null){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.null,received:o.parsedType}),be}return Nt(e.data)}}oi.create=t=>new oi({typeName:ve.ZodNull,...Ve(t)});class fo extends Pe{constructor(){super(...arguments),this._any=!0}_parse(e){return Nt(e.data)}}fo.create=t=>new fo({typeName:ve.ZodAny,...Ve(t)});class Zr extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nt(e.data)}}Zr.create=t=>new Zr({typeName:ve.ZodUnknown,...Ve(t)});class Kn extends Pe{_parse(e){const n=this._getOrReturnCtx(e);return ie(n,{code:ee.invalid_type,expected:ae.never,received:n.parsedType}),be}}Kn.create=t=>new Kn({typeName:ve.ZodNever,...Ve(t)});class Cs extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.void,received:o.parsedType}),be}return Nt(e.data)}}Cs.create=t=>new Cs({typeName:ve.ZodVoid,...Ve(t)});class hn extends Pe{_parse(e){const{ctx:n,status:o}=this._processInputParams(e),i=this._def;if(n.parsedType!==ae.array)return ie(n,{code:ee.invalid_type,expected:ae.array,received:n.parsedType}),be;if(i.exactLength!==null){const c=n.data.length>i.exactLength.value,d=n.data.length<i.exactLength.value;(c||d)&&(ie(n,{code:c?ee.too_big:ee.too_small,minimum:d?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),o.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ie(n,{code:ee.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),o.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ie(n,{code:ee.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),o.dirty()),n.common.async)return Promise.all([...n.data].map((c,d)=>i.type._parseAsync(new In(n,c,n.path,d)))).then(c=>bt.mergeArray(o,c));const l=[...n.data].map((c,d)=>i.type._parseSync(new In(n,c,n.path,d)));return bt.mergeArray(o,l)}get element(){return this._def.type}min(e,n){return new hn({...this._def,minLength:{value:e,message:he.toString(n)}})}max(e,n){return new hn({...this._def,maxLength:{value:e,message:he.toString(n)}})}length(e,n){return new hn({...this._def,exactLength:{value:e,message:he.toString(n)}})}nonempty(e){return this.min(1,e)}}hn.create=(t,e)=>new hn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ve.ZodArray,...Ve(e)});function mo(t){if(t instanceof nt){const e={};for(const n in t.shape){const o=t.shape[n];e[n]=Ln.create(mo(o))}return new nt({...t._def,shape:()=>e})}else return t instanceof hn?new hn({...t._def,type:mo(t.element)}):t instanceof Ln?Ln.create(mo(t.unwrap())):t instanceof fr?fr.create(mo(t.unwrap())):t instanceof Fn?Fn.create(t.items.map(e=>mo(e))):t}class nt extends Pe{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(),n=Ge.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ae.object){const h=this._getOrReturnCtx(e);return ie(h,{code:ee.invalid_type,expected:ae.object,received:h.parsedType}),be}const{status:o,ctx:i}=this._processInputParams(e),{shape:l,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof Kn&&this._def.unknownKeys==="strip"))for(const h in i.data)c.includes(h)||d.push(h);const p=[];for(const h of c){const m=l[h],y=i.data[h];p.push({key:{status:"valid",value:h},value:m._parse(new In(i,y,i.path,h)),alwaysSet:h in i.data})}if(this._def.catchall instanceof Kn){const h=this._def.unknownKeys;if(h==="passthrough")for(const m of d)p.push({key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(h==="strict")d.length>0&&(ie(i,{code:ee.unrecognized_keys,keys:d}),o.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const m of d){const y=i.data[m];p.push({key:{status:"valid",value:m},value:h._parse(new In(i,y,i.path,m)),alwaysSet:m in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const h=[];for(const m of p){const y=await m.key,b=await m.value;h.push({key:y,value:b,alwaysSet:m.alwaysSet})}return h}).then(h=>bt.mergeObjectSync(o,h)):bt.mergeObjectSync(o,p)}get shape(){return this._def.shape()}strict(e){return he.errToObj,new nt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,o)=>{var i,l,c,d;const p=(c=(l=(i=this._def).errorMap)===null||l===void 0?void 0:l.call(i,n,o).message)!==null&&c!==void 0?c:o.defaultError;return n.code==="unrecognized_keys"?{message:(d=he.errToObj(e).message)!==null&&d!==void 0?d:p}:{message:p}}}:{}})}strip(){return new nt({...this._def,unknownKeys:"strip"})}passthrough(){return new nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ve.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new nt({...this._def,catchall:e})}pick(e){const n={};return Ge.objectKeys(e).forEach(o=>{e[o]&&this.shape[o]&&(n[o]=this.shape[o])}),new nt({...this._def,shape:()=>n})}omit(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{e[o]||(n[o]=this.shape[o])}),new nt({...this._def,shape:()=>n})}deepPartial(){return mo(this)}partial(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{const i=this.shape[o];e&&!e[o]?n[o]=i:n[o]=i.optional()}),new nt({...this._def,shape:()=>n})}required(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{if(e&&!e[o])n[o]=this.shape[o];else{let l=this.shape[o];for(;l instanceof Ln;)l=l._def.innerType;n[o]=l}}),new nt({...this._def,shape:()=>n})}keyof(){return cu(Ge.objectKeys(this.shape))}}nt.create=(t,e)=>new nt({shape:()=>t,unknownKeys:"strip",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)}),nt.strictCreate=(t,e)=>new nt({shape:()=>t,unknownKeys:"strict",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)}),nt.lazycreate=(t,e)=>new nt({shape:t,unknownKeys:"strip",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)});class ii extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o=this._def.options;function i(l){for(const d of l)if(d.result.status==="valid")return d.result;for(const d of l)if(d.result.status==="dirty")return n.common.issues.push(...d.ctx.common.issues),d.result;const c=l.map(d=>new Wt(d.ctx.common.issues));return ie(n,{code:ee.invalid_union,unionErrors:c}),be}if(n.common.async)return Promise.all(o.map(async l=>{const c={...n,common:{...n.common,issues:[]},parent:null};return{result:await l._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(i);{let l;const c=[];for(const p of o){const h={...n,common:{...n.common,issues:[]},parent:null},m=p._parseSync({data:n.data,path:n.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!l&&(l={result:m,ctx:h}),h.common.issues.length&&c.push(h.common.issues)}if(l)return n.common.issues.push(...l.ctx.common.issues),l.result;const d=c.map(p=>new Wt(p));return ie(n,{code:ee.invalid_union,unionErrors:d}),be}}get options(){return this._def.options}}ii.create=(t,e)=>new ii({options:t,typeName:ve.ZodUnion,...Ve(e)});const Yn=t=>t instanceof li?Yn(t.schema):t instanceof fn?Yn(t.innerType()):t instanceof ci?[t.value]:t instanceof hr?t.options:t instanceof di?Ge.objectValues(t.enum):t instanceof ui?Yn(t._def.innerType):t instanceof ri?[void 0]:t instanceof oi?[null]:t instanceof Ln?[void 0,...Yn(t.unwrap())]:t instanceof fr?[null,...Yn(t.unwrap())]:t instanceof ul||t instanceof fi?Yn(t.unwrap()):t instanceof pi?Yn(t._def.innerType):[];class vs extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.object)return ie(n,{code:ee.invalid_type,expected:ae.object,received:n.parsedType}),be;const o=this.discriminator,i=n.data[o],l=this.optionsMap.get(i);return l?n.common.async?l._parseAsync({data:n.data,path:n.path,parent:n}):l._parseSync({data:n.data,path:n.path,parent:n}):(ie(n,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,o){const i=new Map;for(const l of n){const c=Yn(l.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const d of c){if(i.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);i.set(d,l)}}return new vs({typeName:ve.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Ve(o)})}}function dl(t,e){const n=dr(t),o=dr(e);if(t===e)return{valid:!0,data:t};if(n===ae.object&&o===ae.object){const i=Ge.objectKeys(e),l=Ge.objectKeys(t).filter(d=>i.indexOf(d)!==-1),c={...t,...e};for(const d of l){const p=dl(t[d],e[d]);if(!p.valid)return{valid:!1};c[d]=p.data}return{valid:!0,data:c}}else if(n===ae.array&&o===ae.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let l=0;l<t.length;l++){const c=t[l],d=e[l],p=dl(c,d);if(!p.valid)return{valid:!1};i.push(p.data)}return{valid:!0,data:i}}else return n===ae.date&&o===ae.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class si extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=(l,c)=>{if(al(l)||al(c))return be;const d=dl(l.value,c.value);return d.valid?((ll(l)||ll(c))&&n.dirty(),{status:n.value,value:d.data}):(ie(o,{code:ee.invalid_intersection_types}),be)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([l,c])=>i(l,c)):i(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}si.create=(t,e,n)=>new si({left:t,right:e,typeName:ve.ZodIntersection,...Ve(n)});class Fn extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.array)return ie(o,{code:ee.invalid_type,expected:ae.array,received:o.parsedType}),be;if(o.data.length<this._def.items.length)return ie(o,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&o.data.length>this._def.items.length&&(ie(o,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const l=[...o.data].map((c,d)=>{const p=this._def.items[d]||this._def.rest;return p?p._parse(new In(o,c,o.path,d)):null}).filter(c=>!!c);return o.common.async?Promise.all(l).then(c=>bt.mergeArray(n,c)):bt.mergeArray(n,l)}get items(){return this._def.items}rest(e){return new Fn({...this._def,rest:e})}}Fn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:t,typeName:ve.ZodTuple,rest:null,...Ve(e)})};class ai extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.object)return ie(o,{code:ee.invalid_type,expected:ae.object,received:o.parsedType}),be;const i=[],l=this._def.keyType,c=this._def.valueType;for(const d in o.data)i.push({key:l._parse(new In(o,d,o.path,d)),value:c._parse(new In(o,o.data[d],o.path,d)),alwaysSet:d in o.data});return o.common.async?bt.mergeObjectAsync(n,i):bt.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,o){return n instanceof Pe?new ai({keyType:e,valueType:n,typeName:ve.ZodRecord,...Ve(o)}):new ai({keyType:pn.create(),valueType:e,typeName:ve.ZodRecord,...Ve(n)})}}class ws extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.map)return ie(o,{code:ee.invalid_type,expected:ae.map,received:o.parsedType}),be;const i=this._def.keyType,l=this._def.valueType,c=[...o.data.entries()].map(([d,p],h)=>({key:i._parse(new In(o,d,o.path,[h,"key"])),value:l._parse(new In(o,p,o.path,[h,"value"]))}));if(o.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const p of c){const h=await p.key,m=await p.value;if(h.status==="aborted"||m.status==="aborted")return be;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),d.set(h.value,m.value)}return{status:n.value,value:d}})}else{const d=new Map;for(const p of c){const h=p.key,m=p.value;if(h.status==="aborted"||m.status==="aborted")return be;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),d.set(h.value,m.value)}return{status:n.value,value:d}}}}ws.create=(t,e,n)=>new ws({valueType:e,keyType:t,typeName:ve.ZodMap,...Ve(n)});class Wr extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.set)return ie(o,{code:ee.invalid_type,expected:ae.set,received:o.parsedType}),be;const i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(ie(o,{code:ee.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&o.data.size>i.maxSize.value&&(ie(o,{code:ee.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const l=this._def.valueType;function c(p){const h=new Set;for(const m of p){if(m.status==="aborted")return be;m.status==="dirty"&&n.dirty(),h.add(m.value)}return{status:n.value,value:h}}const d=[...o.data.values()].map((p,h)=>l._parse(new In(o,p,o.path,h)));return o.common.async?Promise.all(d).then(p=>c(p)):c(d)}min(e,n){return new Wr({...this._def,minSize:{value:e,message:he.toString(n)}})}max(e,n){return new Wr({...this._def,maxSize:{value:e,message:he.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Wr.create=(t,e)=>new Wr({valueType:t,minSize:null,maxSize:null,typeName:ve.ZodSet,...Ve(e)});class go extends Pe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.function)return ie(n,{code:ee.invalid_type,expected:ae.function,received:n.parsedType}),be;function o(d,p){return gs({data:d,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ms(),po].filter(h=>!!h),issueData:{code:ee.invalid_arguments,argumentsError:p}})}function i(d,p){return gs({data:d,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ms(),po].filter(h=>!!h),issueData:{code:ee.invalid_return_type,returnTypeError:p}})}const l={errorMap:n.common.contextualErrorMap},c=n.data;if(this._def.returns instanceof yo){const d=this;return Nt(async function(...p){const h=new Wt([]),m=await d._def.args.parseAsync(p,l).catch(w=>{throw h.addIssue(o(p,w)),h}),y=await Reflect.apply(c,this,m);return await d._def.returns._def.type.parseAsync(y,l).catch(w=>{throw h.addIssue(i(y,w)),h})})}else{const d=this;return Nt(function(...p){const h=d._def.args.safeParse(p,l);if(!h.success)throw new Wt([o(p,h.error)]);const m=Reflect.apply(c,this,h.data),y=d._def.returns.safeParse(m,l);if(!y.success)throw new Wt([i(m,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new go({...this._def,args:Fn.create(e).rest(Zr.create())})}returns(e){return new go({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,o){return new go({args:e||Fn.create([]).rest(Zr.create()),returns:n||Zr.create(),typeName:ve.ZodFunction,...Ve(o)})}}class li extends Pe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}li.create=(t,e)=>new li({getter:t,typeName:ve.ZodLazy,...Ve(e)});class ci extends Pe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ie(n,{received:n.data,code:ee.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:e.data}}get value(){return this._def.value}}ci.create=(t,e)=>new ci({value:t,typeName:ve.ZodLiteral,...Ve(e)});function cu(t,e){return new hr({values:t,typeName:ve.ZodEnum,...Ve(e)})}class hr extends Pe{constructor(){super(...arguments),ei.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),o=this._def.values;return ie(n,{expected:Ge.joinValues(o),received:n.parsedType,code:ee.invalid_type}),be}if(ys(this,ei)||ou(this,ei,new Set(this._def.values)),!ys(this,ei).has(e.data)){const n=this._getOrReturnCtx(e),o=this._def.values;return ie(n,{received:n.data,code:ee.invalid_enum_value,options:o}),be}return Nt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return hr.create(e,{...this._def,...n})}exclude(e,n=this._def){return hr.create(this.options.filter(o=>!e.includes(o)),{...this._def,...n})}}ei=new WeakMap,hr.create=cu;class di extends Pe{constructor(){super(...arguments),ti.set(this,void 0)}_parse(e){const n=Ge.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==ae.string&&o.parsedType!==ae.number){const i=Ge.objectValues(n);return ie(o,{expected:Ge.joinValues(i),received:o.parsedType,code:ee.invalid_type}),be}if(ys(this,ti)||ou(this,ti,new Set(Ge.getValidEnumValues(this._def.values))),!ys(this,ti).has(e.data)){const i=Ge.objectValues(n);return ie(o,{received:o.data,code:ee.invalid_enum_value,options:i}),be}return Nt(e.data)}get enum(){return this._def.values}}ti=new WeakMap,di.create=(t,e)=>new di({values:t,typeName:ve.ZodNativeEnum,...Ve(e)});class yo extends Pe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.promise&&n.common.async===!1)return ie(n,{code:ee.invalid_type,expected:ae.promise,received:n.parsedType}),be;const o=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return Nt(o.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}yo.create=(t,e)=>new yo({type:t,typeName:ve.ZodPromise,...Ve(e)});class fn extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=this._def.effect||null,l={addIssue:c=>{ie(o,c),c.fatal?n.abort():n.dirty()},get path(){return o.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const c=i.transform(o.data,l);if(o.common.async)return Promise.resolve(c).then(async d=>{if(n.value==="aborted")return be;const p=await this._def.schema._parseAsync({data:d,path:o.path,parent:o});return p.status==="aborted"?be:p.status==="dirty"||n.value==="dirty"?ho(p.value):p});{if(n.value==="aborted")return be;const d=this._def.schema._parseSync({data:c,path:o.path,parent:o});return d.status==="aborted"?be:d.status==="dirty"||n.value==="dirty"?ho(d.value):d}}if(i.type==="refinement"){const c=d=>{const p=i.refinement(d,l);if(o.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(o.common.async===!1){const d=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return d.status==="aborted"?be:(d.status==="dirty"&&n.dirty(),c(d.value),{status:n.value,value:d.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(d=>d.status==="aborted"?be:(d.status==="dirty"&&n.dirty(),c(d.value).then(()=>({status:n.value,value:d.value}))))}if(i.type==="transform")if(o.common.async===!1){const c=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Jo(c))return c;const d=i.transform(c.value,l);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:d}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(c=>Jo(c)?Promise.resolve(i.transform(c.value,l)).then(d=>({status:n.value,value:d})):c);Ge.assertNever(i)}}fn.create=(t,e,n)=>new fn({schema:t,typeName:ve.ZodEffects,effect:e,...Ve(n)}),fn.createWithPreprocess=(t,e,n)=>new fn({schema:e,effect:{type:"preprocess",transform:t},typeName:ve.ZodEffects,...Ve(n)});class Ln extends Pe{_parse(e){return this._getType(e)===ae.undefined?Nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ln.create=(t,e)=>new Ln({innerType:t,typeName:ve.ZodOptional,...Ve(e)});class fr extends Pe{_parse(e){return this._getType(e)===ae.null?Nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fr.create=(t,e)=>new fr({innerType:t,typeName:ve.ZodNullable,...Ve(e)});class ui extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e);let o=n.data;return n.parsedType===ae.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ui.create=(t,e)=>new ui({innerType:t,typeName:ve.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ve(e)});class pi extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Qo(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}pi.create=(t,e)=>new pi({innerType:t,typeName:ve.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ve(e)});class bs extends Pe{_parse(e){if(this._getType(e)!==ae.nan){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.nan,received:o.parsedType}),be}return{status:"valid",value:e.data}}}bs.create=t=>new bs({typeName:ve.ZodNaN,...Ve(t)});const cy=Symbol("zod_brand");class ul extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o=n.data;return this._def.type._parse({data:o,path:n.path,parent:n})}unwrap(){return this._def.type}}class hi extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return l.status==="aborted"?be:l.status==="dirty"?(n.dirty(),ho(l.value)):this._def.out._parseAsync({data:l.value,path:o.path,parent:o})})();{const i=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?be:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:o.path,parent:o})}}static create(e,n){return new hi({in:e,out:n,typeName:ve.ZodPipeline})}}class fi extends Pe{_parse(e){const n=this._def.innerType._parse(e),o=i=>(Jo(i)&&(i.value=Object.freeze(i.value)),i);return Qo(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}fi.create=(t,e)=>new fi({innerType:t,typeName:ve.ZodReadonly,...Ve(e)});function du(t,e={},n){return t?fo.create().superRefine((o,i)=>{var l,c;if(!t(o)){const d=typeof e=="function"?e(o):typeof e=="string"?{message:e}:e,p=(c=(l=d.fatal)!==null&&l!==void 0?l:n)!==null&&c!==void 0?c:!0,h=typeof d=="string"?{message:d}:d;i.addIssue({code:"custom",...h,fatal:p})}}):fo.create()}const dy={object:nt.lazycreate};var ve;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ve||(ve={}));const uy=(t,e={message:`Input not instance of ${t.name}`})=>du(n=>n instanceof t,e),uu=pn.create,pu=ur.create,py=bs.create,hy=pr.create,hu=ni.create,fy=Ur.create,my=_s.create,gy=ri.create,yy=oi.create,_y=fo.create,Cy=Zr.create,vy=Kn.create,wy=Cs.create,by=hn.create,xy=nt.create,ky=nt.strictCreate,Sy=ii.create,Ey=vs.create,Ty=si.create,Ny=Fn.create,Vy=ai.create,Ay=ws.create,By=Wr.create,Py=go.create,Ry=li.create,Dy=ci.create,Iy=hr.create,Fy=di.create,Ly=yo.create,fu=fn.create,Oy=Ln.create,My=fr.create,Gy=fn.createWithPreprocess,$y=hi.create;var On=Object.freeze({__proto__:null,defaultErrorMap:po,setErrorMap:jg,getErrorMap:ms,makeIssue:gs,EMPTY_PATH:Hg,addIssueToContext:ie,ParseStatus:bt,INVALID:be,DIRTY:ho,OK:Nt,isAborted:al,isDirty:ll,isValid:Jo,isAsync:Qo,get util(){return Ge},get objectUtil(){return sl},ZodParsedType:ae,getParsedType:dr,ZodType:Pe,datetimeRegex:lu,ZodString:pn,ZodNumber:ur,ZodBigInt:pr,ZodBoolean:ni,ZodDate:Ur,ZodSymbol:_s,ZodUndefined:ri,ZodNull:oi,ZodAny:fo,ZodUnknown:Zr,ZodNever:Kn,ZodVoid:Cs,ZodArray:hn,ZodObject:nt,ZodUnion:ii,ZodDiscriminatedUnion:vs,ZodIntersection:si,ZodTuple:Fn,ZodRecord:ai,ZodMap:ws,ZodSet:Wr,ZodFunction:go,ZodLazy:li,ZodLiteral:ci,ZodEnum:hr,ZodNativeEnum:di,ZodPromise:yo,ZodEffects:fn,ZodTransformer:fn,ZodOptional:Ln,ZodNullable:fr,ZodDefault:ui,ZodCatch:pi,ZodNaN:bs,BRAND:cy,ZodBranded:ul,ZodPipeline:hi,ZodReadonly:fi,custom:du,Schema:Pe,ZodSchema:Pe,late:dy,get ZodFirstPartyTypeKind(){return ve},coerce:{string:t=>pn.create({...t,coerce:!0}),number:t=>ur.create({...t,coerce:!0}),boolean:t=>ni.create({...t,coerce:!0}),bigint:t=>pr.create({...t,coerce:!0}),date:t=>Ur.create({...t,coerce:!0})},any:_y,array:by,bigint:hy,boolean:hu,date:fy,discriminatedUnion:Ey,effect:fu,enum:Iy,function:Py,instanceof:uy,intersection:Ty,lazy:Ry,literal:Dy,map:Ay,nan:py,nativeEnum:Fy,never:vy,null:yy,nullable:My,number:pu,object:xy,oboolean:()=>hu().optional(),onumber:()=>pu().optional(),optional:Oy,ostring:()=>uu().optional(),pipeline:$y,preprocess:Gy,promise:Ly,record:Vy,set:By,strictObject:ky,string:uu,symbol:my,transformer:fu,tuple:Ny,undefined:gy,union:Sy,unknown:Cy,void:wy,NEVER:be,ZodIssueCode:ee,quotelessJson:Wg,ZodError:Wt});const zy=-2147483648,mu=-9007199254740991n,Uy=NaN,Zy=NaN,Wy=null,jy=null;function Hy(t,e){switch(e){case"Int":return t===zy;case"Long":return t===Number(mu)||t===mu;case"Float":return t===Uy;case"Double":return t===Zy;case"String":return t===Wy;case"Bytes":return t===jy;default:throw Error(`unsupported data type: ${e}`)}}function qy(t,e){const n=Math.floor(e/8),o=1<<7-e%8;return(t[n]&o)>0}function jr(t){const{type:e,name:n,domain:o}=t;return{type:e,name:n,...o&&{domain:o}}}On.object({__isRef:On.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:On.string().describe("Upstream block id"),name:On.string().describe("Name of the output provided to the upstream block's output context")}).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.").strict().readonly();function Ky(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}const Yy=On.object({type:On.string(),importance:On.number().optional(),id:On.string().optional(),label:On.string()});On.array(Yy);const Xy="1.15.4";function xs(){return Ky({sdkVersion:Xy})}function Jy(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}function _o(t){return!!t&&typeof t.children<"u"}function mr(t){return _o(t)?t.groupId:t.colId}function gu(t,e,n){const o=(c,d)=>{const p=c.children.map(mr),h=k._includes(p,mr(d)),m=k._last(c.children),y=m&&mr(m)!==mr(d);return h&&y};if(!_o(t))return!0;const i=t,l=n;if(o(i,l))return i.children.push(l),!0;if(i.groupId===e){const c=i.children.map(mr);if(!k._includes(c,mr(l)))return i.children.push(l),!0}for(let c=i.children.length-1;c>=0&&!gu(i.children[c],e,n);c--);return!1}function Qy(t){const e=(i,l)=>_o(i)&&_o(l)&&mr(i)===mr(l),n=(i,l)=>{if(!_o(l))return i;const c=i,d=l;return d.children&&d.groupId&&gu(c,d.groupId,d.children[0])||d.children.forEach(p=>n(c,p)),c},o=[];for(let i=1;i<=t.length;i++){const l=t[i-1],c=t[i];e(l,c)?t[i]=n(l,c):o.push(l)}return o}var e_=class extends k.BeanStub{constructor(){super(...arguments),this.beanName="toolPanelColDefService"}wireBeans(t){this.columnModel=t.columnModel}createColumnTree(t){const e=[],n=(i,l)=>{if(_o(i)){const c=i,d=typeof c.groupId<"u"?c.groupId:c.headerName,p=new k.AgProvidedColumnGroup(c,d,!1,l),h=[];return c.children.forEach(m=>{const y=n(m,l+1);y&&h.push(y)}),p.setChildren(h),p}else{const c=i,d=c.colId?c.colId:c.field,p=this.columnModel.getColDefCol(d);return p||e.push(c),p}},o=[];return t.forEach(i=>{const l=n(i,0);l&&o.push(l)}),e.length>0&&k._warnOnce("unable to find grid columns for the supplied colDef(s):",e),o}syncLayoutWithGrid(t){const e=this.getLeafPathTrees(),n=Qy(e);t(n)}getLeafPathTrees(){const t=(o,i)=>{let l;if(k.isProvidedColumnGroup(o))if(o.isPadding())l=i;else{const d=Object.assign({},o.getColGroupDef());d.groupId=o.getGroupId(),d.children=[i],l=d}else{const d=Object.assign({},o.getColDef());d.colId=o.getColId(),l=d}const c=o.getOriginalParent();return c?t(c,l):l};return this.columnModel.getCols().filter(o=>{const i=o.getColDef();return o.isPrimary()&&!i.showRowGroup}).map(o=>t(o,o.getColDef()))}};function t_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().isDisplayed())??!1}function n_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().setDisplayed(e)}function r_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().setSideBarPosition(e)}function o_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().openToolPanel(e,"api")}function i_(t){var e;(e=t.sideBarService)==null||e.getSideBarComp().close("api")}function s_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().openedItem())??null}function a_(t){var e;(e=t.sideBarService)==null||e.getSideBarComp().refresh()}function l_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().isToolPanelShowing())??!1}function c_(t,e){var o;const n=(o=t.sideBarService)==null?void 0:o.getSideBarComp().getToolPanelInstance(e);return k._unwrapUserComp(n)}function d_(t){var e;return(e=t.sideBarService)==null?void 0:e.getSideBarComp().getDef()}var u_=class extends k.Component{constructor(t){super(),this.eToggleButton=k.RefPlaceholder,this.eIconWrapper=k.RefPlaceholder,this.eLabel=k.RefPlaceholder,this.toolPanelDef=t}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const t=this.createTemplate();this.setTemplate(t,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation">
3
+ `)}}function Mg(t){return{ok:!0,value:t}}function tu(t){if(!t)throw new Qa;if(!t.ok)throw new fs(t.errors);return t.value}function nu(t){return{value:t,errors:void 0}}function Gg(t){if(t.errors)throw new fs(t.errors);if(!t.value)throw new Qa;return t.value}function $g(t){return t!==void 0}function el(t,e){return zr(t)===zr(e)}const tl=t=>t,nl=t=>t instanceof Error?t:Error(String(t)),rl=t=>t.name==="ZodError",ol=t=>{const{formErrors:e,fieldErrors:n}=t.flatten(),o=Object.entries(n).map(([i,l])=>i+":"+(l==null?void 0:l.join(",")));return e.concat(o).join("; ")};function il(t){const e=t.validate??tl,{autoSave:n}=t,o=r.ref(),i=r.ref(),l=E=>{i.value={model:Dn(E)}};r.watch(()=>t.get(),E=>l(E),{immediate:!0});const c=()=>{var E;t.onSave(e(Dn((E=i.value)==null?void 0:E.model)))},d=()=>{l(t.get()),o.value=void 0},p=E=>{const z=nl(E);rl(z)?o.value=Error(ol(z)):o.value=z},h=E=>{o.value=void 0;try{e(E),n&&c()}catch(z){p(z)}},m=r.computed({get:()=>{var E;return(E=i.value)==null?void 0:E.model},set(E){l(E),h(E)}});r.watch(i,(E,z)=>{E&&E===z&&h(E.model)},{deep:!0});const y=r.computed(()=>!o.value),b=r.computed(()=>!el(t.get(),r.unref(i))),w=r.computed(()=>o.value?o.value.message:"");return r.reactive({model:m,valid:y,isChanged:b,error:o,errorString:w,save:c,revert:d,setError:p})}function zg(t,e,n){const o=t.validate??tl,{autoSave:i}=t,l=r.ref(),c=r.ref(),d=$=>{var v;if(n.deepPatchModel){const F=(v=c.value)==null?void 0:v.model,O=Object.assign(Dn($),e??{});c.value={model:F?Qd(F,O):O,stage:Symbol()}}else c.value={model:Object.assign(Dn($),e??{}),stage:Symbol()}};r.watch(()=>t.get(),$=>d($),{immediate:!0});const p=()=>{var $;t.onSave(o(Dn(($=c.value)==null?void 0:$.model)))},h=()=>{d(t.get()),l.value=void 0},m=$=>{const v=nl($);rl(v)?l.value=Error(ol(v)):l.value=v},y=$=>{l.value=void 0;try{o($),i&&p()}catch(v){m(v)}},b=r.computed({get:()=>{var $;return($=c.value)==null?void 0:$.model},set(){throw Error("Cannot replace base model")}});r.watch([()=>({args:b.value.args,ui:b.value.ui}),()=>{var $;return($=c.value)==null?void 0:$.stage}],([$,v],[F,O])=>{v===O&&y($)},{deep:!0});const w=r.computed(()=>!l.value),E=r.computed(()=>{var F;const{args:$,ui:v}=((F=r.unref(c))==null?void 0:F.model)??{};return!el(t.get(),{args:$,ui:v})}),z=r.computed(()=>l.value?l.value.message:"");return r.reactive({model:b,valid:w,isChanged:E,error:l,errorString:z,save:p,revert:h,setError:m})}const Ug=t=>Object.fromEntries(new URL(t,"http://dummy").searchParams);function Zg(t,e,n){const o=(v,...F)=>{n.debug&&console.log(`%c>>> %c${v}`,"color: orange; font-weight: bold","color: orange",...F)},l=Ja(e.setBlockArgs,100),c=Ja(e.setBlockUiState,100),d=Ja(e.setBlockArgsAndUiState,100),p=r.reactive({args:Object.freeze(t.args),outputs:Object.freeze(t.outputs),ui:Object.freeze(t.ui),navigationState:Object.freeze(t.navigationState)});e.onStateUpdates(async v=>{v.forEach(F=>{F.key==="args"&&(p.args=Object.freeze(F.value),o("args patch",p.args)),F.key==="ui"&&(p.ui=Object.freeze(F.value),o("ui patch",p.ui)),F.key==="outputs"&&(p.outputs=Object.freeze(F.value),o("outputs patch",p.outputs)),F.key==="navigationState"&&(p.navigationState=Object.freeze(F.value),o("navigationState patch",p.navigationState))}),await r.nextTick()});const h=()=>Dn(p.args),m=()=>Dn(p.ui),y=()=>Dn(p.navigationState),b={createArgsModel(v={}){return il({get(){return v.transform?v.transform(p.args):p.args},validate:v.validate,autoSave:!0,onSave(F){l(F)}})},createUiModel(v={},F){return il({get(){return v.transform?v.transform(p.ui):p.ui??F()},validate:v.validate,autoSave:!0,onSave(O){c(O)}})},useOutputs(...v){const F=r.reactive({errors:void 0,value:void 0});return r.watch(()=>p.outputs,()=>{try{Object.assign(F,{value:this.unwrapOutputs(...v),errors:void 0})}catch(O){Object.assign(F,{value:void 0,errors:[String(O)]})}},{immediate:!0,deep:!0}),F},unwrapOutputs(...v){const F=p.outputs,O=v.map(j=>[j,tu(F[j])]);return Object.fromEntries(O)},updateArgs(v){const F=h();return v(F),e.setBlockArgs(F)},updateUiState(v){const F=m();return e.setBlockUiState(v(F))},updateNavigationState(v){const F=y();return v(F),e.setNavigationState(F)},navigateTo(v){const F=y();return F.href=v,e.setNavigationState(F)}},w=r.computed(()=>{const v=Object.entries(p.outputs).map(([F,O])=>[F,O.ok&&O.value!==void 0?O.value:void 0]);return Object.fromEntries(v)}),E=r.computed(()=>{const v=Object.entries(p.outputs).map(([F,O])=>[F,O&&!O.ok?new fs(O.errors):void 0]);return Object.fromEntries(v)}),z={snapshot:p,queryParams:r.computed(()=>Ug(p.navigationState.href)),href:r.computed(()=>p.navigationState.href),hasErrors:r.computed(()=>Object.values(p.outputs).some(v=>!(v!=null&&v.ok)))},$=zg({get(){return{args:p.args,ui:p.ui}},autoSave:!0,onSave(v){d(v.args,v.ui)}},{outputs:w,outputErrors:E},n);return r.reactive(Object.assign($,b,z))}var Ge;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const l={};for(const c of i)l[c]=c;return l},t.getValidEnumValues=i=>{const l=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),c={};for(const d of l)c[d]=i[d];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(l){return i[l]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&l.push(c);return l},t.find=(i,l)=>{for(const c of i)if(l(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function o(i,l=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(l)}t.joinValues=o,t.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Ge||(Ge={}));var sl;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(sl||(sl={}));const ae=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=t=>{switch(typeof t){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return isNaN(t)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(t)?ae.array:t===null?ae.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ae.promise:typeof Map<"u"&&t instanceof Map?ae.map:typeof Set<"u"&&t instanceof Set?ae.set:typeof Date<"u"&&t instanceof Date?ae.date:ae.object;default:return ae.unknown}},ee=Ge.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"]),Wg=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Wt extends Error{constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(l){return l.message},o={_errors:[]},i=l=>{for(const c of l.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)o._errors.push(n(c));else{let d=o,p=0;for(;p<c.path.length;){const h=c.path[p];p===c.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(c))):d[h]=d[h]||{_errors:[]},d=d[h],p++}}};return i(this),o}static assert(e){if(!(e instanceof Wt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},o=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):o.push(e(i));return{formErrors:o,fieldErrors:n}}get formErrors(){return this.flatten()}}Wt.create=t=>new Wt(t);const po=(t,e)=>{let n;switch(t.code){case ee.invalid_type:t.received===ae.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ge.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ge.joinValues(t.keys,", ")}`;break;case ee.invalid_union:n="Invalid input";break;case ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ge.joinValues(t.options)}`;break;case ee.invalid_enum_value:n=`Invalid enum value. Expected ${Ge.joinValues(t.options)}, received '${t.received}'`;break;case ee.invalid_arguments:n="Invalid function arguments";break;case ee.invalid_return_type:n="Invalid function return type";break;case ee.invalid_date:n="Invalid date";break;case ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ge.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ee.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ee.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ee.custom:n="Invalid input";break;case ee.invalid_intersection_types:n="Intersection results could not be merged";break;case ee.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ee.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ge.assertNever(t)}return{message:n}};let ru=po;function jg(t){ru=t}function ms(){return ru}const gs=t=>{const{data:e,path:n,errorMaps:o,issueData:i}=t,l=[...n,...i.path||[]],c={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let d="";const p=o.filter(h=>!!h).slice().reverse();for(const h of p)d=h(c,{data:e,defaultError:d}).message;return{...i,path:l,message:d}},Hg=[];function ie(t,e){const n=ms(),o=gs({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===po?void 0:po].filter(i=>!!i)});t.common.issues.push(o)}class bt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const o=[];for(const i of n){if(i.status==="aborted")return be;i.status==="dirty"&&e.dirty(),o.push(i.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,n){const o=[];for(const i of n){const l=await i.key,c=await i.value;o.push({key:l,value:c})}return bt.mergeObjectSync(e,o)}static mergeObjectSync(e,n){const o={};for(const i of n){const{key:l,value:c}=i;if(l.status==="aborted"||c.status==="aborted")return be;l.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),l.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(o[l.value]=c.value)}return{status:e.value,value:o}}}const be=Object.freeze({status:"aborted"}),ho=t=>({status:"dirty",value:t}),Nt=t=>({status:"valid",value:t}),al=t=>t.status==="aborted",ll=t=>t.status==="dirty",Jo=t=>t.status==="valid",Qo=t=>typeof Promise<"u"&&t instanceof Promise;function ys(t,e,n,o){if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function ou(t,e,n,o,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var he;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(he||(he={}));var ei,ti;class In{constructor(e,n,o,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=o,this._key=i}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 iu=(t,e)=>{if(Jo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Wt(t.common.issues);return this._error=n,this._error}}};function Ve(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:o,description:i}=t;if(e&&(n||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,d)=>{var p,h;const{message:m}=t;return c.code==="invalid_enum_value"?{message:m??d.defaultError}:typeof d.data>"u"?{message:(p=m??o)!==null&&p!==void 0?p:d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:(h=m??n)!==null&&h!==void 0?h:d.defaultError}},description:i}}class Pe{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 dr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bt,ctx:{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Qo(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const o=this.safeParse(e,n);if(o.success)return o.data;throw o.error}safeParse(e,n){var o;const i={common:{issues:[],async:(o=n==null?void 0:n.async)!==null&&o!==void 0?o:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},l=this._parseSync({data:e,path:i.path,parent:i});return iu(i,l)}async parseAsync(e,n){const o=await this.safeParseAsync(e,n);if(o.success)return o.data;throw o.error}async safeParseAsync(e,n){const o={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},i=this._parse({data:e,path:o.path,parent:o}),l=await(Qo(i)?i:Promise.resolve(i));return iu(o,l)}refine(e,n){const o=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,l)=>{const c=e(i),d=()=>l.addIssue({code:ee.custom,...o(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(p=>p?!0:(d(),!1)):c?!0:(d(),!1)})}refinement(e,n){return this._refinement((o,i)=>e(o)?!0:(i.addIssue(typeof n=="function"?n(o,i):n),!1))}_refinement(e){return new fn({schema:this,typeName:ve.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ln.create(this,this._def)}nullable(){return fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hn.create(this,this._def)}promise(){return yo.create(this,this._def)}or(e){return ii.create([this,e],this._def)}and(e){return si.create(this,e,this._def)}transform(e){return new fn({...Ve(this._def),schema:this,typeName:ve.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ui({...Ve(this._def),innerType:this,defaultValue:n,typeName:ve.ZodDefault})}brand(){return new ul({typeName:ve.ZodBranded,type:this,...Ve(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new pi({...Ve(this._def),innerType:this,catchValue:n,typeName:ve.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return hi.create(this,e)}readonly(){return fi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const qg=/^c[^\s-]{8,}$/i,Kg=/^[0-9a-z]+$/,Yg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Xg=/^[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,Jg=/^[a-z0-9_-]{21}$/i,Qg=/^[-+]?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)?)??$/,ey=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ty="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let cl;const ny=/^(?:(?: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])$/,ry=/^(([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})))$/,oy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,su="((\\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])))",iy=new RegExp(`^${su}$`);function au(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function sy(t){return new RegExp(`^${au(t)}$`)}function lu(t){let e=`${su}T${au(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ay(t,e){return!!((e==="v4"||!e)&&ny.test(t)||(e==="v6"||!e)&&ry.test(t))}class pn extends Pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ae.string){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.string,received:l.parsedType}),be}const o=new bt;let i;for(const l of this._def.checks)if(l.kind==="min")e.data.length<l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if(l.kind==="max")e.data.length>l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if(l.kind==="length"){const c=e.data.length>l.value,d=e.data.length<l.value;(c||d)&&(i=this._getOrReturnCtx(e,i),c?ie(i,{code:ee.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):d&&ie(i,{code:ee.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if(l.kind==="email")ey.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"email",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="emoji")cl||(cl=new RegExp(ty,"u")),cl.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"emoji",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="uuid")Xg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"uuid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="nanoid")Jg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"nanoid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="cuid")qg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="cuid2")Kg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"cuid2",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="ulid")Yg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ulid",code:ee.invalid_string,message:l.message}),o.dirty());else if(l.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ie(i,{validation:"url",code:ee.invalid_string,message:l.message}),o.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"regex",code:ee.invalid_string,message:l.message}),o.dirty())):l.kind==="trim"?e.data=e.data.trim():l.kind==="includes"?e.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):l.kind==="toLowerCase"?e.data=e.data.toLowerCase():l.kind==="toUpperCase"?e.data=e.data.toUpperCase():l.kind==="startsWith"?e.data.startsWith(l.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):l.kind==="endsWith"?e.data.endsWith(l.value)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):l.kind==="datetime"?lu(l).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"datetime",message:l.message}),o.dirty()):l.kind==="date"?iy.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"date",message:l.message}),o.dirty()):l.kind==="time"?sy(l).test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.invalid_string,validation:"time",message:l.message}),o.dirty()):l.kind==="duration"?Qg.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"duration",code:ee.invalid_string,message:l.message}),o.dirty()):l.kind==="ip"?ay(e.data,l.version)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"ip",code:ee.invalid_string,message:l.message}),o.dirty()):l.kind==="base64"?oy.test(e.data)||(i=this._getOrReturnCtx(e,i),ie(i,{validation:"base64",code:ee.invalid_string,message:l.message}),o.dirty()):Ge.assertNever(l);return{status:o.value,value:e.data}}_regex(e,n,o){return this.refinement(i=>e.test(i),{validation:n,code:ee.invalid_string,...he.errToObj(o)})}_addCheck(e){return new pn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...he.errToObj(e)})}url(e){return this._addCheck({kind:"url",...he.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...he.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...he.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...he.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...he.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...he.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...he.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...he.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...he.errToObj(e)})}datetime(e){var n,o;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(o=e==null?void 0:e.local)!==null&&o!==void 0?o:!1,...he.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,...he.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...he.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...he.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...he.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...he.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...he.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...he.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...he.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...he.errToObj(n)})}nonempty(e){return this.min(1,he.errToObj(e))}trim(){return new pn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pn({...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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pn.create=t=>{var e;return new pn({checks:[],typeName:ve.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ve(t)})};function ly(t,e){const n=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,i=n>o?n:o,l=parseInt(t.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return l%c/Math.pow(10,i)}class ur extends Pe{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)!==ae.number){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.number,received:l.parsedType}),be}let o;const i=new bt;for(const l of this._def.checks)l.kind==="int"?Ge.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?ly(e.data,l.value)!==0&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_finite,message:l.message}),i.dirty()):Ge.assertNever(l);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,he.toString(n))}gt(e,n){return this.setLimit("min",e,!1,he.toString(n))}lte(e,n){return this.setLimit("max",e,!0,he.toString(n))}lt(e,n){return this.setLimit("max",e,!1,he.toString(n))}setLimit(e,n,o,i){return new ur({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:he.toString(i)}]})}_addCheck(e){return new ur({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:he.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:he.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:he.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:he.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:he.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(n===null||o.value>n)&&(n=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(n)&&Number.isFinite(e)}}ur.create=t=>new ur({checks:[],typeName:ve.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ve(t)});class pr extends Pe{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)!==ae.bigint){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.bigint,received:l.parsedType}),be}let o;const i=new bt;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?e.data%l.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),ie(o,{code:ee.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):Ge.assertNever(l);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,he.toString(n))}gt(e,n){return this.setLimit("min",e,!1,he.toString(n))}lte(e,n){return this.setLimit("max",e,!0,he.toString(n))}lt(e,n){return this.setLimit("max",e,!1,he.toString(n))}setLimit(e,n,o,i){return new pr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:he.toString(i)}]})}_addCheck(e){return new pr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:he.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pr.create=t=>{var e;return new pr({checks:[],typeName:ve.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ve(t)})};class ni extends Pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ae.boolean){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.boolean,received:o.parsedType}),be}return Nt(e.data)}}ni.create=t=>new ni({typeName:ve.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ve(t)});class Ur extends Pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ae.date){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_type,expected:ae.date,received:l.parsedType}),be}if(isNaN(e.data.getTime())){const l=this._getOrReturnCtx(e);return ie(l,{code:ee.invalid_date}),be}const o=new bt;let i;for(const l of this._def.checks)l.kind==="min"?e.data.getTime()<l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),o.dirty()):l.kind==="max"?e.data.getTime()>l.value&&(i=this._getOrReturnCtx(e,i),ie(i,{code:ee.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),o.dirty()):Ge.assertNever(l);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ur({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:he.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:he.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ur.create=t=>new Ur({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ve.ZodDate,...Ve(t)});class _s extends Pe{_parse(e){if(this._getType(e)!==ae.symbol){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.symbol,received:o.parsedType}),be}return Nt(e.data)}}_s.create=t=>new _s({typeName:ve.ZodSymbol,...Ve(t)});class ri extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.undefined,received:o.parsedType}),be}return Nt(e.data)}}ri.create=t=>new ri({typeName:ve.ZodUndefined,...Ve(t)});class oi extends Pe{_parse(e){if(this._getType(e)!==ae.null){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.null,received:o.parsedType}),be}return Nt(e.data)}}oi.create=t=>new oi({typeName:ve.ZodNull,...Ve(t)});class fo extends Pe{constructor(){super(...arguments),this._any=!0}_parse(e){return Nt(e.data)}}fo.create=t=>new fo({typeName:ve.ZodAny,...Ve(t)});class Zr extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nt(e.data)}}Zr.create=t=>new Zr({typeName:ve.ZodUnknown,...Ve(t)});class Kn extends Pe{_parse(e){const n=this._getOrReturnCtx(e);return ie(n,{code:ee.invalid_type,expected:ae.never,received:n.parsedType}),be}}Kn.create=t=>new Kn({typeName:ve.ZodNever,...Ve(t)});class Cs extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.void,received:o.parsedType}),be}return Nt(e.data)}}Cs.create=t=>new Cs({typeName:ve.ZodVoid,...Ve(t)});class hn extends Pe{_parse(e){const{ctx:n,status:o}=this._processInputParams(e),i=this._def;if(n.parsedType!==ae.array)return ie(n,{code:ee.invalid_type,expected:ae.array,received:n.parsedType}),be;if(i.exactLength!==null){const c=n.data.length>i.exactLength.value,d=n.data.length<i.exactLength.value;(c||d)&&(ie(n,{code:c?ee.too_big:ee.too_small,minimum:d?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),o.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ie(n,{code:ee.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),o.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ie(n,{code:ee.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),o.dirty()),n.common.async)return Promise.all([...n.data].map((c,d)=>i.type._parseAsync(new In(n,c,n.path,d)))).then(c=>bt.mergeArray(o,c));const l=[...n.data].map((c,d)=>i.type._parseSync(new In(n,c,n.path,d)));return bt.mergeArray(o,l)}get element(){return this._def.type}min(e,n){return new hn({...this._def,minLength:{value:e,message:he.toString(n)}})}max(e,n){return new hn({...this._def,maxLength:{value:e,message:he.toString(n)}})}length(e,n){return new hn({...this._def,exactLength:{value:e,message:he.toString(n)}})}nonempty(e){return this.min(1,e)}}hn.create=(t,e)=>new hn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ve.ZodArray,...Ve(e)});function mo(t){if(t instanceof nt){const e={};for(const n in t.shape){const o=t.shape[n];e[n]=Ln.create(mo(o))}return new nt({...t._def,shape:()=>e})}else return t instanceof hn?new hn({...t._def,type:mo(t.element)}):t instanceof Ln?Ln.create(mo(t.unwrap())):t instanceof fr?fr.create(mo(t.unwrap())):t instanceof Fn?Fn.create(t.items.map(e=>mo(e))):t}class nt extends Pe{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(),n=Ge.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ae.object){const h=this._getOrReturnCtx(e);return ie(h,{code:ee.invalid_type,expected:ae.object,received:h.parsedType}),be}const{status:o,ctx:i}=this._processInputParams(e),{shape:l,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof Kn&&this._def.unknownKeys==="strip"))for(const h in i.data)c.includes(h)||d.push(h);const p=[];for(const h of c){const m=l[h],y=i.data[h];p.push({key:{status:"valid",value:h},value:m._parse(new In(i,y,i.path,h)),alwaysSet:h in i.data})}if(this._def.catchall instanceof Kn){const h=this._def.unknownKeys;if(h==="passthrough")for(const m of d)p.push({key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(h==="strict")d.length>0&&(ie(i,{code:ee.unrecognized_keys,keys:d}),o.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const m of d){const y=i.data[m];p.push({key:{status:"valid",value:m},value:h._parse(new In(i,y,i.path,m)),alwaysSet:m in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const h=[];for(const m of p){const y=await m.key,b=await m.value;h.push({key:y,value:b,alwaysSet:m.alwaysSet})}return h}).then(h=>bt.mergeObjectSync(o,h)):bt.mergeObjectSync(o,p)}get shape(){return this._def.shape()}strict(e){return he.errToObj,new nt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,o)=>{var i,l,c,d;const p=(c=(l=(i=this._def).errorMap)===null||l===void 0?void 0:l.call(i,n,o).message)!==null&&c!==void 0?c:o.defaultError;return n.code==="unrecognized_keys"?{message:(d=he.errToObj(e).message)!==null&&d!==void 0?d:p}:{message:p}}}:{}})}strip(){return new nt({...this._def,unknownKeys:"strip"})}passthrough(){return new nt({...this._def,unknownKeys:"passthrough"})}extend(e){return new nt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ve.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new nt({...this._def,catchall:e})}pick(e){const n={};return Ge.objectKeys(e).forEach(o=>{e[o]&&this.shape[o]&&(n[o]=this.shape[o])}),new nt({...this._def,shape:()=>n})}omit(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{e[o]||(n[o]=this.shape[o])}),new nt({...this._def,shape:()=>n})}deepPartial(){return mo(this)}partial(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{const i=this.shape[o];e&&!e[o]?n[o]=i:n[o]=i.optional()}),new nt({...this._def,shape:()=>n})}required(e){const n={};return Ge.objectKeys(this.shape).forEach(o=>{if(e&&!e[o])n[o]=this.shape[o];else{let l=this.shape[o];for(;l instanceof Ln;)l=l._def.innerType;n[o]=l}}),new nt({...this._def,shape:()=>n})}keyof(){return cu(Ge.objectKeys(this.shape))}}nt.create=(t,e)=>new nt({shape:()=>t,unknownKeys:"strip",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)}),nt.strictCreate=(t,e)=>new nt({shape:()=>t,unknownKeys:"strict",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)}),nt.lazycreate=(t,e)=>new nt({shape:t,unknownKeys:"strip",catchall:Kn.create(),typeName:ve.ZodObject,...Ve(e)});class ii extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o=this._def.options;function i(l){for(const d of l)if(d.result.status==="valid")return d.result;for(const d of l)if(d.result.status==="dirty")return n.common.issues.push(...d.ctx.common.issues),d.result;const c=l.map(d=>new Wt(d.ctx.common.issues));return ie(n,{code:ee.invalid_union,unionErrors:c}),be}if(n.common.async)return Promise.all(o.map(async l=>{const c={...n,common:{...n.common,issues:[]},parent:null};return{result:await l._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(i);{let l;const c=[];for(const p of o){const h={...n,common:{...n.common,issues:[]},parent:null},m=p._parseSync({data:n.data,path:n.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!l&&(l={result:m,ctx:h}),h.common.issues.length&&c.push(h.common.issues)}if(l)return n.common.issues.push(...l.ctx.common.issues),l.result;const d=c.map(p=>new Wt(p));return ie(n,{code:ee.invalid_union,unionErrors:d}),be}}get options(){return this._def.options}}ii.create=(t,e)=>new ii({options:t,typeName:ve.ZodUnion,...Ve(e)});const Yn=t=>t instanceof li?Yn(t.schema):t instanceof fn?Yn(t.innerType()):t instanceof ci?[t.value]:t instanceof hr?t.options:t instanceof di?Ge.objectValues(t.enum):t instanceof ui?Yn(t._def.innerType):t instanceof ri?[void 0]:t instanceof oi?[null]:t instanceof Ln?[void 0,...Yn(t.unwrap())]:t instanceof fr?[null,...Yn(t.unwrap())]:t instanceof ul||t instanceof fi?Yn(t.unwrap()):t instanceof pi?Yn(t._def.innerType):[];class vs extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.object)return ie(n,{code:ee.invalid_type,expected:ae.object,received:n.parsedType}),be;const o=this.discriminator,i=n.data[o],l=this.optionsMap.get(i);return l?n.common.async?l._parseAsync({data:n.data,path:n.path,parent:n}):l._parseSync({data:n.data,path:n.path,parent:n}):(ie(n,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,o){const i=new Map;for(const l of n){const c=Yn(l.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const d of c){if(i.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);i.set(d,l)}}return new vs({typeName:ve.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Ve(o)})}}function dl(t,e){const n=dr(t),o=dr(e);if(t===e)return{valid:!0,data:t};if(n===ae.object&&o===ae.object){const i=Ge.objectKeys(e),l=Ge.objectKeys(t).filter(d=>i.indexOf(d)!==-1),c={...t,...e};for(const d of l){const p=dl(t[d],e[d]);if(!p.valid)return{valid:!1};c[d]=p.data}return{valid:!0,data:c}}else if(n===ae.array&&o===ae.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let l=0;l<t.length;l++){const c=t[l],d=e[l],p=dl(c,d);if(!p.valid)return{valid:!1};i.push(p.data)}return{valid:!0,data:i}}else return n===ae.date&&o===ae.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class si extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=(l,c)=>{if(al(l)||al(c))return be;const d=dl(l.value,c.value);return d.valid?((ll(l)||ll(c))&&n.dirty(),{status:n.value,value:d.data}):(ie(o,{code:ee.invalid_intersection_types}),be)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([l,c])=>i(l,c)):i(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}si.create=(t,e,n)=>new si({left:t,right:e,typeName:ve.ZodIntersection,...Ve(n)});class Fn extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.array)return ie(o,{code:ee.invalid_type,expected:ae.array,received:o.parsedType}),be;if(o.data.length<this._def.items.length)return ie(o,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&o.data.length>this._def.items.length&&(ie(o,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const l=[...o.data].map((c,d)=>{const p=this._def.items[d]||this._def.rest;return p?p._parse(new In(o,c,o.path,d)):null}).filter(c=>!!c);return o.common.async?Promise.all(l).then(c=>bt.mergeArray(n,c)):bt.mergeArray(n,l)}get items(){return this._def.items}rest(e){return new Fn({...this._def,rest:e})}}Fn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:t,typeName:ve.ZodTuple,rest:null,...Ve(e)})};class ai extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.object)return ie(o,{code:ee.invalid_type,expected:ae.object,received:o.parsedType}),be;const i=[],l=this._def.keyType,c=this._def.valueType;for(const d in o.data)i.push({key:l._parse(new In(o,d,o.path,d)),value:c._parse(new In(o,o.data[d],o.path,d)),alwaysSet:d in o.data});return o.common.async?bt.mergeObjectAsync(n,i):bt.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,o){return n instanceof Pe?new ai({keyType:e,valueType:n,typeName:ve.ZodRecord,...Ve(o)}):new ai({keyType:pn.create(),valueType:e,typeName:ve.ZodRecord,...Ve(n)})}}class ws extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.map)return ie(o,{code:ee.invalid_type,expected:ae.map,received:o.parsedType}),be;const i=this._def.keyType,l=this._def.valueType,c=[...o.data.entries()].map(([d,p],h)=>({key:i._parse(new In(o,d,o.path,[h,"key"])),value:l._parse(new In(o,p,o.path,[h,"value"]))}));if(o.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const p of c){const h=await p.key,m=await p.value;if(h.status==="aborted"||m.status==="aborted")return be;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),d.set(h.value,m.value)}return{status:n.value,value:d}})}else{const d=new Map;for(const p of c){const h=p.key,m=p.value;if(h.status==="aborted"||m.status==="aborted")return be;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),d.set(h.value,m.value)}return{status:n.value,value:d}}}}ws.create=(t,e,n)=>new ws({valueType:e,keyType:t,typeName:ve.ZodMap,...Ve(n)});class Wr extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==ae.set)return ie(o,{code:ee.invalid_type,expected:ae.set,received:o.parsedType}),be;const i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(ie(o,{code:ee.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&o.data.size>i.maxSize.value&&(ie(o,{code:ee.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const l=this._def.valueType;function c(p){const h=new Set;for(const m of p){if(m.status==="aborted")return be;m.status==="dirty"&&n.dirty(),h.add(m.value)}return{status:n.value,value:h}}const d=[...o.data.values()].map((p,h)=>l._parse(new In(o,p,o.path,h)));return o.common.async?Promise.all(d).then(p=>c(p)):c(d)}min(e,n){return new Wr({...this._def,minSize:{value:e,message:he.toString(n)}})}max(e,n){return new Wr({...this._def,maxSize:{value:e,message:he.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Wr.create=(t,e)=>new Wr({valueType:t,minSize:null,maxSize:null,typeName:ve.ZodSet,...Ve(e)});class go extends Pe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.function)return ie(n,{code:ee.invalid_type,expected:ae.function,received:n.parsedType}),be;function o(d,p){return gs({data:d,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ms(),po].filter(h=>!!h),issueData:{code:ee.invalid_arguments,argumentsError:p}})}function i(d,p){return gs({data:d,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ms(),po].filter(h=>!!h),issueData:{code:ee.invalid_return_type,returnTypeError:p}})}const l={errorMap:n.common.contextualErrorMap},c=n.data;if(this._def.returns instanceof yo){const d=this;return Nt(async function(...p){const h=new Wt([]),m=await d._def.args.parseAsync(p,l).catch(w=>{throw h.addIssue(o(p,w)),h}),y=await Reflect.apply(c,this,m);return await d._def.returns._def.type.parseAsync(y,l).catch(w=>{throw h.addIssue(i(y,w)),h})})}else{const d=this;return Nt(function(...p){const h=d._def.args.safeParse(p,l);if(!h.success)throw new Wt([o(p,h.error)]);const m=Reflect.apply(c,this,h.data),y=d._def.returns.safeParse(m,l);if(!y.success)throw new Wt([i(m,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new go({...this._def,args:Fn.create(e).rest(Zr.create())})}returns(e){return new go({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,o){return new go({args:e||Fn.create([]).rest(Zr.create()),returns:n||Zr.create(),typeName:ve.ZodFunction,...Ve(o)})}}class li extends Pe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}li.create=(t,e)=>new li({getter:t,typeName:ve.ZodLazy,...Ve(e)});class ci extends Pe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ie(n,{received:n.data,code:ee.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:e.data}}get value(){return this._def.value}}ci.create=(t,e)=>new ci({value:t,typeName:ve.ZodLiteral,...Ve(e)});function cu(t,e){return new hr({values:t,typeName:ve.ZodEnum,...Ve(e)})}class hr extends Pe{constructor(){super(...arguments),ei.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),o=this._def.values;return ie(n,{expected:Ge.joinValues(o),received:n.parsedType,code:ee.invalid_type}),be}if(ys(this,ei)||ou(this,ei,new Set(this._def.values)),!ys(this,ei).has(e.data)){const n=this._getOrReturnCtx(e),o=this._def.values;return ie(n,{received:n.data,code:ee.invalid_enum_value,options:o}),be}return Nt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return hr.create(e,{...this._def,...n})}exclude(e,n=this._def){return hr.create(this.options.filter(o=>!e.includes(o)),{...this._def,...n})}}ei=new WeakMap,hr.create=cu;class di extends Pe{constructor(){super(...arguments),ti.set(this,void 0)}_parse(e){const n=Ge.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==ae.string&&o.parsedType!==ae.number){const i=Ge.objectValues(n);return ie(o,{expected:Ge.joinValues(i),received:o.parsedType,code:ee.invalid_type}),be}if(ys(this,ti)||ou(this,ti,new Set(Ge.getValidEnumValues(this._def.values))),!ys(this,ti).has(e.data)){const i=Ge.objectValues(n);return ie(o,{received:o.data,code:ee.invalid_enum_value,options:i}),be}return Nt(e.data)}get enum(){return this._def.values}}ti=new WeakMap,di.create=(t,e)=>new di({values:t,typeName:ve.ZodNativeEnum,...Ve(e)});class yo extends Pe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ae.promise&&n.common.async===!1)return ie(n,{code:ee.invalid_type,expected:ae.promise,received:n.parsedType}),be;const o=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return Nt(o.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}yo.create=(t,e)=>new yo({type:t,typeName:ve.ZodPromise,...Ve(e)});class fn extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=this._def.effect||null,l={addIssue:c=>{ie(o,c),c.fatal?n.abort():n.dirty()},get path(){return o.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const c=i.transform(o.data,l);if(o.common.async)return Promise.resolve(c).then(async d=>{if(n.value==="aborted")return be;const p=await this._def.schema._parseAsync({data:d,path:o.path,parent:o});return p.status==="aborted"?be:p.status==="dirty"||n.value==="dirty"?ho(p.value):p});{if(n.value==="aborted")return be;const d=this._def.schema._parseSync({data:c,path:o.path,parent:o});return d.status==="aborted"?be:d.status==="dirty"||n.value==="dirty"?ho(d.value):d}}if(i.type==="refinement"){const c=d=>{const p=i.refinement(d,l);if(o.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(o.common.async===!1){const d=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return d.status==="aborted"?be:(d.status==="dirty"&&n.dirty(),c(d.value),{status:n.value,value:d.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(d=>d.status==="aborted"?be:(d.status==="dirty"&&n.dirty(),c(d.value).then(()=>({status:n.value,value:d.value}))))}if(i.type==="transform")if(o.common.async===!1){const c=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Jo(c))return c;const d=i.transform(c.value,l);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:d}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(c=>Jo(c)?Promise.resolve(i.transform(c.value,l)).then(d=>({status:n.value,value:d})):c);Ge.assertNever(i)}}fn.create=(t,e,n)=>new fn({schema:t,typeName:ve.ZodEffects,effect:e,...Ve(n)}),fn.createWithPreprocess=(t,e,n)=>new fn({schema:e,effect:{type:"preprocess",transform:t},typeName:ve.ZodEffects,...Ve(n)});class Ln extends Pe{_parse(e){return this._getType(e)===ae.undefined?Nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ln.create=(t,e)=>new Ln({innerType:t,typeName:ve.ZodOptional,...Ve(e)});class fr extends Pe{_parse(e){return this._getType(e)===ae.null?Nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fr.create=(t,e)=>new fr({innerType:t,typeName:ve.ZodNullable,...Ve(e)});class ui extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e);let o=n.data;return n.parsedType===ae.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ui.create=(t,e)=>new ui({innerType:t,typeName:ve.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ve(e)});class pi extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Qo(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}pi.create=(t,e)=>new pi({innerType:t,typeName:ve.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ve(e)});class bs extends Pe{_parse(e){if(this._getType(e)!==ae.nan){const o=this._getOrReturnCtx(e);return ie(o,{code:ee.invalid_type,expected:ae.nan,received:o.parsedType}),be}return{status:"valid",value:e.data}}}bs.create=t=>new bs({typeName:ve.ZodNaN,...Ve(t)});const cy=Symbol("zod_brand");class ul extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),o=n.data;return this._def.type._parse({data:o,path:n.path,parent:n})}unwrap(){return this._def.type}}class hi extends Pe{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return l.status==="aborted"?be:l.status==="dirty"?(n.dirty(),ho(l.value)):this._def.out._parseAsync({data:l.value,path:o.path,parent:o})})();{const i=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?be:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:o.path,parent:o})}}static create(e,n){return new hi({in:e,out:n,typeName:ve.ZodPipeline})}}class fi extends Pe{_parse(e){const n=this._def.innerType._parse(e),o=i=>(Jo(i)&&(i.value=Object.freeze(i.value)),i);return Qo(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}fi.create=(t,e)=>new fi({innerType:t,typeName:ve.ZodReadonly,...Ve(e)});function du(t,e={},n){return t?fo.create().superRefine((o,i)=>{var l,c;if(!t(o)){const d=typeof e=="function"?e(o):typeof e=="string"?{message:e}:e,p=(c=(l=d.fatal)!==null&&l!==void 0?l:n)!==null&&c!==void 0?c:!0,h=typeof d=="string"?{message:d}:d;i.addIssue({code:"custom",...h,fatal:p})}}):fo.create()}const dy={object:nt.lazycreate};var ve;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ve||(ve={}));const uy=(t,e={message:`Input not instance of ${t.name}`})=>du(n=>n instanceof t,e),uu=pn.create,pu=ur.create,py=bs.create,hy=pr.create,hu=ni.create,fy=Ur.create,my=_s.create,gy=ri.create,yy=oi.create,_y=fo.create,Cy=Zr.create,vy=Kn.create,wy=Cs.create,by=hn.create,xy=nt.create,ky=nt.strictCreate,Sy=ii.create,Ey=vs.create,Ty=si.create,Ny=Fn.create,Vy=ai.create,Ay=ws.create,By=Wr.create,Py=go.create,Ry=li.create,Dy=ci.create,Iy=hr.create,Fy=di.create,Ly=yo.create,fu=fn.create,Oy=Ln.create,My=fr.create,Gy=fn.createWithPreprocess,$y=hi.create;var On=Object.freeze({__proto__:null,defaultErrorMap:po,setErrorMap:jg,getErrorMap:ms,makeIssue:gs,EMPTY_PATH:Hg,addIssueToContext:ie,ParseStatus:bt,INVALID:be,DIRTY:ho,OK:Nt,isAborted:al,isDirty:ll,isValid:Jo,isAsync:Qo,get util(){return Ge},get objectUtil(){return sl},ZodParsedType:ae,getParsedType:dr,ZodType:Pe,datetimeRegex:lu,ZodString:pn,ZodNumber:ur,ZodBigInt:pr,ZodBoolean:ni,ZodDate:Ur,ZodSymbol:_s,ZodUndefined:ri,ZodNull:oi,ZodAny:fo,ZodUnknown:Zr,ZodNever:Kn,ZodVoid:Cs,ZodArray:hn,ZodObject:nt,ZodUnion:ii,ZodDiscriminatedUnion:vs,ZodIntersection:si,ZodTuple:Fn,ZodRecord:ai,ZodMap:ws,ZodSet:Wr,ZodFunction:go,ZodLazy:li,ZodLiteral:ci,ZodEnum:hr,ZodNativeEnum:di,ZodPromise:yo,ZodEffects:fn,ZodTransformer:fn,ZodOptional:Ln,ZodNullable:fr,ZodDefault:ui,ZodCatch:pi,ZodNaN:bs,BRAND:cy,ZodBranded:ul,ZodPipeline:hi,ZodReadonly:fi,custom:du,Schema:Pe,ZodSchema:Pe,late:dy,get ZodFirstPartyTypeKind(){return ve},coerce:{string:t=>pn.create({...t,coerce:!0}),number:t=>ur.create({...t,coerce:!0}),boolean:t=>ni.create({...t,coerce:!0}),bigint:t=>pr.create({...t,coerce:!0}),date:t=>Ur.create({...t,coerce:!0})},any:_y,array:by,bigint:hy,boolean:hu,date:fy,discriminatedUnion:Ey,effect:fu,enum:Iy,function:Py,instanceof:uy,intersection:Ty,lazy:Ry,literal:Dy,map:Ay,nan:py,nativeEnum:Fy,never:vy,null:yy,nullable:My,number:pu,object:xy,oboolean:()=>hu().optional(),onumber:()=>pu().optional(),optional:Oy,ostring:()=>uu().optional(),pipeline:$y,preprocess:Gy,promise:Ly,record:Vy,set:By,strictObject:ky,string:uu,symbol:my,transformer:fu,tuple:Ny,undefined:gy,union:Sy,unknown:Cy,void:wy,NEVER:be,ZodIssueCode:ee,quotelessJson:Wg,ZodError:Wt});const zy=-2147483648,mu=-9007199254740991n,Uy=NaN,Zy=NaN,Wy=null,jy=null;function Hy(t,e){switch(e){case"Int":return t===zy;case"Long":return t===Number(mu)||t===mu;case"Float":return t===Uy;case"Double":return t===Zy;case"String":return t===Wy;case"Bytes":return t===jy;default:throw Error(`unsupported data type: ${e}`)}}function qy(t,e){const n=Math.floor(e/8),o=1<<7-e%8;return(t[n]&o)>0}function jr(t){const{type:e,name:n,domain:o}=t;return{type:e,name:n,...o&&{domain:o}}}On.object({__isRef:On.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:On.string().describe("Upstream block id"),name:On.string().describe("Name of the output provided to the upstream block's output context")}).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.").strict().readonly();function Ky(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}const Yy=On.object({type:On.string(),importance:On.number().optional(),id:On.string().optional(),label:On.string()});On.array(Yy);const Xy="1.17.0";function xs(){return Ky({sdkVersion:Xy})}function Jy(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}function _o(t){return!!t&&typeof t.children<"u"}function mr(t){return _o(t)?t.groupId:t.colId}function gu(t,e,n){const o=(c,d)=>{const p=c.children.map(mr),h=k._includes(p,mr(d)),m=k._last(c.children),y=m&&mr(m)!==mr(d);return h&&y};if(!_o(t))return!0;const i=t,l=n;if(o(i,l))return i.children.push(l),!0;if(i.groupId===e){const c=i.children.map(mr);if(!k._includes(c,mr(l)))return i.children.push(l),!0}for(let c=i.children.length-1;c>=0&&!gu(i.children[c],e,n);c--);return!1}function Qy(t){const e=(i,l)=>_o(i)&&_o(l)&&mr(i)===mr(l),n=(i,l)=>{if(!_o(l))return i;const c=i,d=l;return d.children&&d.groupId&&gu(c,d.groupId,d.children[0])||d.children.forEach(p=>n(c,p)),c},o=[];for(let i=1;i<=t.length;i++){const l=t[i-1],c=t[i];e(l,c)?t[i]=n(l,c):o.push(l)}return o}var e_=class extends k.BeanStub{constructor(){super(...arguments),this.beanName="toolPanelColDefService"}wireBeans(t){this.columnModel=t.columnModel}createColumnTree(t){const e=[],n=(i,l)=>{if(_o(i)){const c=i,d=typeof c.groupId<"u"?c.groupId:c.headerName,p=new k.AgProvidedColumnGroup(c,d,!1,l),h=[];return c.children.forEach(m=>{const y=n(m,l+1);y&&h.push(y)}),p.setChildren(h),p}else{const c=i,d=c.colId?c.colId:c.field,p=this.columnModel.getColDefCol(d);return p||e.push(c),p}},o=[];return t.forEach(i=>{const l=n(i,0);l&&o.push(l)}),e.length>0&&k._warnOnce("unable to find grid columns for the supplied colDef(s):",e),o}syncLayoutWithGrid(t){const e=this.getLeafPathTrees(),n=Qy(e);t(n)}getLeafPathTrees(){const t=(o,i)=>{let l;if(k.isProvidedColumnGroup(o))if(o.isPadding())l=i;else{const d=Object.assign({},o.getColGroupDef());d.groupId=o.getGroupId(),d.children=[i],l=d}else{const d=Object.assign({},o.getColDef());d.colId=o.getColId(),l=d}const c=o.getOriginalParent();return c?t(c,l):l};return this.columnModel.getCols().filter(o=>{const i=o.getColDef();return o.isPrimary()&&!i.showRowGroup}).map(o=>t(o,o.getColDef()))}};function t_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().isDisplayed())??!1}function n_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().setDisplayed(e)}function r_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().setSideBarPosition(e)}function o_(t,e){var n;(n=t.sideBarService)==null||n.getSideBarComp().openToolPanel(e,"api")}function i_(t){var e;(e=t.sideBarService)==null||e.getSideBarComp().close("api")}function s_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().openedItem())??null}function a_(t){var e;(e=t.sideBarService)==null||e.getSideBarComp().refresh()}function l_(t){var e;return((e=t.sideBarService)==null?void 0:e.getSideBarComp().isToolPanelShowing())??!1}function c_(t,e){var o;const n=(o=t.sideBarService)==null?void 0:o.getSideBarComp().getToolPanelInstance(e);return k._unwrapUserComp(n)}function d_(t){var e;return(e=t.sideBarService)==null?void 0:e.getSideBarComp().getDef()}var u_=class extends k.Component{constructor(t){super(),this.eToggleButton=k.RefPlaceholder,this.eIconWrapper=k.RefPlaceholder,this.eLabel=k.RefPlaceholder,this.toolPanelDef=t}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const t=this.createTemplate();this.setTemplate(t,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation">
4
4
  <button type="button" data-ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button">
5
5
  <div data-ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div>
6
6
  <span data-ref="eLabel" class="ag-side-button-label"></span>