@flowscripter/io-plugin-http 1.0.0 → 1.0.2
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/dist/bundle.js +11 -11
- package/package.json +8 -8
package/dist/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
class Pe extends Error{constructor(e,t){super(e,t);this.name="PermanentIOError"}}class ue extends Error{constructor(e,t){super(e,t);this.name="TransientIOError"}}var or="@flowscripter/pluggable-io-framework/provider-factory";function tt(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:o,value:n}=await t.read();if(o){r.close();return}r.enqueue({payload:{kind:"js",data:n}})},cancel(r){return t.cancel(r)}})}function V(e,t){let r=`${t} failed with HTTP ${e.status} ${e.statusText}`.trim();if(e.status===408||e.status===429||e.status>=500)return new ue(r);return new Pe(r)}function Q(e,t){if(e instanceof ue||e instanceof Pe)return e;if(e instanceof DOMException&&e.name==="AbortError")return e;return new ue(`${t} failed: ${String(e)}`,{cause:e})}function nr(e,t,r){let o=0;return e.pipeThrough(new TransformStream({transform(n,i){let s=o;o+=n.byteLength;let c=Math.max(t-s,0),a=Math.min(r-s,n.byteLength);if(a>c)i.enqueue(n.subarray(c,a));if(o>=r)i.terminate()}}))}function ir(){return new ReadableStream({start(e){e.close()}})}async function sr(e,t,r){try{return await e(t,{method:"GET",headers:r})}catch(o){throw Q(o,`GET ${t}`)}}async function cr(e,t,r){let o=await sr(e,t,r);if(!o.ok||o.body===null)throw V(o,`GET ${t}`);return{kind:"js",stream:tt(o.body),async readRange(n,i){if(i<=n)return ir();let s=new Headers(r),c=i>=Number.MAX_SAFE_INTEGER?"":String(i-1);s.set("Range",`bytes=${n}-${c}`);let a=await sr(e,t,s);if(a.status===416)return await a.body?.cancel(),ir();if(!a.ok||a.body===null)throw V(a,`GET ${t}`);let u=a.status===206?a.body:nr(a.body,n,i);return tt(u)}}}function ar(e,t,r,o){let n=new TransformStream,i=n.writable.getWriter(),s=new AbortController,c=`${r} ${t}`,a=e(t,{method:r,headers:o,body:n.readable,signal:s.signal,duplex:"half"}).then(async(u)=>{if(!u.ok)throw V(u,c);await u.body?.cancel()},(u)=>{throw Q(u,c)});return a.catch(()=>{}),{kind:"js",stream:new WritableStream({async write(u){await Promise.race([i.write(u.payload.data),a.then(()=>{})])},async close(){await i.close(),await a},async abort(u){s.abort(u),await i.abort(u).catch(()=>{})}})}}function ze(e){let t=new Headers;for(let{name:r,value:o}of e.headers??[])t.append(r,o);if(e.bearerToken!==void 0)t.set("Authorization",`Bearer ${e.bearerToken}`);else if(e.username!==void 0){let r=`${e.username}:${e.password??""}`;t.set("Authorization",`Basic ${Buffer.from(r).toString("base64")}`)}return t}function ur(e){let t=e.headers.get("content-length"),r=e.headers.get("last-modified"),o=e.headers.get("etag");return{size:t===null?void 0:Number(t),lastModified:r===null?void 0:new Date(r),isContainer:!1,contentType:e.headers.get("content-type")??void 0,properties:o===null?{}:{etag:o}}}class $e{kind="js";#e;#t;constructor(e,t=fetch){this.#e=e,this.#t=t}async[Symbol.asyncDispose](){}async getProperties(e){let t=await this.#r("HEAD",e);return ur(t)}async delete(e){await(await this.#r("DELETE",e)).body?.cancel()}getReadableStream(e){return cr(this.#t,e,ze(this.#e))}async getWritableStream(e){return ar(this.#t,e,this.#e.method??"PUT",ze(this.#e))}async#r(e,t){let r;try{r=await this.#t(t,{method:e,headers:ze(this.#e)})}catch(o){throw Q(o,`${e} ${t}`)}if(!r.ok)throw V(r,`${e} ${t}`);return r}}function rt(e){return{url:e}}function ot(e){let{url:t,...r}=e;return{config:r,target:{kind:"entry",key:t}}}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 it(e,t="|"){return e.map((r)=>at(r)).join(t)}function de(e,t){if(typeof t==="bigint")return t.toString();return t}class lr{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 we(e){return new lr(e)}function pr(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 K(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Se(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function M(e){return Se(e._zod.def)??e._zod.def.shape}function fr(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return K(this,t,o),o},enumerable:!0,configurable:!0})}function dr(e,t,r){if(t in e)K(e,t,r);else e[t]=r}function W(e,t,r,o){let n=M(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);if(!s.enumerable)continue;if(s.get)fr(e,i,()=>{let c=t._zod.def.shape[i];return o?o(c,i):c});else dr(e,i,o?o(s.value,i):s.value)}}function xs(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)fr(e,r,()=>t[r]);else dr(e,r,o.value)}}function I(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function mr(e){return JSON.stringify(e)}function hr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var st="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var gr=we(()=>{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 ee(e){if(pe(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(pe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ct(e){if(ee(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var yr=new Set(["string","number","symbol"]);function te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function at(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function _r(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ut=(()=>({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]}))(),lt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function bs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return W(i,e,Ze(e,t)),L(e,I(r,{shape:i,checks:[]}))}function Ze(e,t){let r=M(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function vs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ze(e,t)),s={};return W(s,e,Reflect.ownKeys(M(e)).filter((c)=>!i.has(c))),L(e,I(r,{shape:s,checks:[]}))}function Ps(e,t){if(!ee(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=M(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,I(e._zod.def,{shape:xr(e,t)}))}function xr(e,t){let r={};return W(r,e,Reflect.ownKeys(M(e))),xs(r,t),r}function zs(e,t){if(!ee(t))throw Error("Invalid input to safeExtend: expected a plain object");return L(e,I(e._zod.def,{shape:xr(e,t)}))}function $s(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={};W(r,e,Reflect.ownKeys(M(e))),W(r,t,Reflect.ownKeys(M(t)));let o=I(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,o)}function br(e,t,r,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(Ze(t,r)):void 0,a={};return W(a,t,Reflect.ownKeys(M(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),L(t,I(t._zod.def,{shape:a,checks:[]}))}function ws(e,t,r){let o=r?new Set(Ze(t,r)):void 0,n={};return W(n,t,Reflect.ownKeys(M(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,I(t._zod.def,{shape:n}))}function j(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 vr(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 Oe(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function le(e){return typeof e==="string"?e:e?.message}function pt(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function B(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:le(e.inst?._zod.def?.error?.(e))??le(i?.(e))??le(t?.error?.(e))??le(r.customError?.(e))??le(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var ks=/[\uD800-\uDBFF]/;function Ie(e){let t=e.length;if(!ks.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 Ee(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Pr(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 G(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function zr(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else Zs(e,r,o.value)}}function U(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Te(e,t,r){return U(e,t,r,!1)}function Ss(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return U(this,r,o(this))},set(n){U(this,r,n)}})}return t}function Zs(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:U(this,t,r.bind(this))},set(o){U(this,t,o)}})}function Os(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var nt,J=!1,Is={configurable:!0,get(){J=!0;return}};function x(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&nt!==e._zod){nt=void 0;return}nt=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Is);let n=J;J=!1;try{let i=r(this);if(J)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return J=J||n,i}catch(i){throw delete this[t],J=J||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function Es(e,t,r,o){let n=Os(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 Ts="~constantCatch";function $r(e){let t=()=>e;return t[Ts]=!0,t}var wr;var ft={value:void 0,enumerable:!1},kr="captureStackTrace"in Error?Error:null;function As(e){let t=kr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return kr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,o){let n={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=n;let s=r,c=s&&new WeakSet;function a(d,m){if(!d._zod){ft.value=new i(m);try{Object.defineProperty(d,"_zod",ft)}finally{ft.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),y=d._zod.constr.prototype,S=_;while(S&&S!==y)S=Object.getPrototypeOf(S);let N=S??_;if(!c.has(N))c.add(N),zr(N,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=o?.Parent?As(l):this;a(m,d);let h=m._zod.deferred;if(h){for(let y of h)y();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class F extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class me extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(wr=globalThis).__zod_globalConfig??(wr.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function C(e){if(e)Object.assign(E,e);return E}function Rs(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,de,2)),e.message}function Cs(e){this._zod.message=e}var Ns={get:Rs,set:Cs,enumerable:!0,configurable:!0},mt={value:void 0,enumerable:!1},Sr=new WeakSet([Object.prototype,Error.prototype]),Zr=(e,t)=>{e.name="$ZodError",mt.value=t,Object.defineProperty(e,"issues",mt),mt.value=void 0,Object.defineProperty(e,"message",Ns);let r=Object.getPrototypeOf(e);if(!Sr.has(r))Sr.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})}})},Or=p("$ZodError",Zr),qu=p("$ZodError",Zr,void 0,{Parent:Error});function Ds(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 Ir(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)Ds(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Er(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>o({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let l=c[u],f=u===c.length-1;if(l==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,l))Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[l];if(f)d._errors.push(t(s));a=d,u++}}}};return o(e),r}function Ae(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Re=(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 F;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>B(u,s,C())));throw st(a,i?.callee??t),a}return c.value};return t};var Ce=(e)=>{let t=async(r,o,n,i)=>{let s=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>B(u,s,C())));throw st(a,i?.callee??t),a}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 F;return i.issues.length?Tr(e,i.issues,n):{success:!0,data:i.value}};function Tr(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>B(n,r,C()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var De=(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?Tr(e,i.issues,n):{success:!0,data:i.value}};var Ks=Symbol.for("zod.compile.invalid"),Ls=Symbol.for("zod.compile.fallback"),ht=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Ks)return!0;if(o.definite===!0&&r===void 0)return!1}return js(e,t,r)};function js(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n)o[Ls]=!0,i=n({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new F;return i.issues.length===0}var gt=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},Ar=(e)=>{let t=Re(e),r=(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,n,c,Ae(r,s))};return r};var Rr=(e)=>{let t=Re(e),r=(o,n,i,s)=>t(o,n,i,Ae(r,s));return r};var Cr=(e)=>{let t=Ce(e),r=async(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,n,c,Ae(r,s))};return r};var Nr=(e)=>{let t=Ce(e),r=async(o,n,i,s)=>await t(o,n,i,Ae(r,s));return r};var Dr=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ne(e)(t,r,n)};var Kr=(e)=>(t,r,o)=>Ne(e)(t,r,o);var Lr=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return De(e)(t,r,n)};var jr=(e)=>async(t,r,o)=>De(e)(t,r,o);var Fr=/^[cC][0-9a-z]{6,}$/,Mr=/^[0-9a-z]+$/,Ur=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Jr=/^[0-9a-vA-V]{20}$/,Br=/^[A-Za-z0-9]{27}$/,Hr=/^[a-zA-Z0-9_-]{21}$/;function Vr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Wr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Gr=/^([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})$/,_t=(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 Xr=/^(?:[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 Fs="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function qr(){return new RegExp(Fs,"u")}var Yr=/^(?:(?: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])$/,Qr=/^(([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 eo=/^((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])$/,to=/^(([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])$/,ro=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,oo=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var no=/^https?$/,io=/^\+[1-9]\d{6,14}$/;var so="(?:(?:\\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 Ms(e){return new RegExp(`^${e}$`)}var co=Ms(so);function yt(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 ao(e){return new RegExp(`^${yt(e)}$`)}function uo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${yt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${yt({precision:e.precision})}`:r;return new RegExp(`^${so}T(?:${o})$`)}var lo=/^[\s\S]{0,}$/;var po=/^[^A-Z]*$/,fo=/^[^a-z]*$/;var T=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var xt=(e)=>{let t=e.value;return!pr(t)&&t.length!==void 0};var mo=p("$ZodCheckMaxLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=xt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>t.maximum?Ie(n):i)<=t.maximum)return;let c=Ee(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ho=p("$ZodCheckMinLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=xt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>=t.minimum&&i<t.minimum*2?Ie(n):i)>=t.minimum)return;let c=Ee(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),go=p("$ZodCheckLengthEquals",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=xt),e._zod.check=(o)=>{let n=o.value,i=n.length,s=typeof n==="string"&&i>=t.length&&i<=t.length*2?Ie(n):i;if(s===t.length)return;let c=Ee(n),a=s>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),ge=p("$ZodCheckStringFormat",(e,t)=>{var r,o;if(T.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),yo=p("$ZodCheckRegex",(e,t)=>{ge.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})}}),_o=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=po),ge.init(e,t)}),xo=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fo),ge.init(e,t)}),bo=p("$ZodCheckIncludes",(e,t)=>{T.init(e,t);let r=te(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vo=p("$ZodCheckStartsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`^${te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Po=p("$ZodCheckEndsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`.*${te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var zo=p("$ZodCheckOverwrite",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class bt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
2
|
+
class ze extends Error{constructor(e,t){super(e,t);this.name="PermanentIOError"}}class ue extends Error{constructor(e,t){super(e,t);this.name="TransientIOError"}}var nr="@flowscripter/pluggable-io-framework/provider-factory";function rt(e){let t=e.getReader();return new ReadableStream({async pull(r){let{done:o,value:n}=await t.read();if(o){r.close();return}r.enqueue({payload:{kind:"js",data:n}})},cancel(r){return t.cancel(r)}})}function V(e,t){let r=`${t} failed with HTTP ${e.status} ${e.statusText}`.trim();if(e.status===408||e.status===429||e.status>=500)return new ue(r);return new ze(r)}function Q(e,t){if(e instanceof ue||e instanceof ze)return e;if(e instanceof DOMException&&e.name==="AbortError")return e;return new ue(`${t} failed: ${String(e)}`,{cause:e})}function ir(e,t,r){let o=0;return e.pipeThrough(new TransformStream({transform(n,i){let s=o;o+=n.byteLength;let c=Math.max(t-s,0),a=Math.min(r-s,n.byteLength);if(a>c)i.enqueue(n.subarray(c,a));if(o>=r)i.terminate()}}))}function sr(){return new ReadableStream({start(e){e.close()}})}async function cr(e,t,r){try{return await e(t,{method:"GET",headers:r})}catch(o){throw Q(o,`GET ${t}`)}}async function ar(e,t,r){let o=await cr(e,t,r);if(!o.ok||o.body===null)throw V(o,`GET ${t}`);return{kind:"js",stream:rt(o.body),async readRange(n,i){if(i<=n)return sr();let s=new Headers(r),c=i>=Number.MAX_SAFE_INTEGER?"":String(i-1);s.set("Range",`bytes=${n}-${c}`);let a=await cr(e,t,s);if(a.status===416)return await a.body?.cancel(),sr();if(!a.ok||a.body===null)throw V(a,`GET ${t}`);let u=a.status===206?a.body:ir(a.body,n,i);return rt(u)}}}function ur(e,t,r,o){let n=new TransformStream,i=n.writable.getWriter(),s=new AbortController,c=`${r} ${t}`,a=e(t,{method:r,headers:o,body:n.readable,signal:s.signal,duplex:"half"}).then(async(u)=>{if(!u.ok)throw V(u,c);await u.body?.cancel()},(u)=>{throw Q(u,c)});return a.catch(()=>{}),{kind:"js",stream:new WritableStream({async write(u){await Promise.race([i.write(u.payload.data),a.then(()=>{})])},async close(){await i.close(),await a},async abort(u){s.abort(u),await i.abort(u).catch(()=>{})}})}}function Pe(e){let t=new Headers;for(let{name:r,value:o}of e.headers??[])t.append(r,o);if(e.bearerToken!==void 0)t.set("Authorization",`Bearer ${e.bearerToken}`);else if(e.username!==void 0){let r=`${e.username}:${e.password??""}`;t.set("Authorization",`Basic ${Buffer.from(r).toString("base64")}`)}return t}function lr(e){let t=e.headers.get("content-length"),r=e.headers.get("last-modified"),o=e.headers.get("etag");return{size:t===null?void 0:Number(t),lastModified:r===null?void 0:new Date(r),isContainer:!1,contentType:e.headers.get("content-type")??void 0,properties:o===null?{}:{etag:o}}}class $e{kind="js";#e;#t;constructor(e,t=fetch){this.#e=e,this.#t=t}async[Symbol.asyncDispose](){}async getProperties(e){let t=await this.#r("HEAD",e);return lr(t)}async delete(e){await(await this.#r("DELETE",e)).body?.cancel()}getReadableStream(e){return ar(this.#t,e,Pe(this.#e))}async getWritableStream(e){return ur(this.#t,e,this.#e.method??"PUT",Pe(this.#e))}async#r(e,t){let r;try{r=await this.#t(t,{method:e,headers:Pe(this.#e)})}catch(o){throw Q(o,`${e} ${t}`)}if(!r.ok)throw V(r,`${e} ${t}`);return r}}function ot(e){return{url:e}}function nt(e){let{url:t,...r}=e;return{config:r,target:{kind:"entry",key:t}}}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 st(e,t="|"){return e.map((r)=>ut(r)).join(t)}function de(e,t){if(typeof t==="bigint")return t.toString();return t}class pr{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 we(e){return new pr(e)}function fr(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 K(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Se(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function M(e){return Se(e._zod.def)??e._zod.def.shape}function dr(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return K(this,t,o),o},enumerable:!0,configurable:!0})}function mr(e,t,r){if(t in e)K(e,t,r);else e[t]=r}function W(e,t,r,o){let n=M(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);if(!s.enumerable)continue;if(s.get)dr(e,i,()=>{let c=t._zod.def.shape[i];return o?o(c,i):c});else mr(e,i,o?o(s.value,i):s.value)}}function bs(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)dr(e,r,()=>t[r]);else mr(e,r,o.value)}}function I(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function hr(e){return JSON.stringify(e)}function gr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ct="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var yr=we(()=>{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 ee(e){if(pe(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(pe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function at(e){if(ee(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var _r=new Set(["string","number","symbol"]);function te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ut(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function xr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var lt=(()=>({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]}))(),pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function vs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return W(i,e,Ze(e,t)),L(e,I(r,{shape:i,checks:[]}))}function Ze(e,t){let r=M(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function zs(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ze(e,t)),s={};return W(s,e,Reflect.ownKeys(M(e)).filter((c)=>!i.has(c))),L(e,I(r,{shape:s,checks:[]}))}function Ps(e,t){if(!ee(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=M(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,I(e._zod.def,{shape:br(e,t)}))}function br(e,t){let r={};return W(r,e,Reflect.ownKeys(M(e))),bs(r,t),r}function $s(e,t){if(!ee(t))throw Error("Invalid input to safeExtend: expected a plain object");return L(e,I(e._zod.def,{shape:br(e,t)}))}function ws(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={};W(r,e,Reflect.ownKeys(M(e))),W(r,t,Reflect.ownKeys(M(t)));let o=I(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,o)}function vr(e,t,r,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(Ze(t,r)):void 0,a={};return W(a,t,Reflect.ownKeys(M(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),L(t,I(t._zod.def,{shape:a,checks:[]}))}function ks(e,t,r){let o=r?new Set(Ze(t,r)):void 0,n={};return W(n,t,Reflect.ownKeys(M(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,I(t._zod.def,{shape:n}))}function j(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 zr(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 Oe(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function le(e){return typeof e==="string"?e:e?.message}function ft(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;if(n>=0)t.push([n,r])}return t}function Ie(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function B(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:le(e.inst?._zod.def?.error?.(e))??le(i?.(e))??le(t?.error?.(e))??le(r.customError?.(e))??le(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Ss=/[\uD800-\uDBFF]/;function Ee(e){let t=e.length;if(!Ss.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 Te(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Pr(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 G(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function $r(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else Os(e,r,o.value)}}function U(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ae(e,t,r){return U(e,t,r,!1)}function Zs(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return U(this,r,o(this))},set(n){U(this,r,n)}})}return t}function Os(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:U(this,t,r.bind(this))},set(o){U(this,t,o)}})}function Is(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var it,J=!1,Es={configurable:!0,get(){J=!0;return}};function x(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&it!==e._zod){it=void 0;return}it=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Es);let n=J;J=!1;try{let i=r(this);if(J)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return J=J||n,i}catch(i){throw delete this[t],J=J||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function Ts(e,t,r,o){let n=Is(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 As="~constantCatch";function wr(e){let t=()=>e;return t[As]=!0,t}var kr;var dt={value:void 0,enumerable:!1},Sr="captureStackTrace"in Error?Error:null;function Rs(e){let t=Sr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Sr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,o){let n={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=n;let s=r,c=s&&new WeakSet;function a(d,m){if(!d._zod){dt.value=new i(m);try{Object.defineProperty(d,"_zod",dt)}finally{dt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),y=d._zod.constr.prototype,S=_;while(S&&S!==y)S=Object.getPrototypeOf(S);let N=S??_;if(!c.has(N))c.add(N),$r(N,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=o?.Parent?Rs(l):this;a(m,d);let h=m._zod.deferred;if(h){for(let y of h)y();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class F extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class me extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(kr=globalThis).__zod_globalConfig??(kr.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function C(e){if(e)Object.assign(E,e);return E}function Cs(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,de,2)),e.message}function Ns(e){this._zod.message=e}var Ds={get:Cs,set:Ns,enumerable:!0,configurable:!0},ht={value:void 0,enumerable:!1},Zr=new WeakSet([Object.prototype,Error.prototype]),Or=(e,t)=>{e.name="$ZodError",ht.value=t,Object.defineProperty(e,"issues",ht),ht.value=void 0,Object.defineProperty(e,"message",Ds);let r=Object.getPrototypeOf(e);if(!Zr.has(r))Zr.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})}})},Ir=p("$ZodError",Or),el=p("$ZodError",Or,void 0,{Parent:Error});function Ks(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 Er(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)Ks(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Tr(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>o({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let l=c[u],f=u===c.length-1;if(l==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,l))Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[l];if(f)d._errors.push(t(s));a=d,u++}}}};return o(e),r}function Re(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ce=(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 F;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>B(u,s,C())));throw ct(a,i?.callee??t),a}return c.value};return t};var Ne=(e)=>{let t=async(r,o,n,i)=>{let s=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>B(u,s,C())));throw ct(a,i?.callee??t),a}return c.value};return t};var De=(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 F;return i.issues.length?Ar(e,i.issues,n):{success:!0,data:i.value}};function Ar(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>B(n,r,C()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var Ke=(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?Ar(e,i.issues,n):{success:!0,data:i.value}};var Ls=Symbol.for("zod.compile.invalid"),js=Symbol.for("zod.compile.fallback"),gt=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Ls)return!0;if(o.definite===!0&&r===void 0)return!1}return Fs(e,t,r)};function Fs(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n)o[js]=!0,i=n({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new F;return i.issues.length===0}var yt=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},Rr=(e)=>{let t=Ce(e),r=(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,n,c,Re(r,s))};return r};var Cr=(e)=>{let t=Ce(e),r=(o,n,i,s)=>t(o,n,i,Re(r,s));return r};var Nr=(e)=>{let t=Ne(e),r=async(o,n,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,n,c,Re(r,s))};return r};var Dr=(e)=>{let t=Ne(e),r=async(o,n,i,s)=>await t(o,n,i,Re(r,s));return r};var Kr=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return De(e)(t,r,n)};var Lr=(e)=>(t,r,o)=>De(e)(t,r,o);var jr=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ke(e)(t,r,n)};var Fr=(e)=>async(t,r,o)=>Ke(e)(t,r,o);var Mr=/^[cC][0-9a-z]{6,}$/,Ur=/^[0-9a-z]+$/,Jr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Br=/^[0-9a-vA-V]{20}$/,Hr=/^[A-Za-z0-9]{27}$/,Vr=/^[a-zA-Z0-9_-]{21}$/;function Wr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Gr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Xr=/^([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})$/,xt=(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 qr=/^(?:[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 Ms="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Yr(){return new RegExp(Ms,"u")}var Qr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eo=/^(([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 to=/^((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])$/,ro=/^(([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])$/,oo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,no=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var io=/^https?$/,so=/^\+[1-9]\d{6,14}$/;var co="(?:(?:\\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 Us(e){return new RegExp(`^${e}$`)}var ao=Us(co);function _t(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 uo(e){return new RegExp(`^${_t(e)}$`)}function lo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${_t({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${_t({precision:e.precision})}`:r;return new RegExp(`^${co}T(?:${o})$`)}var po=/^[\s\S]{0,}$/;var fo=/^[^A-Z]*$/,mo=/^[^a-z]*$/;var T=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var bt=(e)=>{let t=e.value;return!fr(t)&&t.length!==void 0};var ho=p("$ZodCheckMaxLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=bt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>t.maximum?Ee(n):i)<=t.maximum)return;let c=Te(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),go=p("$ZodCheckMinLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=bt),e._zod.check=(o)=>{let n=o.value,i=n.length;if((typeof n==="string"&&i>=t.minimum&&i<t.minimum*2?Ee(n):i)>=t.minimum)return;let c=Te(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),yo=p("$ZodCheckLengthEquals",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=bt),e._zod.check=(o)=>{let n=o.value,i=n.length,s=typeof n==="string"&&i>=t.length&&i<=t.length*2?Ee(n):i;if(s===t.length)return;let c=Te(n),a=s>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),ge=p("$ZodCheckStringFormat",(e,t)=>{var r,o;if(T.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),_o=p("$ZodCheckRegex",(e,t)=>{ge.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})}}),xo=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fo),ge.init(e,t)}),bo=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mo),ge.init(e,t)}),vo=p("$ZodCheckIncludes",(e,t)=>{T.init(e,t);let r=te(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),zo=p("$ZodCheckStartsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`^${te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Po=p("$ZodCheckEndsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`.*${te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var $o=p("$ZodCheckOverwrite",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class vt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
3
|
`).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${t.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}}var wo={major:4,minor:6,patch:5};var z=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wo;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=j(c),f;for(let d of a){if(d._zod.def.when){if(vr(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&&u?.async===!1)throw new F;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(pt(c.issues,m,e),!l)l=j(c,m)});else{if(c.issues.length===m)continue;if(pt(c.issues,m,e),!l)l=j(c,m)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(j(c))return c.aborted=!0,c;let l=i(a,n,u);if(l instanceof Promise){if(u.async===!1)throw new F;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,a));return s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new F;return u.then((l)=>i(l,n,a))}return i(u,n,a)}}},{get "~standard"(){return Te(this,"~standard",Pt(this))},set "~standard"(e){U(this,"~standard",e)}}),No=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>B(r,t,C()))}:{value:e.value};async function Bs(e,t){let r={async:!0};return No(await e._zod.run({value:t,issues:[]},r),r)}function Pt(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return No(o,r)}catch(o){}return Bs(e,t)},vendor:"zod",version:1}}var Fe=p("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??lo,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}}),v=p("$ZodStringFormat",(e,t)=>{ge.init(e,t),Fe.init(e,t)}),Do=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Gr),v.init(e,t)}),Ko=p("$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=_t(o))}else t.pattern??(t.pattern=_t());v.init(e,t)}),Lo=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xr),v.init(e,t)}),jo=1,Le=2;function Fo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Hs(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Fo(e)||Le;return Vs(e,t)}function Vs(e,t){if(!t.normalize&&t.protocol?.source===no.source&&!/^https?:\/\//i.test(e))return jo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Le}return new URL(e)}catch{return Le}}var Ws=/[\t\n\r]/g;function ko(e){return e.replace(Ws,"")}function Gs(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xs(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Mo=p("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=Hs(o,t);if(n===jo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Le){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=ko(o);return}if(t.hostname&&!Gs(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&&!Xs(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:ko(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Uo=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qr()),v.init(e,t)}),Jo=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?Hr:Vr(t.length)),v.init(e,t)}),Bo=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fr),v.init(e,t)}),Ho=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Mr),v.init(e,t)}),Vo=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ur),v.init(e,t)}),Wo=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Jr),v.init(e,t)}),Go=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Br),v.init(e,t)}),Xo=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uo(t)),v.init(e,t)}),qo=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=co),v.init(e,t)}),Yo=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ao(t)),v.init(e,t)}),Qo=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Wr),v.init(e,t)}),en=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Yr),v.init(e,t)}),qs=/^[0-9a-fA-F:.]+$/;function tn(e){if(!qs.test(e))return!1;return Fo(`http://[${e}]`)}var rn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Qr),v.init(e,t),e._zod.check=(r)=>{if(!tn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var on=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eo),v.init(e,t)});function Ys(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 tn(r)}var nn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=to),v.init(e,t),e._zod.check=(r)=>{if(!Ys(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function sn(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}$/,cn=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zt),v.init(e,t),e._zod.check=(r)=>{if(sn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Me=/^[A-Za-z0-9_-]*$/;function Qs(e){if(!Me.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return sn(r)}var an=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Me),v.init(e,t),e._zod.check=(r)=>{if(Qs(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),un=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=io),v.init(e,t)});function ec(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 ln=p("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{if(ec(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var pn=p("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(r)=>r}),fn=p("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function So(e,t,r){if(e.issues.length)t.issues.push(...Oe(r,e.issues));t.value[r]=e.value}var dn=p("$ZodArray",(e,t)=>{z.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=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)s.push(l.then((f)=>So(f,o,a)));else if(So(l,o,a),c&&l.issues.length!==0&&j(l))break}if(s.length)return Promise.all(s).then(()=>o);return o}});function je(e,t,r,o,n,i){let s=r in o,c=i==="optional";if(!s&&c&&n==="optional")return;if(e.issues.length){if(n!==void 0&&c&&!s)return;t.issues.push(...Oe(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var tc=[];function mn(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:tc,n=o.length?[...t,...o]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=_r(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function hn(e,t,r,o,n,i,s){let c=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,{optin:f,optout:d}=u,m=0;for(let h in t){if(s&&r.issues.length!==m){if(j(r,m))break;m=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let _=u.run({value:t[h],issues:[]},o);if(_ instanceof Promise)e.push(_.then((y)=>je(y,r,h,t,f,d)));else je(_,r,h,t,f,d)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var rc=p("$ZodObject",(e,t)=>{z.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=we(()=>mn(t));x(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))K(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=pe,s=t.catchall,c,a=E.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=n.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let d=[],m=c.shape,h=l?.abortEarly,_=u.issues.length;for(let y of c.allKeys){if(h&&u.issues.length!==_){if(j(u,_))break;_=u.issues.length}if(y==="__proto__")continue;let S=m[y],N=S._zod.optin,ce=S._zod.optout,ae=S._zod.run({value:f[y],issues:[]},l);if(ae instanceof Promise)d.push(ae.then((w)=>je(w,u,y,f,N,ce)));else je(ae,u,y,f,N,ce)}if(!s)return d.length?Promise.all(d).then(()=>u):u;return hn(d,f,u,l,n.value,e,h===!0)}}),gn=p("$ZodObjectJIT",(e,t)=>{rc.init(e,t);let r=e._zod.parse,o=we(()=>mn(t)),n=E.memoizer,i=(m)=>{let h=o.value,_=h.symbolKeys,y=new bt(["payload","ctx"],{shape:m,inst:e,memo:n,syms:_}),S=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,N=(w,b)=>`
|
|
6
|
+
};`)(...Object.values(this.closed))}}var ko={major:4,minor:6,patch:7};var P=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ko;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=j(c),f;for(let d of a){if(d._zod.def.when){if(zr(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&&u?.async===!1)throw new F;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Ie(c.issues,m,e),!l)l=j(c,m)});else{if(c.issues.length===m)continue;if(Ie(c.issues,m,e),!l)l=j(c,m)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(j(c))return c.aborted=!0,c;let l=i(a,n,u);if(l instanceof Promise){if(u.async===!1)throw new F;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,a));return s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new F;return u.then((l)=>i(l,n,a))}return i(u,n,a)}}},{get "~standard"(){return Ae(this,"~standard",Pt(this))},set "~standard"(e){U(this,"~standard",e)}}),Do=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>B(r,t,C()))}:{value:e.value};async function Hs(e,t){let r={async:!0};return Do(await e._zod.run({value:t,issues:[]},r),r)}function Pt(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Do(o,r)}catch(o){}return Hs(e,t)},vendor:"zod",version:1}}var Me=p("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??po,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}}),v=p("$ZodStringFormat",(e,t)=>{ge.init(e,t),Me.init(e,t)}),Ko=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xr),v.init(e,t)}),Lo=p("$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=xt(o))}else t.pattern??(t.pattern=xt());v.init(e,t)}),jo=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qr),v.init(e,t)}),Fo=1,je=2;function Mo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Vs(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Mo(e)||je;return Ws(e,t)}function Ws(e,t){if(!t.normalize&&t.protocol?.source===io.source&&!/^https?:\/\//i.test(e))return Fo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??je}return new URL(e)}catch{return je}}var Gs=/[\t\n\r]/g;function So(e){return e.replace(Gs,"")}function Xs(e,t){return t.lastIndex=0,t.test(e.hostname)}function qs(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Uo=p("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=Vs(o,t);if(n===Fo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===je){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=So(o);return}if(t.hostname&&!Xs(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&&!qs(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:So(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Jo=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Yr()),v.init(e,t)}),Bo=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?Vr:Wr(t.length)),v.init(e,t)}),Ho=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mr),v.init(e,t)}),Vo=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ur),v.init(e,t)}),Wo=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Jr),v.init(e,t)}),Go=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Br),v.init(e,t)}),Xo=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Hr),v.init(e,t)}),qo=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=lo(t)),v.init(e,t)}),Yo=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ao),v.init(e,t)}),Qo=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=uo(t)),v.init(e,t)}),en=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gr),v.init(e,t)}),tn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Qr),v.init(e,t)}),Ys=/^[0-9a-fA-F:.]+$/;function rn(e){if(!Ys.test(e))return!1;return Mo(`http://[${e}]`)}var on=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eo),v.init(e,t),e._zod.check=(r)=>{if(!rn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var nn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=to),v.init(e,t)});function Qs(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 rn(r)}var sn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ro),v.init(e,t),e._zod.check=(r)=>{if(!Qs(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function cn(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 $t=/^[0-9a-zA-Z+/]*={0,2}$/,an=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$t),v.init(e,t),e._zod.check=(r)=>{if(cn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ue=/^[A-Za-z0-9_-]*$/;function ec(e){if(!Ue.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return cn(r)}var un=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ue),v.init(e,t),e._zod.check=(r)=>{if(ec(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ln=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=so),v.init(e,t)});function tc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var pn=p("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{if(tc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var fn=p("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=(r)=>r}),dn=p("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function rc(e,t){let r=ft(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map((i)=>i[0])),n=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of ft(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Ie(i.issues,l,e),i}}return n(i,s)}}var oc=(e)=>Array.isArray(e)?e.length:-1;function Zo(e,t,r){if(e.issues.length)t.issues.push(...Oe(r,e.issues));t.value[r]=e.value}var mn=p("$ZodArray",(e,t)=>{P.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=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)s.push(l.then((f)=>Zo(f,o,a)));else if(Zo(l,o,a),c&&l.issues.length!==0&&j(l))break}if(s.length)return Promise.all(s).then(()=>o);return o},rc(e,oc)});function Fe(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(...Oe(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var nc=[];function hn(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:nc,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=xr(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function gn(e,t,r,o,n,i,s){let c=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,{optin:f,optout:d}=u,m=0;for(let h in t){if(s&&r.issues.length!==m){if(j(r,m))break;m=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let _=u.run({value:t[h],issues:[]},o);if(_ instanceof Promise)e.push(_.then((y)=>Fe(y,r,h,t,f,d)));else Fe(_,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 ic=p("$ZodObject",(e,t)=>{P.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=we(()=>hn(t));x(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))K(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=pe,s=t.catchall,c,a=E.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=n.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let d=[],m=c.shape,h=l?.abortEarly,_=u.issues.length;for(let y of c.allKeys){if(h&&u.issues.length!==_){if(j(u,_))break;_=u.issues.length}if(y==="__proto__")continue;let S=m[y],N=S._zod.optin,ce=S._zod.optout,ae=S._zod.run({value:f[y],issues:[]},l);if(ae instanceof Promise)d.push(ae.then((w)=>Fe(w,u,y,f,N,ce)));else Fe(ae,u,y,f,N,ce)}if(!s)return d.length?Promise.all(d).then(()=>u):u;return gn(d,f,u,l,n.value,e,h===!0)}}),yn=p("$ZodObjectJIT",(e,t)=>{ic.init(e,t);let r=e._zod.parse,o=we(()=>hn(t)),n=E.memoizer,i=(m)=>{let h=o.value,_=h.symbolKeys,y=new vt(["payload","ctx"],{shape:m,inst:e,memo:n,syms:_}),S=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,N=(w,b)=>`
|
|
7
7
|
let ${w}_ab = false;
|
|
8
8
|
for (let i = 0; i < ${w}.issues.length; i++) {
|
|
9
9
|
const iss = ${w}.issues[i];
|
|
@@ -14,19 +14,19 @@ ${t.join(`
|
|
|
14
14
|
if (${w}_ab && ctx && ctx.abortEarly) {
|
|
15
15
|
payload.value = newResult;
|
|
16
16
|
return payload;
|
|
17
|
-
}`;y.write("const input = payload.value;");let ce=Object.create(null),ae=0;for(let w of h.allKeys)ce[w]=`key_${ae++}`;y.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let b=ce[w],D=typeof w==="symbol"?`syms[${_.indexOf(w)}]`:
|
|
18
|
-
const ${b}_present = ${
|
|
17
|
+
}`;y.write("const input = payload.value;");let ce=Object.create(null),ae=0;for(let w of h.allKeys)ce[w]=`key_${ae++}`;y.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let b=ce[w],D=typeof w==="symbol"?`syms[${_.indexOf(w)}]`:hr(w),et=`${D} in input`,rr=m[w],tt=rr?._zod?.optin,or=tt!==void 0,_s=rr?._zod?.optout==="optional";if(y.write(`const ${b} = ${S(D)};`),or&&_s){let xs=tt==="optional"?`${b}_present`:`${b}.value !== undefined || ${b}_present`;y.write(`
|
|
18
|
+
const ${b}_present = ${et};
|
|
19
19
|
if (!${b}.issues.length || ${b}_present) {
|
|
20
20
|
if (${b}.issues.length) {${N(b,D)}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (${
|
|
23
|
+
if (${xs}) {
|
|
24
24
|
newResult[${D}] = ${b}.value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}else if(!
|
|
29
|
-
const ${b}_present = ${
|
|
28
|
+
`)}else if(!or)y.write(`
|
|
29
|
+
const ${b}_present = ${et};
|
|
30
30
|
if (${b}.issues.length) {${N(b,D)}
|
|
31
31
|
}
|
|
32
32
|
if (!${b}_present && !${b}.issues.length) {
|
|
@@ -49,10 +49,10 @@ ${t.join(`
|
|
|
49
49
|
`);else if(y.write(`
|
|
50
50
|
if (${b}.issues.length) {${N(b,D)}
|
|
51
51
|
}
|
|
52
|
-
`),
|
|
53
|
-
if (${b}.value !== undefined || ${
|
|
52
|
+
`),tt==="defaulted")y.write(`newResult[${D}] = ${b}.value;`);else y.write(`
|
|
53
|
+
if (${b}.value !== undefined || ${et}) {
|
|
54
54
|
newResult[${D}] = ${b}.value;
|
|
55
55
|
}
|
|
56
|
-
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=pe,a=!E.jitless,l=a&&gr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=o.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(a&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return hn([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function Zo(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)=>!j(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)=>B(s,o,C())))}),t}var yn=p("$ZodUnion",(e,t)=>{z.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)=>ke(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Zo(s,o,e,n);return Promise.all(s).then((c)=>Zo(c,o,e,n))}});var _n=p("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Oo(r,a,u));return Oo(r,i,s)}});function vt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ee(e)&&ee(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=vt(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=vt(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 Oo(e,t,r){let o=new Map,n,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!i.has(d))i.set(d,u);f=[d]}else return!1;for(let d of f){if(!o.has(d))o.set(d,{});o.get(d)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter((l)=>n.keys.includes(l)):[];if(u.length)e.issues.push({...n,keys:u});for(let l of c)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let a=vt(t.value,r.value);if(!a.valid){if(j(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var xn=p("$ZodEnum",(e,t)=>{z.init(e,t);let r=fe(t.entries),o=new Set(r);e._zod.values=o,x(e,"pattern",(n)=>{let i=fe(n.def.entries).filter((s)=>yr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>te(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}});var bn=p("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new me(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 F;return r.value=n,r}});function Io(e,t){return e.value=t.issues.length?void 0:t.value,e}var $t=p("$ZodOptional",(e,t)=>{z.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(`^(${ke(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)=>Io(r,i));return Io(r,n)}return t.innerType._zod.run(r,o)}}),vn=p("$ZodExactOptional",(e,t)=>{$t.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)}),Pn=p("$ZodNullable",(e,t)=>{z.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(`^(${ke(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)}}),zn=p("$ZodDefault",(e,t)=>{z.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)=>Eo(i,t));return Eo(n,t)}});function Eo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var $n=p("$ZodPrefault",(e,t)=>{z.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)}}),wn=p("$ZodNonOptional",(e,t)=>{z.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)=>To(i,e));return To(n,e)}});function To(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 Ao(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)=>B(n,o,C()))},input:e.value}),e}var kn=p("$ZodCatch",(e,t)=>{z.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)=>Ao(r,i,t,o));return Ao(r,n,t,o)}});var Sn=p("$ZodPipe",(e,t)=>{z.init(e,t),x(e,"values",(r)=>r.def.in._zod.values),x(e,"optin",(r)=>r.def.in._zod.optin),x(e,"optout",(r)=>r.def.out._zod.optout),x(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Ke(s,t.in,o));return Ke(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ke(i,t.out,o));return Ke(n,t.out,o)}});function Ke(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Zn=p("$ZodReadonly",(e,t)=>{z.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(Ro);return Ro(n)}});function Ro(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var On=p("$ZodCustom",(e,t)=>{T.init(e,t),z.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)=>Co(i,r,o,e));Co(n,r,o,e);return}});function Co(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(G(n))}}class En extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var kt="~memo",In=[];function Tn(e){return e!==null&&typeof e==="object"}function wt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var An=new WeakMap,ye=0,Be=1,_e=2;function He(e,t,r){let o=An.get(e);if(o!==void 0)return o?_e:ye;if(t.has(e))return _e;t.add(e);let n=ye,i=(l)=>{if(n!==_e&&l?._zod){let f=He(l,t,r);if(f>n)n=f}},s=(l,f)=>{let d=ye;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let _=h.get?Be:h.value?._zod?He(h.value,t,r):ye;if(_>d)d=_}return d},c=(l)=>{if(l>n)n=l},a=e._zod.def,u=a.type;switch(u){case"object":{let l=Se(a);c(l?s(l,!0):Be),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?He(l,t,!1):Be);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let f=Object.getOwnPropertyDescriptor(a,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),oc(e,n)}function oc(e,t){if(t!==Be)An.set(e,t===_e);return t}function nc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ue,Je=[],ic={alloc(e,t,r){let o=Ue;if(!o)return r;Ue=void 0;let n={value:r,issues:null};return o.set(t.value,n),Je.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&sc(i,n.value))throw new En;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let S=He(e,new Set,!1);if(S===ye){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(S===_e||o)r=!0;else o=!0}let l=a.value;if(!Tn(l))return s(a,u);let f=u[kt];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[kt]=f;let d;if(n===u)d=i;else d=nc(f,e),n=u,i=d;let m=d.get(l);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...wt(m.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return a}Ue=d;let h=Je.length,_=s(a,u);Ue=void 0;let y=Je.length>h?Je.pop():void 0;if(_ instanceof Promise)return _.then((S)=>{if(y)y.issues=S.issues.length?wt(S.issues):In;return S});if(y)y.issues=_.issues.length?wt(_.issues):In;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Rn(){return ic}function sc(e,t){let r=e[kt]?.backEdges;return r!==void 0&&Tn(t)&&r.has(t)}var cc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Pr(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${at(i.values[0])}`;return`Invalid option: expected one of ${it(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":""}: ${it(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 St(){return{localeError:cc()}}var Cn;class Nn{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 ac(){return new Nn}(Cn=globalThis).__zod_globalRegistry??(Cn.__zod_globalRegistry=ac());var X=globalThis.__zod_globalRegistry;function uc(e){if(e.checks)e.checks=[...e.checks];return e}function Dn(e,t){return new e(uc({type:"string",...g(t)}))}function Kn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Ln(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function jn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Fn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Un(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Jn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Bn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Hn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Vn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Wn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Gn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Xn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function qn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Yn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Qn(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function ri(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function ni(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function ci(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function ai(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ui(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function li(e){return new e({type:"unknown"})}function pi(e,t){return new e({type:"never",...g(t)})}function Ve(e,t){return new mo({check:"max_length",...g(t),maximum:e})}function re(e,t){return new ho({check:"min_length",...g(t),minimum:e})}function We(e,t){return new go({check:"length_equals",...g(t),length:e})}function Zt(e,t){return new yo({check:"string_format",format:"regex",...g(t),pattern:e})}function Ot(e){return new _o({check:"string_format",format:"lowercase",...g(e)})}function It(e){return new xo({check:"string_format",format:"uppercase",...g(e)})}function Et(e,t){return new bo({check:"string_format",format:"includes",...g(t),includes:e})}function Tt(e,t){return new vo({check:"string_format",format:"starts_with",...g(t),prefix:e})}function At(e,t){return new Po({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new zo({check:"overwrite",tx:e})}function Rt(e){return H((t)=>t.normalize(e))}function Ct(){return H((e)=>e.trim())}function Nt(){return H((e)=>e.toLowerCase())}function Dt(){return H((e)=>e.toUpperCase())}function Kt(){return H((e)=>hr(e))}function fi(e,t,r){return new e({type:"array",element:t,...g(r)})}function di(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function mi(e,t){let r=lc((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(G(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(G(i))}},e(o.value,o)),t);return r}function lc(e,t){let r=new T({check:"custom",...g(t)});return r._zod.check=e,r}function xe(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))K(e,o,r[o]);return e}function jt(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 oe(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let 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[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)xe(s.schema,a);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 hi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ft(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${hi(m)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+hi(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
56
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=pe,a=!E.jitless,l=a&&yr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=o.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(a&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return gn([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function Oo(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)=>!j(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)=>B(s,o,C())))}),t}var _n=p("$ZodUnion",(e,t)=>{P.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)=>ke(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Oo(s,o,e,n);return Promise.all(s).then((c)=>Oo(c,o,e,n))}});var xn=p("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Io(r,a,u));return Io(r,i,s)}});function zt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ee(e)&&ee(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=zt(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=zt(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 Io(e,t,r){let o=new Map,n,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!i.has(d))i.set(d,u);f=[d]}else return!1;for(let d of f){if(!o.has(d))o.set(d,{});o.get(d)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter((l)=>n.keys.includes(l)):[];if(u.length)e.issues.push({...n,keys:u});for(let l of c)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let a=zt(t.value,r.value);if(!a.valid){if(j(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var bn=p("$ZodEnum",(e,t)=>{P.init(e,t);let r=fe(t.entries),o=new Set(r);e._zod.values=o,x(e,"pattern",(n)=>{let i=fe(n.def.entries).filter((s)=>_r.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>te(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}});var vn=p("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new me(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 F;return r.value=n,r}});function Eo(e,t){return e.value=t.issues.length?void 0:t.value,e}var wt=p("$ZodOptional",(e,t)=>{P.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(`^(${ke(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)=>Eo(r,i));return Eo(r,n)}return t.innerType._zod.run(r,o)}}),zn=p("$ZodExactOptional",(e,t)=>{wt.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)}),Pn=p("$ZodNullable",(e,t)=>{P.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(`^(${ke(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)}}),$n=p("$ZodDefault",(e,t)=>{P.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)=>To(i,t));return To(n,t)}});function To(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var wn=p("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",x(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),kn=p("$ZodNonOptional",(e,t)=>{P.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)=>Ao(i,e));return Ao(n,e)}});function Ao(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 Ro(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)=>B(n,o,C()))},input:e.value}),e}var Sn=p("$ZodCatch",(e,t)=>{P.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)=>Ro(r,i,t,o));return Ro(r,n,t,o)}});var Zn=p("$ZodPipe",(e,t)=>{P.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)=>Le(s,t.in,o));return Le(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Le(i,t.out,o));return Le(n,t.out,o)}});function Le(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 On=p("$ZodReadonly",(e,t)=>{P.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(Co);return Co(n)}});function Co(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var In=p("$ZodCustom",(e,t)=>{T.init(e,t),P.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)=>No(i,r,o,e));No(n,r,o,e);return}});function No(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(G(n))}}class Tn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var St="~memo",En=[];function An(e){return e!==null&&typeof e==="object"}function kt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Rn=new WeakMap,ye=0,He=1,_e=2;function Ve(e,t,r){let o=Rn.get(e);if(o!==void 0)return o?_e:ye;if(t.has(e))return _e;t.add(e);let n=ye,i=(l)=>{if(n!==_e&&l?._zod){let f=Ve(l,t,r);if(f>n)n=f}},s=(l,f)=>{let d=ye;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let _=h.get?He:h.value?._zod?Ve(h.value,t,r):ye;if(_>d)d=_}return d},c=(l)=>{if(l>n)n=l},a=e._zod.def,u=a.type;switch(u){case"object":{let l=Se(a);c(l?s(l,!0):He),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?Ve(l,t,!1):He);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 a){let f=Object.getOwnPropertyDescriptor(a,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),sc(e,n)}function sc(e,t){if(t!==He)Rn.set(e,t===_e);return t}function cc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Je,Be=[],ac={alloc(e,t,r){let o=Je;if(!o)return r;Je=void 0;let n={value:r,issues:null};return o.set(t.value,n),Be.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"&&uc(i,n.value))throw new Tn;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let S=Ve(e,new Set,!1);if(S===ye){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(S===_e||o)r=!0;else o=!0}let l=a.value;if(!An(l))return s(a,u);let f=u[St];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[St]=f;let d;if(n===u)d=i;else d=cc(f,e),n=u,i=d;let m=d.get(l);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...kt(m.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return a}Je=d;let h=Be.length,_=s(a,u);Je=void 0;let y=Be.length>h?Be.pop():void 0;if(_ instanceof Promise)return _.then((S)=>{if(y)y.issues=S.issues.length?kt(S.issues):En;return S});if(y)y.issues=_.issues.length?kt(_.issues):En;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Cn(){return ac}function uc(e,t){let r=e[St]?.backEdges;return r!==void 0&&An(t)&&r.has(t)}var lc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Pr(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ut(i.values[0])}`;return`Invalid option: expected one of ${st(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":""}: ${st(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:lc()}}var Nn;class Dn{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 pc(){return new Dn}(Nn=globalThis).__zod_globalRegistry??(Nn.__zod_globalRegistry=pc());var X=globalThis.__zod_globalRegistry;function fc(e){if(e.checks)e.checks=[...e.checks];return e}function Kn(e,t){return new e(fc({type:"string",...g(t)}))}function Ln(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function jn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Fn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Un(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Jn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Bn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Hn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Vn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Wn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Gn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Xn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function qn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Yn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Qn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function ri(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function ni(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function ci(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function ai(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function ui(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function li(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function pi(e){return new e({type:"unknown"})}function fi(e,t){return new e({type:"never",...g(t)})}function We(e,t){return new ho({check:"max_length",...g(t),maximum:e})}function re(e,t){return new go({check:"min_length",...g(t),minimum:e})}function Ge(e,t){return new yo({check:"length_equals",...g(t),length:e})}function Ot(e,t){return new _o({check:"string_format",format:"regex",...g(t),pattern:e})}function It(e){return new xo({check:"string_format",format:"lowercase",...g(e)})}function Et(e){return new bo({check:"string_format",format:"uppercase",...g(e)})}function Tt(e,t){return new vo({check:"string_format",format:"includes",...g(t),includes:e})}function At(e,t){return new zo({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Rt(e,t){return new Po({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new $o({check:"overwrite",tx:e})}function Ct(e){return H((t)=>t.normalize(e))}function Nt(){return H((e)=>e.trim())}function Dt(){return H((e)=>e.toLowerCase())}function Kt(){return H((e)=>e.toUpperCase())}function Lt(){return H((e)=>gr(e))}function di(e,t,r){return new e({type:"array",element:t,...g(r)})}function mi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function hi(e,t){let r=dc((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(G(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(G(i))}},e(o.value,o)),t);return r}function dc(e,t){let r=new T({check:"custom",...g(t)});return r._zod.check=e,r}function xe(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))K(e,o,r[o]);return e}function Ft(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 oe(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let 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[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)xe(s.schema,a);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 gi(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 o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${gi(m)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+gi(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
57
|
|
|
58
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function _i(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;_i(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 xi=new Set(["type","properties","required","additionalProperties"]),gi=["oneOf","anyOf"];function yi(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 Lt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!xi.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??yi(u);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let a=c.length===1?c[0]:Lt(c)??{allOf:c};K(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=yi(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function pc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of xi)if(n in e)return;let r=t.filter((n)=>gi.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=Lt(t);else{let n=r[0],i=gi.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>Lt([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,xe(e,o)}function Mt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){o(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else xe(u,h);if(xe(u,l),c._zod.parent===f)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in l))delete u[y]}if(h.$ref&&m.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y]))delete u[y]}}let d=c._zod.parent;if(d&&d!==f){o(d);let m=e.seen.get(d);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())_i(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(u);else c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])pc(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}xe(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;K(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input: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 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 bi=(e,t={})=>(r)=>{let o=jt({...r,processors:t});return Z(e,o),Ft(o,e),Mt(o,e)},be=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=jt({...n??{},target:i,io:t,processors:r});return Z(e,s),Ft(s,e),Mt(s,e)};var ne=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ie=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},vi=(e,t)=>{ne(e,"minimum",t),ie(e,"maximum",t)},wi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ki=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Si=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Zi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pi=(e,t)=>ne(e,"minimum",t.minimum),zi=(e,t)=>ie(e,"maximum",t.maximum),$i=(e)=>(t,r)=>{Zi(t,r.format);let[o,n]=e[r.format];ne(t,"minimum",o),ie(t,"maximum",n)},fc={greater_than:(e,t)=>ne(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ie(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wi(e,t.value),number_format:$i(ut),bigint_format:$i(lt),min_length:Pi,max_length:zi,length_equals:(e,t)=>vi(e,t.length),min_size:Pi,max_size:zi,size_equals:(e,t)=>vi(e,t.size),string_format:(e,t)=>{if(Zi(e,t.format),t.pattern)ki(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Si(e,t.mime)};function se(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)fc[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)ne(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)ne(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)ie(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)ie(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)wi(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Si(t,n.mime);for(let i of n.patterns??[])ki(t,i);return t}var dc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mc=new Map([[zt,ro],[Me,oo]]),hc=(e)=>mc.get(e)??e,Oi=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=se(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=dc[c]??c,n.format==="")delete n.format;if(c==="time"||l)delete n.format}if(u)n.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(hc);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}))]}};var Ii=(e,t,r,o)=>{r.not={}};var Ei=(e,t,r,o)=>{};var Ti=(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 Ai=(e,t,r,o)=>{oe(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var Ri=(e,t,r,o)=>{oe(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var Ci=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=se(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Z(i.element,t,{...o,path:[...o.path,"items"]})};function Ut(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ut(t.out);if(t.type==="catch")return Ut(t.innerType);return e._zod.optin}var Ni=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oe(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)K(n.properties,u,Z(s[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?Ut(l)===void 0:l._zod.optout===void 0)a.push(u)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Z(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Di=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>Z(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},Ki=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=Z(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};var Li=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},ji=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Jt=Symbol();function Fi(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return oe(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Jt}var Mi=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=Fi(n.defaultValue,e,t,r,o);if(s!==Jt)r.default=s},Ui=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=Fi(n.defaultValue,e,t,r,o);if(s!==Jt)r._prefault=s},Ji=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{oe(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Bi=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;Z(s,t,o);let c=t.seen.get(e);c.ref=s},Hi=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var Bt=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var Vi=new WeakSet([Object.prototype,Error.prototype]);function Ge(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 Zc=(e,t)=>{Or.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Vi.has(r))return;Vi.add(r),Ge(r,"format",(o)=>(n)=>Er(o,n)),Ge(r,"flatten",(o)=>(n)=>Ir(o,n)),Ge(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,de,2)}),Ge(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,de,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var A=p("ZodError",Zc,void 0,{Parent:Error});var Wi=Re(A),Gi=Ce(A),Xi=Ne(A),qi=De(A),Yi=Ar(A),Qi=Rr(A),es=Cr(A),ts=Nr(A),rs=Dr(A),os=Kr(A),ns=Lr(A),is=jr(A);function Ic(){if(!E.localeError)C(St())}function Wt(){if(!E.memoizer)C({memoizer:Rn()})}var k=p("ZodType",(e,t)=>(Ic(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(I(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 L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check($a(e,t))},superRefine(e,t){return this.check(wa(e,t))},overwrite(e){return this.check(H(e))},optional(){return cs(this)},exactOptional(){return pa(this)},nullable(){return as(this)},nullish(){return cs(as(this))},nonoptional(e){return ya(this,e)},array(){return ps(this)},or(e){return sa([this,e])},and(e){return aa(this,e)},transform(e){return us(this,la(e))},default(e){return ma(this,e)},prefault(e){return ga(this,e)},catch(e){return xa(this,e)},pipe(e){return us(this,e)},readonly(){return Pa(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 Te(this,"~standard",{...Pt(this),jsonSchema:{input:be(this,"input"),output:be(this,"output")}})},set "~standard"(e){U(this,"~standard",e)},parse:function e(t,r){return Wi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Gi(this,t,r,{callee:e})},safeParse(e,t){return Xi(this,e,t)},async safeParseAsync(e,t){return qi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){U(this,"spa",e)},validate(e,t){return ht(this,e,t)},validateAsync(e,t){return gt(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 os(this,e,t)},async safeEncodeAsync(e,t){return ns(this,e,t)},async safeDecodeAsync(e,t){return is(this,e,t)},toJSONSchema(e){return bi(this,{})(e)},get description(){return X.get(this)?.description},get _def(){return this._zod.def}}),ls=p("_ZodString",(e,t)=>{Fe.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Oi(e,r,o,n)},Ss({format:(e)=>se(e).format??null,minLength:(e)=>se(e).minimum??null,maxLength:(e)=>se(e).maximum??null},{regex(...e){return this.check(Zt(...e))},includes(...e){return this.check(Et(...e))},startsWith(...e){return this.check(Tt(...e))},endsWith(...e){return this.check(At(...e))},min(...e){return this.check(re(...e))},max(...e){return this.check(Ve(...e))},length(...e){return this.check(We(...e))},nonempty(...e){return this.check(re(1,...e))},lowercase(e){return this.check(Ot(e))},uppercase(e){return this.check(It(e))},trim(){return this.check(Ct())},normalize(...e){return this.check(Rt(...e))},toLowerCase(){return this.check(Nt())},toUpperCase(){return this.check(Dt())},slugify(){return this.check(Kt())}})),Ec=p("ZodString",(e,t)=>{Fe.init(e,t),ls.init(e,t)},{email(e){return this.check(Kn(Nc,e))},url(e){return this.check(Jn(Kc,e))},jwt(e){return this.check(ii(Qc,e))},emoji(e){return this.check(Bn(Lc,e))},guid(e){return this.check(Ln(Dc,e))},uuid(e){return this.check(jn(Xe,e))},uuidv4(e){return this.check(Fn(Xe,e))},uuidv6(e){return this.check(Mn(Xe,e))},uuidv7(e){return this.check(Un(Xe,e))},nanoid(e){return this.check(Hn(jc,e))},cuid(e){return this.check(Vn(Fc,e))},cuid2(e){return this.check(Wn(Mc,e))},ulid(e){return this.check(Gn(Uc,e))},base64(e){return this.check(ri(Xc,e))},base64url(e){return this.check(oi(qc,e))},xid(e){return this.check(Xn(Jc,e))},ksuid(e){return this.check(qn(Bc,e))},ipv4(e){return this.check(Yn(Hc,e))},ipv6(e){return this.check(Qn(Vc,e))},cidrv4(e){return this.check(ei(Wc,e))},cidrv6(e){return this.check(ti(Gc,e))},e164(e){return this.check(ni(Yc,e))},datetime(e){return this.check(si(Tc,e))},date(e){return this.check(ci(Ac,e))},time(e){return this.check(ai(Rc,e))},duration(e){return this.check(ui(Cc,e))}});function q(e){return Dn(Ec,e)}var P=p("ZodStringFormat",(e,t)=>{v.init(e,t),ls.init(e,t)}),Tc=p("ZodISODateTime",(e,t)=>{Xo.init(e,t),P.init(e,t)}),Ac=p("ZodISODate",(e,t)=>{qo.init(e,t),P.init(e,t)}),Rc=p("ZodISOTime",(e,t)=>{Yo.init(e,t),P.init(e,t)}),Cc=p("ZodISODuration",(e,t)=>{Qo.init(e,t),P.init(e,t)}),Nc=p("ZodEmail",(e,t)=>{Lo.init(e,t),P.init(e,t)});var Dc=p("ZodGUID",(e,t)=>{Do.init(e,t),P.init(e,t)});var Xe=p("ZodUUID",(e,t)=>{Ko.init(e,t),P.init(e,t)});var Kc=p("ZodURL",(e,t)=>{Mo.init(e,t),P.init(e,t)});var Lc=p("ZodEmoji",(e,t)=>{Uo.init(e,t),P.init(e,t)});var jc=p("ZodNanoID",(e,t)=>{Jo.init(e,t),P.init(e,t)});var Fc=p("ZodCUID",(e,t)=>{Bo.init(e,t),P.init(e,t)});var Mc=p("ZodCUID2",(e,t)=>{Ho.init(e,t),P.init(e,t)});var Uc=p("ZodULID",(e,t)=>{Vo.init(e,t),P.init(e,t)});var Jc=p("ZodXID",(e,t)=>{Wo.init(e,t),P.init(e,t)});var Bc=p("ZodKSUID",(e,t)=>{Go.init(e,t),P.init(e,t)});var Hc=p("ZodIPv4",(e,t)=>{en.init(e,t),P.init(e,t)});var Vc=p("ZodIPv6",(e,t)=>{rn.init(e,t),P.init(e,t)});var Wc=p("ZodCIDRv4",(e,t)=>{on.init(e,t),P.init(e,t)});var Gc=p("ZodCIDRv6",(e,t)=>{nn.init(e,t),P.init(e,t)});var Xc=p("ZodBase64",(e,t)=>{cn.init(e,t),P.init(e,t)});var qc=p("ZodBase64URL",(e,t)=>{an.init(e,t),P.init(e,t)});var Yc=p("ZodE164",(e,t)=>{un.init(e,t),P.init(e,t)});var Qc=p("ZodJWT",(e,t)=>{ln.init(e,t),P.init(e,t)});var ea=p("ZodUnknown",(e,t)=>{pn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ei(e,r,o,n)});function ss(){return li(ea)}var ta=p("ZodNever",(e,t)=>{fn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ii(e,r,o,n)});function ra(e){return pi(ta,e)}var oa=p("ZodArray",(e,t)=>{Wt(),dn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ci(e,r,o,n),e.element=t.element},{min(e,t){return this.check(re(e,t))},nonempty(e){return this.check(re(1,e))},max(e,t){return this.check(Ve(e,t))},length(e,t){return this.check(We(e,t))},unwrap(){return this.element}});function ps(e,t){return fi(oa,e,t)}var na=p("ZodObject",(e,t)=>{Wt(),gn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ni(e,r,o,n),Es(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return fs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(I(this._zod.def,{catchall:e}))},passthrough(){return this.clone(I(this._zod.def,{catchall:ss()}))},loose(){return this.clone(I(this._zod.def,{catchall:ss()}))},strict(){return this.clone(I(this._zod.def,{catchall:ra()}))},strip(){return this.clone(I(this._zod.def,{catchall:void 0}))},extend(e){return Ps(this,e)},safeExtend(e){return zs(this,e)},merge(e){return $s(this,e)},pick(e){return bs(this,e)},omit(e){return vs(this,e)},partial(...e){return br(ds,this,e[0])},exactPartial(...e){return br(ms,this,e[0],"exactPartial")},required(...e){return ws(hs,this,e[0])}});function qe(e,t){let r={type:"object",shape:e??{},...g(t)};return new na(r)}var ia=p("ZodUnion",(e,t)=>{yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Di(e,r,o,n),e.options=t.options});function sa(e,t){return new ia({type:"union",options:e,...g(t)})}var ca=p("ZodIntersection",(e,t)=>{_n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ki(e,r,o,n)});function aa(e,t){return new ca({type:"intersection",left:e,right:t})}var Vt=p("ZodEnum",(e,t)=>{xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Ti(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...g(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...g(n),entries:i})}});function fs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Vt({type:"enum",entries:r,...g(t)})}var ua=p("ZodTransform",(e,t)=>{Wt(),bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ri(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new me(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(G(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(G(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 la(e){return new ua({type:"transform",transform:e})}var ds=p("ZodOptional",(e,t)=>{$t.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function cs(e){return new ds({type:"optional",innerType:e})}var ms=p("ZodExactOptional",(e,t)=>{vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bt(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pa(e){return new ms({type:"optional",innerType:e})}var fa=p("ZodNullable",(e,t)=>{Pn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Li(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function as(e){return new fa({type:"nullable",innerType:e})}var da=p("ZodDefault",(e,t)=>{zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ma(e,t){return new da({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ct(t)}})}var ha=p("ZodPrefault",(e,t)=>{$n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ui(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ga(e,t){return new ha({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ct(t)}})}var hs=p("ZodNonOptional",(e,t)=>{wn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ji(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ya(e,t){return new hs({type:"nonoptional",innerType:e,...g(t)})}var _a=p("ZodCatch",(e,t)=>{kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ji(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xa(e,t){return new _a({type:"catch",innerType:e,catchValue:typeof t==="function"?t:$r(t)})}var ba=p("ZodPipe",(e,t)=>{Sn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bi(e,r,o,n),e.in=t.in,e.out=t.out});function us(e,t){return new ba({type:"pipe",in:e,out:t})}var va=p("ZodReadonly",(e,t)=>{Zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Pa(e){return new va({type:"readonly",innerType:e})}var za=p("ZodCustom",(e,t)=>{On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ai(e,r,o,n)});function $a(e,t={}){return di(za,e,t)}function wa(e,t){return mi(e,t)}var gs=qe({name:q(),value:q()}),ve=qe({method:fs(["PUT","POST"]).optional(),username:q().optional(),password:q().optional().meta({secret:!0}),bearerToken:q().optional().meta({secret:!0}),headers:ps(gs).optional()});function Gt(e){return ve.extend({url:q().refine((t)=>t.toLowerCase().startsWith(`${e}://`),{message:`url must start with ${e}://`})})}var Xt=qe({etag:q().optional()});var qt=qe({});function Yt(e){return{protocol:e,kind:"js",configSchema:ve,locationSchema:Gt(e),propertySchema:Xt,settablePropertySchema:qt,parseLocationString:rt,toProviderInputs:ot,async createProvider(t){return new $e(t)}}}var Qt=Yt("http"),er=Yt("https");var ka=[Qt,er].map((e)=>({extensionPoint:or,factory:{create:()=>Promise.resolve(e)}})),Sa={extensionDescriptors:ka},Za=Sa;export{$e as HttpIOProvider,Yt as createHttpIOProviderFactory,Gt as createHttpLocationSchema,Za as default,ve as httpConfigSchema,gs as httpHeaderSchema,Qt as httpIOProviderFactory,Xt as httpPropertySchema,qt as httpSettablePropertySchema,er as httpsIOProviderFactory,rt as parseHttpLocationString,ot as toHttpProviderInputs};
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function xi(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;xi(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 bi=new Set(["type","properties","required","additionalProperties"]),yi=["oneOf","anyOf"];function _i(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function jt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!bi.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??_i(u);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let a=c.length===1?c[0]:jt(c)??{allOf:c};K(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=_i(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function mc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of bi)if(n in e)return;let r=t.filter((n)=>yi.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=jt(t);else{let n=r[0],i=yi.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>jt([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,xe(e,o)}function Ut(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){o(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else xe(u,h);if(xe(u,l),c._zod.parent===f)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in l))delete u[y]}if(h.$ref&&m.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y]))delete u[y]}}let d=c._zod.parent;if(d&&d!==f){o(d);let m=e.seen.get(d);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())xi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(u);else c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])mc(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}xe(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;K(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input: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 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 vi=(e,t={})=>(r)=>{let o=Ft({...r,processors:t});return Z(e,o),Mt(o,e),Ut(o,e)},be=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Ft({...n??{},target:i,io:t,processors:r});return Z(e,s),Mt(s,e),Ut(s,e)};var ne=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ie=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},zi=(e,t)=>{ne(e,"minimum",t),ie(e,"maximum",t)},ki=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Si=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Zi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Oi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pi=(e,t)=>ne(e,"minimum",t.minimum),$i=(e,t)=>ie(e,"maximum",t.maximum),wi=(e)=>(t,r)=>{Oi(t,r.format);let[o,n]=e[r.format];ne(t,"minimum",o),ie(t,"maximum",n)},hc={greater_than:(e,t)=>ne(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ie(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ki(e,t.value),number_format:wi(lt),bigint_format:wi(pt),min_length:Pi,max_length:$i,length_equals:(e,t)=>zi(e,t.length),min_size:Pi,max_size:$i,size_equals:(e,t)=>zi(e,t.size),string_format:(e,t)=>{if(Oi(e,t.format),t.pattern)Si(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Zi(e,t.mime)};function se(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)hc[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)ne(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)ne(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)ie(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)ie(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)ki(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Zi(t,n.mime);for(let i of n.patterns??[])Si(t,i);return t}var gc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yc=new Map([[$t,oo],[Ue,no]]),_c=(e)=>yc.get(e)??e,Ii=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=se(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=gc[c]??c,n.format==="")delete n.format;if(c==="time"||l)delete n.format}if(u)n.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(_c);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}))]}};var Ei=(e,t,r,o)=>{r.not={}};var Ti=(e,t,r,o)=>{};var Ai=(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 Ri=(e,t,r,o)=>{oe(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var Ci=(e,t,r,o)=>{oe(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var Ni=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=se(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Z(i.element,t,{...o,path:[...o.path,"items"]})};function Jt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Jt(t.out);if(t.type==="catch")return Jt(t.innerType);return e._zod.optin}var Di=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oe(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)K(n.properties,u,Z(s[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?Jt(l)===void 0:l._zod.optout===void 0)a.push(u)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Z(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Ki=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>Z(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},Li=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=Z(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};var ji=(e,t,r,o)=>{let n=e._zod.def,i=Z(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Fi=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Bt=Symbol();function Mi(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return oe(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Bt}var Ui=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=Mi(n.defaultValue,e,t,r,o);if(s!==Bt)r.default=s},Ji=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=Mi(n.defaultValue,e,t,r,o);if(s!==Bt)r._prefault=s},Bi=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{oe(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Hi=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;Z(s,t,o);let c=t.seen.get(e);c.ref=s},Vi=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var Ht=(e,t,r,o)=>{let n=e._zod.def;Z(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var Wi=new WeakSet([Object.prototype,Error.prototype]);function Xe(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 Ec=(e,t)=>{Ir.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Wi.has(r))return;Wi.add(r),Xe(r,"format",(o)=>(n)=>Tr(o,n)),Xe(r,"flatten",(o)=>(n)=>Er(o,n)),Xe(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,de,2)}),Xe(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,de,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var A=p("ZodError",Ec,void 0,{Parent:Error});var Gi=Ce(A),Xi=Ne(A),qi=De(A),Yi=Ke(A),Qi=Rr(A),es=Cr(A),ts=Nr(A),rs=Dr(A),os=Kr(A),ns=Lr(A),is=jr(A),ss=Fr(A);function Ac(){if(!E.localeError)C(Zt())}function Gt(){if(!E.memoizer)C({memoizer:Cn()})}var k=p("ZodType",(e,t)=>(Ac(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(I(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 L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Sa(e,t))},superRefine(e,t){return this.check(Za(e,t))},overwrite(e){return this.check(H(e))},optional(){return as(this)},exactOptional(){return ma(this)},nullable(){return us(this)},nullish(){return as(us(this))},nonoptional(e){return ba(this,e)},array(){return fs(this)},or(e){return ua([this,e])},and(e){return pa(this,e)},transform(e){return ls(this,da(e))},default(e){return ya(this,e)},prefault(e){return xa(this,e)},catch(e){return za(this,e)},pipe(e){return ls(this,e)},readonly(){return wa(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 Ae(this,"~standard",{...Pt(this),jsonSchema:{input:be(this,"input"),output:be(this,"output")}})},set "~standard"(e){U(this,"~standard",e)},parse:function e(t,r){return Gi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Xi(this,t,r,{callee:e})},safeParse(e,t){return qi(this,e,t)},async safeParseAsync(e,t){return Yi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){U(this,"spa",e)},validate(e,t){return gt(this,e,t)},validateAsync(e,t){return yt(this,e,t)},encode:function e(t,r){return Qi(this,t,r,{callee:e})},decode:function e(t,r){return es(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ts(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await rs(this,t,r,{callee:e})},safeEncode(e,t){return os(this,e,t)},safeDecode(e,t){return ns(this,e,t)},async safeEncodeAsync(e,t){return is(this,e,t)},async safeDecodeAsync(e,t){return ss(this,e,t)},toJSONSchema(e){return vi(this,{})(e)},get description(){return X.get(this)?.description},get _def(){return this._zod.def}}),ps=p("_ZodString",(e,t)=>{Me.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ii(e,r,o,n)},Zs({format:(e)=>se(e).format??null,minLength:(e)=>se(e).minimum??null,maxLength:(e)=>se(e).maximum??null},{regex(...e){return this.check(Ot(...e))},includes(...e){return this.check(Tt(...e))},startsWith(...e){return this.check(At(...e))},endsWith(...e){return this.check(Rt(...e))},min(...e){return this.check(re(...e))},max(...e){return this.check(We(...e))},length(...e){return this.check(Ge(...e))},nonempty(...e){return this.check(re(1,...e))},lowercase(e){return this.check(It(e))},uppercase(e){return this.check(Et(e))},trim(){return this.check(Nt())},normalize(...e){return this.check(Ct(...e))},toLowerCase(){return this.check(Dt())},toUpperCase(){return this.check(Kt())},slugify(){return this.check(Lt())}})),Rc=p("ZodString",(e,t)=>{Me.init(e,t),ps.init(e,t)},{email(e){return this.check(Ln(Lc,e))},url(e){return this.check(Bn(Fc,e))},jwt(e){return this.check(si(ra,e))},emoji(e){return this.check(Hn(Mc,e))},guid(e){return this.check(jn(jc,e))},uuid(e){return this.check(Fn(qe,e))},uuidv4(e){return this.check(Mn(qe,e))},uuidv6(e){return this.check(Un(qe,e))},uuidv7(e){return this.check(Jn(qe,e))},nanoid(e){return this.check(Vn(Uc,e))},cuid(e){return this.check(Wn(Jc,e))},cuid2(e){return this.check(Gn(Bc,e))},ulid(e){return this.check(Xn(Hc,e))},base64(e){return this.check(oi(Qc,e))},base64url(e){return this.check(ni(ea,e))},xid(e){return this.check(qn(Vc,e))},ksuid(e){return this.check(Yn(Wc,e))},ipv4(e){return this.check(Qn(Gc,e))},ipv6(e){return this.check(ei(Xc,e))},cidrv4(e){return this.check(ti(qc,e))},cidrv6(e){return this.check(ri(Yc,e))},e164(e){return this.check(ii(ta,e))},datetime(e){return this.check(ci(Cc,e))},date(e){return this.check(ai(Nc,e))},time(e){return this.check(ui(Dc,e))},duration(e){return this.check(li(Kc,e))}});function q(e){return Kn(Rc,e)}var z=p("ZodStringFormat",(e,t)=>{v.init(e,t),ps.init(e,t)}),Cc=p("ZodISODateTime",(e,t)=>{qo.init(e,t),z.init(e,t)}),Nc=p("ZodISODate",(e,t)=>{Yo.init(e,t),z.init(e,t)}),Dc=p("ZodISOTime",(e,t)=>{Qo.init(e,t),z.init(e,t)}),Kc=p("ZodISODuration",(e,t)=>{en.init(e,t),z.init(e,t)}),Lc=p("ZodEmail",(e,t)=>{jo.init(e,t),z.init(e,t)});var jc=p("ZodGUID",(e,t)=>{Ko.init(e,t),z.init(e,t)});var qe=p("ZodUUID",(e,t)=>{Lo.init(e,t),z.init(e,t)});var Fc=p("ZodURL",(e,t)=>{Uo.init(e,t),z.init(e,t)});var Mc=p("ZodEmoji",(e,t)=>{Jo.init(e,t),z.init(e,t)});var Uc=p("ZodNanoID",(e,t)=>{Bo.init(e,t),z.init(e,t)});var Jc=p("ZodCUID",(e,t)=>{Ho.init(e,t),z.init(e,t)});var Bc=p("ZodCUID2",(e,t)=>{Vo.init(e,t),z.init(e,t)});var Hc=p("ZodULID",(e,t)=>{Wo.init(e,t),z.init(e,t)});var Vc=p("ZodXID",(e,t)=>{Go.init(e,t),z.init(e,t)});var Wc=p("ZodKSUID",(e,t)=>{Xo.init(e,t),z.init(e,t)});var Gc=p("ZodIPv4",(e,t)=>{tn.init(e,t),z.init(e,t)});var Xc=p("ZodIPv6",(e,t)=>{on.init(e,t),z.init(e,t)});var qc=p("ZodCIDRv4",(e,t)=>{nn.init(e,t),z.init(e,t)});var Yc=p("ZodCIDRv6",(e,t)=>{sn.init(e,t),z.init(e,t)});var Qc=p("ZodBase64",(e,t)=>{an.init(e,t),z.init(e,t)});var ea=p("ZodBase64URL",(e,t)=>{un.init(e,t),z.init(e,t)});var ta=p("ZodE164",(e,t)=>{ln.init(e,t),z.init(e,t)});var ra=p("ZodJWT",(e,t)=>{pn.init(e,t),z.init(e,t)});var oa=p("ZodUnknown",(e,t)=>{fn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ti(e,r,o,n)});function cs(){return pi(oa)}var na=p("ZodNever",(e,t)=>{dn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ei(e,r,o,n)});function ia(e){return fi(na,e)}var sa=p("ZodArray",(e,t)=>{Gt(),mn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ni(e,r,o,n),e.element=t.element},{min(e,t){return this.check(re(e,t))},nonempty(e){return this.check(re(1,e))},max(e,t){return this.check(We(e,t))},length(e,t){return this.check(Ge(e,t))},unwrap(){return this.element}});function fs(e,t){return di(sa,e,t)}var ca=p("ZodObject",(e,t)=>{Gt(),yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Di(e,r,o,n),Ts(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return ds(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(I(this._zod.def,{catchall:e}))},passthrough(){return this.clone(I(this._zod.def,{catchall:cs()}))},loose(){return this.clone(I(this._zod.def,{catchall:cs()}))},strict(){return this.clone(I(this._zod.def,{catchall:ia()}))},strip(){return this.clone(I(this._zod.def,{catchall:void 0}))},extend(e){return Ps(this,e)},safeExtend(e){return $s(this,e)},merge(e){return ws(this,e)},pick(e){return vs(this,e)},omit(e){return zs(this,e)},partial(...e){return vr(ms,this,e[0])},exactPartial(...e){return vr(hs,this,e[0],"exactPartial")},required(...e){return ks(gs,this,e[0])}});function Ye(e,t){let r={type:"object",shape:e??{},...g(t)};return new ca(r)}var aa=p("ZodUnion",(e,t)=>{_n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ki(e,r,o,n),e.options=t.options});function ua(e,t){return new aa({type:"union",options:e,...g(t)})}var la=p("ZodIntersection",(e,t)=>{xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Li(e,r,o,n)});function pa(e,t){return new la({type:"intersection",left:e,right:t})}var Wt=p("ZodEnum",(e,t)=>{bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Ai(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Wt({...t,checks:[],...g(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Wt({...t,checks:[],...g(n),entries:i})}});function ds(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Wt({type:"enum",entries:r,...g(t)})}var fa=p("ZodTransform",(e,t)=>{Gt(),vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ci(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new me(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(G(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(G(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 da(e){return new fa({type:"transform",transform:e})}var ms=p("ZodOptional",(e,t)=>{wt.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ht(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function as(e){return new ms({type:"optional",innerType:e})}var hs=p("ZodExactOptional",(e,t)=>{zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ht(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new hs({type:"optional",innerType:e})}var ha=p("ZodNullable",(e,t)=>{Pn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ji(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function us(e){return new ha({type:"nullable",innerType:e})}var ga=p("ZodDefault",(e,t)=>{$n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ui(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ya(e,t){return new ga({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():at(t)}})}var _a=p("ZodPrefault",(e,t)=>{wn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ji(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function xa(e,t){return new _a({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():at(t)}})}var gs=p("ZodNonOptional",(e,t)=>{kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ba(e,t){return new gs({type:"nonoptional",innerType:e,...g(t)})}var va=p("ZodCatch",(e,t)=>{Sn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function za(e,t){return new va({type:"catch",innerType:e,catchValue:typeof t==="function"?t:wr(t)})}var Pa=p("ZodPipe",(e,t)=>{Zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hi(e,r,o,n),e.in=t.in,e.out=t.out});function ls(e,t){return new Pa({type:"pipe",in:e,out:t})}var $a=p("ZodReadonly",(e,t)=>{On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function wa(e){return new $a({type:"readonly",innerType:e})}var ka=p("ZodCustom",(e,t)=>{In.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ri(e,r,o,n)});function Sa(e,t={}){return mi(ka,e,t)}function Za(e,t){return hi(e,t)}var ys=Ye({name:q(),value:q()}),ve=Ye({method:ds(["PUT","POST"]).optional(),username:q().optional(),password:q().optional().meta({secret:!0}),bearerToken:q().optional().meta({secret:!0}),headers:fs(ys).optional()});function Xt(e){return ve.extend({url:q().refine((t)=>t.toLowerCase().startsWith(`${e}://`),{message:`url must start with ${e}://`})})}var qt=Ye({etag:q().optional()});var Yt=Ye({});function Qt(e){return{protocol:e,kind:"js",configSchema:ve,locationSchema:Xt(e),propertySchema:qt,settablePropertySchema:Yt,parseLocationString:ot,toProviderInputs:nt,async createProvider(t){return new $e(t)}}}var er=Qt("http"),tr=Qt("https");var Oa=[er,tr].map((e)=>({extensionPoint:nr,factory:{create:()=>Promise.resolve(e)}})),Ia={extensionDescriptors:Oa},Ea=Ia;export{$e as HttpIOProvider,Qt as createHttpIOProviderFactory,Xt as createHttpLocationSchema,Ea as default,ve as httpConfigSchema,ys as httpHeaderSchema,er as httpIOProviderFactory,qt as httpPropertySchema,Yt as httpSettablePropertySchema,tr as httpsIOProviderFactory,ot as parseHttpLocationString,nt as toHttpProviderInputs};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/io-plugin-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "HTTP and HTTPS source/sink plugin for https://github.com/flowscripter/pluggable-io-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"test": "bun test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flowscripter/pluggable-io-framework-api": "^3.1.
|
|
42
|
-
"zod": "^4.6.
|
|
41
|
+
"@flowscripter/pluggable-io-framework-api": "^3.1.3",
|
|
42
|
+
"zod": "^4.6.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
46
|
-
"@types/bun": "^1.4.
|
|
47
|
-
"@types/node": "^26.6.
|
|
48
|
-
"oxfmt": "0.
|
|
49
|
-
"oxlint": "1.
|
|
45
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.22",
|
|
46
|
+
"@types/bun": "^1.4.3",
|
|
47
|
+
"@types/node": "^26.6.5",
|
|
48
|
+
"oxfmt": "0.73.0",
|
|
49
|
+
"oxlint": "1.88.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@flowscripter/dynamic-plugin-framework": "*",
|