@flowscripter/io-plugin-filesystem 2.0.4 → 2.0.5

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.
Files changed (2) hide show
  1. package/dist/bundle.js +9 -9
  2. package/package.json +1 -1
package/dist/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- var fr="@flowscripter/pluggable-io-framework/provider-factory";function dr(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:o,value:n}=await t.read();if(o){r.close();return}r.enqueue({payload:{kind:"js",data:n}})},cancel(r){return t.cancel(r)}})}import{chmod as ru,cp as Cs,mkdir as or,rename as ou,rm as Ns,utimes as nu}from"fs/promises";import{join as ot,resolve as iu}from"path";import{resolve as st,sep as mr}from"path";function E(e,t){if(e==="")return st(t);let r=st(e),o=st(r,t),n=r.endsWith(mr)?r:r+mr;if(o!==r&&!o.startsWith(n))throw Error(`Path "${t}" resolves outside provider root "${e}"`);return o}function ue(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function at(e,t="|"){return e.map((r)=>pt(r)).join(t)}function le(e,t){if(typeof t==="bigint")return t.toString();return t}class hr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Pe(e){return new hr(e)}function yr(e){return e===null||e===void 0}function ze(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function gr(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function j(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $e(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function J(e){return $e(e._zod.def)??e._zod.def.shape}function _r(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return j(this,t,o),o},enumerable:!0,configurable:!0})}function xr(e,t,r){if(t in e)j(e,t,r);else e[t]=r}function G(e,t,r,o){let n=J(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);if(!s.enumerable)continue;if(s.get)_r(e,i,()=>{let c=t._zod.def.shape[i];return o?o(c,i):c});else xr(e,i,o?o(s.value,i):s.value)}}function Ls(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)_r(e,r,()=>t[r]);else xr(e,r,o.value)}}function T(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function br(e){return JSON.stringify(e)}function vr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ut="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Pr=Pe(()=>{if(A.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ee(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ae(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function lt(e){if(ee(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var zr=new Set(["string","number","symbol"]);function te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function y(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function pt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function $r(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var we=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),ft={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function js(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return G(i,e,ke(e,t)),F(e,T(r,{shape:i,checks:[]}))}function ke(e,t){let r=J(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function Fs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ke(e,t)),s={};return G(s,e,Reflect.ownKeys(J(e)).filter((c)=>!i.has(c))),F(e,T(r,{shape:s,checks:[]}))}function Ms(e,t){if(!ee(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=J(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,T(e._zod.def,{shape:wr(e,t)}))}function wr(e,t){let r={};return G(r,e,Reflect.ownKeys(J(e))),Ls(r,t),r}function Us(e,t){if(!ee(t))throw Error("Invalid input to safeExtend: expected a plain object");return F(e,T(e._zod.def,{shape:wr(e,t)}))}function Js(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};G(r,e,Reflect.ownKeys(J(e))),G(r,t,Reflect.ownKeys(J(t)));let o=T(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return F(e,o)}function kr(e,t,r,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(ke(t,r)):void 0,a={};return G(a,t,Reflect.ownKeys(J(t)),e&&((u,p)=>c&&!c.has(p)?u:new e({type:"optional",innerType:u}))),F(t,T(t._zod.def,{shape:a,checks:[]}))}function Bs(e,t,r){let o=r?new Set(ke(t,r)):void 0,n={};return G(n,t,Reflect.ownKeys(J(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),F(t,T(t._zod.def,{shape:n}))}function M(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Sr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function ce(e){return typeof e==="string"?e:e?.message}function dt(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;if(n>=0)t.push([n,r])}return t}function Ze(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function V(e,t,r){var o;let n=e.inst?._zod?.traits;if(n?.has("$ZodType"))if(n.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ce(e.inst?._zod.def?.error?.(e))??ce(i?.(e))??ce(t?.error?.(e))??ce(r.customError?.(e))??ce(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Ws=/[\uD800-\uDBFF]/;function Oe(e){let t=e.length;if(!Ws.test(e))return t;let r=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)r--,o++;return r}function Ie(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Zr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function X(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function Or(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else Vs(e,r,o.value)}}function B(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ee(e,t,r){return B(e,t,r,!1)}function Ir(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return B(this,r,o(this))},set(n){B(this,r,n)}})}return t}function Vs(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:B(this,t,r.bind(this))},set(o){B(this,t,o)}})}function Hs(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ct,W=!1,Gs={configurable:!0,get(){W=!0;return}};function x(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&ct!==e._zod){ct=void 0;return}ct=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Gs);let n=W;W=!1;try{let i=r(this);if(W)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return W=W||n,i}catch(i){throw delete this[t],W=W||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function Xs(e,t,r,o){let n=Hs(e,t);if(!n)return;Object.defineProperty(n,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var Ys="~constantCatch";function Er(e){let t=()=>e;return t[Ys]=!0,t}var Tr;var mt={value:void 0,enumerable:!1},Ar="captureStackTrace"in Error?Error:null;function qs(e){let t=Ar;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Ar=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,o){let n={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=n;let s=r,c=s&&new WeakSet;function a(d,m){if(!d._zod){mt.value=new i(m);try{Object.defineProperty(d,"_zod",mt)}finally{mt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),g=d._zod.constr.prototype,b=_;while(b&&b!==g)b=Object.getPrototypeOf(b);let K=b??_;if(!c.has(K))c.add(K),Or(K,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let u=o?.Parent??Object;class p extends u{}Object.defineProperty(p,"name",{value:e});function f(d){let m=o?.Parent?qs(p):this;a(m,d);let h=m._zod.deferred;if(h){for(let g of h)g();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class U extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class pe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Tr=globalThis).__zod_globalConfig??(Tr.__zod_globalConfig={});var A=globalThis.__zod_globalConfig;function N(e){if(e)Object.assign(A,e);return A}function Qs(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,le,2)),e.message}function ec(e){this._zod.message=e}var tc={get:Qs,set:ec,enumerable:!0,configurable:!0},yt={value:void 0,enumerable:!1},Rr=new WeakSet([Object.prototype,Error.prototype]),Cr=(e,t)=>{e.name="$ZodError",yt.value=t,Object.defineProperty(e,"issues",yt),yt.value=void 0,Object.defineProperty(e,"message",tc);let r=Object.getPrototypeOf(e);if(!Rr.has(r))Rr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},Nr=l("$ZodError",Cr),yl=l("$ZodError",Cr,void 0,{Parent:Error});function rc(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Dr(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)rc(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Kr(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>o({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let p=c[u],f=u===c.length-1;if(p==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,p))Object.defineProperty(a,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[p];if(f)d._errors.push(t(s));a=d,u++}}}};return o(e),r}function Te(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ae=(e)=>{let t=(r,o,n,i)=>{let s=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)throw new U;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>V(u,s,N())));throw ut(a,i?.callee??t),a}return c.value};return t};var Re=(e)=>{let t=async(r,o,n,i)=>{let s=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>V(u,s,N())));throw ut(a,i?.callee??t),a}return c.value};return t};var Ce=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new U;return i.issues.length?Lr(e,i.issues,n):{success:!0,data:i.value}};function Lr(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>V(n,r,N()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var Ne=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?Lr(e,i.issues,n):{success:!0,data:i.value}};var oc=Symbol.for("zod.compile.invalid"),nc=Symbol.for("zod.compile.fallback"),gt=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==oc)return!0;if(o.definite===!0&&r===void 0)return!1}return ic(e,t,r)};function ic(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n)o[nc]=!0,i=n({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new U;return i.issues.length===0}var _t=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},jr=(e)=>{let t=Ae(e),r=(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,n,c,Te(r,s))};return r};var Fr=(e)=>{let t=Ae(e),r=(o,n,i,s)=>t(o,n,i,Te(r,s));return r};var Mr=(e)=>{let t=Re(e),r=async(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,n,c,Te(r,s))};return r};var Ur=(e)=>{let t=Re(e),r=async(o,n,i,s)=>await t(o,n,i,Te(r,s));return r};var Jr=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ce(e)(t,r,n)};var Br=(e)=>(t,r,o)=>Ce(e)(t,r,o);var Wr=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ne(e)(t,r,n)};var Vr=(e)=>async(t,r,o)=>Ne(e)(t,r,o);var Hr=/^[cC][0-9a-z]{6,}$/,Gr=/^[0-9a-z]+$/,Xr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Yr=/^[0-9a-vA-V]{20}$/,qr=/^[A-Za-z0-9]{27}$/,Qr=/^[a-zA-Z0-9_-]{21}$/;function eo(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var to=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ro=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var oo=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var sc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function no(){return new RegExp(sc,"u")}var io=/^(?:(?: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])$/,so=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var co=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ao=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lo=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var po=/^https?$/,fo=/^\+[1-9]\d{6,14}$/;var mo="(?:(?:\\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])))";function cc(e){return new RegExp(`^${e}$`)}var ho=cc(mo);function xt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function yo(e){return new RegExp(`^${xt(e)}$`)}function go(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${xt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${xt({precision:e.precision})}`:r;return new RegExp(`^${mo}T(?:${o})$`)}var _o=/^[\s\S]{0,}$/;var vt=/^-?\d+(?:\.\d+)?$/;var xo=/^[^A-Z]*$/,bo=/^[^a-z]*$/;var O=l("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Pt=(e)=>{let t=e.value;return!yr(t)&&t.length!==void 0},De={number:"number",bigint:"bigint",object:"date"},zt=l("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:De[typeof o.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$t=l("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:De[typeof o.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vo=l("$ZodCheckMultipleOf",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):gr(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Po=l("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=we[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(c<n)s.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var zo=l("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>t.maximum?Oe(n):i)<=t.maximum)return;let c=Ie(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$o=l("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>=t.minimum&&i<t.minimum*2?Oe(n):i)>=t.minimum)return;let c=Ie(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),wo=l("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length,s=typeof n==="string"&&i>=t.length&&i<=t.length*2?Oe(n):i;if(s===t.length)return;let c=Ie(n),a=s>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),de=l("$ZodCheckStringFormat",(e,t)=>{var r,o;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),ko=l("$ZodCheckRegex",(e,t)=>{de.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),So=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xo),de.init(e,t)}),Zo=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=bo),de.init(e,t)}),Oo=l("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=te(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Io=l("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Eo=l("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var To=l("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class wt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
2
+ var fr="@flowscripter/pluggable-io-framework/provider-factory";function dr(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:o,value:n}=await t.read();if(o){r.close();return}r.enqueue({payload:{kind:"js",data:n}})},cancel(r){return t.cancel(r)}})}import{chmod as uu,cp as Ks,mkdir as or,rename as lu,rm as Ls,utimes as pu}from"fs/promises";import{join as ot,resolve as fu}from"path";import{lstatSync as Ms,realpathSync as gr}from"fs";import{dirname as Us,join as Js,resolve as st,sep as mr}from"path";function E(e,t){if(e==="")return st(t);let r=st(e),o=st(r,t);if(!hr(r,o))throw Error(`Path "${t}" resolves outside provider root "${e}"`);if(!hr(Bs(r),yr(o)))throw Error(`Path "${t}" resolves outside provider root "${e}"`);return o}function hr(e,t){let r=e.endsWith(mr)?e:e+mr;return t===e||t.startsWith(r)}function Bs(e){try{return gr(e)}catch{return e}}function yr(e){try{return gr(e)}catch(n){if(n.code!=="ENOENT")throw n}let t=!1;try{t=Ms(e).isSymbolicLink()}catch{}if(t)return"";let r=Us(e);if(r===e)return e;let o=yr(r);return o===""?"":Js(o,e.slice(r.length+1))}function ue(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function at(e,t="|"){return e.map((r)=>pt(r)).join(t)}function le(e,t){if(typeof t==="bigint")return t.toString();return t}class _r{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Pe(e){return new _r(e)}function xr(e){return e===null||e===void 0}function ze(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function br(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function j(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $e(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function J(e){return $e(e._zod.def)??e._zod.def.shape}function vr(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return j(this,t,o),o},enumerable:!0,configurable:!0})}function Pr(e,t,r){if(t in e)j(e,t,r);else e[t]=r}function G(e,t,r,o){let n=J(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);if(!s.enumerable)continue;if(s.get)vr(e,i,()=>{let c=t._zod.def.shape[i];return o?o(c,i):c});else Pr(e,i,o?o(s.value,i):s.value)}}function Ws(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)vr(e,r,()=>t[r]);else Pr(e,r,o.value)}}function T(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function zr(e){return JSON.stringify(e)}function $r(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ut="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wr=Pe(()=>{if(A.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ee(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ae(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function lt(e){if(ee(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var kr=new Set(["string","number","symbol"]);function te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function pt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Sr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var we=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),ft={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Vs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return G(i,e,ke(e,t)),F(e,T(r,{shape:i,checks:[]}))}function ke(e,t){let r=J(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function Hs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ke(e,t)),s={};return G(s,e,Reflect.ownKeys(J(e)).filter((c)=>!i.has(c))),F(e,T(r,{shape:s,checks:[]}))}function Gs(e,t){if(!ee(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=J(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,T(e._zod.def,{shape:Zr(e,t)}))}function Zr(e,t){let r={};return G(r,e,Reflect.ownKeys(J(e))),Ws(r,t),r}function Xs(e,t){if(!ee(t))throw Error("Invalid input to safeExtend: expected a plain object");return F(e,T(e._zod.def,{shape:Zr(e,t)}))}function Ys(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};G(r,e,Reflect.ownKeys(J(e))),G(r,t,Reflect.ownKeys(J(t)));let o=T(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return F(e,o)}function Or(e,t,r,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(ke(t,r)):void 0,a={};return G(a,t,Reflect.ownKeys(J(t)),e&&((u,p)=>c&&!c.has(p)?u:new e({type:"optional",innerType:u}))),F(t,T(t._zod.def,{shape:a,checks:[]}))}function qs(e,t,r){let o=r?new Set(ke(t,r)):void 0,n={};return G(n,t,Reflect.ownKeys(J(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),F(t,T(t._zod.def,{shape:n}))}function M(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ir(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function ce(e){return typeof e==="string"?e:e?.message}function dt(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;if(n>=0)t.push([n,r])}return t}function Ze(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function V(e,t,r){var o;let n=e.inst?._zod?.traits;if(n?.has("$ZodType"))if(n.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ce(e.inst?._zod.def?.error?.(e))??ce(i?.(e))??ce(t?.error?.(e))??ce(r.customError?.(e))??ce(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Qs=/[\uD800-\uDBFF]/;function Oe(e){let t=e.length;if(!Qs.test(e))return t;let r=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)r--,o++;return r}function Ie(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Er(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function X(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function Tr(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else ec(e,r,o.value)}}function B(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ee(e,t,r){return B(e,t,r,!1)}function Ar(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return B(this,r,o(this))},set(n){B(this,r,n)}})}return t}function ec(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:B(this,t,r.bind(this))},set(o){B(this,t,o)}})}function tc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ct,W=!1,rc={configurable:!0,get(){W=!0;return}};function x(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&ct!==e._zod){ct=void 0;return}ct=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,rc);let n=W;W=!1;try{let i=r(this);if(W)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return W=W||n,i}catch(i){throw delete this[t],W=W||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function oc(e,t,r,o){let n=tc(e,t);if(!n)return;Object.defineProperty(n,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var nc="~constantCatch";function Rr(e){let t=()=>e;return t[nc]=!0,t}var Cr;var mt={value:void 0,enumerable:!1},Nr="captureStackTrace"in Error?Error:null;function ic(e){let t=Nr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Nr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,o){let n={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=n;let s=r,c=s&&new WeakSet;function a(d,m){if(!d._zod){mt.value=new i(m);try{Object.defineProperty(d,"_zod",mt)}finally{mt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),y=d._zod.constr.prototype,b=_;while(b&&b!==y)b=Object.getPrototypeOf(b);let K=b??_;if(!c.has(K))c.add(K),Tr(K,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let u=o?.Parent??Object;class p extends u{}Object.defineProperty(p,"name",{value:e});function f(d){let m=o?.Parent?ic(p):this;a(m,d);let h=m._zod.deferred;if(h){for(let y of h)y();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class U extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class pe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Cr=globalThis).__zod_globalConfig??(Cr.__zod_globalConfig={});var A=globalThis.__zod_globalConfig;function N(e){if(e)Object.assign(A,e);return A}function sc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,le,2)),e.message}function cc(e){this._zod.message=e}var ac={get:sc,set:cc,enumerable:!0,configurable:!0},gt={value:void 0,enumerable:!1},Dr=new WeakSet([Object.prototype,Error.prototype]),Kr=(e,t)=>{e.name="$ZodError",gt.value=t,Object.defineProperty(e,"issues",gt),gt.value=void 0,Object.defineProperty(e,"message",ac);let r=Object.getPrototypeOf(e);if(!Dr.has(r))Dr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},Lr=l("$ZodError",Kr),$l=l("$ZodError",Kr,void 0,{Parent:Error});function uc(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function jr(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)uc(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Fr(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>o({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let p=c[u],f=u===c.length-1;if(p==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,p))Object.defineProperty(a,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[p];if(f)d._errors.push(t(s));a=d,u++}}}};return o(e),r}function Te(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ae=(e)=>{let t=(r,o,n,i)=>{let s=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)throw new U;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>V(u,s,N())));throw ut(a,i?.callee??t),a}return c.value};return t};var Re=(e)=>{let t=async(r,o,n,i)=>{let s=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>V(u,s,N())));throw ut(a,i?.callee??t),a}return c.value};return t};var Ce=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new U;return i.issues.length?Mr(e,i.issues,n):{success:!0,data:i.value}};function Mr(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>V(n,r,N()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var Ne=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?Mr(e,i.issues,n):{success:!0,data:i.value}};var lc=Symbol.for("zod.compile.invalid"),pc=Symbol.for("zod.compile.fallback"),yt=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==lc)return!0;if(o.definite===!0&&r===void 0)return!1}return fc(e,t,r)};function fc(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n)o[pc]=!0,i=n({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new U;return i.issues.length===0}var _t=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},Ur=(e)=>{let t=Ae(e),r=(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,n,c,Te(r,s))};return r};var Jr=(e)=>{let t=Ae(e),r=(o,n,i,s)=>t(o,n,i,Te(r,s));return r};var Br=(e)=>{let t=Re(e),r=async(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,n,c,Te(r,s))};return r};var Wr=(e)=>{let t=Re(e),r=async(o,n,i,s)=>await t(o,n,i,Te(r,s));return r};var Vr=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ce(e)(t,r,n)};var Hr=(e)=>(t,r,o)=>Ce(e)(t,r,o);var Gr=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ne(e)(t,r,n)};var Xr=(e)=>async(t,r,o)=>Ne(e)(t,r,o);var Yr=/^[cC][0-9a-z]{6,}$/,qr=/^[0-9a-z]+$/,Qr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eo=/^[0-9a-vA-V]{20}$/,to=/^[A-Za-z0-9]{27}$/,ro=/^[a-zA-Z0-9_-]{21}$/;function oo(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var no=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var io=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var so=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var dc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function co(){return new RegExp(dc,"u")}var ao=/^(?:(?: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])$/,uo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var lo=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,po=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mo=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var ho=/^https?$/,go=/^\+[1-9]\d{6,14}$/;var yo="(?:(?:\\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])))";function mc(e){return new RegExp(`^${e}$`)}var _o=mc(yo);function xt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function xo(e){return new RegExp(`^${xt(e)}$`)}function bo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${xt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${xt({precision:e.precision})}`:r;return new RegExp(`^${yo}T(?:${o})$`)}var vo=/^[\s\S]{0,}$/;var vt=/^-?\d+(?:\.\d+)?$/;var Po=/^[^A-Z]*$/,zo=/^[^a-z]*$/;var O=l("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Pt=(e)=>{let t=e.value;return!xr(t)&&t.length!==void 0},De={number:"number",bigint:"bigint",object:"date"},zt=l("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:De[typeof o.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$t=l("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:De[typeof o.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$o=l("$ZodCheckMultipleOf",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):br(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wo=l("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=we[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(c<n)s.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var ko=l("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>t.maximum?Oe(n):i)<=t.maximum)return;let c=Ie(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),So=l("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>=t.minimum&&i<t.minimum*2?Oe(n):i)>=t.minimum)return;let c=Ie(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Zo=l("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(o)=>{let n=o.value,i=n.length,s=typeof n==="string"&&i>=t.length&&i<=t.length*2?Oe(n):i;if(s===t.length)return;let c=Ie(n),a=s>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),de=l("$ZodCheckStringFormat",(e,t)=>{var r,o;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Oo=l("$ZodCheckRegex",(e,t)=>{de.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Io=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Po),de.init(e,t)}),Eo=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zo),de.init(e,t)}),To=l("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=te(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ao=l("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ro=l("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Co=l("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class wt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
3
3
  `).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
4
  ${t.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}}var Ro={major:4,minor:6,patch:7};var w=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ro;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let p=M(c),f;for(let d of a){if(d._zod.def.when){if(Sr(c))continue;if(!d._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new U;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Ze(c.issues,m,e),!p)p=M(c,m)});else{if(c.issues.length===m)continue;if(Ze(c.issues,m,e),!p)p=M(c,m)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(M(c))return c.aborted=!0,c;let p=i(a,n,u);if(p instanceof Promise){if(u.async===!1)throw new U;return p.then((f)=>e._zod.parse(f,u))}return e._zod.parse(p,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>s(f,c,a));return s(p,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new U;return u.then((p)=>i(p,n,a))}return i(u,n,a)}}},{get "~standard"(){return Ee(this,"~standard",St(this))},set "~standard"(e){B(this,"~standard",e)}}),Bo=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>V(r,t,N()))}:{value:e.value};async function uc(e,t){let r={async:!0};return Bo(await e._zod.run({value:t,issues:[]},r),r)}function St(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Bo(o,r)}catch(o){}return uc(e,t)},vendor:"zod",version:1}}var Fe=l("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??_o,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),P=l("$ZodStringFormat",(e,t)=>{de.init(e,t),Fe.init(e,t)}),Wo=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ro),P.init(e,t)}),Vo=l("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=bt(o))}else t.pattern??(t.pattern=bt());P.init(e,t)}),Ho=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=oo),P.init(e,t)}),Go=1,Le=2;function Xo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function lc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Xo(e)||Le;return pc(e,t)}function pc(e,t){if(!t.normalize&&t.protocol?.source===po.source&&!/^https?:\/\//i.test(e))return Go;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Le}return new URL(e)}catch{return Le}}var fc=/[\t\n\r]/g;function Co(e){return e.replace(fc,"")}function dc(e,t){return t.lastIndex=0,t.test(e.hostname)}function mc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Yo=l("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=lc(o,t);if(n===Go){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Le){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Co(o);return}if(t.hostname&&!dc(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!mc(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:Co(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),qo=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=no()),P.init(e,t)}),Qo=l("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Qr:eo(t.length)),P.init(e,t)}),en=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Hr),P.init(e,t)}),tn=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Gr),P.init(e,t)}),rn=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xr),P.init(e,t)}),on=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yr),P.init(e,t)}),nn=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qr),P.init(e,t)}),sn=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=go(t)),P.init(e,t)}),cn=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ho),P.init(e,t)}),an=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yo(t)),P.init(e,t)}),un=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=to),P.init(e,t)}),ln=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=io),P.init(e,t)}),hc=/^[0-9a-fA-F:.]+$/;function pn(e){if(!hc.test(e))return!1;return Xo(`http://[${e}]`)}var fn=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=so),P.init(e,t),e._zod.check=(r)=>{if(!pn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var dn=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=co),P.init(e,t)});function yc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return pn(r)}var mn=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ao),P.init(e,t),e._zod.check=(r)=>{if(!yc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function hn(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Zt=/^[0-9a-zA-Z+/]*={0,2}$/,yn=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zt),P.init(e,t),e._zod.check=(r)=>{if(hn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Me=/^[A-Za-z0-9_-]*$/;function gc(e){if(!Me.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return hn(r)}var gn=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Me),P.init(e,t),e._zod.check=(r)=>{if(gc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_n=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fo),P.init(e,t)});function _c(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var xn=l("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{if(_c(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ot=l("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=vt,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),bn=l("$ZodNumberFormat",(e,t)=>{Po.init(e,t),Ot.init(e,t)});var vn=l("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),Pn=l("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function xc(e,t){let r=dt(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map((i)=>i[0])),n=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of dt(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let p=i.issues.length;return u._zod.check(i),i.issues[p].continue=!1,Ze(i.issues,p,e),i}}return n(i,s)}}var bc=(e)=>Array.isArray(e)?e.length:-1;function No(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}var zn=l("$ZodArray",(e,t)=>{w.init(e,t);let r=A.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=r?r.alloc(e,o,Array(i.length),n):Array(i.length);let s=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],p=t.element._zod.run({value:u,issues:[]},n);if(p instanceof Promise)s.push(p.then((f)=>No(f,o,a)));else if(No(p,o,a),c&&p.issues.length!==0&&M(p))break}if(s.length)return Promise.all(s).then(()=>o);return o},xc(e,bc)});function je(e,t,r,o,n,i){let s=r in o,c=i==="optional";if(!s&&c&&n==="optional")return;if(e.issues.length){if(n!==void 0&&c&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var vc=[];function $n(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:vc,n=o.length?[...t,...o]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=$r(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function wn(e,t,r,o,n,i,s){let c=[],a=n.keySet,u=n.catchall._zod,p=u.def.type,{optin:f,optout:d}=u,m=0;for(let h in t){if(s&&r.issues.length!==m){if(M(r,m))break;m=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(p==="never")c.push(h);continue}if(p==="never"){c.push(h);continue}let _=u.run({value:t[h],issues:[]},o);if(_ instanceof Promise)e.push(_.then((g)=>je(g,r,h,t,f,d)));else je(_,r,h,t,f,d)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Pc=l("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let p={...o};return Object.defineProperty(t,"shape",{value:p}),u.raw=p,p};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=Pe(()=>$n(t));x(e,"propValues",(u)=>{let p=u.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))j(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=ae,s=t.catchall,c,a=A.memoizer;a?.attach(e),e._zod.parse=(u,p)=>{c??(c=n.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,_=u.issues.length;for(let g of c.allKeys){if(h&&u.issues.length!==_){if(M(u,_))break;_=u.issues.length}if(g==="__proto__")continue;let b=m[g],K=b._zod.optin,ie=b._zod.optout,se=b._zod.run({value:f[g],issues:[]},p);if(se instanceof Promise)d.push(se.then((S)=>je(S,u,g,f,K,ie)));else je(se,u,g,f,K,ie)}if(!s)return d.length?Promise.all(d).then(()=>u):u;return wn(d,f,u,p,n.value,e,h===!0)}}),kn=l("$ZodObjectJIT",(e,t)=>{Pc.init(e,t);let r=e._zod.parse,o=Pe(()=>$n(t)),n=A.memoizer,i=(m)=>{let h=o.value,_=h.symbolKeys,g=new wt(["payload","ctx"],{shape:m,inst:e,memo:n,syms:_}),b=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,K=(S,v)=>`
6
+ };`)(...Object.values(this.closed))}}var Do={major:4,minor:6,patch:7};var w=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Do;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let p=M(c),f;for(let d of a){if(d._zod.def.when){if(Ir(c))continue;if(!d._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new U;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Ze(c.issues,m,e),!p)p=M(c,m)});else{if(c.issues.length===m)continue;if(Ze(c.issues,m,e),!p)p=M(c,m)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(M(c))return c.aborted=!0,c;let p=i(a,n,u);if(p instanceof Promise){if(u.async===!1)throw new U;return p.then((f)=>e._zod.parse(f,u))}return e._zod.parse(p,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>s(f,c,a));return s(p,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new U;return u.then((p)=>i(p,n,a))}return i(u,n,a)}}},{get "~standard"(){return Ee(this,"~standard",St(this))},set "~standard"(e){B(this,"~standard",e)}}),Ho=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>V(r,t,N()))}:{value:e.value};async function gc(e,t){let r={async:!0};return Ho(await e._zod.run({value:t,issues:[]},r),r)}function St(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Ho(o,r)}catch(o){}return gc(e,t)},vendor:"zod",version:1}}var Fe=l("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??vo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),P=l("$ZodStringFormat",(e,t)=>{de.init(e,t),Fe.init(e,t)}),Go=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=io),P.init(e,t)}),Xo=l("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=bt(o))}else t.pattern??(t.pattern=bt());P.init(e,t)}),Yo=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=so),P.init(e,t)}),qo=1,Le=2;function Qo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function yc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Qo(e)||Le;return _c(e,t)}function _c(e,t){if(!t.normalize&&t.protocol?.source===ho.source&&!/^https?:\/\//i.test(e))return qo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Le}return new URL(e)}catch{return Le}}var xc=/[\t\n\r]/g;function Ko(e){return e.replace(xc,"")}function bc(e,t){return t.lastIndex=0,t.test(e.hostname)}function vc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var en=l("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=yc(o,t);if(n===qo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Le){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Ko(o);return}if(t.hostname&&!bc(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!vc(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:Ko(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tn=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=co()),P.init(e,t)}),rn=l("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ro:oo(t.length)),P.init(e,t)}),on=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yr),P.init(e,t)}),nn=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qr),P.init(e,t)}),sn=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qr),P.init(e,t)}),cn=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=eo),P.init(e,t)}),an=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=to),P.init(e,t)}),un=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bo(t)),P.init(e,t)}),ln=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_o),P.init(e,t)}),pn=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xo(t)),P.init(e,t)}),fn=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=no),P.init(e,t)}),dn=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ao),P.init(e,t)}),Pc=/^[0-9a-fA-F:.]+$/;function mn(e){if(!Pc.test(e))return!1;return Qo(`http://[${e}]`)}var hn=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=uo),P.init(e,t),e._zod.check=(r)=>{if(!mn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var gn=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lo),P.init(e,t)});function zc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return mn(r)}var yn=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=po),P.init(e,t),e._zod.check=(r)=>{if(!zc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function _n(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Zt=/^[0-9a-zA-Z+/]*={0,2}$/,xn=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zt),P.init(e,t),e._zod.check=(r)=>{if(_n(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Me=/^[A-Za-z0-9_-]*$/;function $c(e){if(!Me.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _n(r)}var bn=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Me),P.init(e,t),e._zod.check=(r)=>{if($c(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vn=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=go),P.init(e,t)});function wc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var Pn=l("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{if(wc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ot=l("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=vt,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),zn=l("$ZodNumberFormat",(e,t)=>{wo.init(e,t),Ot.init(e,t)});var $n=l("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),wn=l("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function kc(e,t){let r=dt(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map((i)=>i[0])),n=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of dt(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let p=i.issues.length;return u._zod.check(i),i.issues[p].continue=!1,Ze(i.issues,p,e),i}}return n(i,s)}}var Sc=(e)=>Array.isArray(e)?e.length:-1;function Lo(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}var kn=l("$ZodArray",(e,t)=>{w.init(e,t);let r=A.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=r?r.alloc(e,o,Array(i.length),n):Array(i.length);let s=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],p=t.element._zod.run({value:u,issues:[]},n);if(p instanceof Promise)s.push(p.then((f)=>Lo(f,o,a)));else if(Lo(p,o,a),c&&p.issues.length!==0&&M(p))break}if(s.length)return Promise.all(s).then(()=>o);return o},kc(e,Sc)});function je(e,t,r,o,n,i){let s=r in o,c=i==="optional";if(!s&&c&&n==="optional")return;if(e.issues.length){if(n!==void 0&&c&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var Zc=[];function Sn(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Zc,n=o.length?[...t,...o]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Sr(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Zn(e,t,r,o,n,i,s){let c=[],a=n.keySet,u=n.catchall._zod,p=u.def.type,{optin:f,optout:d}=u,m=0;for(let h in t){if(s&&r.issues.length!==m){if(M(r,m))break;m=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(p==="never")c.push(h);continue}if(p==="never"){c.push(h);continue}let _=u.run({value:t[h],issues:[]},o);if(_ instanceof Promise)e.push(_.then((y)=>je(y,r,h,t,f,d)));else je(_,r,h,t,f,d)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Oc=l("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let p={...o};return Object.defineProperty(t,"shape",{value:p}),u.raw=p,p};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=Pe(()=>Sn(t));x(e,"propValues",(u)=>{let p=u.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))j(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=ae,s=t.catchall,c,a=A.memoizer;a?.attach(e),e._zod.parse=(u,p)=>{c??(c=n.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,_=u.issues.length;for(let y of c.allKeys){if(h&&u.issues.length!==_){if(M(u,_))break;_=u.issues.length}if(y==="__proto__")continue;let b=m[y],K=b._zod.optin,ie=b._zod.optout,se=b._zod.run({value:f[y],issues:[]},p);if(se instanceof Promise)d.push(se.then((S)=>je(S,u,y,f,K,ie)));else je(se,u,y,f,K,ie)}if(!s)return d.length?Promise.all(d).then(()=>u):u;return Zn(d,f,u,p,n.value,e,h===!0)}}),On=l("$ZodObjectJIT",(e,t)=>{Oc.init(e,t);let r=e._zod.parse,o=Pe(()=>Sn(t)),n=A.memoizer,i=(m)=>{let h=o.value,_=h.symbolKeys,y=new wt(["payload","ctx"],{shape:m,inst:e,memo:n,syms:_}),b=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,K=(S,v)=>`
7
7
  let ${S}_ab = false;
8
8
  for (let i = 0; i < ${S}.issues.length; i++) {
9
9
  const iss = ${S}.issues[i];
@@ -14,18 +14,18 @@ ${t.join(`
14
14
  if (${S}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;g.write("const input = payload.value;");let ie=Object.create(null),se=0;for(let S of h.allKeys)ie[S]=`key_${se++}`;g.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let S of h.allKeys){if(S==="__proto__")continue;let v=ie[S],L=typeof S==="symbol"?`syms[${_.indexOf(S)}]`:br(S),nt=`${L} in input`,lr=m[S],it=lr?._zod?.optin,pr=it!==void 0,Ds=lr?._zod?.optout==="optional";if(g.write(`const ${v} = ${b(L)};`),pr&&Ds){let Ks=it==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;g.write(`
17
+ }`;y.write("const input = payload.value;");let ie=Object.create(null),se=0;for(let S of h.allKeys)ie[S]=`key_${se++}`;y.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let S of h.allKeys){if(S==="__proto__")continue;let v=ie[S],L=typeof S==="symbol"?`syms[${_.indexOf(S)}]`:zr(S),nt=`${L} in input`,lr=m[S],it=lr?._zod?.optin,pr=it!==void 0,js=lr?._zod?.optout==="optional";if(y.write(`const ${v} = ${b(L)};`),pr&&js){let Fs=it==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;y.write(`
18
18
  const ${v}_present = ${nt};
19
19
  if (!${v}.issues.length || ${v}_present) {
20
20
  if (${v}.issues.length) {${K(v,L)}
21
21
  }
22
22
 
23
- if (${Ks}) {
23
+ if (${Fs}) {
24
24
  newResult[${L}] = ${v}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else if(!pr)g.write(`
28
+ `)}else if(!pr)y.write(`
29
29
  const ${v}_present = ${nt};
30
30
  if (${v}.issues.length) {${K(v,L)}
31
31
  }
@@ -46,13 +46,13 @@ ${t.join(`
46
46
  newResult[${L}] = ${v}.value;
47
47
  }
48
48
 
49
- `);else if(g.write(`
49
+ `);else if(y.write(`
50
50
  if (${v}.issues.length) {${K(v,L)}
51
51
  }
52
- `),it==="defaulted")g.write(`newResult[${L}] = ${v}.value;`);else g.write(`
52
+ `),it==="defaulted")y.write(`newResult[${L}] = ${v}.value;`);else y.write(`
53
53
  if (${v}.value !== undefined || ${nt}) {
54
54
  newResult[${L}] = ${v}.value;
55
55
  }
56
- `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},s,c=ae,a=!A.jitless,p=a&&Pr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=o.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(a&&p&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return wn([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function Do(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!M(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>V(s,o,N())))}),t}var Sn=l("$ZodUnion",(e,t)=>{w.init(e,t),x(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),x(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),x(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${n.map((i)=>ze(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Do(s,o,e,n);return Promise.all(s).then((c)=>Do(c,o,e,n))}});var Zn=l("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Ko(r,a,u));return Ko(r,i,s)}});function kt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ee(e)&&ee(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=kt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=kt(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ko(e,t,r){let o=new Map,n,i=new Map,s=(u,p)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!i.has(d))i.set(d,u);f=[d]}else return!1;for(let d of f){if(!o.has(d))o.set(d,{});o.get(d)[p]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter((p)=>n.keys.includes(p)):[];if(u.length)e.issues.push({...n,keys:u});for(let p of c)if(!u.includes(p)&&i.has(p))e.issues.push(i.get(p))}let a=kt(t.value,r.value);if(!a.valid){if(M(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var On=l("$ZodEnum",(e,t)=>{w.init(e,t);let r=ue(t.entries),o=new Set(r);e._zod.values=o,x(e,"pattern",(n)=>{let i=ue(n.def.entries).filter((s)=>zr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>te(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}});var In=l("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",A.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new pe(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r));if(n instanceof Promise)throw new U;return r.value=n,r}});function Lo(e,t){return e.value=t.issues.length?void 0:t.value,e}var It=l("$ZodOptional",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",x(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),x(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${ze(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Lo(r,i));return Lo(r,n)}return t.innerType._zod.run(r,o)}}),En=l("$ZodExactOptional",(e,t)=>{It.init(e,t),x(e,"values",(r)=>r.def.innerType._zod.values),x(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Tn=l("$ZodNullable",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin),x(e,"optout",(r)=>r.def.innerType._zod.optout),x(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${ze(o.source)}|null)$`):void 0}),x(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),An=l("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>jo(i,t));return jo(n,t)}});function jo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Rn=l("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Cn=l("$ZodNonOptional",(e,t)=>{w.init(e,t),x(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Fo(i,e));return Fo(n,e)}});function Fo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Mo(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>V(n,o,N()))},input:e.value}),e}var Nn=l("$ZodCatch",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),x(e,"optout",(r)=>r.def.innerType._zod.optout),x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Mo(r,i,t,o));return Mo(r,n,t,o)}});var Dn=l("$ZodPipe",(e,t)=>{w.init(e,t),x(e,"values",(r)=>r.def.in._zod.values),x(e,"optin",(r)=>r.def.in._zod.optin),x(e,"optout",(r)=>r.def.out._zod.optout),x(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Ke(s,t.in,o));return Ke(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ke(i,t.out,o));return Ke(n,t.out,o)}});function Ke(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Kn=l("$ZodReadonly",(e,t)=>{w.init(e,t),x(e,"propValues",(r)=>r.def.innerType._zod.propValues),x(e,"values",(r)=>r.def.innerType._zod.values),x(e,"optin",(r)=>r.def.innerType?._zod?.optin),x(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Uo);return Uo(n)}});function Uo(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ln=l("$ZodCustom",(e,t)=>{O.init(e,t),w.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Jo(i,r,o,e));Jo(n,r,o,e);return}});function Jo(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(X(n))}}class Fn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Tt="~memo",jn=[];function Mn(e){return e!==null&&typeof e==="object"}function Et(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Un=new WeakMap,me=0,Be=1,he=2;function We(e,t,r){let o=Un.get(e);if(o!==void 0)return o?he:me;if(t.has(e))return he;t.add(e);let n=me,i=(p)=>{if(n!==he&&p?._zod){let f=We(p,t,r);if(f>n)n=f}},s=(p,f)=>{let d=me;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let _=h.get?Be:h.value?._zod?We(h.value,t,r):me;if(_>d)d=_}return d},c=(p)=>{if(p>n)n=p},a=e._zod.def,u=a.type;switch(u){case"object":{let p=$e(a);c(p?s(p,!0):Be),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let p of a.items)i(p);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let p of a.options)i(p);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let p=a._cachedInner??(r?e._zod.innerType:void 0);c(p?We(p,t,!1):Be);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in a){let f=Object.getOwnPropertyDescriptor(a,p);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),zc(e,n)}function zc(e,t){if(t!==Be)Un.set(e,t===he);return t}function $c(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ue,Je=[],wc={alloc(e,t,r){let o=Ue;if(!o)return r;Ue=void 0;let n={value:r,issues:null};return o.set(t.value,n),Je.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&kc(i,n.value))throw new Fn;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let b=We(e,new Set,!1);if(b===me){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(b===he||o)r=!0;else o=!0}let p=a.value;if(!Mn(p))return s(a,u);let f=u[Tt];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[Tt]=f;let d;if(n===u)d=i;else d=$c(f,e),n=u,i=d;let m=d.get(p);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...Et(m.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return a}Ue=d;let h=Je.length,_=s(a,u);Ue=void 0;let g=Je.length>h?Je.pop():void 0;if(_ instanceof Promise)return _.then((b)=>{if(g)g.issues=b.issues.length?Et(b.issues):jn;return b});if(g)g.issues=_.issues.length?Et(_.issues):jn;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Jn(){return wc}function kc(e,t){let r=e[Tt]?.backEdges;return r!==void 0&&Mn(t)&&r.has(t)}var Sc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Zr(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${pt(i.values[0])}`;return`Invalid option: expected one of ${at(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${at(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function At(){return{localeError:Sc()}}var Bn;class Wn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zc(){return new Wn}(Bn=globalThis).__zod_globalRegistry??(Bn.__zod_globalRegistry=Zc());var Y=globalThis.__zod_globalRegistry;function Vn(e){if(e.checks)e.checks=[...e.checks];return e}function Hn(e,t){return new e(Vn({type:"string",...y(t)}))}function Gn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function Xn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function ti(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function ri(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function oi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function ni(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function ii(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function si(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function ci(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function ai(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function ui(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function li(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function pi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function fi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function di(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function mi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function hi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function yi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function gi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function _i(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function xi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function bi(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function vi(e,t){return new e(Vn({type:"number",checks:[],...y(t)}))}function Pi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function zi(e){return new e({type:"unknown"})}function $i(e,t){return new e({type:"never",...y(t)})}function Ve(e,t){return new zt({check:"less_than",...y(t),value:e,inclusive:!1})}function ye(e,t){return new zt({check:"less_than",...y(t),value:e,inclusive:!0})}function He(e,t){return new $t({check:"greater_than",...y(t),value:e,inclusive:!1})}function ge(e,t){return new $t({check:"greater_than",...y(t),value:e,inclusive:!0})}function Ge(e,t){return new vo({check:"multiple_of",...y(t),value:e})}function Xe(e,t){return new zo({check:"max_length",...y(t),maximum:e})}function re(e,t){return new $o({check:"min_length",...y(t),minimum:e})}function Ye(e,t){return new wo({check:"length_equals",...y(t),length:e})}function Rt(e,t){return new ko({check:"string_format",format:"regex",...y(t),pattern:e})}function Ct(e){return new So({check:"string_format",format:"lowercase",...y(e)})}function Nt(e){return new Zo({check:"string_format",format:"uppercase",...y(e)})}function Dt(e,t){return new Oo({check:"string_format",format:"includes",...y(t),includes:e})}function Kt(e,t){return new Io({check:"string_format",format:"starts_with",...y(t),prefix:e})}function Lt(e,t){return new Eo({check:"string_format",format:"ends_with",...y(t),suffix:e})}function H(e){return new To({check:"overwrite",tx:e})}function jt(e){return H((t)=>t.normalize(e))}function Ft(){return H((e)=>e.trim())}function Mt(){return H((e)=>e.toLowerCase())}function Ut(){return H((e)=>e.toUpperCase())}function Jt(){return H((e)=>vr(e))}function wi(e,t,r){return new e({type:"array",element:t,...y(r)})}function ki(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function Si(e,t){let r=Oc((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(X(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(X(i))}},e(o.value,o)),t);return r}function Oc(e,t){let r=new O({check:"custom",...y(t)});return r._zod.check=e,r}function _e(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))j(e,o,r[o]);return e}function Wt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function q(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let d=s.schema,m=t.processors[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,d,p)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,p),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)_e(s.schema,a);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Zi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Zi(m)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:u+Zi(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let p=c.schema;for(let f in p)delete p[f];p.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
56
+ `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=ae,a=!A.jitless,p=a&&wr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=o.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(a&&p&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return Zn([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function jo(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!M(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>V(s,o,N())))}),t}var In=l("$ZodUnion",(e,t)=>{w.init(e,t),x(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),x(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),x(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${n.map((i)=>ze(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return jo(s,o,e,n);return Promise.all(s).then((c)=>jo(c,o,e,n))}});var En=l("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Fo(r,a,u));return Fo(r,i,s)}});function kt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ee(e)&&ee(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=kt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=kt(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Fo(e,t,r){let o=new Map,n,i=new Map,s=(u,p)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!i.has(d))i.set(d,u);f=[d]}else return!1;for(let d of f){if(!o.has(d))o.set(d,{});o.get(d)[p]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter((p)=>n.keys.includes(p)):[];if(u.length)e.issues.push({...n,keys:u});for(let p of c)if(!u.includes(p)&&i.has(p))e.issues.push(i.get(p))}let a=kt(t.value,r.value);if(!a.valid){if(M(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var Tn=l("$ZodEnum",(e,t)=>{w.init(e,t);let r=ue(t.entries),o=new Set(r);e._zod.values=o,x(e,"pattern",(n)=>{let i=ue(n.def.entries).filter((s)=>kr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>te(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}});var An=l("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",A.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new pe(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r));if(n instanceof Promise)throw new U;return r.value=n,r}});function Mo(e,t){return e.value=t.issues.length?void 0:t.value,e}var It=l("$ZodOptional",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",x(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),x(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${ze(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Mo(r,i));return Mo(r,n)}return t.innerType._zod.run(r,o)}}),Rn=l("$ZodExactOptional",(e,t)=>{It.init(e,t),x(e,"values",(r)=>r.def.innerType._zod.values),x(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Cn=l("$ZodNullable",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin),x(e,"optout",(r)=>r.def.innerType._zod.optout),x(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${ze(o.source)}|null)$`):void 0}),x(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Nn=l("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Uo(i,t));return Uo(n,t)}});function Uo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Dn=l("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Kn=l("$ZodNonOptional",(e,t)=>{w.init(e,t),x(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Jo(i,e));return Jo(n,e)}});function Jo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Bo(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>V(n,o,N()))},input:e.value}),e}var Ln=l("$ZodCatch",(e,t)=>{w.init(e,t),x(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),x(e,"optout",(r)=>r.def.innerType._zod.optout),x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Bo(r,i,t,o));return Bo(r,n,t,o)}});var jn=l("$ZodPipe",(e,t)=>{w.init(e,t),x(e,"values",(r)=>r.def.in._zod.values),x(e,"optin",(r)=>r.def.in._zod.optin),x(e,"optout",(r)=>r.def.out._zod.optout),x(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Ke(s,t.in,o));return Ke(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ke(i,t.out,o));return Ke(n,t.out,o)}});function Ke(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Fn=l("$ZodReadonly",(e,t)=>{w.init(e,t),x(e,"propValues",(r)=>r.def.innerType._zod.propValues),x(e,"values",(r)=>r.def.innerType._zod.values),x(e,"optin",(r)=>r.def.innerType?._zod?.optin),x(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Wo);return Wo(n)}});function Wo(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Mn=l("$ZodCustom",(e,t)=>{O.init(e,t),w.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Vo(i,r,o,e));Vo(n,r,o,e);return}});function Vo(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(X(n))}}class Jn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Tt="~memo",Un=[];function Bn(e){return e!==null&&typeof e==="object"}function Et(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Wn=new WeakMap,me=0,Be=1,he=2;function We(e,t,r){let o=Wn.get(e);if(o!==void 0)return o?he:me;if(t.has(e))return he;t.add(e);let n=me,i=(p)=>{if(n!==he&&p?._zod){let f=We(p,t,r);if(f>n)n=f}},s=(p,f)=>{let d=me;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let _=h.get?Be:h.value?._zod?We(h.value,t,r):me;if(_>d)d=_}return d},c=(p)=>{if(p>n)n=p},a=e._zod.def,u=a.type;switch(u){case"object":{let p=$e(a);c(p?s(p,!0):Be),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let p of a.items)i(p);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let p of a.options)i(p);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let p=a._cachedInner??(r?e._zod.innerType:void 0);c(p?We(p,t,!1):Be);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in a){let f=Object.getOwnPropertyDescriptor(a,p);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),Ic(e,n)}function Ic(e,t){if(t!==Be)Wn.set(e,t===he);return t}function Ec(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ue,Je=[],Tc={alloc(e,t,r){let o=Ue;if(!o)return r;Ue=void 0;let n={value:r,issues:null};return o.set(t.value,n),Je.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&Ac(i,n.value))throw new Jn;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let b=We(e,new Set,!1);if(b===me){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(b===he||o)r=!0;else o=!0}let p=a.value;if(!Bn(p))return s(a,u);let f=u[Tt];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[Tt]=f;let d;if(n===u)d=i;else d=Ec(f,e),n=u,i=d;let m=d.get(p);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...Et(m.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return a}Ue=d;let h=Je.length,_=s(a,u);Ue=void 0;let y=Je.length>h?Je.pop():void 0;if(_ instanceof Promise)return _.then((b)=>{if(y)y.issues=b.issues.length?Et(b.issues):Un;return b});if(y)y.issues=_.issues.length?Et(_.issues):Un;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Vn(){return Tc}function Ac(e,t){let r=e[Tt]?.backEdges;return r!==void 0&&Bn(t)&&r.has(t)}var Rc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Er(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${pt(i.values[0])}`;return`Invalid option: expected one of ${at(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${at(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function At(){return{localeError:Rc()}}var Hn;class Gn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Cc(){return new Gn}(Hn=globalThis).__zod_globalRegistry??(Hn.__zod_globalRegistry=Cc());var Y=globalThis.__zod_globalRegistry;function Xn(e){if(e.checks)e.checks=[...e.checks];return e}function Yn(e,t){return new e(Xn({type:"string",...g(t)}))}function qn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Qn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function ni(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function ci(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function ai(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function ui(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function li(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function pi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function fi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function di(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function mi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function hi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function gi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function yi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function _i(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function xi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function bi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function vi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Pi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function zi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function $i(e,t){return new e(Xn({type:"number",checks:[],...g(t)}))}function wi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function ki(e){return new e({type:"unknown"})}function Si(e,t){return new e({type:"never",...g(t)})}function Ve(e,t){return new zt({check:"less_than",...g(t),value:e,inclusive:!1})}function ge(e,t){return new zt({check:"less_than",...g(t),value:e,inclusive:!0})}function He(e,t){return new $t({check:"greater_than",...g(t),value:e,inclusive:!1})}function ye(e,t){return new $t({check:"greater_than",...g(t),value:e,inclusive:!0})}function Ge(e,t){return new $o({check:"multiple_of",...g(t),value:e})}function Xe(e,t){return new ko({check:"max_length",...g(t),maximum:e})}function re(e,t){return new So({check:"min_length",...g(t),minimum:e})}function Ye(e,t){return new Zo({check:"length_equals",...g(t),length:e})}function Rt(e,t){return new Oo({check:"string_format",format:"regex",...g(t),pattern:e})}function Ct(e){return new Io({check:"string_format",format:"lowercase",...g(e)})}function Nt(e){return new Eo({check:"string_format",format:"uppercase",...g(e)})}function Dt(e,t){return new To({check:"string_format",format:"includes",...g(t),includes:e})}function Kt(e,t){return new Ao({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Lt(e,t){return new Ro({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new Co({check:"overwrite",tx:e})}function jt(e){return H((t)=>t.normalize(e))}function Ft(){return H((e)=>e.trim())}function Mt(){return H((e)=>e.toLowerCase())}function Ut(){return H((e)=>e.toUpperCase())}function Jt(){return H((e)=>$r(e))}function Zi(e,t,r){return new e({type:"array",element:t,...g(r)})}function Oi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Ii(e,t){let r=Nc((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(X(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(X(i))}},e(o.value,o)),t);return r}function Nc(e,t){let r=new O({check:"custom",...g(t)});return r._zod.check=e,r}function _e(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))j(e,o,r[o]);return e}function Wt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function q(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let d=s.schema,m=t.processors[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,d,p)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,p),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)_e(s.schema,a);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Ei(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Ei(m)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:u+Ei(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let p=c.schema;for(let f in p)delete p[f];p.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
57
57
 
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Ei(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;Ei(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Ti=new Set(["type","properties","required","additionalProperties"]),Oi=["oneOf","anyOf"];function Ii(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Bt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Ti.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let p=u.properties?.[s]??Ii(u);if(p===null||p===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(p)))c.push(p)}let a=c.length===1?c[0]:Bt(c)??{allOf:c};j(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=Ii(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function Ic(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Ti)if(n in e)return;let r=t.filter((n)=>Oi.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=Bt(t);else{let n=r[0],i=Oi.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>Bt([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,_e(e,o)}function Ht(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,p={...u},f=a.ref;if(a.ref=null,f){o(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else _e(u,h);if(_e(u,p),c._zod.parent===f)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in p))delete u[g]}if(h.$ref&&m.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g]))delete u[g]}}let d=c._zod.parent;if(d&&d!==f){o(d);let m=e.seen.get(d);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Ei(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let p=u?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);if(f)f.push(u);else c.set(p,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Ic(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}_e(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;j(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:xe(t,"input",e.processors),output:xe(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function I(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return I(o.element,r);if(o.type==="set")return I(o.valueType,r);if(o.type==="lazy")return I(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return I(o.innerType,r);if(o.type==="intersection")return I(o.left,r)||I(o.right,r);if(o.type==="record"||o.type==="map")return I(o.keyType,r)||I(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(o.in,r)||I(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(I(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(I(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(I(n,r))return!0;if(o.rest&&I(o.rest,r))return!0;return!1}return!1}var Ai=(e,t={})=>(r)=>{let o=Wt({...r,processors:t});return Z(e,o),Vt(o,e),Ht(o,e)},xe=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Wt({...n??{},target:i,io:t,processors:r});return Z(e,s),Vt(s,e),Ht(s,e)};var oe=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ne=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Ri=(e,t)=>{oe(e,"minimum",t),ne(e,"maximum",t)},Ki=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Li=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ji=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Fi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ci=(e,t)=>oe(e,"minimum",t.minimum),Ni=(e,t)=>ne(e,"maximum",t.maximum),Di=(e)=>(t,r)=>{Fi(t,r.format);let[o,n]=e[r.format];oe(t,"minimum",o),ne(t,"maximum",n)},Ec={greater_than:(e,t)=>oe(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ne(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ki(e,t.value),number_format:Di(we),bigint_format:Di(ft),min_length:Ci,max_length:Ni,length_equals:(e,t)=>Ri(e,t.length),min_size:Ci,max_size:Ni,size_equals:(e,t)=>Ri(e,t.size),string_format:(e,t)=>{if(Fi(e,t.format),t.pattern)Li(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>ji(e,t.mime)};function D(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)Ec[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)oe(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)oe(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)ne(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)ne(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Ki(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)ji(t,n.mime);for(let i of n.patterns??[])Li(t,i);return t}var Tc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ac=new Map([[Zt,uo],[Me,lo]]),Rc=(e)=>Ac.get(e)??e,Mi=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:p}=D(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=Tc[c]??c,n.format==="")delete n.format;if(c==="time"||p)delete n.format}if(u)n.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(Rc);if(f.length===1)n.pattern=f[0].source;else if(f.length>1)n.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Ui=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:p}=D(e);n.type=p?"integer":"number";let f=typeof u==="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)n.minimum=u,n.exclusiveMinimum=!0;else n.exclusiveMinimum=u;else if(typeof i==="number")n.minimum=i;if(d)if(m)n.maximum=a,n.exclusiveMaximum=!0;else n.exclusiveMaximum=a;else if(typeof s==="number")n.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else q(e,t,n,o,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...g]=h;if(_!==void 0)n.multipleOf=_;if(g.length)n.allOf=[...n.allOf??[],...g.map((b)=>({multipleOf:b}))]}};var Ji=(e,t,r,o)=>{r.not={}};var Bi=(e,t,r,o)=>{};var Wi=(e,t,r,o)=>{let n=e._zod.def,i=ue(n.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i};var Vi=(e,t,r,o)=>{q(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var Hi=(e,t,r,o)=>{q(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var Gi=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=D(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Z(i.element,t,{...o,path:[...o.path,"items"]})};function Gt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Gt(t.out);if(t.type==="catch")return Gt(t.innerType);return e._zod.optin}var Xi=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)j(n.properties,u,Z(s[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let p=i.shape[u];if(t.io==="input"?Gt(p)===void 0:p._zod.optout===void 0)a.push(u)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Z(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Yi=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>Z(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},qi=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=Z(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};var Qi=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},es=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Xt=Symbol();function ts(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return q(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Xt}var rs=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=ts(n.defaultValue,e,t,r,o);if(s!==Xt)r.default=s},os=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=ts(n.defaultValue,e,t,r,o);if(s!==Xt)r._prefault=s},ns=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{q(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},is=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;Z(s,t,o);let c=t.seen.get(e);c.ref=s},ss=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var Yt=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var cs=new WeakSet([Object.prototype,Error.prototype]);function qe(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var Mc=(e,t)=>{Nr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(cs.has(r))return;cs.add(r),qe(r,"format",(o)=>(n)=>Kr(o,n)),qe(r,"flatten",(o)=>(n)=>Dr(o,n)),qe(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,le,2)}),qe(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,le,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var R=l("ZodError",Mc,void 0,{Parent:Error});var as=Ae(R),us=Re(R),ls=Ce(R),ps=Ne(R),fs=jr(R),ds=Fr(R),ms=Mr(R),hs=Ur(R),ys=Jr(R),gs=Br(R),_s=Wr(R),xs=Vr(R);function Jc(){if(!A.localeError)N(At())}function er(){if(!A.memoizer)N({memoizer:Jn()})}var k=l("ZodType",(e,t)=>(Jc(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Fa(e,t))},superRefine(e,t){return this.check(Ma(e,t))},overwrite(e){return this.check(H(e))},optional(){return Ps(this)},exactOptional(){return Za(this)},nullable(){return zs(this)},nullish(){return Ps(zs(this))},nonoptional(e){return Ra(this,e)},array(){return xa(this)},or(e){return Pa([this,e])},and(e){return $a(this,e)},transform(e){return $s(this,Sa(e))},default(e){return Ea(this,e)},prefault(e){return Aa(this,e)},catch(e){return Na(this,e)},pipe(e){return $s(this,e)},readonly(){return La(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ee(this,"~standard",{...St(this),jsonSchema:{input:xe(this,"input"),output:xe(this,"output")}})},set "~standard"(e){B(this,"~standard",e)},parse:function e(t,r){return as(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await us(this,t,r,{callee:e})},safeParse(e,t){return ls(this,e,t)},async safeParseAsync(e,t){return ps(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B(this,"spa",e)},validate(e,t){return gt(this,e,t)},validateAsync(e,t){return _t(this,e,t)},encode:function e(t,r){return fs(this,t,r,{callee:e})},decode:function e(t,r){return ds(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ms(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await hs(this,t,r,{callee:e})},safeEncode(e,t){return ys(this,e,t)},safeDecode(e,t){return gs(this,e,t)},async safeEncodeAsync(e,t){return _s(this,e,t)},async safeDecodeAsync(e,t){return xs(this,e,t)},toJSONSchema(e){return Ai(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ws=l("_ZodString",(e,t)=>{Fe.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mi(e,r,o,n)},Ir({format:(e)=>D(e).format??null,minLength:(e)=>D(e).minimum??null,maxLength:(e)=>D(e).maximum??null},{regex(...e){return this.check(Rt(...e))},includes(...e){return this.check(Dt(...e))},startsWith(...e){return this.check(Kt(...e))},endsWith(...e){return this.check(Lt(...e))},min(...e){return this.check(re(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(Ye(...e))},nonempty(...e){return this.check(re(1,...e))},lowercase(e){return this.check(Ct(e))},uppercase(e){return this.check(Nt(e))},trim(){return this.check(Ft())},normalize(...e){return this.check(jt(...e))},toLowerCase(){return this.check(Mt())},toUpperCase(){return this.check(Ut())},slugify(){return this.check(Jt())}})),Bc=l("ZodString",(e,t)=>{Fe.init(e,t),ws.init(e,t)},{email(e){return this.check(Gn(Xc,e))},url(e){return this.check(ti(qc,e))},jwt(e){return this.check(yi(da,e))},emoji(e){return this.check(ri(Qc,e))},guid(e){return this.check(Xn(Yc,e))},uuid(e){return this.check(Yn(Qe,e))},uuidv4(e){return this.check(qn(Qe,e))},uuidv6(e){return this.check(Qn(Qe,e))},uuidv7(e){return this.check(ei(Qe,e))},nanoid(e){return this.check(oi(ea,e))},cuid(e){return this.check(ni(ta,e))},cuid2(e){return this.check(ii(ra,e))},ulid(e){return this.check(si(oa,e))},base64(e){return this.check(di(la,e))},base64url(e){return this.check(mi(pa,e))},xid(e){return this.check(ci(na,e))},ksuid(e){return this.check(ai(ia,e))},ipv4(e){return this.check(ui(sa,e))},ipv6(e){return this.check(li(ca,e))},cidrv4(e){return this.check(pi(aa,e))},cidrv6(e){return this.check(fi(ua,e))},e164(e){return this.check(hi(fa,e))},datetime(e){return this.check(gi(Wc,e))},date(e){return this.check(_i(Vc,e))},time(e){return this.check(xi(Hc,e))},duration(e){return this.check(bi(Gc,e))}});function et(e){return Hn(Bc,e)}var z=l("ZodStringFormat",(e,t)=>{P.init(e,t),ws.init(e,t)}),Wc=l("ZodISODateTime",(e,t)=>{sn.init(e,t),z.init(e,t)}),Vc=l("ZodISODate",(e,t)=>{cn.init(e,t),z.init(e,t)}),Hc=l("ZodISOTime",(e,t)=>{an.init(e,t),z.init(e,t)}),Gc=l("ZodISODuration",(e,t)=>{un.init(e,t),z.init(e,t)}),Xc=l("ZodEmail",(e,t)=>{Ho.init(e,t),z.init(e,t)});var Yc=l("ZodGUID",(e,t)=>{Wo.init(e,t),z.init(e,t)});var Qe=l("ZodUUID",(e,t)=>{Vo.init(e,t),z.init(e,t)});var qc=l("ZodURL",(e,t)=>{Yo.init(e,t),z.init(e,t)});var Qc=l("ZodEmoji",(e,t)=>{qo.init(e,t),z.init(e,t)});var ea=l("ZodNanoID",(e,t)=>{Qo.init(e,t),z.init(e,t)});var ta=l("ZodCUID",(e,t)=>{en.init(e,t),z.init(e,t)});var ra=l("ZodCUID2",(e,t)=>{tn.init(e,t),z.init(e,t)});var oa=l("ZodULID",(e,t)=>{rn.init(e,t),z.init(e,t)});var na=l("ZodXID",(e,t)=>{on.init(e,t),z.init(e,t)});var ia=l("ZodKSUID",(e,t)=>{nn.init(e,t),z.init(e,t)});var sa=l("ZodIPv4",(e,t)=>{ln.init(e,t),z.init(e,t)});var ca=l("ZodIPv6",(e,t)=>{fn.init(e,t),z.init(e,t)});var aa=l("ZodCIDRv4",(e,t)=>{dn.init(e,t),z.init(e,t)});var ua=l("ZodCIDRv6",(e,t)=>{mn.init(e,t),z.init(e,t)});var la=l("ZodBase64",(e,t)=>{yn.init(e,t),z.init(e,t)});var pa=l("ZodBase64URL",(e,t)=>{gn.init(e,t),z.init(e,t)});var fa=l("ZodE164",(e,t)=>{_n.init(e,t),z.init(e,t)});var da=l("ZodJWT",(e,t)=>{xn.init(e,t),z.init(e,t)});var ks=l("ZodNumber",(e,t)=>{Ot.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ui(e,r,o,n),e.isFinite=!0},Ir({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=D(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=D(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=D(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>D(e).format??null},{gt(e,t){return this.check(He(e,t))},gte(e,t){return this.check(ge(e,t))},min(e,t){return this.check(ge(e,t))},lt(e,t){return this.check(Ve(e,t))},lte(e,t){return this.check(ye(e,t))},max(e,t){return this.check(ye(e,t))},int(e){return this.check(bs(e))},safe(e){return this.check(bs(e))},positive(e){return this.check(He(0,e))},nonnegative(e){return this.check(ge(0,e))},negative(e){return this.check(Ve(0,e))},nonpositive(e){return this.check(ye(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Ss(e){return vi(ks,e)}var ma=l("ZodNumberFormat",(e,t)=>{bn.init(e,t),ks.init(e,t)});function bs(e){return Pi(ma,e)}var ha=l("ZodUnknown",(e,t)=>{vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bi(e,r,o,n)});function vs(){return zi(ha)}var ya=l("ZodNever",(e,t)=>{Pn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ji(e,r,o,n)});function ga(e){return $i(ya,e)}var _a=l("ZodArray",(e,t)=>{er(),zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gi(e,r,o,n),e.element=t.element},{min(e,t){return this.check(re(e,t))},nonempty(e){return this.check(re(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(Ye(e,t))},unwrap(){return this.element}});function xa(e,t){return wi(_a,e,t)}var ba=l("ZodObject",(e,t)=>{er(),kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xi(e,r,o,n),Xs(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return wa(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:vs()}))},loose(){return this.clone(T(this._zod.def,{catchall:vs()}))},strict(){return this.clone(T(this._zod.def,{catchall:ga()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return Ms(this,e)},safeExtend(e){return Us(this,e)},merge(e){return Js(this,e)},pick(e){return js(this,e)},omit(e){return Fs(this,e)},partial(...e){return kr(Zs,this,e[0])},exactPartial(...e){return kr(Os,this,e[0],"exactPartial")},required(...e){return Bs(Is,this,e[0])}});function tt(e,t){let r={type:"object",shape:e??{},...y(t)};return new ba(r)}var va=l("ZodUnion",(e,t)=>{Sn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yi(e,r,o,n),e.options=t.options});function Pa(e,t){return new va({type:"union",options:e,...y(t)})}var za=l("ZodIntersection",(e,t)=>{Zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qi(e,r,o,n)});function $a(e,t){return new za({type:"intersection",left:e,right:t})}var Qt=l("ZodEnum",(e,t)=>{On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Wi(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Qt({...t,checks:[],...y(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Qt({...t,checks:[],...y(n),entries:i})}});function wa(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Qt({type:"enum",entries:r,...y(t)})}var ka=l("ZodTransform",(e,t)=>{er(),In.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hi(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new pe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(X(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(X(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r));return r.value=n,r}});function Sa(e){return new ka({type:"transform",transform:e})}var Zs=l("ZodOptional",(e,t)=>{It.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ps(e){return new Zs({type:"optional",innerType:e})}var Os=l("ZodExactOptional",(e,t)=>{En.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Za(e){return new Os({type:"optional",innerType:e})}var Oa=l("ZodNullable",(e,t)=>{Tn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function zs(e){return new Oa({type:"nullable",innerType:e})}var Ia=l("ZodDefault",(e,t)=>{An.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ea(e,t){return new Ia({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():lt(t)}})}var Ta=l("ZodPrefault",(e,t)=>{Rn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>os(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Aa(e,t){return new Ta({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():lt(t)}})}var Is=l("ZodNonOptional",(e,t)=>{Cn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>es(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ra(e,t){return new Is({type:"nonoptional",innerType:e,...y(t)})}var Ca=l("ZodCatch",(e,t)=>{Nn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ns(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Na(e,t){return new Ca({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Er(t)})}var Da=l("ZodPipe",(e,t)=>{Dn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>is(e,r,o,n),e.in=t.in,e.out=t.out});function $s(e,t){return new Da({type:"pipe",in:e,out:t})}var Ka=l("ZodReadonly",(e,t)=>{Kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ss(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ka({type:"readonly",innerType:e})}var ja=l("ZodCustom",(e,t)=>{Ln.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vi(e,r,o,n)});function Fa(e,t={}){return ki(ja,e,t)}function Ma(e,t){return Si(e,t)}var be=tt({mode:Ss().optional()});import{mkdir as Ua,open as Ja}from"fs/promises";import{dirname as Ba}from"path";function Es(e){return{async write(t){await Ua(Ba(e),{recursive:!0});let r=await Ja(e,"w");try{let o=[];for await(let n of t)o.push((async()=>{let i=n.stream.getReader(),s=n.offset;for(;;){let{done:c,value:a}=await i.read();if(c)break;let u=a.payload.data;await r.write(u,0,u.byteLength,s),s+=u.byteLength}await n.complete()})());await Promise.all(o)}finally{await r.close()}}}}import{createReadStream as Wa}from"fs";import{Readable as Va}from"stream";function Ts(e,t,r){if(r!==void 0&&r<=t)return new ReadableStream({start(n){n.close()}});let o=Wa(e,{start:t,end:r===void 0?void 0:r-1});return dr(Va.toWeb(o))}function As(e){return{kind:"js",stream:Ts(e,0),async readRange(t,r){return Ts(e,t,r)}}}import{createWriteStream as Ha}from"fs";import{mkdir as Ga,stat as Xa}from"fs/promises";import{dirname as Ya}from"path";async function qa(e){try{return(await Xa(e)).size}catch(t){if(t.code==="ENOENT")return 0;throw t}}async function Rs(e,t){await Ga(Ya(e),{recursive:!0});let r=t?await qa(e):0,o=Ha(e,{flags:t?"a":"w"});o.on("error",()=>{});let n=r,i=new WritableStream({write(s){return new Promise((c,a)=>{o.write(s.payload.data,(u)=>{if(u){a(u);return}n+=s.payload.data.byteLength,c()})})},close(){return new Promise((s,c)=>{o.end((a)=>a?c(a):s())})},abort(){return new Promise((s)=>{o.once("close",()=>s()),o.destroy()})}});return{kind:"js",stream:i,startOffset:r,resumeToken:()=>({offset:n})}}import{stat as Qa}from"fs/promises";async function tr(e){let t=await Qa(e),r=t.isDirectory();return{size:r?void 0:t.size,lastModified:t.mtime,isContainer:r,properties:{mode:t.mode}}}import{readdir as eu}from"fs/promises";import{join as tu}from"path";async function*rr(e,t,r){let o=await eu(tu(e,t),{withFileTypes:!0});for(let n of o){let i=t?`${t}/${n.name}`:n.name;if(yield i,n.isDirectory()&&r)yield*rr(e,i,r)}}var su=8388608;class ve{kind="js";rootPath;constructor(e=""){this.rootPath=e===""?"":iu(e)}async[Symbol.asyncDispose](){}async createContainer(e){await or(E(this.rootPath,e),{recursive:!0})}joinKey(e,t){return ot(e,t)}list(e,t){let r=this.rootPath,o=E(r,e);async function*n(){for await(let i of rr(o,"",t?.recursive??!1)){if(t?.regex&&!t.regex.test(i))continue;let s=await tr(ot(o,i));yield{path:i,properties:s}}}return n()}async getProperties(e){return tr(E(this.rootPath,e))}async setProperties(e,t){let r=E(this.rootPath,e),o=be.parse(t.properties??{});if(o.mode!==void 0)await ru(r,o.mode);if(t.lastModified!==void 0)await nu(r,t.lastModified,t.lastModified)}async delete(e){await Ns(E(this.rootPath,e),{recursive:!0,force:!1})}async getReadableStream(e){return As(E(this.rootPath,e))}async getWritableStream(e,t){return Rs(E(this.rootPath,e),t?.resume)}getPartSizeConstraints(e){return{minPartSize:0,maxPartSize:1/0,maxParts:1/0,defaultPartSize:su}}getMultipartWriter(e,t){return Es(E(this.rootPath,e))}canDirectTransfer(e){return e instanceof ve&&e.rootPath===this.rootPath}supportsRecursiveDirectTransfer=!0;async directCopy(e,t,r){let o=E(this.rootPath,t);await or(ot(o,".."),{recursive:!0}),await Cs(E(this.rootPath,e),o,{recursive:!0})}async directMove(e,t,r){let o=E(this.rootPath,e),n=E(this.rootPath,t);await or(ot(n,".."),{recursive:!0});try{await ou(o,n)}catch(i){if(i.code==="EXDEV"){await Cs(o,n,{recursive:!0}),await Ns(o,{recursive:!0,force:!1});return}throw i}}}import{fileURLToPath as cu}from"url";function nr(e){if(/^file:/i.test(e))return{path:cu(new URL(e))};return{path:e}}import{join as au}from"path";function ir(e){let t={rootPath:""};if(e.filename!==void 0)return{config:t,target:{kind:"entry",key:au(e.path,e.filename)}};if(e.pattern!==void 0)return{config:t,target:{kind:"pattern",containerKey:e.path,pattern:e.pattern}};return{config:t,target:{kind:"container",key:e.path}}}var sr=tt({rootPath:et().optional()});var cr=tt({path:et().default("/"),filename:et().optional(),pattern:et().optional()}).refine((e)=>e.filename===void 0||e.pattern===void 0,{message:"filename and pattern are mutually exclusive"});var ar=tt({mode:Ss().optional()});var ur={protocol:"file",kind:"js",configSchema:sr,locationSchema:cr,propertySchema:ar,settablePropertySchema:be,parseLocationString:nr,toProviderInputs:ir,async createProvider(e){return new ve(e.rootPath)}};var uu={create:()=>Promise.resolve(ur)},lu={extensionPoint:fr,factory:uu},pu={extensionDescriptors:[lu]},fu=pu;export{ve as FilesystemIOProvider,fu as default,sr as filesystemConfigSchema,ur as filesystemIOProviderFactory,cr as filesystemLocationSchema,ar as filesystemPropertySchema,be as filesystemSettablePropertySchema,nr as parseFileLocationString,ir as toFileProviderInputs};
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Ri(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;Ri(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Ci=new Set(["type","properties","required","additionalProperties"]),Ti=["oneOf","anyOf"];function Ai(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Bt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Ci.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let p=u.properties?.[s]??Ai(u);if(p===null||p===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(p)))c.push(p)}let a=c.length===1?c[0]:Bt(c)??{allOf:c};j(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=Ai(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function Dc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Ci)if(n in e)return;let r=t.filter((n)=>Ti.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=Bt(t);else{let n=r[0],i=Ti.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>Bt([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,_e(e,o)}function Ht(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,p={...u},f=a.ref;if(a.ref=null,f){o(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else _e(u,h);if(_e(u,p),c._zod.parent===f)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in p))delete u[y]}if(h.$ref&&m.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y]))delete u[y]}}let d=c._zod.parent;if(d&&d!==f){o(d);let m=e.seen.get(d);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Ri(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let p=u?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);if(f)f.push(u);else c.set(p,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Dc(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}_e(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;j(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:xe(t,"input",e.processors),output:xe(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function I(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return I(o.element,r);if(o.type==="set")return I(o.valueType,r);if(o.type==="lazy")return I(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return I(o.innerType,r);if(o.type==="intersection")return I(o.left,r)||I(o.right,r);if(o.type==="record"||o.type==="map")return I(o.keyType,r)||I(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(o.in,r)||I(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(I(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(I(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(I(n,r))return!0;if(o.rest&&I(o.rest,r))return!0;return!1}return!1}var Ni=(e,t={})=>(r)=>{let o=Wt({...r,processors:t});return Z(e,o),Vt(o,e),Ht(o,e)},xe=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Wt({...n??{},target:i,io:t,processors:r});return Z(e,s),Vt(s,e),Ht(s,e)};var oe=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ne=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Di=(e,t)=>{oe(e,"minimum",t),ne(e,"maximum",t)},Fi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Mi=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Ui=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ji=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ki=(e,t)=>oe(e,"minimum",t.minimum),Li=(e,t)=>ne(e,"maximum",t.maximum),ji=(e)=>(t,r)=>{Ji(t,r.format);let[o,n]=e[r.format];oe(t,"minimum",o),ne(t,"maximum",n)},Kc={greater_than:(e,t)=>oe(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ne(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Fi(e,t.value),number_format:ji(we),bigint_format:ji(ft),min_length:Ki,max_length:Li,length_equals:(e,t)=>Di(e,t.length),min_size:Ki,max_size:Li,size_equals:(e,t)=>Di(e,t.size),string_format:(e,t)=>{if(Ji(e,t.format),t.pattern)Mi(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Ui(e,t.mime)};function D(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)Kc[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)oe(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)oe(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)ne(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)ne(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Fi(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Ui(t,n.mime);for(let i of n.patterns??[])Mi(t,i);return t}var Lc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jc=new Map([[Zt,fo],[Me,mo]]),Fc=(e)=>jc.get(e)??e,Bi=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:p}=D(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=Lc[c]??c,n.format==="")delete n.format;if(c==="time"||p)delete n.format}if(u)n.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(Fc);if(f.length===1)n.pattern=f[0].source;else if(f.length>1)n.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Wi=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:p}=D(e);n.type=p?"integer":"number";let f=typeof u==="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)n.minimum=u,n.exclusiveMinimum=!0;else n.exclusiveMinimum=u;else if(typeof i==="number")n.minimum=i;if(d)if(m)n.maximum=a,n.exclusiveMaximum=!0;else n.exclusiveMaximum=a;else if(typeof s==="number")n.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else q(e,t,n,o,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...y]=h;if(_!==void 0)n.multipleOf=_;if(y.length)n.allOf=[...n.allOf??[],...y.map((b)=>({multipleOf:b}))]}};var Vi=(e,t,r,o)=>{r.not={}};var Hi=(e,t,r,o)=>{};var Gi=(e,t,r,o)=>{let n=e._zod.def,i=ue(n.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i};var Xi=(e,t,r,o)=>{q(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var Yi=(e,t,r,o)=>{q(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var qi=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=D(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Z(i.element,t,{...o,path:[...o.path,"items"]})};function Gt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Gt(t.out);if(t.type==="catch")return Gt(t.innerType);return e._zod.optin}var Qi=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)j(n.properties,u,Z(s[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let p=i.shape[u];if(t.io==="input"?Gt(p)===void 0:p._zod.optout===void 0)a.push(u)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Z(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},es=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>Z(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},ts=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=Z(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};var rs=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},os=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Xt=Symbol();function ns(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return q(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Xt}var is=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=ns(n.defaultValue,e,t,r,o);if(s!==Xt)r.default=s},ss=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=ns(n.defaultValue,e,t,r,o);if(s!==Xt)r._prefault=s},cs=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{q(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},as=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;Z(s,t,o);let c=t.seen.get(e);c.ref=s},us=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var Yt=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var ls=new WeakSet([Object.prototype,Error.prototype]);function qe(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var Gc=(e,t)=>{Lr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ls.has(r))return;ls.add(r),qe(r,"format",(o)=>(n)=>Fr(o,n)),qe(r,"flatten",(o)=>(n)=>jr(o,n)),qe(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,le,2)}),qe(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,le,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var R=l("ZodError",Gc,void 0,{Parent:Error});var ps=Ae(R),fs=Re(R),ds=Ce(R),ms=Ne(R),hs=Ur(R),gs=Jr(R),ys=Br(R),_s=Wr(R),xs=Vr(R),bs=Hr(R),vs=Gr(R),Ps=Xr(R);function Yc(){if(!A.localeError)N(At())}function er(){if(!A.memoizer)N({memoizer:Vn()})}var k=l("ZodType",(e,t)=>(Yc(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ha(e,t))},superRefine(e,t){return this.check(Ga(e,t))},overwrite(e){return this.check(H(e))},optional(){return ws(this)},exactOptional(){return Ca(this)},nullable(){return ks(this)},nullish(){return ws(ks(this))},nonoptional(e){return Fa(this,e)},array(){return ka(this)},or(e){return Oa([this,e])},and(e){return Ea(this,e)},transform(e){return Ss(this,Ra(e))},default(e){return Ka(this,e)},prefault(e){return ja(this,e)},catch(e){return Ua(this,e)},pipe(e){return Ss(this,e)},readonly(){return Wa(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ee(this,"~standard",{...St(this),jsonSchema:{input:xe(this,"input"),output:xe(this,"output")}})},set "~standard"(e){B(this,"~standard",e)},parse:function e(t,r){return ps(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await fs(this,t,r,{callee:e})},safeParse(e,t){return ds(this,e,t)},async safeParseAsync(e,t){return ms(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B(this,"spa",e)},validate(e,t){return yt(this,e,t)},validateAsync(e,t){return _t(this,e,t)},encode:function e(t,r){return hs(this,t,r,{callee:e})},decode:function e(t,r){return gs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ys(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await _s(this,t,r,{callee:e})},safeEncode(e,t){return xs(this,e,t)},safeDecode(e,t){return bs(this,e,t)},async safeEncodeAsync(e,t){return vs(this,e,t)},async safeDecodeAsync(e,t){return Ps(this,e,t)},toJSONSchema(e){return Ni(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),Zs=l("_ZodString",(e,t)=>{Fe.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bi(e,r,o,n)},Ar({format:(e)=>D(e).format??null,minLength:(e)=>D(e).minimum??null,maxLength:(e)=>D(e).maximum??null},{regex(...e){return this.check(Rt(...e))},includes(...e){return this.check(Dt(...e))},startsWith(...e){return this.check(Kt(...e))},endsWith(...e){return this.check(Lt(...e))},min(...e){return this.check(re(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(Ye(...e))},nonempty(...e){return this.check(re(1,...e))},lowercase(e){return this.check(Ct(e))},uppercase(e){return this.check(Nt(e))},trim(){return this.check(Ft())},normalize(...e){return this.check(jt(...e))},toLowerCase(){return this.check(Mt())},toUpperCase(){return this.check(Ut())},slugify(){return this.check(Jt())}})),qc=l("ZodString",(e,t)=>{Fe.init(e,t),Zs.init(e,t)},{email(e){return this.check(qn(oa,e))},url(e){return this.check(ni(ia,e))},jwt(e){return this.check(xi(ba,e))},emoji(e){return this.check(ii(sa,e))},guid(e){return this.check(Qn(na,e))},uuid(e){return this.check(ei(Qe,e))},uuidv4(e){return this.check(ti(Qe,e))},uuidv6(e){return this.check(ri(Qe,e))},uuidv7(e){return this.check(oi(Qe,e))},nanoid(e){return this.check(si(ca,e))},cuid(e){return this.check(ci(aa,e))},cuid2(e){return this.check(ai(ua,e))},ulid(e){return this.check(ui(la,e))},base64(e){return this.check(gi(ya,e))},base64url(e){return this.check(yi(_a,e))},xid(e){return this.check(li(pa,e))},ksuid(e){return this.check(pi(fa,e))},ipv4(e){return this.check(fi(da,e))},ipv6(e){return this.check(di(ma,e))},cidrv4(e){return this.check(mi(ha,e))},cidrv6(e){return this.check(hi(ga,e))},e164(e){return this.check(_i(xa,e))},datetime(e){return this.check(bi(Qc,e))},date(e){return this.check(vi(ea,e))},time(e){return this.check(Pi(ta,e))},duration(e){return this.check(zi(ra,e))}});function et(e){return Yn(qc,e)}var z=l("ZodStringFormat",(e,t)=>{P.init(e,t),Zs.init(e,t)}),Qc=l("ZodISODateTime",(e,t)=>{un.init(e,t),z.init(e,t)}),ea=l("ZodISODate",(e,t)=>{ln.init(e,t),z.init(e,t)}),ta=l("ZodISOTime",(e,t)=>{pn.init(e,t),z.init(e,t)}),ra=l("ZodISODuration",(e,t)=>{fn.init(e,t),z.init(e,t)}),oa=l("ZodEmail",(e,t)=>{Yo.init(e,t),z.init(e,t)});var na=l("ZodGUID",(e,t)=>{Go.init(e,t),z.init(e,t)});var Qe=l("ZodUUID",(e,t)=>{Xo.init(e,t),z.init(e,t)});var ia=l("ZodURL",(e,t)=>{en.init(e,t),z.init(e,t)});var sa=l("ZodEmoji",(e,t)=>{tn.init(e,t),z.init(e,t)});var ca=l("ZodNanoID",(e,t)=>{rn.init(e,t),z.init(e,t)});var aa=l("ZodCUID",(e,t)=>{on.init(e,t),z.init(e,t)});var ua=l("ZodCUID2",(e,t)=>{nn.init(e,t),z.init(e,t)});var la=l("ZodULID",(e,t)=>{sn.init(e,t),z.init(e,t)});var pa=l("ZodXID",(e,t)=>{cn.init(e,t),z.init(e,t)});var fa=l("ZodKSUID",(e,t)=>{an.init(e,t),z.init(e,t)});var da=l("ZodIPv4",(e,t)=>{dn.init(e,t),z.init(e,t)});var ma=l("ZodIPv6",(e,t)=>{hn.init(e,t),z.init(e,t)});var ha=l("ZodCIDRv4",(e,t)=>{gn.init(e,t),z.init(e,t)});var ga=l("ZodCIDRv6",(e,t)=>{yn.init(e,t),z.init(e,t)});var ya=l("ZodBase64",(e,t)=>{xn.init(e,t),z.init(e,t)});var _a=l("ZodBase64URL",(e,t)=>{bn.init(e,t),z.init(e,t)});var xa=l("ZodE164",(e,t)=>{vn.init(e,t),z.init(e,t)});var ba=l("ZodJWT",(e,t)=>{Pn.init(e,t),z.init(e,t)});var Os=l("ZodNumber",(e,t)=>{Ot.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wi(e,r,o,n),e.isFinite=!0},Ar({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=D(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=D(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=D(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>D(e).format??null},{gt(e,t){return this.check(He(e,t))},gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},lt(e,t){return this.check(Ve(e,t))},lte(e,t){return this.check(ge(e,t))},max(e,t){return this.check(ge(e,t))},int(e){return this.check(zs(e))},safe(e){return this.check(zs(e))},positive(e){return this.check(He(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ve(0,e))},nonpositive(e){return this.check(ge(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Is(e){return $i(Os,e)}var va=l("ZodNumberFormat",(e,t)=>{zn.init(e,t),Os.init(e,t)});function zs(e){return wi(va,e)}var Pa=l("ZodUnknown",(e,t)=>{$n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hi(e,r,o,n)});function $s(){return ki(Pa)}var za=l("ZodNever",(e,t)=>{wn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vi(e,r,o,n)});function $a(e){return Si(za,e)}var wa=l("ZodArray",(e,t)=>{er(),kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qi(e,r,o,n),e.element=t.element},{min(e,t){return this.check(re(e,t))},nonempty(e){return this.check(re(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(Ye(e,t))},unwrap(){return this.element}});function ka(e,t){return Zi(wa,e,t)}var Sa=l("ZodObject",(e,t)=>{er(),On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qi(e,r,o,n),oc(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ta(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:$s()}))},loose(){return this.clone(T(this._zod.def,{catchall:$s()}))},strict(){return this.clone(T(this._zod.def,{catchall:$a()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return Gs(this,e)},safeExtend(e){return Xs(this,e)},merge(e){return Ys(this,e)},pick(e){return Vs(this,e)},omit(e){return Hs(this,e)},partial(...e){return Or(Es,this,e[0])},exactPartial(...e){return Or(Ts,this,e[0],"exactPartial")},required(...e){return qs(As,this,e[0])}});function tt(e,t){let r={type:"object",shape:e??{},...g(t)};return new Sa(r)}var Za=l("ZodUnion",(e,t)=>{In.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>es(e,r,o,n),e.options=t.options});function Oa(e,t){return new Za({type:"union",options:e,...g(t)})}var Ia=l("ZodIntersection",(e,t)=>{En.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ts(e,r,o,n)});function Ea(e,t){return new Ia({type:"intersection",left:e,right:t})}var Qt=l("ZodEnum",(e,t)=>{Tn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Gi(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Qt({...t,checks:[],...g(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Qt({...t,checks:[],...g(n),entries:i})}});function Ta(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Qt({type:"enum",entries:r,...g(t)})}var Aa=l("ZodTransform",(e,t)=>{er(),An.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yi(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new pe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(X(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(X(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r));return r.value=n,r}});function Ra(e){return new Aa({type:"transform",transform:e})}var Es=l("ZodOptional",(e,t)=>{It.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ws(e){return new Es({type:"optional",innerType:e})}var Ts=l("ZodExactOptional",(e,t)=>{Rn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ca(e){return new Ts({type:"optional",innerType:e})}var Na=l("ZodNullable",(e,t)=>{Cn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ks(e){return new Na({type:"nullable",innerType:e})}var Da=l("ZodDefault",(e,t)=>{Nn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>is(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ka(e,t){return new Da({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():lt(t)}})}var La=l("ZodPrefault",(e,t)=>{Dn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ss(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ja(e,t){return new La({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():lt(t)}})}var As=l("ZodNonOptional",(e,t)=>{Kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>os(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Fa(e,t){return new As({type:"nonoptional",innerType:e,...g(t)})}var Ma=l("ZodCatch",(e,t)=>{Ln.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ua(e,t){return new Ma({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Rr(t)})}var Ja=l("ZodPipe",(e,t)=>{jn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>as(e,r,o,n),e.in=t.in,e.out=t.out});function Ss(e,t){return new Ja({type:"pipe",in:e,out:t})}var Ba=l("ZodReadonly",(e,t)=>{Fn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>us(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Wa(e){return new Ba({type:"readonly",innerType:e})}var Va=l("ZodCustom",(e,t)=>{Mn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xi(e,r,o,n)});function Ha(e,t={}){return Oi(Va,e,t)}function Ga(e,t){return Ii(e,t)}var be=tt({mode:Is().optional()});import{mkdir as Xa,open as Ya}from"fs/promises";import{dirname as qa}from"path";function Rs(e){return{async write(t){await Xa(qa(e),{recursive:!0});let r=await Ya(e,"w");try{let o=[];for await(let n of t)o.push((async()=>{let i=n.stream.getReader(),s=n.offset;for(;;){let{done:c,value:a}=await i.read();if(c)break;let u=a.payload.data;await r.write(u,0,u.byteLength,s),s+=u.byteLength}await n.complete()})());await Promise.all(o)}finally{await r.close()}}}}import{createReadStream as Qa}from"fs";import{Readable as eu}from"stream";function Cs(e,t,r){if(r!==void 0&&r<=t)return new ReadableStream({start(n){n.close()}});let o=Qa(e,{start:t,end:r===void 0?void 0:r-1});return dr(eu.toWeb(o))}function Ns(e){return{kind:"js",stream:Cs(e,0),async readRange(t,r){return Cs(e,t,r)}}}import{createWriteStream as tu}from"fs";import{mkdir as ru,stat as ou}from"fs/promises";import{dirname as nu}from"path";async function iu(e){try{return(await ou(e)).size}catch(t){if(t.code==="ENOENT")return 0;throw t}}async function Ds(e,t){await ru(nu(e),{recursive:!0});let r=t?await iu(e):0,o=tu(e,{flags:t?"a":"w"});o.on("error",()=>{});let n=r,i=new WritableStream({write(s){return new Promise((c,a)=>{o.write(s.payload.data,(u)=>{if(u){a(u);return}n+=s.payload.data.byteLength,c()})})},close(){return new Promise((s,c)=>{o.end((a)=>a?c(a):s())})},abort(){return new Promise((s)=>{o.once("close",()=>s()),o.destroy()})}});return{kind:"js",stream:i,startOffset:r,resumeToken:()=>({offset:n})}}import{stat as su}from"fs/promises";async function tr(e){let t=await su(e),r=t.isDirectory();return{size:r?void 0:t.size,lastModified:t.mtime,isContainer:r,properties:{mode:t.mode}}}import{readdir as cu}from"fs/promises";import{join as au}from"path";async function*rr(e,t,r){let o=await cu(au(e,t),{withFileTypes:!0});for(let n of o){let i=t?`${t}/${n.name}`:n.name;if(yield i,n.isDirectory()&&r)yield*rr(e,i,r)}}var du=8388608;class ve{kind="js";rootPath;constructor(e=""){this.rootPath=e===""?"":fu(e)}async[Symbol.asyncDispose](){}async createContainer(e){await or(E(this.rootPath,e),{recursive:!0})}joinKey(e,t){return ot(e,t)}list(e,t){let r=this.rootPath,o=E(r,e);async function*n(){for await(let i of rr(o,"",t?.recursive??!1)){if(t?.regex&&!t.regex.test(i))continue;let s=await tr(ot(o,i));yield{path:i,properties:s}}}return n()}async getProperties(e){return tr(E(this.rootPath,e))}async setProperties(e,t){let r=E(this.rootPath,e),o=be.parse(t.properties??{});if(o.mode!==void 0)await uu(r,o.mode);if(t.lastModified!==void 0)await pu(r,t.lastModified,t.lastModified)}async delete(e){await Ls(E(this.rootPath,e),{recursive:!0,force:!1})}async getReadableStream(e){return Ns(E(this.rootPath,e))}async getWritableStream(e,t){return Ds(E(this.rootPath,e),t?.resume)}getPartSizeConstraints(e){return{minPartSize:0,maxPartSize:1/0,maxParts:1/0,defaultPartSize:du}}getMultipartWriter(e,t){return Rs(E(this.rootPath,e))}canDirectTransfer(e){return e instanceof ve&&e.rootPath===this.rootPath}supportsRecursiveDirectTransfer=!0;async directCopy(e,t,r){let o=E(this.rootPath,t);await or(ot(o,".."),{recursive:!0}),await Ks(E(this.rootPath,e),o,{recursive:!0})}async directMove(e,t,r){let o=E(this.rootPath,e),n=E(this.rootPath,t);await or(ot(n,".."),{recursive:!0});try{await lu(o,n)}catch(i){if(i.code==="EXDEV"){await Ks(o,n,{recursive:!0}),await Ls(o,{recursive:!0,force:!1});return}throw i}}}import{fileURLToPath as mu}from"url";function nr(e){if(/^file:/i.test(e))return{path:mu(new URL(e))};return{path:e}}import{join as hu}from"path";function ir(e){let t={rootPath:""};if(e.filename!==void 0)return{config:t,target:{kind:"entry",key:hu(e.path,e.filename)}};if(e.pattern!==void 0)return{config:t,target:{kind:"pattern",containerKey:e.path,pattern:e.pattern}};return{config:t,target:{kind:"container",key:e.path}}}var sr=tt({rootPath:et().optional()});var cr=tt({path:et().default("/"),filename:et().optional(),pattern:et().optional()}).refine((e)=>e.filename===void 0||e.pattern===void 0,{message:"filename and pattern are mutually exclusive"});var ar=tt({mode:Is().optional()});var ur={protocol:"file",kind:"js",configSchema:sr,locationSchema:cr,propertySchema:ar,settablePropertySchema:be,parseLocationString:nr,toProviderInputs:ir,async createProvider(e){return new ve(e.rootPath)}};var gu={create:()=>Promise.resolve(ur)},yu={extensionPoint:fr,factory:gu},_u={extensionDescriptors:[yu]},xu=_u;export{ve as FilesystemIOProvider,xu as default,sr as filesystemConfigSchema,ur as filesystemIOProviderFactory,cr as filesystemLocationSchema,ar as filesystemPropertySchema,be as filesystemSettablePropertySchema,nr as parseFileLocationString,ir as toFileProviderInputs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/io-plugin-filesystem",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Local filesystem source/sink plugin for https://github.com/flowscripter/pluggable-io-framework",
5
5
  "keywords": [
6
6
  "bun",