@flowscripter/io-plugin-filesystem 1.0.7 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +15 -10
  2. package/dist/bundle.js +28 -33
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -15,21 +15,26 @@
15
15
  - Implements the `IOProviderFactory`/`IOProvider` contract from
16
16
  [pluggable-io-framework-api](https://github.com/flowscripter/pluggable-io-framework-api)
17
17
  for the local filesystem - both source and sink.
18
- - Config: `{ rootPath: string }` (validated with Zod). All paths passed to
19
- provider methods are resolved and sandboxed against `rootPath` - a path
20
- that would escape it is rejected. `rootPath: ""` is an explicit sentinel
21
- for "no restriction" (full filesystem access), since POSIX `"/"` isn't a
18
+ - Config: `{ rootPath?: string }` (validated with Zod) - `rootPath` is
19
+ optional, defaulting to `""`. All paths passed to provider methods are
20
+ resolved and sandboxed against `rootPath` - a path that would escape it is
21
+ rejected. `rootPath: ""` (or omitted) is an explicit sentinel for "no
22
+ restriction" (full filesystem access), since POSIX `"/"` isn't a
22
23
  meaningful "everything" root on Windows (multiple drive letters, no
23
24
  single filesystem root).
24
25
  - `list` (recursive, regex-filterable), `getProperties`/`setProperties`
25
26
  (size/lastModified/isFolder plus a `mode` extension property),
26
- `delete`, plain readable/writable streams, and multipart read/write
27
- (concurrent byte-range parts written directly to file offsets via a
28
- single shared file handle).
27
+ `delete`, `createFolder`, plain readable/writable streams, and multipart
28
+ read/write (concurrent byte-range parts written directly to file offsets
29
+ via a single shared file handle) at a caller-supplied part size -
30
+ `getPartSizeConstraints` reports unconstrained bounds with an 8MB default,
31
+ since the local filesystem imposes no real part-size limits.
29
32
  - `canDirectTransfer`/`directCopy`/`directMove`: two `FilesystemIOProvider`
30
- instances with the same `rootPath` copy/move directly (`copyFile`/
31
- `rename`, with an `EXDEV` cross-device fallback to copy+unlink) instead of
32
- streaming.
33
+ instances with the same `rootPath` copy/move directly (`cp`/`rename`, with
34
+ an `EXDEV` cross-device fallback to recursive copy+delete) instead of
35
+ streaming. `supportsRecursiveDirectTransfer` is `true` - a folder
36
+ `sourcePath` is copied/moved recursively in one `directCopy`/`directMove`
37
+ call, preserving empty subfolders.
33
38
  - Bundled (`bun build --target bun`) as a single-file plugin, loaded by
34
39
  `dynamic-plugin-framework` via `import()` - proven end to end in this
35
40
  repo's tests via a real `LocalFolderPluginRepository`, not just
package/dist/bundle.js CHANGED
@@ -1,40 +1,40 @@
1
1
  // @bun
2
- function Qe(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:n,value:o}=await t.read();if(n){r.close();return}r.enqueue({kind:"js",data:o})},cancel(r){return t.cancel(r)}})}var tr="@flowscripter/pluggable-io-framework/provider-factory";function ae(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function tt(e,t="|"){return e.map((r)=>ot(r)).join(t)}function le(e,t){if(typeof t==="bigint")return t.toString();return t}class nr{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 ze(e){return new nr(e)}function or(e){return e===null||e===void 0}function $e(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ir(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function L(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ke(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function J(e){return ke(e._zod.def)??e._zod.def.shape}function sr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return L(this,t,n),n},enumerable:!0,configurable:!0})}function cr(e,t,r){if(t in e)L(e,t,r);else e[t]=r}function q(e,t,r,n){let o=J(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)sr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else cr(e,i,n?n(s.value,i):s.value)}}function Os(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)sr(e,r,()=>t[r]);else cr(e,r,n.value)}}function C(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ur(e){return JSON.stringify(e)}function ar(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var rt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var lr=ze(()=>{if(E.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Q(e){if(ue(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(ue(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function nt(e){if(Q(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 pr=new Set(["string","number","symbol"]);function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}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 ot(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function fr(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]}))(),it={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Is(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return q(i,e,Pe(e,t)),M(e,C(r,{shape:i,checks:[]}))}function Pe(e,t){let r=J(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Es(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Pe(e,t)),s={};return q(s,e,Reflect.ownKeys(J(e)).filter((c)=>!i.has(c))),M(e,C(r,{shape:s,checks:[]}))}function Cs(e,t){if(!Q(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=J(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,C(e._zod.def,{shape:dr(e,t)}))}function dr(e,t){let r={};return q(r,e,Reflect.ownKeys(J(e))),Os(r,t),r}function As(e,t){if(!Q(t))throw Error("Invalid input to safeExtend: expected a plain object");return M(e,C(e._zod.def,{shape:dr(e,t)}))}function Ts(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={};q(r,e,Reflect.ownKeys(J(e))),q(r,t,Reflect.ownKeys(J(t)));let n=C(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return M(e,n)}function mr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Pe(t,r)):void 0,u={};return q(u,t,Reflect.ownKeys(J(t)),e&&((a,p)=>c&&!c.has(p)?a:new e({type:"optional",innerType:a}))),M(t,C(t._zod.def,{shape:u,checks:[]}))}function Rs(e,t,r){let n=r?new Set(Pe(t,r)):void 0,o={};return q(o,t,Reflect.ownKeys(J(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),M(t,C(t._zod.def,{shape:o}))}function U(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 hr(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 pe(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ce(e){return typeof e==="string"?e:e?.message}function st(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function W(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.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 u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Ns=/[\uD800-\uDBFF]/;function Ze(e){let t=e.length;if(!Ns.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Se(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function gr(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 H(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function _r(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else rr(e,r,n.value)}for(let r of Object.getOwnPropertySymbols(t))rr(e,r,t[r])}function B(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ct(e,t,r){return B(e,t,r,!1)}function yr(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return B(this,r,n(this))},set(o){B(this,r,o)}})}return t}function rr(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:B(this,t,r.bind(this))},set(n){B(this,t,n)}})}function js(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var et,V=!1,Ds={configurable:!0,get(){V=!0;return}};function x(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&et!==e._zod){et=void 0;return}et=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ds);let o=V;V=!1;try{let i=r(this);if(V)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return V=V||o,i}catch(i){throw delete this[t],V=V||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Fs(e,t,r,n){let o=js(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,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:n,value:i})}})}var Ls="~constantCatch";function xr(e){let t=()=>e;return t[Ls]=!0,t}var br;var ut={value:void 0,enumerable:!1},vr="captureStackTrace"in Error?Error:null;function Ms(e){let t=vr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return vr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){ut.value=new i(m);try{Object.defineProperty(d,"_zod",ut)}finally{ut.value=void 0}}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 D=b??_;if(!c.has(D))c.add(D),_r(D,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let a=n?.Parent??Object;class p extends a{}Object.defineProperty(p,"name",{value:e});function f(d){let m=n?.Parent?Ms(p):this;u(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:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class K extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(br=globalThis).__zod_globalConfig??(br.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function N(e){if(e)Object.assign(E,e);return E}function Us(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,le,2)),e.message}function Ks(e){this._zod.message=e}var Js={get:Us,set:Ks,enumerable:!0,configurable:!0},lt={value:void 0,enumerable:!1},zr=new WeakSet([Object.prototype,Error.prototype]),$r=(e,t)=>{e.name="$ZodError",lt.value=t,Object.defineProperty(e,"issues",lt),lt.value=void 0,Object.defineProperty(e,"message",Js);let r=Object.getPrototypeOf(e);if(!zr.has(r))zr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},kr=l("$ZodError",$r),sa=l("$ZodError",$r,void 0,{Parent:Error});function Bs(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 wr(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Bs(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Pr(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let p=c[a],f=a===c.length-1;if(p==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,p))Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[p];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Oe(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ie=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new K;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>W(a,s,N())));throw rt(u,i?.callee??t),u}return c.value};return t};var Ee=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>W(a,s,N())));throw rt(u,i?.callee??t),u}return c.value};return t};var Ce=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new K;return i.issues.length?Zr(e,i.issues,o):{success:!0,data:i.value}};function Zr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>W(o,r,N()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Ae=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Zr(e,i.issues,o):{success:!0,data:i.value}};var Vs=Symbol.for("zod.compile.invalid"),Ws=Symbol.for("zod.compile.fallback"),pt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Vs)return!0;if(n.definite===!0&&r===void 0)return!1}return Gs(e,t,r)};function Gs(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Ws]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new K;return i.issues.length===0}var ft=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Sr=(e)=>{let t=Ie(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Oe(r,s))};return r};var Or=(e)=>{let t=Ie(e),r=(n,o,i,s)=>t(n,o,i,Oe(r,s));return r};var Ir=(e)=>{let t=Ee(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Oe(r,s))};return r};var Er=(e)=>{let t=Ee(e),r=async(n,o,i,s)=>await t(n,o,i,Oe(r,s));return r};var Cr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ce(e)(t,r,o)};var Ar=(e)=>(t,r,n)=>Ce(e)(t,r,n);var Tr=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ae(e)(t,r,o)};var Rr=(e)=>async(t,r,n)=>Ae(e)(t,r,n);var Nr=/^[cC][0-9a-z]{6,}$/,jr=/^[0-9a-z]+$/,Dr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Fr=/^[0-9a-vA-V]{20}$/,Lr=/^[A-Za-z0-9]{27}$/,Mr=/^[a-zA-Z0-9_-]{21}$/;function Ur(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Kr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Jr=/^([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})$/,mt=(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 Br=/^(?:[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 qs="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Vr(){return new RegExp(qs,"u")}var Wr=/^(?:(?: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])$/,Gr=/^(([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 qr=/^((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])$/,Hr=/^(([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])$/,Xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Qr=/^https?$/,en=/^\+[1-9]\d{6,14}$/;var tn="(?:(?:\\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 Hs(e){return new RegExp(`^${e}$`)}var rn=Hs(tn);function dt(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 nn(e){return new RegExp(`^${dt(e)}$`)}function on(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${dt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${dt({precision:e.precision})}`:r;return new RegExp(`^${tn}T(?:${n})$`)}var sn=/^[\s\S]{0,}$/;var ht=/^-?\d+(?:\.\d+)?$/;var cn=/^[^A-Z]*$/,un=/^[^a-z]*$/;var S=l("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var gt=(e)=>{let t=e.value;return!or(t)&&t.length!==void 0},Te={number:"number",bigint:"bigint",object:"date"},_t=l("$ZodCheckLessThan",(e,t)=>{S.init(e,t);let r=Te[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Te[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yt=l("$ZodCheckGreaterThan",(e,t)=>{S.init(e,t);let r=Te[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Te[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),an=l("$ZodCheckMultipleOf",(e,t)=>{S.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):ir(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})}}),ln=l("$ZodCheckNumberFormat",(e,t)=>{S.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=we[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,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:n,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:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,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 pn=l("$ZodCheckMaxLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ze(o):i)<=t.maximum)return;let c=Se(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fn=l("$ZodCheckMinLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ze(o):i)>=t.minimum)return;let c=Se(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dn=l("$ZodCheckLengthEquals",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ze(o):i;if(s===t.length)return;let c=Se(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),me=l("$ZodCheckStringFormat",(e,t)=>{var r,n;if(S.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),mn=l("$ZodCheckRegex",(e,t)=>{me.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})}}),hn=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=cn),me.init(e,t)}),gn=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=un),me.init(e,t)}),_n=l("$ZodCheckIncludes",(e,t)=>{S.init(e,t);let r=ee(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),yn=l("$ZodCheckStartsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`^${ee(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=l("$ZodCheckEndsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`.*${ee(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var bn=l("$ZodCheckOverwrite",(e,t)=>{S.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class xt{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
+ function rt(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:n,value:o}=await t.read();if(n){r.close();return}r.enqueue({kind:"js",data:o})},cancel(r){return t.cancel(r)}})}var tr="@flowscripter/pluggable-io-framework/provider-factory";function ae(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ot(e,t="|"){return e.map((r)=>ct(r)).join(t)}function le(e,t){if(typeof t==="bigint")return t.toString();return t}class rr{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 ze(e){return new rr(e)}function nr(e){return e===null||e===void 0}function $e(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function or(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function F(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ke(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function J(e){return ke(e._zod.def)??e._zod.def.shape}function ir(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return F(this,t,n),n},enumerable:!0,configurable:!0})}function sr(e,t,r){if(t in e)F(e,t,r);else e[t]=r}function H(e,t,r,n){let o=J(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)ir(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else sr(e,i,n?n(s.value,i):s.value)}}function Is(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)ir(e,r,()=>t[r]);else sr(e,r,n.value)}}function E(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function cr(e){return JSON.stringify(e)}function ur(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var it="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ar=ze(()=>{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 Q(e){if(ue(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(ue(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function st(e){if(Q(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 lr=new Set(["string","number","symbol"]);function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}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 ct(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function pr(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]}))(),ut={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Cs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return H(i,e,Pe(e,t)),M(e,E(r,{shape:i,checks:[]}))}function Pe(e,t){let r=J(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Es(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Pe(e,t)),s={};return H(s,e,Reflect.ownKeys(J(e)).filter((c)=>!i.has(c))),M(e,E(r,{shape:s,checks:[]}))}function As(e,t){if(!Q(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=J(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,E(e._zod.def,{shape:fr(e,t)}))}function fr(e,t){let r={};return H(r,e,Reflect.ownKeys(J(e))),Is(r,t),r}function Ts(e,t){if(!Q(t))throw Error("Invalid input to safeExtend: expected a plain object");return M(e,E(e._zod.def,{shape:fr(e,t)}))}function Rs(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={};H(r,e,Reflect.ownKeys(J(e))),H(r,t,Reflect.ownKeys(J(t)));let n=E(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return M(e,n)}function dr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Pe(t,r)):void 0,u={};return H(u,t,Reflect.ownKeys(J(t)),e&&((a,p)=>c&&!c.has(p)?a:new e({type:"optional",innerType:a}))),M(t,E(t._zod.def,{shape:u,checks:[]}))}function Ns(e,t,r){let n=r?new Set(Pe(t,r)):void 0,o={};return H(o,t,Reflect.ownKeys(J(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),M(t,E(t._zod.def,{shape:o}))}function U(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 mr(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 n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ce(e){return typeof e==="string"?e:e?.message}function at(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function W(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.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 u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Ds=/[\uD800-\uDBFF]/;function Ze(e){let t=e.length;if(!Ds.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Oe(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function hr(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,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function gr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else js(e,r,n.value)}}function B(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ie(e,t,r){return B(e,t,r,!1)}function _r(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return B(this,r,n(this))},set(o){B(this,r,o)}})}return t}function js(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:B(this,t,r.bind(this))},set(n){B(this,t,n)}})}function Ls(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var nt,V=!1,Fs={configurable:!0,get(){V=!0;return}};function x(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&nt!==e._zod){nt=void 0;return}nt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Fs);let o=V;V=!1;try{let i=r(this);if(V)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return V=V||o,i}catch(i){throw delete this[t],V=V||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Ms(e,t,r,n){let o=Ls(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,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:n,value:i})}})}var Us="~constantCatch";function yr(e){let t=()=>e;return t[Us]=!0,t}var xr;var lt={value:void 0,enumerable:!1},br="captureStackTrace"in Error?Error:null;function Ks(e){let t=br;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return br=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){lt.value=new i(m);try{Object.defineProperty(d,"_zod",lt)}finally{lt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let y=Object.getPrototypeOf(d),_=d._zod.constr.prototype,b=y;while(b&&b!==_)b=Object.getPrototypeOf(b);let j=b??y;if(!c.has(j))c.add(j),gr(j,s)}let h=f.prototype;for(let y in h){if(!Object.prototype.hasOwnProperty.call(h,y))continue;if(!(y in d))d[y]=h[y].bind(d)}}let a=n?.Parent??Object;class p extends a{}Object.defineProperty(p,"name",{value:e});function f(d){let m=n?.Parent?Ks(p):this;u(m,d);let h=m._zod.deferred;if(h){for(let _ of h)_();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(m);return m}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class K 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"}}(xr=globalThis).__zod_globalConfig??(xr.__zod_globalConfig={});var A=globalThis.__zod_globalConfig;function N(e){if(e)Object.assign(A,e);return A}function Js(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,le,2)),e.message}function Bs(e){this._zod.message=e}var Vs={get:Js,set:Bs,enumerable:!0,configurable:!0},ft={value:void 0,enumerable:!1},vr=new WeakSet([Object.prototype,Error.prototype]),zr=(e,t)=>{e.name="$ZodError",ft.value=t,Object.defineProperty(e,"issues",ft),ft.value=void 0,Object.defineProperty(e,"message",Vs);let r=Object.getPrototypeOf(e);if(!vr.has(r))vr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},$r=l("$ZodError",zr),aa=l("$ZodError",zr,void 0,{Parent:Error});function Ws(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 kr(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Ws(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function wr(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let p=c[a],f=a===c.length-1;if(p==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,p))Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[p];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Ce(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ee=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new K;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>W(a,s,N())));throw it(u,i?.callee??t),u}return c.value};return t};var Ae=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>W(a,s,N())));throw it(u,i?.callee??t),u}return c.value};return t};var Te=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new K;return i.issues.length?Pr(e,i.issues,o):{success:!0,data:i.value}};function Pr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>W(o,r,N()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Re=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Pr(e,i.issues,o):{success:!0,data:i.value}};var Gs=Symbol.for("zod.compile.invalid"),Hs=Symbol.for("zod.compile.fallback"),dt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Gs)return!0;if(n.definite===!0&&r===void 0)return!1}return Xs(e,t,r)};function Xs(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Hs]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new K;return i.issues.length===0}var mt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Sr=(e)=>{let t=Ee(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Ce(r,s))};return r};var Zr=(e)=>{let t=Ee(e),r=(n,o,i,s)=>t(n,o,i,Ce(r,s));return r};var Or=(e)=>{let t=Ae(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Ce(r,s))};return r};var Ir=(e)=>{let t=Ae(e),r=async(n,o,i,s)=>await t(n,o,i,Ce(r,s));return r};var Cr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Te(e)(t,r,o)};var Er=(e)=>(t,r,n)=>Te(e)(t,r,n);var Ar=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Re(e)(t,r,o)};var Tr=(e)=>async(t,r,n)=>Re(e)(t,r,n);var Rr=/^[cC][0-9a-z]{6,}$/,Nr=/^[0-9a-z]+$/,Dr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,jr=/^[0-9a-vA-V]{20}$/,Lr=/^[A-Za-z0-9]{27}$/,Fr=/^[a-zA-Z0-9_-]{21}$/;function Mr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ur=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Kr=/^([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})$/,gt=(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 Jr=/^(?:[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 Ys="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Br(){return new RegExp(Ys,"u")}var Vr=/^(?:(?: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])$/,Wr=/^(([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 Gr=/^((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])$/,Hr=/^(([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])$/,Xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var qr=/^https?$/,Qr=/^\+[1-9]\d{6,14}$/;var en="(?:(?:\\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 qs(e){return new RegExp(`^${e}$`)}var tn=qs(en);function ht(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 rn(e){return new RegExp(`^${ht(e)}$`)}function nn(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${ht({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${ht({precision:e.precision})}`:r;return new RegExp(`^${en}T(?:${n})$`)}var on=/^[\s\S]{0,}$/;var _t=/^-?\d+(?:\.\d+)?$/;var sn=/^[^A-Z]*$/,cn=/^[^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 yt=(e)=>{let t=e.value;return!nr(t)&&t.length!==void 0},Ne={number:"number",bigint:"bigint",object:"date"},xt=l("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=Ne[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ne[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=l("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=Ne[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ne[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=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):or(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})}}),an=l("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=we[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,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:n,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:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,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 ln=l("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ze(o):i)<=t.maximum)return;let c=Oe(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pn=l("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ze(o):i)>=t.minimum)return;let c=Oe(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fn=l("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ze(o):i;if(s===t.length)return;let c=Oe(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),de=l("$ZodCheckStringFormat",(e,t)=>{var r,n;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),dn=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})}}),mn=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sn),de.init(e,t)}),hn=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cn),de.init(e,t)}),gn=l("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=ee(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),_n=l("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${ee(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=l("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${ee(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var xn=l("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class vt{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),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)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 zn={major:4,minor:6,patch:1};var w=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let p=U(c),f;for(let d of u){if(d._zod.def.when){if(hr(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&&a?.async===!1)throw new K;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(st(c.issues,m,e),!p)p=U(c,m)});else{if(c.issues.length===m)continue;if(st(c.issues,m,e),!p)p=U(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(U(c))return c.aborted=!0,c;let p=i(u,o,a);if(p instanceof Promise){if(a.async===!1)throw new K;return p.then((f)=>e._zod.parse(f,a))}return e._zod.parse(p,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>s(f,c,u));return s(p,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new K;return a.then((p)=>i(p,o,u))}return i(a,o,u)}}},{get "~standard"(){return ct(this,"~standard",vt(this))},set "~standard"(e){B(this,"~standard",e)}}),An=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>W(r,t,N()))}:{value:e.value};async function Ys(e,t){let r={async:!0};return An(await e._zod.run({value:t,issues:[]},r),r)}function vt(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return An(n,r)}catch(n){}return Ys(e,t)},vendor:"zod",version:1}}var je=l("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??sn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),v=l("$ZodStringFormat",(e,t)=>{me.init(e,t),je.init(e,t)}),Tn=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Jr),v.init(e,t)}),Rn=l("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mt(n))}else t.pattern??(t.pattern=mt());v.init(e,t)}),Nn=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Br),v.init(e,t)}),jn=1,Dn=2;function Qs(e,t){if(!t.normalize&&t.protocol?.source===Qr.source&&!/^https?:\/\//i.test(e))return jn;try{return new URL(e)}catch{return Dn}}var ec=/[\t\n\r]/g;function tc(e){return e.replace(ec,"")}function rc(e,t){return t.lastIndex=0,t.test(e.hostname)}function nc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Fn=l("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Qs(n,t);if(o===jn){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Dn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(t.hostname&&!rc(o,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&&!nc(o,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?o.href:tc(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ln=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Vr()),v.init(e,t)}),Mn=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?Mr:Ur(t.length)),v.init(e,t)}),Un=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Nr),v.init(e,t)}),Kn=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=jr),v.init(e,t)}),Jn=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Dr),v.init(e,t)}),Bn=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fr),v.init(e,t)}),Vn=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lr),v.init(e,t)}),Wn=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=on(t)),v.init(e,t)}),Gn=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rn),v.init(e,t)}),qn=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nn(t)),v.init(e,t)}),Hn=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Kr),v.init(e,t)}),Xn=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wr),v.init(e,t)}),oc=/^[0-9a-fA-F:.]+$/;function Yn(e){if(!oc.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Qn=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Gr),v.init(e,t),e._zod.check=(r)=>{if(!Yn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var eo=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qr),v.init(e,t)});function ic(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Yn(r)}var to=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Hr),v.init(e,t),e._zod.check=(r)=>{if(!ic(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function ro(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}$/,no=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zt),v.init(e,t),e._zod.check=(r)=>{if(ro(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),De=/^[A-Za-z0-9_-]*$/;function sc(e){if(!De.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ro(r)}var oo=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=De),v.init(e,t),e._zod.check=(r)=>{if(sc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),io=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=en),v.init(e,t)});function cc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var so=l("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{if(cc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var $t=l("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=ht,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),co=l("$ZodNumberFormat",(e,t)=>{ln.init(e,t),$t.init(e,t)});var uo=l("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),ao=l("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function $n(e,t,r){if(e.issues.length)t.issues.push(...pe(r,e.issues));t.value[r]=e.value}var lo=l("$ZodArray",(e,t)=>{w.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],p=t.element._zod.run({value:a,issues:[]},o);if(p instanceof Promise)s.push(p.then((f)=>$n(f,n,u)));else if($n(p,n,u),c&&p.issues.length!==0&&U(p))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function Ne(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...pe(r,e.issues))}if(!s&&o===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)t.value[r]=void 0}else t.value[r]=e.value}var uc=[];function po(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:uc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=fr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function fo(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,p=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(U(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(p==="never")c.push(h);continue}if(p==="never"){c.push(h);continue}let _=a.run({value:t[h],issues:[]},n);if(_ instanceof Promise)e.push(_.then((y)=>Ne(y,r,h,t,f,d)));else Ne(_,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 ac=l("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let p={...n};return Object.defineProperty(t,"shape",{value:p}),a.raw=p,p};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ze(()=>po(t));x(e,"propValues",(a)=>{let p=a.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))L(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=ue,s=t.catchall,c,u=E.memoizer;u?.attach(e),e._zod.parse=(a,p)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,_=a.issues.length;for(let y of c.allKeys){if(h&&a.issues.length!==_){if(U(a,_))break;_=a.issues.length}if(y==="__proto__")continue;let b=m[y],D=b._zod.optin,ie=b._zod.optout,se=b._zod.run({value:f[y],issues:[]},p);if(se instanceof Promise)d.push(se.then((Z)=>Ne(Z,a,y,f,D,ie)));else Ne(se,a,y,f,D,ie)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return fo(d,f,a,p,o.value,e,h===!0)}}),mo=l("$ZodObjectJIT",(e,t)=>{ac.init(e,t);let r=e._zod.parse,n=ze(()=>po(t)),o=E.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,y=new xt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),b=(Z)=>`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`,D=(Z,z)=>`
7
- let ${Z}_ab = false;
8
- for (let i = 0; i < ${Z}.issues.length; i++) {
9
- const iss = ${Z}.issues[i];
10
- iss.path = iss.path ? [${z}, ...iss.path] : [${z}];
6
+ };`)(...Object.values(this.closed))}}var vn={major:4,minor:6,patch:5};var w=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let p=U(c),f;for(let d of u){if(d._zod.def.when){if(mr(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&&a?.async===!1)throw new K;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(at(c.issues,m,e),!p)p=U(c,m)});else{if(c.issues.length===m)continue;if(at(c.issues,m,e),!p)p=U(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(U(c))return c.aborted=!0,c;let p=i(u,o,a);if(p instanceof Promise){if(a.async===!1)throw new K;return p.then((f)=>e._zod.parse(f,a))}return e._zod.parse(p,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>s(f,c,u));return s(p,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new K;return a.then((p)=>i(p,o,u))}return i(a,o,u)}}},{get "~standard"(){return Ie(this,"~standard",$t(this))},set "~standard"(e){B(this,"~standard",e)}}),En=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>W(r,t,N()))}:{value:e.value};async function ec(e,t){let r={async:!0};return En(await e._zod.run({value:t,issues:[]},r),r)}function $t(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return En(n,r)}catch(n){}return ec(e,t)},vendor:"zod",version:1}}var Fe=l("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??on,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),z=l("$ZodStringFormat",(e,t)=>{de.init(e,t),Fe.init(e,t)}),An=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Kr),z.init(e,t)}),Tn=l("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gt(n))}else t.pattern??(t.pattern=gt());z.init(e,t)}),Rn=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Jr),z.init(e,t)}),Nn=1,je=2;function Dn(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function tc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Dn(e)||je;return rc(e,t)}function rc(e,t){if(!t.normalize&&t.protocol?.source===qr.source&&!/^https?:\/\//i.test(e))return Nn;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??je}return new URL(e)}catch{return je}}var nc=/[\t\n\r]/g;function zn(e){return e.replace(nc,"")}function oc(e,t){return t.lastIndex=0,t.test(e.hostname)}function ic(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var jn=l("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=tc(n,t);if(o===Nn){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===je){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=zn(n);return}if(t.hostname&&!oc(o,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&&!ic(o,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?o.href:zn(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ln=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Br()),z.init(e,t)}),Fn=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?Fr:Mr(t.length)),z.init(e,t)}),Mn=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rr),z.init(e,t)}),Un=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nr),z.init(e,t)}),Kn=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Dr),z.init(e,t)}),Jn=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jr),z.init(e,t)}),Bn=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lr),z.init(e,t)}),Vn=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nn(t)),z.init(e,t)}),Wn=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tn),z.init(e,t)}),Gn=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rn(t)),z.init(e,t)}),Hn=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ur),z.init(e,t)}),Xn=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vr),z.init(e,t)}),sc=/^[0-9a-fA-F:.]+$/;function Yn(e){if(!sc.test(e))return!1;return Dn(`http://[${e}]`)}var qn=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wr),z.init(e,t),e._zod.check=(r)=>{if(!Yn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Qn=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Gr),z.init(e,t)});function cc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Yn(r)}var eo=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Hr),z.init(e,t),e._zod.check=(r)=>{if(!cc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function to(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 kt=/^[0-9a-zA-Z+/]*={0,2}$/,ro=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=kt),z.init(e,t),e._zod.check=(r)=>{if(to(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 uc(e){if(!Me.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return to(r)}var no=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Me),z.init(e,t),e._zod.check=(r)=>{if(uc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),oo=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Qr),z.init(e,t)});function ac(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var io=l("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{if(ac(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wt=l("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=_t,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),so=l("$ZodNumberFormat",(e,t)=>{an.init(e,t),wt.init(e,t)});var co=l("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),uo=l("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function $n(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}var ao=l("$ZodArray",(e,t)=>{w.init(e,t);let r=A.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],p=t.element._zod.run({value:a,issues:[]},o);if(p instanceof Promise)s.push(p.then((f)=>$n(f,n,u)));else if($n(p,n,u),c&&p.issues.length!==0&&U(p))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function Le(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&o===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||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var lc=[];function lo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:lc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=pr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function po(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,p=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(U(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(p==="never")c.push(h);continue}if(p==="never"){c.push(h);continue}let y=a.run({value:t[h],issues:[]},n);if(y instanceof Promise)e.push(y.then((_)=>Le(_,r,h,t,f,d)));else Le(y,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"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let p={...n};return Object.defineProperty(t,"shape",{value:p}),a.raw=p,p};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ze(()=>lo(t));x(e,"propValues",(a)=>{let p=a.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))F(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=ue,s=t.catchall,c,u=A.memoizer;u?.attach(e),e._zod.parse=(a,p)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,y=a.issues.length;for(let _ of c.allKeys){if(h&&a.issues.length!==y){if(U(a,y))break;y=a.issues.length}if(_==="__proto__")continue;let b=m[_],j=b._zod.optin,ie=b._zod.optout,se=b._zod.run({value:f[_],issues:[]},p);if(se instanceof Promise)d.push(se.then((S)=>Le(S,a,_,f,j,ie)));else Le(se,a,_,f,j,ie)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return po(d,f,a,p,o.value,e,h===!0)}}),fo=l("$ZodObjectJIT",(e,t)=>{pc.init(e,t);let r=e._zod.parse,n=ze(()=>lo(t)),o=A.memoizer,i=(m)=>{let h=n.value,y=h.symbolKeys,_=new vt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),b=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,j=(S,v)=>`
7
+ let ${S}_ab = false;
8
+ for (let i = 0; i < ${S}.issues.length; i++) {
9
+ const iss = ${S}.issues[i];
10
+ iss.path = iss.path ? [${v}, ...iss.path] : [${v}];
11
11
  payload.issues.push(iss);
12
- if (iss.continue !== true) ${Z}_ab = true;
12
+ if (iss.continue !== true) ${S}_ab = true;
13
13
  }
14
- if (${Z}_ab && ctx && ctx.abortEarly) {
14
+ if (${S}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;y.write("const input = payload.value;");let ie=Object.create(null),se=0;for(let Z of h.allKeys)ie[Z]=`key_${se++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let Z of h.allKeys){if(Z==="__proto__")continue;let z=ie[Z],F=typeof Z==="symbol"?`syms[${_.indexOf(Z)}]`:ur(Z),Ye=`${F} in input`,Yt=m[Z],Qt=Yt?._zod?.optin,er=Qt!==void 0,Zs=Yt?._zod?.optout==="optional";if(y.write(`const ${z} = ${b(F)};`),er&&Zs){let Ss=Qt==="optional"?`${z}_present`:`${z}.value !== undefined || ${z}_present`;y.write(`
18
- const ${z}_present = ${Ye};
19
- if (!${z}.issues.length || ${z}_present) {
20
- if (${z}.issues.length) {${D(z,F)}
17
+ }`;_.write("const input = payload.value;");let ie=Object.create(null),se=0;for(let S of h.allKeys)ie[S]=`key_${se++}`;_.write(o?"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[${y.indexOf(S)}]`:cr(S),et=`${L} in input`,Qt=m[S],tt=Qt?._zod?.optin,er=tt!==void 0,Zs=Qt?._zod?.optout==="optional";if(_.write(`const ${v} = ${b(L)};`),er&&Zs){let Os=tt==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;_.write(`
18
+ const ${v}_present = ${et};
19
+ if (!${v}.issues.length || ${v}_present) {
20
+ if (${v}.issues.length) {${j(v,L)}
21
21
  }
22
22
 
23
- if (${Ss}) {
24
- newResult[${F}] = ${z}.value;
23
+ if (${Os}) {
24
+ newResult[${L}] = ${v}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else if(!er)y.write(`
29
- const ${z}_present = ${Ye};
30
- if (${z}.issues.length) {${D(z,F)}
28
+ `)}else if(!er)_.write(`
29
+ const ${v}_present = ${et};
30
+ if (${v}.issues.length) {${j(v,L)}
31
31
  }
32
- if (!${z}_present && !${z}.issues.length) {
32
+ if (!${v}_present && !${v}.issues.length) {
33
33
  payload.issues.push({
34
34
  code: "invalid_type",
35
35
  expected: "nonoptional",
36
36
  input: undefined,
37
- path: [${F}]
37
+ path: [${L}]
38
38
  });
39
39
  if (ctx && ctx.abortEarly) {
40
40
  payload.value = newResult;
@@ -42,22 +42,17 @@ ${t.join(`
42
42
  }
43
43
  }
44
44
 
45
- if (${z}_present) {
46
- newResult[${F}] = ${z}.value;
45
+ if (${v}_present) {
46
+ newResult[${L}] = ${v}.value;
47
47
  }
48
48
 
49
- `);else y.write(`
50
- if (${z}.issues.length) {${D(z,F)}
49
+ `);else if(_.write(`
50
+ if (${v}.issues.length) {${j(v,L)}
51
51
  }
52
-
53
- if (${z}.value === undefined) {
54
- if (${Ye}) {
55
- newResult[${F}] = undefined;
56
- }
57
- } else {
58
- newResult[${F}] = ${z}.value;
52
+ `),tt==="defaulted")_.write(`newResult[${L}] = ${v}.value;`);else _.write(`
53
+ if (${v}.value !== undefined || ${et}) {
54
+ newResult[${L}] = ${v}.value;
59
55
  }
56
+ `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=ue,u=!A.jitless,p=u&&ar.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let y=m.value;if(!c(y))return m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m;if(u&&p&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return po([],y,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function kn(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!U(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>W(s,n,N())))}),t}var mo=l("$ZodUnion",(e,t)=>{w.init(e,t),x(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),x(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),x(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>$e(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return kn(s,n,e,o);return Promise.all(s).then((c)=>kn(c,n,e,o))}});var ho=l("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>wn(r,u,a));return wn(r,i,s)}});function zt(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(Q(e)&&Q(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=zt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=zt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function wn(e,t,r){let n=new Map,o,i=new Map,s=(a,p)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[p]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((p)=>o.keys.includes(p)):[];if(a.length)e.issues.push({...o,keys:a});for(let p of c)if(!a.includes(p)&&i.has(p))e.issues.push(i.get(p))}let u=zt(t.value,r.value);if(!u.valid){if(U(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var go=l("$ZodEnum",(e,t)=>{w.init(e,t);let r=ae(t.entries),n=new Set(r);e._zod.values=n,x(e,"pattern",(o)=>{let i=ae(o.def.entries).filter((s)=>lr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var _o=l("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",A.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new K;return r.value=o,r}});function Pn(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pt=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 n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),x(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Pn(r,i));return Pn(r,o)}return t.innerType._zod.run(r,n)}}),yo=l("$ZodExactOptional",(e,t)=>{Pt.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,n)=>t.innerType._zod.run(r,n)}),xo=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 n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.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,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),bo=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Sn(i,t));return Sn(o,t)}});function Sn(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var vo=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),zo=l("$ZodNonOptional",(e,t)=>{w.init(e,t),x(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Zn(i,e));return Zn(o,e)}});function Zn(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 On(e,t,r,n){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((o)=>W(o,n,N()))},input:e.value}),e}var $o=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>On(r,i,t,n));return On(r,o,t,n)}});var ko=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,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>De(s,t.in,n));return De(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>De(i,t.out,n));return De(o,t.out,n)}});function De(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var wo=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(In);return In(o)}});function In(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Po=l("$ZodCustom",(e,t)=>{O.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>Cn(i,r,n,e));Cn(o,r,n,e);return}});function Cn(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(X(o))}}class Zo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Zt="~memo",So=[];function Oo(e){return e!==null&&typeof e==="object"}function St(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Io=new WeakMap,me=0,Je=1,he=2;function Be(e,t,r){let n=Io.get(e);if(n!==void 0)return n?he:me;if(t.has(e))return he;t.add(e);let o=me,i=(p)=>{if(o!==he&&p?._zod){let f=Be(p,t,r);if(f>o)o=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 y=h.get?Je:h.value?._zod?Be(h.value,t,r):me;if(y>d)d=y}return d},c=(p)=>{if(p>o)o=p},u=e._zod.def,a=u.type;switch(a){case"object":{let p=ke(u);c(p?s(p,!0):Je),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let p of u.items)i(p);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let p of u.options)i(p);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let p=u._cachedInner??(r?e._zod.innerType:void 0);c(p?Be(p,t,!1):Je);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 u){let f=Object.getOwnPropertyDescriptor(u,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),fc(e,o)}function fc(e,t){if(t!==Je)Io.set(e,t===he);return t}function dc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ue,Ke=[],mc={alloc(e,t,r){let n=Ue;if(!n)return r;Ue=void 0;let o={value:r,issues:null};return n.set(t.value,o),Ke.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&hc(i,o.value))throw new Zo;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let b=Be(e,new Set,!1);if(b===me){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(b===he||n)r=!0;else n=!0}let p=u.value;if(!Oo(p))return s(u,a);let f=a[Zt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Zt]=f;let d;if(o===a)d=i;else d=dc(f,e),o=a,i=d;let m=d.get(p);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...St(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}Ue=d;let h=Ke.length,y=s(u,a);Ue=void 0;let _=Ke.length>h?Ke.pop():void 0;if(y instanceof Promise)return y.then((b)=>{if(_)_.issues=b.issues.length?St(b.issues):So;return b});if(_)_.issues=y.issues.length?St(y.issues):So;return y};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Co(){return mc}function hc(e,t){let r=e[Zt]?.backEdges;return r!==void 0&&Oo(t)&&r.has(t)}var gc=()=>{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"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=hr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ct(i.values[0])}`;return`Invalid option: expected one of ${ot(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":""}: ${ot(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 Ot(){return{localeError:gc()}}var Eo;class Ao{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 n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function _c(){return new Ao}(Eo=globalThis).__zod_globalRegistry??(Eo.__zod_globalRegistry=_c());var Y=globalThis.__zod_globalRegistry;function To(e){if(e.checks)e.checks=[...e.checks];return e}function Ro(e,t){return new e(To({type:"string",...g(t)}))}function No(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Do(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Fo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Mo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ko(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Jo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Bo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Go(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Yo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Qo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function ri(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function ni(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function ii(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function si(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ci(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function ui(e,t){return new e(To({type:"number",checks:[],...g(t)}))}function ai(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function li(e){return new e({type:"unknown"})}function pi(e,t){return new e({type:"never",...g(t)})}function Ve(e,t){return new xt({check:"less_than",...g(t),value:e,inclusive:!1})}function ge(e,t){return new xt({check:"less_than",...g(t),value:e,inclusive:!0})}function We(e,t){return new bt({check:"greater_than",...g(t),value:e,inclusive:!1})}function _e(e,t){return new bt({check:"greater_than",...g(t),value:e,inclusive:!0})}function Ge(e,t){return new un({check:"multiple_of",...g(t),value:e})}function He(e,t){return new ln({check:"max_length",...g(t),maximum:e})}function te(e,t){return new pn({check:"min_length",...g(t),minimum:e})}function Xe(e,t){return new fn({check:"length_equals",...g(t),length:e})}function It(e,t){return new dn({check:"string_format",format:"regex",...g(t),pattern:e})}function Ct(e){return new mn({check:"string_format",format:"lowercase",...g(e)})}function Et(e){return new hn({check:"string_format",format:"uppercase",...g(e)})}function At(e,t){return new gn({check:"string_format",format:"includes",...g(t),includes:e})}function Tt(e,t){return new _n({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Rt(e,t){return new yn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function G(e){return new xn({check:"overwrite",tx:e})}function Nt(e){return G((t)=>t.normalize(e))}function Dt(){return G((e)=>e.trim())}function jt(){return G((e)=>e.toLowerCase())}function Lt(){return G((e)=>e.toUpperCase())}function Ft(){return G((e)=>ur(e))}function fi(e,t,r){return new e({type:"array",element:t,...g(r)})}function di(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function mi(e,t){let r=yc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(X(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(X(i))}},e(n.value,n)),t);return r}function yc(e,t){let r=new O({check:"custom",...g(t)});return r._zod.check=e,r}function ye(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))F(e,n,r[n]);return e}function Ut(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,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var n;let o=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[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.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 u=t.metadataRegistry.get(e);if(u)ye(s.schema,u);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function hi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Kt(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 n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(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}/${hi(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:a+hi(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let p=c.schema;for(let f in p)delete p[f];p.$ref=u};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>
60
57
 
61
- `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=ue,u=!E.jitless,p=u&&lr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(u&&p&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return fo([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function kn(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!U(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>W(s,n,N())))}),t}var ho=l("$ZodUnion",(e,t)=>{w.init(e,t),x(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),x(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),x(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>$e(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return kn(s,n,e,o);return Promise.all(s).then((c)=>kn(c,n,e,o))}});var go=l("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>wn(r,u,a));return wn(r,i,s)}});function bt(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(Q(e)&&Q(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=bt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=bt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function wn(e,t,r){let n=new Map,o,i=new Map,s=(a,p)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[p]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((p)=>o.keys.includes(p)):[];if(a.length)e.issues.push({...o,keys:a});for(let p of c)if(!a.includes(p)&&i.has(p))e.issues.push(i.get(p))}let u=bt(t.value,r.value);if(!u.valid){if(U(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var _o=l("$ZodEnum",(e,t)=>{w.init(e,t);let r=ae(t.entries),n=new Set(r);e._zod.values=n,x(e,"pattern",(o)=>{let i=ae(o.def.entries).filter((s)=>pr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var yo=l("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new K;return r.value=o,r}});function Pn(e,t){return e.value=t.issues.length?void 0:t.value,e}var kt=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 n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),x(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Pn(r,i));return Pn(r,o)}return t.innerType._zod.run(r,n)}}),xo=l("$ZodExactOptional",(e,t)=>{kt.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,n)=>t.innerType._zod.run(r,n)}),bo=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 n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.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,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),vo=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Zn(i,t));return Zn(o,t)}});function Zn(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var zo=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),$o=l("$ZodNonOptional",(e,t)=>{w.init(e,t),x(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Sn(i,e));return Sn(o,e)}});function Sn(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 On(e,t,r,n){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((o)=>W(o,n,N()))},input:e.value}),e}var ko=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>On(r,i,t,n));return On(r,o,t,n)}});var wo=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,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Re(s,t.in,n));return Re(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Re(i,t.out,n));return Re(o,t.out,n)}});function Re(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Po=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,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(In);return In(o)}});function In(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Zo=l("$ZodCustom",(e,t)=>{S.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>En(i,r,n,e));En(o,r,n,e);return}});function En(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(H(o))}}function Cn(e,t,r){if(e.issues.length)t.issues.push(...pe(r,e.issues))}var lc=l("$ZodProperties",(e,t)=>{w.init(e,t),S.init(e,t);let r=E.memoizer;r?.attach(e);let n,o=(i,s)=>{n??(n=Reflect.ownKeys(t.shape).map((a)=>[a,t.shape[a]]));let c=i.value,u;for(let[a,p]of n){let f=p._zod.run({value:c[a],issues:[]},s);if(f instanceof Promise)u??(u=[]),u.push(f.then((d)=>Cn(d,i,a)));else Cn(f,i,a)}if(u)return Promise.all(u).then(()=>{return});return};e._zod.parse=(i,s)=>{let c=i.value;if(c===null||typeof c!=="object"&&typeof c!=="function")return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;if(s.direction==="backward")s={...s,direction:"forward"};if(r)r.alloc(e,i,c,s);let u=o(i,s);return u instanceof Promise?u.then(()=>i):i},e._zod.check=(i)=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}return o(i,{})}},{*[Symbol.iterator](){yield this}});class Oo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Pt="~memo",So=[];function Io(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function wt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Eo=new WeakMap,he=0,Me=1,ge=2;function Ue(e,t,r){let n=Eo.get(e);if(n!==void 0)return n?ge:he;if(t.has(e))return ge;t.add(e);let o=he,i=(p)=>{if(o!==ge&&p?._zod){let f=Ue(p,t,r);if(f>o)o=f}},s=(p,f)=>{let d=he;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let _=h.get?Me:h.value?._zod?Ue(h.value,t,r):he;if(_>d)d=_}return d},c=(p)=>{if(p>o)o=p},u=e._zod.def,a=u.type;switch(a){case"object":{let p=ke(u);c(p?s(p,!0):Me),i(u.catchall);break}case"properties":c(s(u.shape,!1));break;case"array":i(u.element);break;case"tuple":for(let p of u.items)i(p);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let p of u.options)i(p);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let p=u._cachedInner??(r?e._zod.innerType:void 0);c(p?Ue(p,t,!1):Me);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 u){let f=Object.getOwnPropertyDescriptor(u,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),pc(e,o)}function pc(e,t){if(t!==Me)Eo.set(e,t===ge);return t}function fc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Fe,Le=[],dc={alloc(e,t,r){let n=Fe;if(!n)return r;Fe=void 0;let o={value:r,issues:null};return n.set(t.value,o),Le.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&mc(i,o.value))throw new Oo;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let b=Ue(e,new Set,!1);if(b===he){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(b===ge||n)r=!0;else n=!0}let p=u.value;if(!Io(p))return s(u,a);let f=a[Pt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Pt]=f;let d;if(o===a)d=i;else d=fc(f,e),o=a,i=d;let m=d.get(p);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...wt(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}Fe=d;let h=Le.length,_=s(u,a);Fe=void 0;let y=Le.length>h?Le.pop():void 0;if(_ instanceof Promise)return _.then((b)=>{if(y)y.issues=b.issues.length?wt(b.issues):So;return b});if(y)y.issues=_.issues.length?wt(_.issues):So;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Co(){return dc}function mc(e,t){let r=e[Pt]?.backEdges;return r!==void 0&&Io(t)&&r.has(t)}var hc=()=>{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",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=gr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ot(i.values[0])}`;return`Invalid option: expected one of ${tt(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":""}: ${tt(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 Zt(){return{localeError:hc()}}var Ao;class To{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 n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function gc(){return new To}(Ao=globalThis).__zod_globalRegistry??(Ao.__zod_globalRegistry=gc());var X=globalThis.__zod_globalRegistry;function Ro(e,t){return new e({type:"string",...g(t)})}function No(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function jo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Do(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Fo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Mo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ko(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Jo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Bo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Go(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Yo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Qo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function ri(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function ni(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function ii(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function si(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ci(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function ui(e,t){return new e({type:"number",checks:[],...g(t)})}function ai(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function li(e){return new e({type:"unknown"})}function pi(e,t){return new e({type:"never",...g(t)})}function Ke(e,t){return new _t({check:"less_than",...g(t),value:e,inclusive:!1})}function _e(e,t){return new _t({check:"less_than",...g(t),value:e,inclusive:!0})}function Je(e,t){return new yt({check:"greater_than",...g(t),value:e,inclusive:!1})}function ye(e,t){return new yt({check:"greater_than",...g(t),value:e,inclusive:!0})}function Be(e,t){return new an({check:"multiple_of",...g(t),value:e})}function Ve(e,t){return new pn({check:"max_length",...g(t),maximum:e})}function te(e,t){return new fn({check:"min_length",...g(t),minimum:e})}function We(e,t){return new dn({check:"length_equals",...g(t),length:e})}function St(e,t){return new mn({check:"string_format",format:"regex",...g(t),pattern:e})}function Ot(e){return new hn({check:"string_format",format:"lowercase",...g(e)})}function It(e){return new gn({check:"string_format",format:"uppercase",...g(e)})}function Et(e,t){return new _n({check:"string_format",format:"includes",...g(t),includes:e})}function Ct(e,t){return new yn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function At(e,t){return new xn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function G(e){return new bn({check:"overwrite",tx:e})}function Tt(e){return G((t)=>t.normalize(e))}function Rt(){return G((e)=>e.trim())}function Nt(){return G((e)=>e.toLowerCase())}function jt(){return G((e)=>e.toUpperCase())}function Dt(){return G((e)=>ar(e))}function fi(e,t,r){return new e({type:"array",element:t,...g(r)})}function di(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function mi(e,t){let r=_c((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(H(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(H(i))}},e(n.value,n)),t);return r}function _c(e,t){let r=new S({check:"custom",...g(t)});return r._zod.check=e,r}function xe(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))L(e,n,r[n]);return e}function Lt(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??X,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 Y(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function O(e,t,r={path:[],schemaPath:[]}){var n;let o=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[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,p)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;O(f,t,p),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)xe(s.schema,u);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function hi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Mt(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 n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(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}/${hi(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:a+hi(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let p=c.schema;for(let f in p)delete p[f];p.$ref=u};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>
62
-
63
- 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 a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){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 yi(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;yi(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.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 xi=new Set(["type","properties","required","additionalProperties"]),gi=["oneOf","anyOf"];function _i(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 Ft(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!xi.has(s))return null;t.push(i)}let r={},n=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 a of t){let p=a.properties?.[s]??_i(a);if(p===null||p===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(p)))c.push(p)}let u=c.length===1?c[0]:Ft(c)??{allOf:c};L(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=_i(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function yc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of xi)if(o in e)return;let r=t.filter((o)=>gi.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Ft(t);else{let o=r[0],i=gi.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>Ft([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,xe(e,n)}function Ut(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,p={...a},f=u.ref;if(u.ref=null,f){n(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"))a.allOf=a.allOf??[],a.allOf.push(h);else xe(a,h);if(xe(a,p),c._zod.parent===f)for(let y in a){if(y==="$ref"||y==="allOf")continue;if(!(y in p))delete a[y]}if(h.$ref&&m.def)for(let y in a){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(a[y])===JSON.stringify(m.def[y]))delete a[y]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())yi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let p=a?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);if(f)f.push(a);else c.set(p,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])yc(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$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");o.$id=e.external.uri(c)}xe(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;L(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:be(t,"input",e.processors),output:be(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 n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return I(n.element,r);if(n.type==="set")return I(n.valueType,r);if(n.type==="lazy")return I(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return I(n.innerType,r);if(n.type==="intersection")return I(n.left,r)||I(n.right,r);if(n.type==="record"||n.type==="map")return I(n.keyType,r)||I(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(n.in,r)||I(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(I(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(I(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(I(o,r))return!0;if(n.rest&&I(n.rest,r))return!0;return!1}return!1}var bi=(e,t={})=>(r)=>{let n=Lt({...r,processors:t});return O(e,n),Mt(n,e),Ut(n,e)},be=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Lt({...o??{},target:i,io:t,processors:r});return O(e,s),Mt(s,e),Ut(s,e)};var re=(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},vi=(e,t)=>{re(e,"minimum",t),ne(e,"maximum",t)},wi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Pi=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Zi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Si=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},zi=(e,t)=>re(e,"minimum",t.minimum),$i=(e,t)=>ne(e,"maximum",t.maximum),ki=(e)=>(t,r)=>{Si(t,r.format);let[n,o]=e[r.format];re(t,"minimum",n),ne(t,"maximum",o)},xc={greater_than:(e,t)=>re(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ne(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wi(e,t.value),number_format:ki(we),bigint_format:ki(it),min_length:zi,max_length:$i,length_equals:(e,t)=>vi(e,t.length),min_size:zi,max_size:$i,size_equals:(e,t)=>vi(e,t.size),string_format:(e,t)=>{if(Si(e,t.format),t.pattern)Pi(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)=>Zi(e,t.mime)};function j(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)xc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)re(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)re(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ne(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ne(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)wi(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Zi(t,o.mime);for(let i of o.patterns??[])Pi(t,i);return t}var bc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},vc=new Map([[zt,Xr],[De,Yr]]),zc=(e)=>vc.get(e)??e,Oi=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:p}=j(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=bc[c]??c,o.format==="")delete o.format;if(c==="time"||p)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(zc);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Ii=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:p}=j(e);o.type=p?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),d=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(d)if(m)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.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 Y(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...y]=h;if(_!==void 0)o.multipleOf=_;if(y.length)o.allOf=[...o.allOf??[],...y.map((b)=>({multipleOf:b}))]}};var Ei=(e,t,r,n)=>{r.not={}};var Ci=(e,t,r,n)=>{};var Ai=(e,t,r,n)=>{let o=e._zod.def,i=ae(o.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 Ti=(e,t,r,n)=>{Y(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Ri=(e,t,r,n)=>{Y(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Ni=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=j(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=O(i.element,t,{...n,path:[...n.path,"items"]})};function Kt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Kt(t.out);if(t.type==="catch")return Kt(t.innerType);return e._zod.optin}var ji=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Y(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let p in s)L(o.properties,p,O(s[p],t,{...n,path:[...n.path,"properties",p]}));let u=new Set(Object.keys(s)),a=new Set([...u].filter((p)=>{let f=i.shape[p];if(t.io==="input")return Kt(f)===void 0;else return f._zod.optout===void 0}));if(a.size>0)o.required=Array.from(a);if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=O(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})};var Di=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>O(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},Fi=(e,t,r,n)=>{let o=e._zod.def,i=O(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=O(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};var Li=(e,t,r,n)=>{let o=e._zod.def,i=O(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Mi=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Jt=Symbol();function Ui(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return Y(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Jt}var Ki=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Ui(o.defaultValue,e,t,r,n);if(s!==Jt)r.default=s},Ji=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ui(o.defaultValue,e,t,r,n);if(s!==Jt)r._prefault=s},Bi=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Y(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Vi=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;O(s,t,n);let c=t.seen.get(e);c.ref=s},Wi=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Bt=(e,t,r,n)=>{let o=e._zod.def;O(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Gi=new WeakSet([Object.prototype,Error.prototype]);function Ge(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Oc=(e,t)=>{kr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Gi.has(r))return;Gi.add(r),Ge(r,"format",(n)=>(o)=>Pr(n,o)),Ge(r,"flatten",(n)=>(o)=>wr(n,o)),Ge(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,le,2)}),Ge(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,le,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var A=l("ZodError",Oc,void 0,{Parent:Error});var qi=Ie(A),Hi=Ee(A),Xi=Ce(A),Yi=Ae(A),Qi=Sr(A),es=Or(A),ts=Ir(A),rs=Er(A),ns=Cr(A),os=Ar(A),is=Tr(A),ss=Rr(A);function Ec(){if(!E.localeError)N(Zt())}function Gt(){if(!E.memoizer)N({memoizer:Co()})}var P=l("ZodType",(e,t)=>(Ec(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C(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 M(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Iu(e,t))},superRefine(e,t){return this.check(Eu(e,t))},overwrite(e){return this.check(G(e))},optional(){return as(this)},exactOptional(){return _u(this)},nullable(){return ls(this)},nullish(){return as(ls(this))},nonoptional(e){return $u(this,e)},array(){return uu(this)},or(e){return pu([this,e])},and(e){return du(this,e)},transform(e){return ps(this,gu(e))},default(e){return bu(this,e)},prefault(e){return zu(this,e)},catch(e){return wu(this,e)},pipe(e){return ps(this,e)},readonly(){return Su(this)},describe(e){let t=this.clone();return X.add(t,{description:e}),t},meta(...e){if(e.length===0)return X.get(this);let t=this.clone();return X.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 ct(this,"~standard",{...vt(this),jsonSchema:{input:be(this,"input"),output:be(this,"output")}})},set "~standard"(e){B(this,"~standard",e)},parse:function e(t,r){return qi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Hi(this,t,r,{callee:e})},safeParse(e,t){return Xi(this,e,t)},async safeParseAsync(e,t){return Yi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B(this,"spa",e)},validate(e,t){return pt(this,e,t)},validateAsync(e,t){return ft(this,e,t)},encode:function e(t,r){return Qi(this,t,r,{callee:e})},decode:function e(t,r){return es(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ts(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await rs(this,t,r,{callee:e})},safeEncode(e,t){return ns(this,e,t)},safeDecode(e,t){return os(this,e,t)},async safeEncodeAsync(e,t){return is(this,e,t)},async safeDecodeAsync(e,t){return ss(this,e,t)},toJSONSchema(e){return bi(this,{})(e)},get description(){return X.get(this)?.description},get _def(){return this._zod.def}}),fs=l("_ZodString",(e,t)=>{je.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o)},yr({format:(e)=>j(e).format??null,minLength:(e)=>j(e).minimum??null,maxLength:(e)=>j(e).maximum??null},{regex(...e){return this.check(St(...e))},includes(...e){return this.check(Et(...e))},startsWith(...e){return this.check(Ct(...e))},endsWith(...e){return this.check(At(...e))},min(...e){return this.check(te(...e))},max(...e){return this.check(Ve(...e))},length(...e){return this.check(We(...e))},nonempty(...e){return this.check(te(1,...e))},lowercase(e){return this.check(Ot(e))},uppercase(e){return this.check(It(e))},trim(){return this.check(Rt())},normalize(...e){return this.check(Tt(...e))},toLowerCase(){return this.check(Nt())},toUpperCase(){return this.check(jt())},slugify(){return this.check(Dt())}})),Cc=l("ZodString",(e,t)=>{je.init(e,t),fs.init(e,t)},{email(e){return this.check(No(Dc,e))},url(e){return this.check(Uo(Lc,e))},jwt(e){return this.check(ni(tu,e))},emoji(e){return this.check(Ko(Mc,e))},guid(e){return this.check(jo(Fc,e))},uuid(e){return this.check(Do(qe,e))},uuidv4(e){return this.check(Fo(qe,e))},uuidv6(e){return this.check(Lo(qe,e))},uuidv7(e){return this.check(Mo(qe,e))},nanoid(e){return this.check(Jo(Uc,e))},cuid(e){return this.check(Bo(Kc,e))},cuid2(e){return this.check(Vo(Jc,e))},ulid(e){return this.check(Wo(Bc,e))},base64(e){return this.check(ei(Yc,e))},base64url(e){return this.check(ti(Qc,e))},xid(e){return this.check(Go(Vc,e))},ksuid(e){return this.check(qo(Wc,e))},ipv4(e){return this.check(Ho(Gc,e))},ipv6(e){return this.check(Xo(qc,e))},cidrv4(e){return this.check(Yo(Hc,e))},cidrv6(e){return this.check(Qo(Xc,e))},e164(e){return this.check(ri(eu,e))},datetime(e){return this.check(oi(Tc,e))},date(e){return this.check(ii(Rc,e))},time(e){return this.check(si(Nc,e))},duration(e){return this.check(ci(jc,e))}});function Ac(e){return Ro(Cc,e)}var k=l("ZodStringFormat",(e,t)=>{v.init(e,t),fs.init(e,t)}),Tc=l("ZodISODateTime",(e,t)=>{Wn.init(e,t),k.init(e,t)}),Rc=l("ZodISODate",(e,t)=>{Gn.init(e,t),k.init(e,t)}),Nc=l("ZodISOTime",(e,t)=>{qn.init(e,t),k.init(e,t)}),jc=l("ZodISODuration",(e,t)=>{Hn.init(e,t),k.init(e,t)}),Dc=l("ZodEmail",(e,t)=>{Nn.init(e,t),k.init(e,t)});var Fc=l("ZodGUID",(e,t)=>{Tn.init(e,t),k.init(e,t)});var qe=l("ZodUUID",(e,t)=>{Rn.init(e,t),k.init(e,t)});var Lc=l("ZodURL",(e,t)=>{Fn.init(e,t),k.init(e,t)});var Mc=l("ZodEmoji",(e,t)=>{Ln.init(e,t),k.init(e,t)});var Uc=l("ZodNanoID",(e,t)=>{Mn.init(e,t),k.init(e,t)});var Kc=l("ZodCUID",(e,t)=>{Un.init(e,t),k.init(e,t)});var Jc=l("ZodCUID2",(e,t)=>{Kn.init(e,t),k.init(e,t)});var Bc=l("ZodULID",(e,t)=>{Jn.init(e,t),k.init(e,t)});var Vc=l("ZodXID",(e,t)=>{Bn.init(e,t),k.init(e,t)});var Wc=l("ZodKSUID",(e,t)=>{Vn.init(e,t),k.init(e,t)});var Gc=l("ZodIPv4",(e,t)=>{Xn.init(e,t),k.init(e,t)});var qc=l("ZodIPv6",(e,t)=>{Qn.init(e,t),k.init(e,t)});var Hc=l("ZodCIDRv4",(e,t)=>{eo.init(e,t),k.init(e,t)});var Xc=l("ZodCIDRv6",(e,t)=>{to.init(e,t),k.init(e,t)});var Yc=l("ZodBase64",(e,t)=>{no.init(e,t),k.init(e,t)});var Qc=l("ZodBase64URL",(e,t)=>{oo.init(e,t),k.init(e,t)});var eu=l("ZodE164",(e,t)=>{io.init(e,t),k.init(e,t)});var tu=l("ZodJWT",(e,t)=>{so.init(e,t),k.init(e,t)});var ds=l("ZodNumber",(e,t)=>{$t.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.isFinite=!0},yr({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=j(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=j(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=j(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>j(e).format??null},{gt(e,t){return this.check(Je(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(Ke(e,t))},lte(e,t){return this.check(_e(e,t))},max(e,t){return this.check(_e(e,t))},int(e){return this.check(cs(e))},safe(e){return this.check(cs(e))},positive(e){return this.check(Je(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ke(0,e))},nonpositive(e){return this.check(_e(0,e))},multipleOf(e,t){return this.check(Be(e,t))},step(e,t){return this.check(Be(e,t))},finite(){return this}}));function ru(e){return ui(ds,e)}var nu=l("ZodNumberFormat",(e,t)=>{co.init(e,t),ds.init(e,t)});function cs(e){return ai(nu,e)}var ou=l("ZodUnknown",(e,t)=>{uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ci(e,r,n,o)});function us(){return li(ou)}var iu=l("ZodNever",(e,t)=>{ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ei(e,r,n,o)});function su(e){return pi(iu,e)}var cu=l("ZodArray",(e,t)=>{Gt(),lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.element=t.element},{min(e,t){return this.check(te(e,t))},nonempty(e){return this.check(te(1,e))},max(e,t){return this.check(Ve(e,t))},length(e,t){return this.check(We(e,t))},unwrap(){return this.element}});function uu(e,t){return fi(cu,e,t)}var au=l("ZodObject",(e,t)=>{Gt(),mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ji(e,r,n,o),Fs(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return mu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(C(this._zod.def,{catchall:e}))},passthrough(){return this.clone(C(this._zod.def,{catchall:us()}))},loose(){return this.clone(C(this._zod.def,{catchall:us()}))},strict(){return this.clone(C(this._zod.def,{catchall:su()}))},strip(){return this.clone(C(this._zod.def,{catchall:void 0}))},extend(e){return Cs(this,e)},safeExtend(e){return As(this,e)},merge(e){return Ts(this,e)},pick(e){return Is(this,e)},omit(e){return Es(this,e)},partial(...e){return mr(hs,this,e[0])},exactPartial(...e){return mr(gs,this,e[0],"exactPartial")},required(...e){return Rs(_s,this,e[0])}});function ms(e,t){let r={type:"object",shape:e??{},...g(t)};return new au(r)}var lu=l("ZodUnion",(e,t)=>{ho.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Di(e,r,n,o),e.options=t.options});function pu(e,t){return new lu({type:"union",options:e,...g(t)})}var fu=l("ZodIntersection",(e,t)=>{go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fi(e,r,n,o)});function du(e,t){return new fu({type:"intersection",left:e,right:t})}var Wt=l("ZodEnum",(e,t)=>{_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ai(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Wt({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Wt({...t,checks:[],...g(o),entries:i})}});function mu(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Wt({type:"enum",entries:r,...g(t)})}var hu=l("ZodTransform",(e,t)=>{Gt(),yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(H(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(H(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function gu(e){return new hu({type:"transform",transform:e})}var hs=l("ZodOptional",(e,t)=>{kt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function as(e){return new hs({type:"optional",innerType:e})}var gs=l("ZodExactOptional",(e,t)=>{xo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _u(e){return new gs({type:"optional",innerType:e})}var yu=l("ZodNullable",(e,t)=>{bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Li(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ls(e){return new yu({type:"nullable",innerType:e})}var xu=l("ZodDefault",(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bu(e,t){return new xu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():nt(t)}})}var vu=l("ZodPrefault",(e,t)=>{zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ji(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zu(e,t){return new vu({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():nt(t)}})}var _s=l("ZodNonOptional",(e,t)=>{$o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $u(e,t){return new _s({type:"nonoptional",innerType:e,...g(t)})}var ku=l("ZodCatch",(e,t)=>{ko.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wu(e,t){return new ku({type:"catch",innerType:e,catchValue:typeof t==="function"?t:xr(t)})}var Pu=l("ZodPipe",(e,t)=>{wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vi(e,r,n,o),e.in=t.in,e.out=t.out});function ps(e,t){return new Pu({type:"pipe",in:e,out:t})}var Zu=l("ZodReadonly",(e,t)=>{Po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Su(e){return new Zu({type:"readonly",innerType:e})}var Ou=l("ZodCustom",(e,t)=>{Zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o)});function Iu(e,t={}){return di(Ou,e,t)}function Eu(e,t){return mi(e,t)}import{createReadStream as bs,createWriteStream as Cu}from"fs";import{chmod as Au,copyFile as vs,mkdir as He,open as Tu,readdir as Ru,rename as Nu,rm as ju,stat as ks,unlink as Du,utimes as Fu}from"fs/promises";import{join as oe,resolve as Lu}from"path";import{Readable as zs}from"stream";import{resolve as qt,sep as xs}from"path";function T(e,t){if(e==="")return qt(t);let r=qt(e),n=qt(r,t),o=r.endsWith(xs)?r:r+xs;if(n!==r&&!n.startsWith(o))throw Error(`Path "${t}" resolves outside provider root "${e}"`);return n}var Xe=ms({mode:ru().optional()}),Ht=8388608;async function $s(e){let t=await ks(e),r=t.isDirectory();return{size:r?void 0:t.size,lastModified:t.mtime,isFolder:r,properties:{mode:t.mode}}}async function*ws(e,t,r){let n=await Ru(oe(e,t),{withFileTypes:!0});for(let o of n){let i=t?`${t}/${o.name}`:o.name;if(yield i,o.isDirectory()&&r)yield*ws(e,i,r)}}class ve{kind="js";rootPath;constructor(e){this.rootPath=e===""?"":Lu(e)}async[Symbol.asyncDispose](){}list(e,t){let r=this.rootPath,n=T(r,e);async function*o(){for await(let i of ws(n,"",t?.recursive??!1)){if(t?.regex&&!t.regex.test(i))continue;let s=await $s(oe(n,i));yield{path:i,properties:s}}}return o()}async getProperties(e){return $s(T(this.rootPath,e))}async setProperties(e,t){let r=T(this.rootPath,e),n=Xe.partial().parse(t);if(n.mode!==void 0)await Au(r,n.mode);if(t.lastModified instanceof Date)await Fu(r,t.lastModified,t.lastModified)}async delete(e){await ju(T(this.rootPath,e),{recursive:!0,force:!1})}async getReadableStream(e){let t=T(this.rootPath,e),r=zs.toWeb(bs(t));return{kind:"js",stream:Qe(r)}}async getWritableStream(e){let t=T(this.rootPath,e);await He(oe(t,".."),{recursive:!0});let r=Cu(t),n=new WritableStream({write(o){return new Promise((i,s)=>{r.write(o.data,(c)=>c?s(c):i())})},close(){return new Promise((o,i)=>{r.end((s)=>s?i(s):o())})},abort(o){r.destroy(o instanceof Error?o:Error(String(o)))}});return{kind:"js",stream:n}}getMultipartReader(e){let t=T(this.rootPath,e);async function*r(){let n=await ks(t),o=Math.max(1,Math.ceil(n.size/Ht));for(let i=0;i<o;i+=1){let s=i*Ht,c=Math.min(s+Ht,n.size)-1,u=zs.toWeb(bs(t,{start:s,end:Math.max(s,c)}));yield{index:i,offset:s,kind:"js",stream:Qe(u),complete:async()=>{}}}}return r()}getMultipartWriter(e){let t=T(this.rootPath,e);return{async write(r){await He(oe(t,".."),{recursive:!0});let n=await Tu(t,"w");try{let o=[];for await(let i of r)o.push((async()=>{let s=i.stream.getReader(),c=i.offset;for(;;){let{done:u,value:a}=await s.read();if(u)break;await n.write(a.data,0,a.data.byteLength,c),c+=a.data.byteLength}await i.complete()})());await Promise.all(o)}finally{await n.close()}}}}canDirectTransfer(e){return e instanceof ve&&e.rootPath===this.rootPath}async directCopy(e,t){let r=T(this.rootPath,t);await He(oe(r,".."),{recursive:!0}),await vs(T(this.rootPath,e),r)}async directMove(e,t){let r=T(this.rootPath,e),n=T(this.rootPath,t);await He(oe(n,".."),{recursive:!0});try{await Nu(r,n)}catch(o){if(o.code==="EXDEV"){await vs(r,n),await Du(r);return}throw o}}}var Ps=ms({rootPath:Ac()}),Xt={configSchema:Ps,propertySchema:Xe,async createProvider(e){return new ve(e.rootPath)}};var Mu={create:()=>Promise.resolve(Xt)},Uu={extensionPoint:tr,factory:Mu},Ku={extensionDescriptors:[Uu]},Ju=Ku;export{ve as FilesystemIOProvider,Ju as default,Ps as filesystemConfigSchema,Xt as filesystemIOProviderFactory,Xe as filesystemPropertySchema};
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 a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){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 yi(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;yi(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.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 xi=new Set(["type","properties","required","additionalProperties"]),gi=["oneOf","anyOf"];function _i(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 Mt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!xi.has(s))return null;t.push(i)}let r={},n=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 a of t){let p=a.properties?.[s]??_i(a);if(p===null||p===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(p)))c.push(p)}let u=c.length===1?c[0]:Mt(c)??{allOf:c};F(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=_i(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function xc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of xi)if(o in e)return;let r=t.filter((o)=>gi.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Mt(t);else{let o=r[0],i=gi.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>Mt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ye(e,n)}function Jt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,p={...a},f=u.ref;if(u.ref=null,f){n(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"))a.allOf=a.allOf??[],a.allOf.push(h);else ye(a,h);if(ye(a,p),c._zod.parent===f)for(let _ in a){if(_==="$ref"||_==="allOf")continue;if(!(_ in p))delete a[_]}if(h.$ref&&m.def)for(let _ in a){if(_==="$ref"||_==="allOf")continue;if(_ in m.def&&JSON.stringify(a[_])===JSON.stringify(m.def[_]))delete a[_]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())yi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let p=a?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);if(f)f.push(a);else c.set(p,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])xc(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$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");o.$id=e.external.uri(c)}ye(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;F(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));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 n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return I(n.element,r);if(n.type==="set")return I(n.valueType,r);if(n.type==="lazy")return I(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return I(n.innerType,r);if(n.type==="intersection")return I(n.left,r)||I(n.right,r);if(n.type==="record"||n.type==="map")return I(n.keyType,r)||I(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(n.in,r)||I(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(I(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(I(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(I(o,r))return!0;if(n.rest&&I(n.rest,r))return!0;return!1}return!1}var bi=(e,t={})=>(r)=>{let n=Ut({...r,processors:t});return Z(e,n),Kt(n,e),Jt(n,e)},xe=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Ut({...o??{},target:i,io:t,processors:r});return Z(e,s),Kt(s,e),Jt(s,e)};var re=(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},vi=(e,t)=>{re(e,"minimum",t),ne(e,"maximum",t)},wi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Pi=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Si=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Zi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},zi=(e,t)=>re(e,"minimum",t.minimum),$i=(e,t)=>ne(e,"maximum",t.maximum),ki=(e)=>(t,r)=>{Zi(t,r.format);let[n,o]=e[r.format];re(t,"minimum",n),ne(t,"maximum",o)},bc={greater_than:(e,t)=>re(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ne(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wi(e,t.value),number_format:ki(we),bigint_format:ki(ut),min_length:zi,max_length:$i,length_equals:(e,t)=>vi(e,t.length),min_size:zi,max_size:$i,size_equals:(e,t)=>vi(e,t.size),string_format:(e,t)=>{if(Zi(e,t.format),t.pattern)Pi(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)=>Si(e,t.mime)};function D(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)bc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)re(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)re(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ne(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ne(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)wi(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Si(t,o.mime);for(let i of o.patterns??[])Pi(t,i);return t}var vc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zc=new Map([[kt,Xr],[Me,Yr]]),$c=(e)=>zc.get(e)??e,Oi=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:p}=D(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=vc[c]??c,o.format==="")delete o.format;if(c==="time"||p)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map($c);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Ii=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:p}=D(e);o.type=p?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),d=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(d)if(m)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.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,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[y,..._]=h;if(y!==void 0)o.multipleOf=y;if(_.length)o.allOf=[...o.allOf??[],..._.map((b)=>({multipleOf:b}))]}};var Ci=(e,t,r,n)=>{r.not={}};var Ei=(e,t,r,n)=>{};var Ai=(e,t,r,n)=>{let o=e._zod.def,i=ae(o.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 Ti=(e,t,r,n)=>{q(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Ri=(e,t,r,n)=>{q(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Ni=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=D(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=Z(i.element,t,{...n,path:[...n.path,"items"]})};function Bt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Bt(t.out);if(t.type==="catch")return Bt(t.innerType);return e._zod.optin}var Di=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)F(o.properties,a,Z(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let p=i.shape[a];if(t.io==="input"?Bt(p)===void 0:p._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=Z(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},ji=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>Z(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},Li=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=Z(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};var Fi=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Mi=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Vt=Symbol();function Ui(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return q(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Vt}var Ki=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Ui(o.defaultValue,e,t,r,n);if(s!==Vt)r.default=s},Ji=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ui(o.defaultValue,e,t,r,n);if(s!==Vt)r._prefault=s},Bi=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{q(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Vi=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Z(s,t,n);let c=t.seen.get(e);c.ref=s},Wi=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Wt=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Gi=new WeakSet([Object.prototype,Error.prototype]);function Ye(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Cc=(e,t)=>{$r.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Gi.has(r))return;Gi.add(r),Ye(r,"format",(n)=>(o)=>wr(n,o)),Ye(r,"flatten",(n)=>(o)=>kr(n,o)),Ye(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,le,2)}),Ye(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,le,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var T=l("ZodError",Cc,void 0,{Parent:Error});var Hi=Ee(T),Xi=Ae(T),Yi=Te(T),qi=Re(T),Qi=Sr(T),es=Zr(T),ts=Or(T),rs=Ir(T),ns=Cr(T),os=Er(T),is=Ar(T),ss=Tr(T);function Ac(){if(!A.localeError)N(Ot())}function Xt(){if(!A.memoizer)N({memoizer:Co()})}var P=l("ZodType",(e,t)=>(Ac(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E(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 M(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Eu(e,t))},superRefine(e,t){return this.check(Au(e,t))},overwrite(e){return this.check(G(e))},optional(){return as(this)},exactOptional(){return xu(this)},nullable(){return ls(this)},nullish(){return as(ls(this))},nonoptional(e){return wu(this,e)},array(){return lu(this)},or(e){return du([this,e])},and(e){return hu(this,e)},transform(e){return ps(this,yu(e))},default(e){return zu(this,e)},prefault(e){return ku(this,e)},catch(e){return Su(this,e)},pipe(e){return ps(this,e)},readonly(){return Iu(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 Ie(this,"~standard",{...$t(this),jsonSchema:{input:xe(this,"input"),output:xe(this,"output")}})},set "~standard"(e){B(this,"~standard",e)},parse:function e(t,r){return Hi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Xi(this,t,r,{callee:e})},safeParse(e,t){return Yi(this,e,t)},async safeParseAsync(e,t){return qi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B(this,"spa",e)},validate(e,t){return dt(this,e,t)},validateAsync(e,t){return mt(this,e,t)},encode:function e(t,r){return Qi(this,t,r,{callee:e})},decode:function e(t,r){return es(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ts(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await rs(this,t,r,{callee:e})},safeEncode(e,t){return ns(this,e,t)},safeDecode(e,t){return os(this,e,t)},async safeEncodeAsync(e,t){return is(this,e,t)},async safeDecodeAsync(e,t){return ss(this,e,t)},toJSONSchema(e){return bi(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),fs=l("_ZodString",(e,t)=>{Fe.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o)},_r({format:(e)=>D(e).format??null,minLength:(e)=>D(e).minimum??null,maxLength:(e)=>D(e).maximum??null},{regex(...e){return this.check(It(...e))},includes(...e){return this.check(At(...e))},startsWith(...e){return this.check(Tt(...e))},endsWith(...e){return this.check(Rt(...e))},min(...e){return this.check(te(...e))},max(...e){return this.check(He(...e))},length(...e){return this.check(Xe(...e))},nonempty(...e){return this.check(te(1,...e))},lowercase(e){return this.check(Ct(e))},uppercase(e){return this.check(Et(e))},trim(){return this.check(Dt())},normalize(...e){return this.check(Nt(...e))},toLowerCase(){return this.check(jt())},toUpperCase(){return this.check(Lt())},slugify(){return this.check(Ft())}})),Tc=l("ZodString",(e,t)=>{Fe.init(e,t),fs.init(e,t)},{email(e){return this.check(No(Fc,e))},url(e){return this.check(Uo(Uc,e))},jwt(e){return this.check(ni(nu,e))},emoji(e){return this.check(Ko(Kc,e))},guid(e){return this.check(Do(Mc,e))},uuid(e){return this.check(jo(qe,e))},uuidv4(e){return this.check(Lo(qe,e))},uuidv6(e){return this.check(Fo(qe,e))},uuidv7(e){return this.check(Mo(qe,e))},nanoid(e){return this.check(Jo(Jc,e))},cuid(e){return this.check(Bo(Bc,e))},cuid2(e){return this.check(Vo(Vc,e))},ulid(e){return this.check(Wo(Wc,e))},base64(e){return this.check(ei(eu,e))},base64url(e){return this.check(ti(tu,e))},xid(e){return this.check(Go(Gc,e))},ksuid(e){return this.check(Ho(Hc,e))},ipv4(e){return this.check(Xo(Xc,e))},ipv6(e){return this.check(Yo(Yc,e))},cidrv4(e){return this.check(qo(qc,e))},cidrv6(e){return this.check(Qo(Qc,e))},e164(e){return this.check(ri(ru,e))},datetime(e){return this.check(oi(Nc,e))},date(e){return this.check(ii(Dc,e))},time(e){return this.check(si(jc,e))},duration(e){return this.check(ci(Lc,e))}});function Rc(e){return Ro(Tc,e)}var k=l("ZodStringFormat",(e,t)=>{z.init(e,t),fs.init(e,t)}),Nc=l("ZodISODateTime",(e,t)=>{Vn.init(e,t),k.init(e,t)}),Dc=l("ZodISODate",(e,t)=>{Wn.init(e,t),k.init(e,t)}),jc=l("ZodISOTime",(e,t)=>{Gn.init(e,t),k.init(e,t)}),Lc=l("ZodISODuration",(e,t)=>{Hn.init(e,t),k.init(e,t)}),Fc=l("ZodEmail",(e,t)=>{Rn.init(e,t),k.init(e,t)});var Mc=l("ZodGUID",(e,t)=>{An.init(e,t),k.init(e,t)});var qe=l("ZodUUID",(e,t)=>{Tn.init(e,t),k.init(e,t)});var Uc=l("ZodURL",(e,t)=>{jn.init(e,t),k.init(e,t)});var Kc=l("ZodEmoji",(e,t)=>{Ln.init(e,t),k.init(e,t)});var Jc=l("ZodNanoID",(e,t)=>{Fn.init(e,t),k.init(e,t)});var Bc=l("ZodCUID",(e,t)=>{Mn.init(e,t),k.init(e,t)});var Vc=l("ZodCUID2",(e,t)=>{Un.init(e,t),k.init(e,t)});var Wc=l("ZodULID",(e,t)=>{Kn.init(e,t),k.init(e,t)});var Gc=l("ZodXID",(e,t)=>{Jn.init(e,t),k.init(e,t)});var Hc=l("ZodKSUID",(e,t)=>{Bn.init(e,t),k.init(e,t)});var Xc=l("ZodIPv4",(e,t)=>{Xn.init(e,t),k.init(e,t)});var Yc=l("ZodIPv6",(e,t)=>{qn.init(e,t),k.init(e,t)});var qc=l("ZodCIDRv4",(e,t)=>{Qn.init(e,t),k.init(e,t)});var Qc=l("ZodCIDRv6",(e,t)=>{eo.init(e,t),k.init(e,t)});var eu=l("ZodBase64",(e,t)=>{ro.init(e,t),k.init(e,t)});var tu=l("ZodBase64URL",(e,t)=>{no.init(e,t),k.init(e,t)});var ru=l("ZodE164",(e,t)=>{oo.init(e,t),k.init(e,t)});var nu=l("ZodJWT",(e,t)=>{io.init(e,t),k.init(e,t)});var ds=l("ZodNumber",(e,t)=>{wt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.isFinite=!0},_r({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(We(e,t))},gte(e,t){return this.check(_e(e,t))},min(e,t){return this.check(_e(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(cs(e))},safe(e){return this.check(cs(e))},positive(e){return this.check(We(0,e))},nonnegative(e){return this.check(_e(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 ou(e){return ui(ds,e)}var iu=l("ZodNumberFormat",(e,t)=>{so.init(e,t),ds.init(e,t)});function cs(e){return ai(iu,e)}var su=l("ZodUnknown",(e,t)=>{co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ei(e,r,n,o)});function us(){return li(su)}var cu=l("ZodNever",(e,t)=>{uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ci(e,r,n,o)});function uu(e){return pi(cu,e)}var au=l("ZodArray",(e,t)=>{Xt(),ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.element=t.element},{min(e,t){return this.check(te(e,t))},nonempty(e){return this.check(te(1,e))},max(e,t){return this.check(He(e,t))},length(e,t){return this.check(Xe(e,t))},unwrap(){return this.element}});function lu(e,t){return fi(au,e,t)}var pu=l("ZodObject",(e,t)=>{Xt(),fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Di(e,r,n,o),Ms(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return gu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E(this._zod.def,{catchall:us()}))},loose(){return this.clone(E(this._zod.def,{catchall:us()}))},strict(){return this.clone(E(this._zod.def,{catchall:uu()}))},strip(){return this.clone(E(this._zod.def,{catchall:void 0}))},extend(e){return As(this,e)},safeExtend(e){return Ts(this,e)},merge(e){return Rs(this,e)},pick(e){return Cs(this,e)},omit(e){return Es(this,e)},partial(...e){return dr(hs,this,e[0])},exactPartial(...e){return dr(gs,this,e[0],"exactPartial")},required(...e){return Ns(_s,this,e[0])}});function ms(e,t){let r={type:"object",shape:e??{},...g(t)};return new pu(r)}var fu=l("ZodUnion",(e,t)=>{mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ji(e,r,n,o),e.options=t.options});function du(e,t){return new fu({type:"union",options:e,...g(t)})}var mu=l("ZodIntersection",(e,t)=>{ho.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Li(e,r,n,o)});function hu(e,t){return new mu({type:"intersection",left:e,right:t})}var Ht=l("ZodEnum",(e,t)=>{go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ai(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...g(o),entries:i})}});function gu(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Ht({type:"enum",entries:r,...g(t)})}var _u=l("ZodTransform",(e,t)=>{Xt(),_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o),e._zod.parse=(r,n)=>{if(n.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 o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function yu(e){return new _u({type:"transform",transform:e})}var hs=l("ZodOptional",(e,t)=>{Pt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function as(e){return new hs({type:"optional",innerType:e})}var gs=l("ZodExactOptional",(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xu(e){return new gs({type:"optional",innerType:e})}var bu=l("ZodNullable",(e,t)=>{xo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ls(e){return new bu({type:"nullable",innerType:e})}var vu=l("ZodDefault",(e,t)=>{bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zu(e,t){return new vu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():st(t)}})}var $u=l("ZodPrefault",(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ji(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ku(e,t){return new $u({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():st(t)}})}var _s=l("ZodNonOptional",(e,t)=>{zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wu(e,t){return new _s({type:"nonoptional",innerType:e,...g(t)})}var Pu=l("ZodCatch",(e,t)=>{$o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Su(e,t){return new Pu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:yr(t)})}var Zu=l("ZodPipe",(e,t)=>{ko.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vi(e,r,n,o),e.in=t.in,e.out=t.out});function ps(e,t){return new Zu({type:"pipe",in:e,out:t})}var Ou=l("ZodReadonly",(e,t)=>{wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new Ou({type:"readonly",innerType:e})}var Cu=l("ZodCustom",(e,t)=>{Po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o)});function Eu(e,t={}){return di(Cu,e,t)}function Au(e,t){return mi(e,t)}import{createReadStream as bs,createWriteStream as Tu}from"fs";import{chmod as Ru,cp as vs,mkdir as be,open as Nu,readdir as Du,rename as ju,rm as zs,stat as ws,utimes as Lu}from"fs/promises";import{join as oe,resolve as Fu}from"path";import{Readable as $s}from"stream";import{resolve as Yt,sep as xs}from"path";function C(e,t){if(e==="")return Yt(t);let r=Yt(e),n=Yt(r,t),o=r.endsWith(xs)?r:r+xs;if(n!==r&&!n.startsWith(o))throw Error(`Path "${t}" resolves outside provider root "${e}"`);return n}var Qe=ms({mode:ou().optional()}),Mu=8388608;async function ks(e){let t=await ws(e),r=t.isDirectory();return{size:r?void 0:t.size,lastModified:t.mtime,isFolder:r,properties:{mode:t.mode}}}async function*Ps(e,t,r){let n=await Du(oe(e,t),{withFileTypes:!0});for(let o of n){let i=t?`${t}/${o.name}`:o.name;if(yield i,o.isDirectory()&&r)yield*Ps(e,i,r)}}class ve{kind="js";rootPath;constructor(e=""){this.rootPath=e===""?"":Fu(e)}async[Symbol.asyncDispose](){}async createFolder(e){await be(C(this.rootPath,e),{recursive:!0})}list(e,t){let r=this.rootPath,n=C(r,e);async function*o(){for await(let i of Ps(n,"",t?.recursive??!1)){if(t?.regex&&!t.regex.test(i))continue;let s=await ks(oe(n,i));yield{path:i,properties:s}}}return o()}async getProperties(e){return ks(C(this.rootPath,e))}async setProperties(e,t){let r=C(this.rootPath,e),n=Qe.partial().parse(t);if(n.mode!==void 0)await Ru(r,n.mode);if(t.lastModified instanceof Date)await Lu(r,t.lastModified,t.lastModified)}async delete(e){await zs(C(this.rootPath,e),{recursive:!0,force:!1})}async getReadableStream(e){let t=C(this.rootPath,e),r=$s.toWeb(bs(t));return{kind:"js",stream:rt(r)}}async getWritableStream(e){let t=C(this.rootPath,e);await be(oe(t,".."),{recursive:!0});let r=Tu(t),n=new WritableStream({write(o){return new Promise((i,s)=>{r.write(o.data,(c)=>c?s(c):i())})},close(){return new Promise((o,i)=>{r.end((s)=>s?i(s):o())})},abort(o){r.destroy(o instanceof Error?o:Error(String(o)))}});return{kind:"js",stream:n}}getPartSizeConstraints(e){return{minPartSize:0,maxPartSize:1/0,maxParts:1/0,defaultPartSize:Mu}}getMultipartReader(e,t){let r=C(this.rootPath,e);async function*n(){let o=await ws(r),i=Math.max(1,Math.ceil(o.size/t));for(let s=0;s<i;s+=1){let c=s*t,u=Math.min(c+t,o.size)-1,a=$s.toWeb(bs(r,{start:c,end:Math.max(c,u)}));yield{index:s,offset:c,kind:"js",stream:rt(a),complete:async()=>{}}}}return n()}getMultipartWriter(e,t){let r=C(this.rootPath,e);return{async write(n){await be(oe(r,".."),{recursive:!0});let o=await Nu(r,"w");try{let i=[];for await(let s of n)i.push((async()=>{let c=s.stream.getReader(),u=s.offset;for(;;){let{done:a,value:p}=await c.read();if(a)break;await o.write(p.data,0,p.data.byteLength,u),u+=p.data.byteLength}await s.complete()})());await Promise.all(i)}finally{await o.close()}}}}canDirectTransfer(e){return e instanceof ve&&e.rootPath===this.rootPath}supportsRecursiveDirectTransfer=!0;async directCopy(e,t,r){let n=C(this.rootPath,t);await be(oe(n,".."),{recursive:!0}),await vs(C(this.rootPath,e),n,{recursive:!0})}async directMove(e,t,r){let n=C(this.rootPath,e),o=C(this.rootPath,t);await be(oe(o,".."),{recursive:!0});try{await ju(n,o)}catch(i){if(i.code==="EXDEV"){await vs(n,o,{recursive:!0}),await zs(n,{recursive:!0,force:!1});return}throw i}}}var Ss=ms({rootPath:Rc().optional()}),qt={configSchema:Ss,propertySchema:Qe,async createProvider(e){return new ve(e.rootPath)}};var Uu={create:()=>Promise.resolve(qt)},Ku={extensionPoint:tr,factory:Uu},Ju={extensionDescriptors:[Ku]},Bu=Ju;export{ve as FilesystemIOProvider,Bu as default,Ss as filesystemConfigSchema,qt as filesystemIOProviderFactory,Qe as filesystemPropertySchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/io-plugin-filesystem",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
4
  "description": "Local filesystem source/sink plugin for https://github.com/flowscripter/pluggable-io-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -36,13 +36,13 @@
36
36
  "test": "bun test"
37
37
  },
38
38
  "dependencies": {
39
- "@flowscripter/pluggable-io-framework-api": "^1.0.9",
40
- "zod": "^4.6.1"
39
+ "@flowscripter/pluggable-io-framework-api": "^1.1.1",
40
+ "zod": "^4.6.5"
41
41
  },
42
42
  "devDependencies": {
43
- "@flowscripter/dynamic-plugin-framework": "^2.2.7",
43
+ "@flowscripter/dynamic-plugin-framework": "^2.2.9",
44
44
  "@types/bun": "^1.4.2",
45
- "@types/node": "^26.4.1",
45
+ "@types/node": "^26.5.1",
46
46
  "oxfmt": "0.67.0",
47
47
  "oxlint": "1.82.0"
48
48
  },