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