@regojs/erp-sdk 1.1.0 → 1.1.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/browser/index.js +23 -28
- package/dist/browser/index.js.map +8 -7
- package/dist/browser/vanilla/index.d.ts +4 -0
- package/dist/browser/vanilla/providers/regoProvider.d.ts +1 -1
- package/dist/browser/vanilla/types/regoProvider.d.ts +6 -3
- package/dist/browser/vanilla/validators/fullData.d.ts +7 -0
- package/dist/browser/vanilla/validators/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/browser/vanilla/index.ts +5 -0
- package/src/browser/vanilla/providers/regoProvider.ts +22 -20
- package/src/browser/vanilla/types/regoProvider.ts +20 -7
- package/src/browser/vanilla/validators/fullData.ts +14 -0
- package/src/browser/vanilla/validators/index.ts +2 -0
package/dist/browser/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var ls=Object.defineProperty;var ps=(e)=>e;function fs(e,t){this[e]=ps.bind(null,t)}var Yt=(e,t)=>{for(var r in t)ls(e,r,{get:t[r],enumerable:!0,configurable:!0,set:fs.bind(t,r)})};var cs={};Yt(cs,{Enums:()=>ve,RegoProvider:()=>qt,dataSchema:()=>Ge,metadataSchema:()=>Xe,routeSchema:()=>Wt,staticDataSchema:()=>He});var ve={};Yt(ve,{EScriptIds:()=>te});var te;((o)=>{o.routes="rego-routes";o.data="rego-data";o.metadata="rego-metadata";o.staticData="rego-static-data"})(te||={});function fe(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function et(e,t="|"){return e.map((r)=>nt(r)).join(t)}function de(e,t){if(typeof t==="bigint")return t.toString();return t}class er{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function $e(e){return new er(e)}function tr(e){return e===null||e===void 0}function ze(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function j(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function we(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function B(e){return we(e._zod.def)??e._zod.def.shape}function rr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return j(this,t,n),n},enumerable:!0,configurable:!0})}function nr(e,t,r){if(t in e)j(e,t,r);else e[t]=r}function G(e,t,r,n){let o=B(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)rr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else nr(e,i,n?n(s.value,i):s.value)}}function ds(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)rr(e,r,()=>t[r]);else nr(e,r,n.value)}}function A(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function or(e){return JSON.stringify(e)}function ir(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var tt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var sr=$e(()=>{if(I.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function X(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 rt(e){if(X(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 cr=new Set(["string","number","symbol"]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function nt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ur(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ot=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),it={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ms(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return G(i,e,ke(e,t)),F(e,A(r,{shape:i,checks:[]}))}function ke(e,t){let r=B(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function hs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ke(e,t)),s={};return G(s,e,Reflect.ownKeys(B(e)).filter((c)=>!i.has(c))),F(e,A(r,{shape:s,checks:[]}))}function gs(e,t){if(!X(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=B(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,A(e._zod.def,{shape:ar(e,t)}))}function ar(e,t){let r={};return G(r,e,Reflect.ownKeys(B(e))),ds(r,t),r}function _s(e,t){if(!X(t))throw Error("Invalid input to safeExtend: expected a plain object");return F(e,A(e._zod.def,{shape:ar(e,t)}))}function xs(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};G(r,e,Reflect.ownKeys(B(e))),G(r,t,Reflect.ownKeys(B(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return F(e,n)}function lr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(ke(t,r)):void 0,u={};return G(u,t,Reflect.ownKeys(B(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),F(t,A(t._zod.def,{shape:u,checks:[]}))}function ys(e,t,r){let n=r?new Set(ke(t,r)):void 0,o={};return G(o,t,Reflect.ownKeys(B(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),F(t,A(t._zod.def,{shape:o}))}function M(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function pr(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 K(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function le(e){return typeof e==="string"?e:e?.message}function st(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function U(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message: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 u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var bs=/[\uD800-\uDBFF]/;function Ze(e){let t=e.length;if(!bs.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Pe(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function fr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function H(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function dr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Qt(e,r,n.value)}for(let r of Object.getOwnPropertySymbols(t))Qt(e,r,t[r])}function V(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ct(e,t,r){return V(e,t,r,!1)}function vs(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return V(this,r,n(this))},set(o){V(this,r,o)}})}return t}function Qt(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:V(this,t,r.bind(this))},set(n){V(this,t,n)}})}function $s(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Qe,W=!1,zs={configurable:!0,get(){W=!0;return}};function y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Qe!==e._zod){Qe=void 0;return}Qe=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,zs);let o=W;W=!1;try{let i=r(this);if(W)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return W=W||o,i}catch(i){throw delete this[t],W=W||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ws(e,t,r,n){let o=$s(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var ks="~constantCatch";function mr(e){let t=()=>e;return t[ks]=!0,t}var hr;var ut={value:void 0,enumerable:!1},gr="captureStackTrace"in Error?Error:null;function Zs(e){let t=gr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return gr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){ut.value=new i(m);try{Object.defineProperty(d,"_zod",ut)}finally{ut.value=void 0}}if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),x=d._zod.constr.prototype,w=_;while(w&&w!==x)w=Object.getPrototypeOf(w);let C=w??_;if(!c.has(C))c.add(C),dr(C,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?Zs(l):this;u(m,d);let h=m._zod.deferred;if(h){for(let x of h)x();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class J 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"}}(hr=globalThis).__zod_globalConfig??(hr.__zod_globalConfig={});var I=globalThis.__zod_globalConfig;function T(e){if(e)Object.assign(I,e);return I}function Ps(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,de,2)),e.message}function Ss(e){this._zod.message=e}var Os={get:Ps,set:Ss,enumerable:!0,configurable:!0},lt={value:void 0,enumerable:!1},_r=new WeakSet([Object.prototype,Error.prototype]),xr=(e,t)=>{e.name="$ZodError",lt.value=t,Object.defineProperty(e,"issues",lt),lt.value=void 0,Object.defineProperty(e,"message",Os);let r=Object.getPrototypeOf(e);if(!_r.has(r))_r.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},yr=p("$ZodError",xr),zu=p("$ZodError",xr,void 0,{Parent:Error});function Is(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 br(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Is(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function vr(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let l=c[a],f=a===c.length-1;if(l==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[l];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Se(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Oe=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new J;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>U(a,s,T())));throw tt(u,i?.callee??t),u}return c.value};return t};var Ie=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>U(a,s,T())));throw tt(u,i?.callee??t),u}return c.value};return t};var Ee=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new J;return i.issues.length?$r(e,i.issues,o):{success:!0,data:i.value}};function $r(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>U(o,r,T()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Ae=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?$r(e,i.issues,o):{success:!0,data:i.value}};var Es=Symbol.for("zod.compile.invalid"),As=Symbol.for("zod.compile.fallback"),pt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Es)return!0;if(n.definite===!0&&r===void 0)return!1}return Ts(e,t,r)};function Ts(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[As]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new J;return i.issues.length===0}var ft=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},zr=(e)=>{let t=Oe(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Se(r,s))};return r};var wr=(e)=>{let t=Oe(e),r=(n,o,i,s)=>t(n,o,i,Se(r,s));return r};var kr=(e)=>{let t=Ie(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Se(r,s))};return r};var Zr=(e)=>{let t=Ie(e),r=async(n,o,i,s)=>await t(n,o,i,Se(r,s));return r};var Pr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ee(e)(t,r,o)};var Sr=(e)=>(t,r,n)=>Ee(e)(t,r,n);var Or=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ae(e)(t,r,o)};var Ir=(e)=>async(t,r,n)=>Ae(e)(t,r,n);var Er=/^[cC][0-9a-z]{6,}$/,Ar=/^[0-9a-z]+$/,Tr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nr=/^[0-9a-vA-V]{20}$/,Cr=/^[A-Za-z0-9]{27}$/,jr=/^[a-zA-Z0-9_-]{21}$/;function Rr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Dr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Lr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Fr=/^(?:[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 Ns="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Mr(){return new RegExp(Ns,"u")}var Ur=/^(?:(?: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])$/,Jr=/^(([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 Br=/^((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])$/,Vr=/^(([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])$/,Kr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var qr=/^https?$/,Gr=/^\+[1-9]\d{6,14}$/;var Xr="(?:(?:\\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 Cs(e){return new RegExp(`^${e}$`)}var Hr=Cs(Xr);function dt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Yr(e){return new RegExp(`^${dt(e)}$`)}function Qr(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${dt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${dt({precision:e.precision})}`:r;return new RegExp(`^${Xr}T(?:${n})$`)}var en=/^[\s\S]{0,}$/;var ht=/^-?\d+$/,Te=/^-?\d+(?:\.\d+)?$/;var tn=/^[^A-Z]*$/,rn=/^[^a-z]*$/;var E=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var gt=(e)=>{let t=e.value;return!tr(t)&&t.length!==void 0};var nn=p("$ZodCheckMaxLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ze(o):i)<=t.maximum)return;let c=Pe(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),on=p("$ZodCheckMinLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ze(o):i)>=t.minimum)return;let c=Pe(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),sn=p("$ZodCheckLengthEquals",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=gt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ze(o):i;if(s===t.length)return;let c=Pe(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ge=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(E.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),cn=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})}}),un=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tn),ge.init(e,t)}),an=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rn),ge.init(e,t)}),ln=p("$ZodCheckIncludes",(e,t)=>{E.init(e,t);let r=re(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),pn=p("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);let r=new RegExp(`^${re(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),fn=p("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);let r=new RegExp(`.*${re(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var dn=p("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class _t{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
2
|
+
var ps=Object.defineProperty;var fs=(e)=>e;function ds(e,t){this[e]=fs.bind(null,t)}var Qt=(e,t)=>{for(var r in t)ps(e,r,{get:t[r],enumerable:!0,configurable:!0,set:ds.bind(t,r)})};var us={};Qt(us,{Enums:()=>we,RegoProvider:()=>Xt,dataSchema:()=>ve,fullDataSchema:()=>qt,metadataSchema:()=>$e,routeSchema:()=>Gt,staticDataSchema:()=>ze});var we={};Qt(we,{EScriptIds:()=>te});var te;((o)=>{o.routes="rego-routes";o.data="rego-data";o.metadata="rego-metadata";o.staticData="rego-static-data"})(te||={});function fe(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function tt(e,t="|"){return e.map((r)=>ot(r)).join(t)}function de(e,t){if(typeof t==="bigint")return t.toString();return t}class tr{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 ke(e){return new tr(e)}function rr(e){return e===null||e===void 0}function Ze(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function j(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Pe(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function B(e){return Pe(e._zod.def)??e._zod.def.shape}function nr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return j(this,t,n),n},enumerable:!0,configurable:!0})}function or(e,t,r){if(t in e)j(e,t,r);else e[t]=r}function G(e,t,r,n){let o=B(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)nr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else or(e,i,n?n(s.value,i):s.value)}}function ms(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)nr(e,r,()=>t[r]);else or(e,r,n.value)}}function A(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ir(e){return JSON.stringify(e)}function sr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var rt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var cr=ke(()=>{if(I.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function X(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 nt(e){if(X(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 ur=new Set(["string","number","symbol"]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ot(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ar(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var it=(()=>({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]}))(),st={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function hs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return G(i,e,Se(e,t)),F(e,A(r,{shape:i,checks:[]}))}function Se(e,t){let r=B(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function gs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Se(e,t)),s={};return G(s,e,Reflect.ownKeys(B(e)).filter((c)=>!i.has(c))),F(e,A(r,{shape:s,checks:[]}))}function _s(e,t){if(!X(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=B(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,A(e._zod.def,{shape:lr(e,t)}))}function lr(e,t){let r={};return G(r,e,Reflect.ownKeys(B(e))),ms(r,t),r}function xs(e,t){if(!X(t))throw Error("Invalid input to safeExtend: expected a plain object");return F(e,A(e._zod.def,{shape:lr(e,t)}))}function ys(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};G(r,e,Reflect.ownKeys(B(e))),G(r,t,Reflect.ownKeys(B(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return F(e,n)}function pr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Se(t,r)):void 0,u={};return G(u,t,Reflect.ownKeys(B(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),F(t,A(t._zod.def,{shape:u,checks:[]}))}function bs(e,t,r){let n=r?new Set(Se(t,r)):void 0,o={};return G(o,t,Reflect.ownKeys(B(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),F(t,A(t._zod.def,{shape:o}))}function M(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function fr(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 K(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function le(e){return typeof e==="string"?e:e?.message}function ct(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function U(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message: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 u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var vs=/[\uD800-\uDBFF]/;function Oe(e){let t=e.length;if(!vs.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Ie(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function dr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function H(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function mr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else er(e,r,n.value)}for(let r of Object.getOwnPropertySymbols(t))er(e,r,t[r])}function V(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ut(e,t,r){return V(e,t,r,!1)}function $s(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return V(this,r,n(this))},set(o){V(this,r,o)}})}return t}function er(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:V(this,t,r.bind(this))},set(n){V(this,t,n)}})}function zs(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var et,W=!1,ws={configurable:!0,get(){W=!0;return}};function y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&et!==e._zod){et=void 0;return}et=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ws);let o=W;W=!1;try{let i=r(this);if(W)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return W=W||o,i}catch(i){throw delete this[t],W=W||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ks(e,t,r,n){let o=zs(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Zs="~constantCatch";function hr(e){let t=()=>e;return t[Zs]=!0,t}var gr;var at={value:void 0,enumerable:!1},_r="captureStackTrace"in Error?Error:null;function Ps(e){let t=_r;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return _r=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){at.value=new i(m);try{Object.defineProperty(d,"_zod",at)}finally{at.value=void 0}}if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),x=d._zod.constr.prototype,w=_;while(w&&w!==x)w=Object.getPrototypeOf(w);let C=w??_;if(!c.has(C))c.add(C),mr(C,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?Ps(l):this;u(m,d);let h=m._zod.deferred;if(h){for(let x of h)x();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class J 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"}}(gr=globalThis).__zod_globalConfig??(gr.__zod_globalConfig={});var I=globalThis.__zod_globalConfig;function T(e){if(e)Object.assign(I,e);return I}function Ss(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,de,2)),e.message}function Os(e){this._zod.message=e}var Is={get:Ss,set:Os,enumerable:!0,configurable:!0},pt={value:void 0,enumerable:!1},xr=new WeakSet([Object.prototype,Error.prototype]),yr=(e,t)=>{e.name="$ZodError",pt.value=t,Object.defineProperty(e,"issues",pt),pt.value=void 0,Object.defineProperty(e,"message",Is);let r=Object.getPrototypeOf(e);if(!xr.has(r))xr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},br=p("$ZodError",yr),zu=p("$ZodError",yr,void 0,{Parent:Error});function Es(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 vr(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Es(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function $r(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let l=c[a],f=a===c.length-1;if(l==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[l];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Ee(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ae=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new J;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>U(a,s,T())));throw rt(u,i?.callee??t),u}return c.value};return t};var Te=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>U(a,s,T())));throw rt(u,i?.callee??t),u}return c.value};return t};var Ne=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new J;return i.issues.length?zr(e,i.issues,o):{success:!0,data:i.value}};function zr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>U(o,r,T()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Ce=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?zr(e,i.issues,o):{success:!0,data:i.value}};var As=Symbol.for("zod.compile.invalid"),Ts=Symbol.for("zod.compile.fallback"),ft=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==As)return!0;if(n.definite===!0&&r===void 0)return!1}return Ns(e,t,r)};function Ns(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Ts]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new J;return i.issues.length===0}var dt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},wr=(e)=>{let t=Ae(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Ee(r,s))};return r};var kr=(e)=>{let t=Ae(e),r=(n,o,i,s)=>t(n,o,i,Ee(r,s));return r};var Zr=(e)=>{let t=Te(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Ee(r,s))};return r};var Pr=(e)=>{let t=Te(e),r=async(n,o,i,s)=>await t(n,o,i,Ee(r,s));return r};var Sr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ne(e)(t,r,o)};var Or=(e)=>(t,r,n)=>Ne(e)(t,r,n);var Ir=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ce(e)(t,r,o)};var Er=(e)=>async(t,r,n)=>Ce(e)(t,r,n);var Ar=/^[cC][0-9a-z]{6,}$/,Tr=/^[0-9a-z]+$/,Nr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cr=/^[0-9a-vA-V]{20}$/,jr=/^[A-Za-z0-9]{27}$/,Rr=/^[a-zA-Z0-9_-]{21}$/;function Dr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Lr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Fr=/^([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})$/,ht=(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 Mr=/^(?:[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 Cs="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ur(){return new RegExp(Cs,"u")}var Jr=/^(?:(?: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])$/,Br=/^(([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 Vr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Kr=/^(([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])$/,Wr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Gr=/^https?$/,Xr=/^\+[1-9]\d{6,14}$/;var Hr="(?:(?:\\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 js(e){return new RegExp(`^${e}$`)}var Yr=js(Hr);function mt(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 Qr(e){return new RegExp(`^${mt(e)}$`)}function en(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${mt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${mt({precision:e.precision})}`:r;return new RegExp(`^${Hr}T(?:${n})$`)}var tn=/^[\s\S]{0,}$/;var gt=/^-?\d+$/,je=/^-?\d+(?:\.\d+)?$/;var rn=/^[^A-Z]*$/,nn=/^[^a-z]*$/;var E=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var _t=(e)=>{let t=e.value;return!rr(t)&&t.length!==void 0};var on=p("$ZodCheckMaxLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=_t),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Oe(o):i)<=t.maximum)return;let c=Ie(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),sn=p("$ZodCheckMinLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=_t),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Oe(o):i)>=t.minimum)return;let c=Ie(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cn=p("$ZodCheckLengthEquals",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=_t),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Oe(o):i;if(s===t.length)return;let c=Ie(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ge=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(E.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),un=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})}}),an=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rn),ge.init(e,t)}),ln=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nn),ge.init(e,t)}),pn=p("$ZodCheckIncludes",(e,t)=>{E.init(e,t);let r=re(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),fn=p("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);let r=new RegExp(`^${re(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),dn=p("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);let r=new RegExp(`.*${re(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var mn=p("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class xt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
3
|
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${t.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}}var hn={major:4,minor:6,patch:1};var k=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=M(c),f;for(let d of u){if(d._zod.def.when){if(pr(c))continue;if(!d._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new J;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(st(c.issues,m,e),!l)l=M(c,m)});else{if(c.issues.length===m)continue;if(st(c.issues,m,e),!l)l=M(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(M(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new J;return l.then((f)=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new J;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return ct(this,"~standard",yt(this))},set "~standard"(e){V(this,"~standard",e)}}),Zn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>U(r,t,T()))}:{value:e.value};async function js(e,t){let r={async:!0};return Zn(await e._zod.run({value:t,issues:[]},r),r)}function yt(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Zn(n,r)}catch(n){}return js(e,t)},vendor:"zod",version:1}}var je=p("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??en,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),b=p("$ZodStringFormat",(e,t)=>{ge.init(e,t),je.init(e,t)}),Pn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Lr),b.init(e,t)}),Sn=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mt(n))}else t.pattern??(t.pattern=mt());b.init(e,t)}),On=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fr),b.init(e,t)}),In=1,En=2;function Rs(e,t){if(!t.normalize&&t.protocol?.source===qr.source&&!/^https?:\/\//i.test(e))return In;try{return new URL(e)}catch{return En}}var Ds=/[\t\n\r]/g;function Ls(e){return e.replace(Ds,"")}function Fs(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ms(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var An=p("$ZodURL",(e,t)=>{b.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Rs(n,t);if(o===In){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===En){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(t.hostname&&!Fs(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Ms(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Ls(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Tn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mr()),b.init(e,t)}),Nn=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?jr:Rr(t.length)),b.init(e,t)}),Cn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Er),b.init(e,t)}),jn=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ar),b.init(e,t)}),Rn=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Tr),b.init(e,t)}),Dn=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Nr),b.init(e,t)}),Ln=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cr),b.init(e,t)}),Fn=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qr(t)),b.init(e,t)}),Mn=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hr),b.init(e,t)}),Un=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yr(t)),b.init(e,t)}),Jn=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Dr),b.init(e,t)}),Bn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ur),b.init(e,t)}),Us=/^[0-9a-fA-F:.]+$/;function Vn(e){if(!Us.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Kn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jr),b.init(e,t),e._zod.check=(r)=>{if(!Vn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Wn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Br),b.init(e,t)});function Js(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Vn(r)}var qn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vr),b.init(e,t),e._zod.check=(r)=>{if(!Js(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Gn(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 bt=/^[0-9a-zA-Z+/]*={0,2}$/,Xn=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bt),b.init(e,t),e._zod.check=(r)=>{if(Gn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Re=/^[A-Za-z0-9_-]*$/;function Bs(e){if(!Re.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gn(r)}var Hn=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Re),b.init(e,t),e._zod.check=(r)=>{if(Bs(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Yn=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Gr),b.init(e,t)});function Vs(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Qn=p("$ZodJWT",(e,t)=>{b.init(e,t),e._zod.check=(r)=>{if(Vs(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var eo=p("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=(r)=>r}),to=p("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function gn(e,t,r){if(e.issues.length)t.issues.push(...K(r,e.issues));t.value[r]=e.value}var ro=p("$ZodArray",(e,t)=>{k.init(e,t);let r=I.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>gn(f,n,u)));else if(gn(l,n,u),c&&l.issues.length!==0&&M(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function Ce(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...K(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s)t.value[r]=void 0}else t.value[r]=e.value}var Ks=[];function no(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ks,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ur(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function oo(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(M(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let _=a.run({value:t[h],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>Ce(x,r,h,t,f,d)));else Ce(_,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 Ws=p("$ZodObject",(e,t)=>{k.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=$e(()=>no(t));y(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))j(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=pe,s=t.catchall,c,u=I.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let d=[],m=c.shape,h=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(h&&a.issues.length!==_){if(M(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let w=m[x],C=w._zod.optin,ue=w._zod.optout,ae=w._zod.run({value:f[x],issues:[]},l);if(ae instanceof Promise)d.push(ae.then((S)=>Ce(S,a,x,f,C,ue)));else Ce(ae,a,x,f,C,ue)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return oo(d,f,a,l,o.value,e,h===!0)}}),io=p("$ZodObjectJIT",(e,t)=>{Ws.init(e,t);let r=e._zod.parse,n=$e(()=>no(t)),o=I.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,x=new _t(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),w=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,C=(S,v)=>`
|
|
6
|
+
};`)(...Object.values(this.closed))}}var gn={major:4,minor:6,patch:2};var k=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=M(c),f;for(let d of u){if(d._zod.def.when){if(fr(c))continue;if(!d._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new J;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(ct(c.issues,m,e),!l)l=M(c,m)});else{if(c.issues.length===m)continue;if(ct(c.issues,m,e),!l)l=M(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(M(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new J;return l.then((f)=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new J;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return ut(this,"~standard",bt(this))},set "~standard"(e){V(this,"~standard",e)}}),Pn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>U(r,t,T()))}:{value:e.value};async function Rs(e,t){let r={async:!0};return Pn(await e._zod.run({value:t,issues:[]},r),r)}function bt(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Pn(n,r)}catch(n){}return Rs(e,t)},vendor:"zod",version:1}}var Le=p("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??tn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),v=p("$ZodStringFormat",(e,t)=>{ge.init(e,t),Le.init(e,t)}),Sn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fr),v.init(e,t)}),On=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ht(n))}else t.pattern??(t.pattern=ht());v.init(e,t)}),In=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mr),v.init(e,t)}),En=1,An=2;function Ds(e,t){if(!t.normalize&&t.protocol?.source===Gr.source&&!/^https?:\/\//i.test(e))return En;try{return new URL(e)}catch{return An}}var Ls=/[\t\n\r]/g;function Fs(e){return e.replace(Ls,"")}function Ms(e,t){return t.lastIndex=0,t.test(e.hostname)}function Us(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Tn=p("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Ds(n,t);if(o===En){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===An){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(t.hostname&&!Ms(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Us(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Fs(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ur()),v.init(e,t)}),Cn=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?Rr:Dr(t.length)),v.init(e,t)}),jn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ar),v.init(e,t)}),Rn=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tr),v.init(e,t)}),Dn=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Nr),v.init(e,t)}),Ln=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cr),v.init(e,t)}),Fn=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=jr),v.init(e,t)}),Mn=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=en(t)),v.init(e,t)}),Un=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Yr),v.init(e,t)}),Jn=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Qr(t)),v.init(e,t)}),Bn=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Lr),v.init(e,t)}),Vn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Jr),v.init(e,t)}),Js=/^[0-9a-fA-F:.]+$/;function Kn(e){if(!Js.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Wn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Br),v.init(e,t),e._zod.check=(r)=>{if(!Kn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var qn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vr),v.init(e,t)});function Bs(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Kn(r)}var Gn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Kr),v.init(e,t),e._zod.check=(r)=>{if(!Bs(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Xn(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 vt=/^[0-9a-zA-Z+/]*={0,2}$/,Hn=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vt),v.init(e,t),e._zod.check=(r)=>{if(Xn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Fe=/^[A-Za-z0-9_-]*$/;function Vs(e){if(!Fe.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xn(r)}var Yn=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fe),v.init(e,t),e._zod.check=(r)=>{if(Vs(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Qn=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xr),v.init(e,t)});function Ks(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var eo=p("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=(r)=>{if(Ks(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var to=p("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=(r)=>r}),ro=p("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function _n(e,t,r){if(e.issues.length)t.issues.push(...K(r,e.issues));t.value[r]=e.value}var no=p("$ZodArray",(e,t)=>{k.init(e,t);let r=I.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>_n(f,n,u)));else if(_n(l,n,u),c&&l.issues.length!==0&&M(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function De(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...K(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var Ws=[];function oo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ws,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ar(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function io(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(M(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let _=a.run({value:t[h],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>De(x,r,h,t,f,d)));else De(_,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 qs=p("$ZodObject",(e,t)=>{k.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ke(()=>oo(t));y(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))j(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=pe,s=t.catchall,c,u=I.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let d=[],m=c.shape,h=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(h&&a.issues.length!==_){if(M(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let w=m[x],C=w._zod.optin,ue=w._zod.optout,ae=w._zod.run({value:f[x],issues:[]},l);if(ae instanceof Promise)d.push(ae.then((S)=>De(S,a,x,f,C,ue)));else De(ae,a,x,f,C,ue)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return io(d,f,a,l,o.value,e,h===!0)}}),so=p("$ZodObjectJIT",(e,t)=>{qs.init(e,t);let r=e._zod.parse,n=ke(()=>oo(t)),o=I.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,x=new xt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),w=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,C=(S,b)=>`
|
|
7
7
|
let ${S}_ab = false;
|
|
8
8
|
for (let i = 0; i < ${S}.issues.length; i++) {
|
|
9
9
|
const iss = ${S}.issues[i];
|
|
10
|
-
iss.path = iss.path ? [${
|
|
10
|
+
iss.path = iss.path ? [${b}, ...iss.path] : [${b}];
|
|
11
11
|
payload.issues.push(iss);
|
|
12
12
|
if (iss.continue !== true) ${S}_ab = true;
|
|
13
13
|
}
|
|
14
14
|
if (${S}_ab && ctx && ctx.abortEarly) {
|
|
15
15
|
payload.value = newResult;
|
|
16
16
|
return payload;
|
|
17
|
-
}`;x.write("const input = payload.value;");let ue=Object.create(null),ae=0;for(let S of h.allKeys)ue[S]=`key_${ae++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let S of h.allKeys){if(S==="__proto__")continue;let
|
|
18
|
-
const ${
|
|
19
|
-
if (!${
|
|
20
|
-
if (${
|
|
17
|
+
}`;x.write("const input = payload.value;");let ue=Object.create(null),ae=0;for(let S of h.allKeys)ue[S]=`key_${ae++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let S of h.allKeys){if(S==="__proto__")continue;let b=ue[S],L=typeof S==="symbol"?`syms[${_.indexOf(S)}]`:ir(S),Ye=`${L} in input`,Ht=m[S],Qe=Ht?._zod?.optin,Yt=Qe!==void 0,as=Ht?._zod?.optout==="optional";if(x.write(`const ${b} = ${w(L)};`),Yt&&as){let ls=Qe==="optional"?`${b}_present`:`${b}.value !== undefined || ${b}_present`;x.write(`
|
|
18
|
+
const ${b}_present = ${Ye};
|
|
19
|
+
if (!${b}.issues.length || ${b}_present) {
|
|
20
|
+
if (${b}.issues.length) {${C(b,L)}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (${
|
|
24
|
-
newResult[${L}] = ${
|
|
23
|
+
if (${ls}) {
|
|
24
|
+
newResult[${L}] = ${b}.value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}else if(!
|
|
29
|
-
const ${
|
|
30
|
-
if (${
|
|
28
|
+
`)}else if(!Yt)x.write(`
|
|
29
|
+
const ${b}_present = ${Ye};
|
|
30
|
+
if (${b}.issues.length) {${C(b,L)}
|
|
31
31
|
}
|
|
32
|
-
if (!${
|
|
32
|
+
if (!${b}_present && !${b}.issues.length) {
|
|
33
33
|
payload.issues.push({
|
|
34
34
|
code: "invalid_type",
|
|
35
35
|
expected: "nonoptional",
|
|
@@ -42,24 +42,19 @@ ${t.join(`
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if (${
|
|
46
|
-
newResult[${L}] = ${
|
|
45
|
+
if (${b}_present) {
|
|
46
|
+
newResult[${L}] = ${b}.value;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
`);else x.write(`
|
|
50
|
-
if (${
|
|
49
|
+
`);else if(x.write(`
|
|
50
|
+
if (${b}.issues.length) {${C(b,L)}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
if (${
|
|
54
|
-
|
|
55
|
-
newResult[${L}] = undefined;
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
newResult[${L}] = ${v}.value;
|
|
52
|
+
`),Qe==="defaulted")x.write(`newResult[${L}] = ${b}.value;`);else x.write(`
|
|
53
|
+
if (${b}.value !== undefined || ${Ye}) {
|
|
54
|
+
newResult[${L}] = ${b}.value;
|
|
59
55
|
}
|
|
56
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=pe,u=!I.jitless,l=u&&cr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(u&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return io([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function xn(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!M(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>U(s,n,T())))}),t}var co=p("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),y(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),y(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),y(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Ze(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return xn(s,n,e,o);return Promise.all(s).then((c)=>xn(c,n,e,o))}});var uo=p("$ZodIntersection",(e,t)=>{k.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>yn(r,u,a));return yn(r,i,s)}});function yt(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(X(e)&&X(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=yt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=yt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function yn(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[l]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((l)=>o.keys.includes(l)):[];if(a.length)e.issues.push({...o,keys:a});for(let l of c)if(!a.includes(l)&&i.has(l))e.issues.push(i.get(l))}let u=yt(t.value,r.value);if(!u.valid){if(M(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var ao=p("$ZodRecord",(e,t)=>{k.init(e,t);let r=I.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!X(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>U(h,o,T())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);if(m instanceof Promise)s.push(m.then((h)=>{if(h.issues.length)n.issues.push(...K(l,h.issues));n.value[d]=h.value}));else{if(m.issues.length)n.issues.push(...K(l,m.issues));n.value[d]=m.value}}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&je.test(a)&&l.issues.length){let h=t.keyType._zod.run({value:Number(a),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[a]=i[a];else if(c)u=u??[],u.push(a);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>U(h,o,T())),input:a,path:[a],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[a],issues:[]},o);if(m instanceof Promise)s.push(m.then((h)=>{if(h.issues.length)n.issues.push(...K(a,h.issues));n.value[d]=h.value}));else{if(m.issues.length)n.issues.push(...K(a,m.issues));n.value[d]=m.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var lo=p("$ZodEnum",(e,t)=>{k.init(e,t);let r=fe(t.entries),n=new Set(r);e._zod.values=n,y(e,"pattern",(o)=>{let i=fe(o.def.entries).filter((s)=>ur.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>re(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var po=p("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",I.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new me(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new J;return r.value=o,r}});function bn(e,t){return e.value=t.issues.length?void 0:t.value,e}var $t=p("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ze(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>bn(r,i));return bn(r,o)}return t.innerType._zod.run(r,n)}}),fo=p("$ZodExactOptional",(e,t)=>{$t.init(e,t),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),mo=p("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ze(n.source)}|null)$`):void 0}),y(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ho=p("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>vn(i,t));return vn(o,t)}});function vn(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var go=p("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),_o=p("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>$n(i,e));return $n(o,e)}});function $n(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 zn(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>U(o,n,T()))},input:e.value}),e}var xo=p("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>zn(r,i,t,n));return zn(r,o,t,n)}});var yo=p("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",(r)=>r.def.in._zod.values),y(e,"optin",(r)=>r.def.in._zod.optin),y(e,"optout",(r)=>r.def.out._zod.optout),y(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Re(s,t.in,n));return Re(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Re(i,t.out,n));return Re(o,t.out,n)}});function Re(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var bo=p("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",(r)=>r.def.innerType._zod.propValues),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"optin",(r)=>r.def.innerType?._zod?.optin),y(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(wn);return wn(o)}});function wn(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var vo=p("$ZodCustom",(e,t)=>{E.init(e,t),k.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>kn(i,r,n,e));kn(o,r,n,e);return}});function kn(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(H(o))}}function Zn(e,t,r){if(e.issues.length)t.issues.push(...K(r,e.issues))}var Gs=p("$ZodProperties",(e,t)=>{k.init(e,t),E.init(e,t);let r=I.memoizer;r?.attach(e);let n,o=(i,s)=>{n??(n=Reflect.ownKeys(t.shape).map((a)=>[a,t.shape[a]]));let c=i.value,u;for(let[a,l]of n){let f=l._zod.run({value:c[a],issues:[]},s);if(f instanceof Promise)u??(u=[]),u.push(f.then((d)=>Zn(d,i,a)));else Zn(f,i,a)}if(u)return Promise.all(u).then(()=>{return});return};e._zod.parse=(i,s)=>{let c=i.value;if(c===null||typeof c!=="object"&&typeof c!=="function")return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;if(s.direction==="backward")s={...s,direction:"forward"};if(r)r.alloc(e,i,c,s);let u=o(i,s);return u instanceof Promise?u.then(()=>i):i},e._zod.check=(i)=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}return o(i,{})}},{*[Symbol.iterator](){yield this}});class zo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var wt="~memo",$o=[];function wo(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function zt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var ko=new WeakMap,_e=0,Je=1,xe=2;function Be(e,t,r){let n=ko.get(e);if(n!==void 0)return n?xe:_e;if(t.has(e))return xe;t.add(e);let o=_e,i=(l)=>{if(o!==xe&&l?._zod){let f=Be(l,t,r);if(f>o)o=f}},s=(l,f)=>{let d=_e;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let _=h.get?Je:h.value?._zod?Be(h.value,t,r):_e;if(_>d)d=_}return d},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=Pe(u);c(l?s(l,!0):Je),i(u.catchall);break}case"properties":c(s(u.shape,!1));break;case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?Be(l,t,!1):Je);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let f=Object.getOwnPropertyDescriptor(u,l);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),Xs(e,o)}function Xs(e,t){if(t!==Je)ko.set(e,t===xe);return t}function Hs(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Me,Ue=[],Ys={alloc(e,t,r){let n=Me;if(!n)return r;Me=void 0;let o={value:r,issues:null};return n.set(t.value,o),Ue.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Qs(i,o.value))throw new zo;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let w=Be(e,new Set,!1);if(w===_e){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(w===xe||n)r=!0;else n=!0}let l=u.value;if(!wo(l))return s(u,a);let f=a[wt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[wt]=f;let d;if(o===a)d=i;else d=Hs(f,e),o=a,i=d;let m=d.get(l);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...zt(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}Me=d;let h=Ue.length,_=s(u,a);Me=void 0;let x=Ue.length>h?Ue.pop():void 0;if(_ instanceof Promise)return _.then((w)=>{if(x)x.issues=w.issues.length?zt(w.issues):$o;return w});if(x)x.issues=_.issues.length?zt(_.issues):$o;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Zo(){return Ys}function Qs(e,t){let r=e[wt]?.backEdges;return r!==void 0&&wo(t)&&r.has(t)}var ec=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=dr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ot(i.values[0])}`;return`Invalid option: expected one of ${tt(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${tt(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function kt(){return{localeError:ec()}}var Po;class So{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function tc(){return new So}(Po=globalThis).__zod_globalRegistry??(Po.__zod_globalRegistry=tc());var Y=globalThis.__zod_globalRegistry;function Oo(e,t){return new e({type:"string",...g(t)})}function Io(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Eo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function To(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function No(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Co(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function jo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ro(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Do(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Lo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Fo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Mo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Uo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Jo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Bo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Ko(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Go(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Yo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Qo(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function ei(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ti(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function ri(e){return new e({type:"unknown"})}function ni(e,t){return new e({type:"never",...g(t)})}function Ve(e,t){return new on({check:"max_length",...g(t),maximum:e})}function ne(e,t){return new sn({check:"min_length",...g(t),minimum:e})}function Ke(e,t){return new cn({check:"length_equals",...g(t),length:e})}function Zt(e,t){return new un({check:"string_format",format:"regex",...g(t),pattern:e})}function Pt(e){return new an({check:"string_format",format:"lowercase",...g(e)})}function St(e){return new ln({check:"string_format",format:"uppercase",...g(e)})}function Ot(e,t){return new pn({check:"string_format",format:"includes",...g(t),includes:e})}function It(e,t){return new fn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Et(e,t){return new dn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function q(e){return new mn({check:"overwrite",tx:e})}function At(e){return q((t)=>t.normalize(e))}function Tt(){return q((e)=>e.trim())}function Nt(){return q((e)=>e.toLowerCase())}function Ct(){return q((e)=>e.toUpperCase())}function jt(){return q((e)=>sr(e))}function oi(e,t,r){return new e({type:"array",element:t,...g(r)})}function ii(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function si(e,t){let r=rc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(H(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(H(i))}},e(n.value,n)),t);return r}function rc(e,t){let r=new E({check:"custom",...g(t)});return r._zod.check=e,r}function ye(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))j(e,n,r[n]);return e}function Dt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function oe(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ye(s.schema,u);if(t.io==="input"&&O(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function ci(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Lt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${ci(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+ci(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let l=c.schema;for(let f in l)delete l[f];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
60
57
|
|
|
61
|
-
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=pe,u=!I.jitless,l=u&&sr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(u&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return oo([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function _n(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!M(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>U(s,n,T())))}),t}var so=p("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),y(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),y(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),y(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>ze(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return _n(s,n,e,o);return Promise.all(s).then((c)=>_n(c,n,e,o))}});var co=p("$ZodIntersection",(e,t)=>{k.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>xn(r,u,a));return xn(r,i,s)}});function xt(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(X(e)&&X(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=xt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=xt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xn(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[l]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((l)=>o.keys.includes(l)):[];if(a.length)e.issues.push({...o,keys:a});for(let l of c)if(!a.includes(l)&&i.has(l))e.issues.push(i.get(l))}let u=xt(t.value,r.value);if(!u.valid){if(M(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var uo=p("$ZodRecord",(e,t)=>{k.init(e,t);let r=I.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!X(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>U(h,o,T())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);if(m instanceof Promise)s.push(m.then((h)=>{if(h.issues.length)n.issues.push(...K(l,h.issues));n.value[d]=h.value}));else{if(m.issues.length)n.issues.push(...K(l,m.issues));n.value[d]=m.value}}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Te.test(a)&&l.issues.length){let h=t.keyType._zod.run({value:Number(a),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[a]=i[a];else if(c)u=u??[],u.push(a);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>U(h,o,T())),input:a,path:[a],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[a],issues:[]},o);if(m instanceof Promise)s.push(m.then((h)=>{if(h.issues.length)n.issues.push(...K(a,h.issues));n.value[d]=h.value}));else{if(m.issues.length)n.issues.push(...K(a,m.issues));n.value[d]=m.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var ao=p("$ZodEnum",(e,t)=>{k.init(e,t);let r=fe(t.entries),n=new Set(r);e._zod.values=n,y(e,"pattern",(o)=>{let i=fe(o.def.entries).filter((s)=>cr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>re(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var lo=p("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",I.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new me(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new J;return r.value=o,r}});function yn(e,t){return e.value=t.issues.length?void 0:t.value,e}var vt=p("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ze(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>yn(r,i));return yn(r,o)}return t.innerType._zod.run(r,n)}}),po=p("$ZodExactOptional",(e,t)=>{vt.init(e,t),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),fo=p("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ze(n.source)}|null)$`):void 0}),y(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),mo=p("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>bn(i,t));return bn(o,t)}});function bn(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var ho=p("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),go=p("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>vn(i,e));return vn(o,e)}});function vn(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 $n(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>U(o,n,T()))},input:e.value}),e}var _o=p("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>$n(r,i,t,n));return $n(r,o,t,n)}});var xo=p("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",(r)=>r.def.in._zod.values),y(e,"optin",(r)=>r.def.in._zod.optin),y(e,"optout",(r)=>r.def.out._zod.optout),y(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Ne(s,t.in,n));return Ne(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ne(i,t.out,n));return Ne(o,t.out,n)}});function Ne(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var yo=p("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",(r)=>r.def.innerType._zod.propValues),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"optin",(r)=>r.def.innerType?._zod?.optin),y(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(zn);return zn(o)}});function zn(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var bo=p("$ZodCustom",(e,t)=>{E.init(e,t),k.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>wn(i,r,n,e));wn(o,r,n,e);return}});function wn(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(H(o))}}function kn(e,t,r){if(e.issues.length)t.issues.push(...K(r,e.issues))}var qs=p("$ZodProperties",(e,t)=>{k.init(e,t),E.init(e,t);let r=I.memoizer;r?.attach(e);let n,o=(i,s)=>{n??(n=Reflect.ownKeys(t.shape).map((a)=>[a,t.shape[a]]));let c=i.value,u;for(let[a,l]of n){let f=l._zod.run({value:c[a],issues:[]},s);if(f instanceof Promise)u??(u=[]),u.push(f.then((d)=>kn(d,i,a)));else kn(f,i,a)}if(u)return Promise.all(u).then(()=>{return});return};e._zod.parse=(i,s)=>{let c=i.value;if(c===null||typeof c!=="object"&&typeof c!=="function")return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;if(s.direction==="backward")s={...s,direction:"forward"};if(r)r.alloc(e,i,c,s);let u=o(i,s);return u instanceof Promise?u.then(()=>i):i},e._zod.check=(i)=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}return o(i,{})}},{*[Symbol.iterator](){yield this}});class $o extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var zt="~memo",vo=[];function zo(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function $t(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var wo=new WeakMap,_e=0,Fe=1,xe=2;function Me(e,t,r){let n=wo.get(e);if(n!==void 0)return n?xe:_e;if(t.has(e))return xe;t.add(e);let o=_e,i=(l)=>{if(o!==xe&&l?._zod){let f=Me(l,t,r);if(f>o)o=f}},s=(l,f)=>{let d=_e;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let _=h.get?Fe:h.value?._zod?Me(h.value,t,r):_e;if(_>d)d=_}return d},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=we(u);c(l?s(l,!0):Fe),i(u.catchall);break}case"properties":c(s(u.shape,!1));break;case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?Me(l,t,!1):Fe);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let f=Object.getOwnPropertyDescriptor(u,l);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),Gs(e,o)}function Gs(e,t){if(t!==Fe)wo.set(e,t===xe);return t}function Xs(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var De,Le=[],Hs={alloc(e,t,r){let n=De;if(!n)return r;De=void 0;let o={value:r,issues:null};return n.set(t.value,o),Le.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Ys(i,o.value))throw new $o;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let w=Me(e,new Set,!1);if(w===_e){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(w===xe||n)r=!0;else n=!0}let l=u.value;if(!zo(l))return s(u,a);let f=a[zt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[zt]=f;let d;if(o===a)d=i;else d=Xs(f,e),o=a,i=d;let m=d.get(l);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...$t(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}De=d;let h=Le.length,_=s(u,a);De=void 0;let x=Le.length>h?Le.pop():void 0;if(_ instanceof Promise)return _.then((w)=>{if(x)x.issues=w.issues.length?$t(w.issues):vo;return w});if(x)x.issues=_.issues.length?$t(_.issues):vo;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function ko(){return Hs}function Ys(e,t){let r=e[zt]?.backEdges;return r!==void 0&&zo(t)&&r.has(t)}var Qs=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=fr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${nt(i.values[0])}`;return`Invalid option: expected one of ${et(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":""}: ${et(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 wt(){return{localeError:Qs()}}var Zo;class Po{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ec(){return new Po}(Zo=globalThis).__zod_globalRegistry??(Zo.__zod_globalRegistry=ec());var Y=globalThis.__zod_globalRegistry;function So(e,t){return new e({type:"string",...g(t)})}function Oo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function To(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function No(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Co(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function jo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Ro(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Do(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Lo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Fo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Mo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Uo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Jo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Bo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ko(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Go(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Yo(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Qo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function ei(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function ti(e){return new e({type:"unknown"})}function ri(e,t){return new e({type:"never",...g(t)})}function Ue(e,t){return new nn({check:"max_length",...g(t),maximum:e})}function ne(e,t){return new on({check:"min_length",...g(t),minimum:e})}function Je(e,t){return new sn({check:"length_equals",...g(t),length:e})}function kt(e,t){return new cn({check:"string_format",format:"regex",...g(t),pattern:e})}function Zt(e){return new un({check:"string_format",format:"lowercase",...g(e)})}function Pt(e){return new an({check:"string_format",format:"uppercase",...g(e)})}function St(e,t){return new ln({check:"string_format",format:"includes",...g(t),includes:e})}function Ot(e,t){return new pn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function It(e,t){return new fn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function q(e){return new dn({check:"overwrite",tx:e})}function Et(e){return q((t)=>t.normalize(e))}function At(){return q((e)=>e.trim())}function Tt(){return q((e)=>e.toLowerCase())}function Nt(){return q((e)=>e.toUpperCase())}function Ct(){return q((e)=>ir(e))}function ni(e,t,r){return new e({type:"array",element:t,...g(r)})}function oi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function ii(e,t){let r=tc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(H(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(H(i))}},e(n.value,n)),t);return r}function tc(e,t){let r=new E({check:"custom",...g(t)});return r._zod.check=e,r}function ye(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))j(e,n,r[n]);return e}function Rt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function oe(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function Z(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ye(s.schema,u);if(t.io==="input"&&O(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function si(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Dt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${si(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+si(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let l=c.schema;for(let f in l)delete l[f];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
62
|
-
|
|
63
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function ai(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;ai(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var li=new Set(["type","properties","required","additionalProperties"]),ci=["oneOf","anyOf"];function ui(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(!li.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ui(a);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:jt(c)??{allOf:c};j(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ui(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function rc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of li)if(o in e)return;let r=t.filter((o)=>ci.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=jt(t);else{let o=r[0],i=ci.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>jt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ye(e,n)}function Lt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},f=u.ref;if(u.ref=null,f){n(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(h);else ye(a,h);if(ye(a,l),c._zod.parent===f)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(!(x in l))delete a[x]}if(h.$ref&&m.def)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(x in m.def&&JSON.stringify(a[x])===JSON.stringify(m.def[x]))delete a[x]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ai(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])rc(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}ye(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;j(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:be(t,"input",e.processors),output:be(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function O(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return O(n.element,r);if(n.type==="set")return O(n.valueType,r);if(n.type==="lazy")return O(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return O(n.innerType,r);if(n.type==="intersection")return O(n.left,r)||O(n.right,r);if(n.type==="record"||n.type==="map")return O(n.keyType,r)||O(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return O(n.in,r)||O(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(O(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(O(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(O(o,r))return!0;if(n.rest&&O(n.rest,r))return!0;return!1}return!1}var pi=(e,t={})=>(r)=>{let n=Rt({...r,processors:t});return Z(e,n),Dt(n,e),Lt(n,e)},be=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Rt({...o??{},target:i,io:t,processors:r});return Z(e,s),Dt(s,e),Lt(s,e)};var ie=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},se=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},fi=(e,t)=>{ie(e,"minimum",t),se(e,"maximum",t)},gi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},_i=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},xi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},yi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},di=(e,t)=>ie(e,"minimum",t.minimum),mi=(e,t)=>se(e,"maximum",t.maximum),hi=(e)=>(t,r)=>{yi(t,r.format);let[n,o]=e[r.format];ie(t,"minimum",n),se(t,"maximum",o)},nc={greater_than:(e,t)=>ie(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>se(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>gi(e,t.value),number_format:hi(ot),bigint_format:hi(it),min_length:di,max_length:mi,length_equals:(e,t)=>fi(e,t.length),min_size:di,max_size:mi,size_equals:(e,t)=>fi(e,t.size),string_format:(e,t)=>{if(yi(e,t.format),t.pattern)_i(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)=>xi(e,t.mime)};function Q(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)nc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ie(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ie(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)se(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)se(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)gi(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)xi(t,o.mime);for(let i of o.patterns??[])_i(t,i);return t}var oc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ic=new Map([[bt,Kr],[Re,Wr]]),bi=(e)=>ic.get(e)??e,vi=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=Q(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=oc[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(bi);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}};var $i=(e,t,r,n)=>{r.not={}};var zi=(e,t,r,n)=>{};var wi=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i};var ki=(e,t,r,n)=>{oe(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Zi=(e,t,r,n)=>{oe(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Pi=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=Q(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=Z(i.element,t,{...n,path:[...n.path,"items"]})};function Be(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Be(t.out);if(t.type==="catch")return Be(t.innerType);return e._zod.optin}var Si=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oe(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)j(o.properties,l,Z(s[l],t,{...n,path:[...n.path,"properties",l]}));let u=new Set(Object.keys(s)),a=new Set([...u].filter((l)=>{let f=i.shape[l];if(t.io==="input")return Be(f)===void 0;else return f._zod.optout===void 0}));if(a.size>0)o.required=Array.from(a);if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=Z(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})};var Oi=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>Z(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},Ii=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=Z(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};function Ft(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let _=Ft(e,h,r);return _===h?t:_}for(let h of["anyOf","oneOf"]){let _=t[h];if(!Array.isArray(_))continue;let x=_.map((w)=>Ft(e,w,r));if(x.some((w,C)=>w!==_[C]))t={...t,[h]:x}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:f,id:d,...m}=t;if(m.enum)m.enum=m.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof m.const==="number")m.const=String(m.const);if(!o)return m;if(m.type="string",!i)m.pattern=(n.includes("number")?Te:ht).source;return m}var Mt=new WeakMap;function sc(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Mt.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Ft(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var Ei=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=Q(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=Z(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)j(o.patternProperties,bi(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Z(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Mt.get(t);if(!l)l=[],Mt.set(t,l),t.deferred.push(()=>sc(t));l.push(e)}o.additionalProperties=Z(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&Be(i.valueType)!==void 0;if(u&&!i.partial&&!a){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},Ai=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Ti=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ut=Symbol();function Ni(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return oe(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Ut}var Ci=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Ni(o.defaultValue,e,t,r,n);if(s!==Ut)r.default=s},ji=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ni(o.defaultValue,e,t,r,n);if(s!==Ut)r._prefault=s},Ri=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{oe(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Di=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Z(s,t,n);let c=t.seen.get(e);c.ref=s},Li=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Jt=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Fi=new WeakSet([Object.prototype,Error.prototype]);function Ve(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var xc=(e,t)=>{yr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Fi.has(r))return;Fi.add(r),Ve(r,"format",(n)=>(o)=>vr(n,o)),Ve(r,"flatten",(n)=>(o)=>br(n,o)),Ve(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,de,2)}),Ve(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,de,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var N=p("ZodError",xc,void 0,{Parent:Error});var Mi=Oe(N),Ui=Ie(N),Ji=Ee(N),Bi=Ae(N),Vi=zr(N),Ki=wr(N),Wi=kr(N),qi=Zr(N),Gi=Pr(N),Xi=Sr(N),Hi=Or(N),Yi=Ir(N);function bc(){if(!I.localeError)T(wt())}function We(){if(!I.memoizer)T({memoizer:ko()})}var P=p("ZodType",(e,t)=>(bc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(hu(e,t))},superRefine(e,t){return this.check(gu(e,t))},overwrite(e){return this.check(q(e))},optional(){return es(this)},exactOptional(){return ru(this)},nullable(){return ts(this)},nullish(){return es(ts(this))},nonoptional(e){return uu(this,e)},array(){return qc(this)},or(e){return Kt([this,e])},and(e){return Yc(this,e)},transform(e){return rs(this,tu(e))},default(e){return iu(this,e)},prefault(e){return cu(this,e)},catch(e){return lu(this,e)},pipe(e){return rs(this,e)},readonly(){return du(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ct(this,"~standard",{...yt(this),jsonSchema:{input:be(this,"input"),output:be(this,"output")}})},set "~standard"(e){V(this,"~standard",e)},parse:function e(t,r){return Mi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ui(this,t,r,{callee:e})},safeParse(e,t){return Ji(this,e,t)},async safeParseAsync(e,t){return Bi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return pt(this,e,t)},validateAsync(e,t){return ft(this,e,t)},encode:function e(t,r){return Vi(this,t,r,{callee:e})},decode:function e(t,r){return Ki(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Wi(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await qi(this,t,r,{callee:e})},safeEncode(e,t){return Gi(this,e,t)},safeDecode(e,t){return Xi(this,e,t)},async safeEncodeAsync(e,t){return Hi(this,e,t)},async safeDecodeAsync(e,t){return Yi(this,e,t)},toJSONSchema(e){return pi(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ns=p("_ZodString",(e,t)=>{je.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vi(e,r,n,o)},vs({format:(e)=>Q(e).format??null,minLength:(e)=>Q(e).minimum??null,maxLength:(e)=>Q(e).maximum??null},{regex(...e){return this.check(kt(...e))},includes(...e){return this.check(St(...e))},startsWith(...e){return this.check(Ot(...e))},endsWith(...e){return this.check(It(...e))},min(...e){return this.check(ne(...e))},max(...e){return this.check(Ue(...e))},length(...e){return this.check(Je(...e))},nonempty(...e){return this.check(ne(1,...e))},lowercase(e){return this.check(Zt(e))},uppercase(e){return this.check(Pt(e))},trim(){return this.check(At())},normalize(...e){return this.check(Et(...e))},toLowerCase(){return this.check(Tt())},toUpperCase(){return this.check(Nt())},slugify(){return this.check(Ct())}})),vc=p("ZodString",(e,t)=>{je.init(e,t),ns.init(e,t)},{email(e){return this.check(Oo(Zc,e))},url(e){return this.check(Co(Sc,e))},jwt(e){return this.check(Xo(Jc,e))},emoji(e){return this.check(jo(Oc,e))},guid(e){return this.check(Io(Pc,e))},uuid(e){return this.check(Eo(Ke,e))},uuidv4(e){return this.check(Ao(Ke,e))},uuidv6(e){return this.check(To(Ke,e))},uuidv7(e){return this.check(No(Ke,e))},nanoid(e){return this.check(Ro(Ic,e))},cuid(e){return this.check(Do(Ec,e))},cuid2(e){return this.check(Lo(Ac,e))},ulid(e){return this.check(Fo(Tc,e))},base64(e){return this.check(Wo(Fc,e))},base64url(e){return this.check(qo(Mc,e))},xid(e){return this.check(Mo(Nc,e))},ksuid(e){return this.check(Uo(Cc,e))},ipv4(e){return this.check(Jo(jc,e))},ipv6(e){return this.check(Bo(Rc,e))},cidrv4(e){return this.check(Vo(Dc,e))},cidrv6(e){return this.check(Ko(Lc,e))},e164(e){return this.check(Go(Uc,e))},datetime(e){return this.check(Ho($c,e))},date(e){return this.check(Yo(zc,e))},time(e){return this.check(Qo(wc,e))},duration(e){return this.check(ei(kc,e))}});function D(e){return So(vc,e)}var z=p("ZodStringFormat",(e,t)=>{b.init(e,t),ns.init(e,t)}),$c=p("ZodISODateTime",(e,t)=>{Fn.init(e,t),z.init(e,t)}),zc=p("ZodISODate",(e,t)=>{Mn.init(e,t),z.init(e,t)}),wc=p("ZodISOTime",(e,t)=>{Un.init(e,t),z.init(e,t)}),kc=p("ZodISODuration",(e,t)=>{Jn.init(e,t),z.init(e,t)}),Zc=p("ZodEmail",(e,t)=>{On.init(e,t),z.init(e,t)});var Pc=p("ZodGUID",(e,t)=>{Pn.init(e,t),z.init(e,t)});var Ke=p("ZodUUID",(e,t)=>{Sn.init(e,t),z.init(e,t)});var Sc=p("ZodURL",(e,t)=>{An.init(e,t),z.init(e,t)});var Oc=p("ZodEmoji",(e,t)=>{Tn.init(e,t),z.init(e,t)});var Ic=p("ZodNanoID",(e,t)=>{Nn.init(e,t),z.init(e,t)});var Ec=p("ZodCUID",(e,t)=>{Cn.init(e,t),z.init(e,t)});var Ac=p("ZodCUID2",(e,t)=>{jn.init(e,t),z.init(e,t)});var Tc=p("ZodULID",(e,t)=>{Rn.init(e,t),z.init(e,t)});var Nc=p("ZodXID",(e,t)=>{Dn.init(e,t),z.init(e,t)});var Cc=p("ZodKSUID",(e,t)=>{Ln.init(e,t),z.init(e,t)});var jc=p("ZodIPv4",(e,t)=>{Bn.init(e,t),z.init(e,t)});var Rc=p("ZodIPv6",(e,t)=>{Kn.init(e,t),z.init(e,t)});var Dc=p("ZodCIDRv4",(e,t)=>{Wn.init(e,t),z.init(e,t)});var Lc=p("ZodCIDRv6",(e,t)=>{qn.init(e,t),z.init(e,t)});var Fc=p("ZodBase64",(e,t)=>{Xn.init(e,t),z.init(e,t)});var Mc=p("ZodBase64URL",(e,t)=>{Hn.init(e,t),z.init(e,t)});var Uc=p("ZodE164",(e,t)=>{Yn.init(e,t),z.init(e,t)});var Jc=p("ZodJWT",(e,t)=>{Qn.init(e,t),z.init(e,t)});var Bc=p("ZodUnknown",(e,t)=>{eo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o)});function ee(){return ti(Bc)}var Vc=p("ZodNever",(e,t)=>{to.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o)});function Kc(e){return ri(Vc,e)}var Wc=p("ZodArray",(e,t)=>{We(),ro.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ne(e,t))},nonempty(e){return this.check(ne(1,e))},max(e,t){return this.check(Ue(e,t))},length(e,t){return this.check(Je(e,t))},unwrap(){return this.element}});function qc(e,t){return ni(Wc,e,t)}var Gc=p("ZodObject",(e,t)=>{We(),io.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),ws(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Qc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A(this._zod.def,{catchall:ee()}))},loose(){return this.clone(A(this._zod.def,{catchall:ee()}))},strict(){return this.clone(A(this._zod.def,{catchall:Kc()}))},strip(){return this.clone(A(this._zod.def,{catchall:void 0}))},extend(e){return gs(this,e)},safeExtend(e){return _s(this,e)},merge(e){return xs(this,e)},pick(e){return ms(this,e)},omit(e){return hs(this,e)},partial(...e){return lr(os,this,e[0])},exactPartial(...e){return lr(is,this,e[0],"exactPartial")},required(...e){return ys(ss,this,e[0])}});function qe(e,t){let r={type:"object",shape:e??{},...g(t)};return new Gc(r)}var Xc=p("ZodUnion",(e,t)=>{so.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.options=t.options});function Kt(e,t){return new Xc({type:"union",options:e,...g(t)})}var Hc=p("ZodIntersection",(e,t)=>{co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o)});function Yc(e,t){return new Hc({type:"intersection",left:e,right:t})}var Qi=p("ZodRecord",(e,t)=>{We(),uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ei(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ce(e,t,r){if(!t||!t._zod)return new Qi({type:"record",keyType:D(),valueType:e,...g(t)});return new Qi({type:"record",keyType:e,valueType:t,...g(r)})}var Vt=p("ZodEnum",(e,t)=>{ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>wi(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...g(o),entries:i})}});function Qc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Vt({type:"enum",entries:r,...g(t)})}var eu=p("ZodTransform",(e,t)=>{We(),lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new me(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(H(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(H(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function tu(e){return new eu({type:"transform",transform:e})}var os=p("ZodOptional",(e,t)=>{vt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function es(e){return new os({type:"optional",innerType:e})}var is=p("ZodExactOptional",(e,t)=>{po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ru(e){return new is({type:"optional",innerType:e})}var nu=p("ZodNullable",(e,t)=>{fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ts(e){return new nu({type:"nullable",innerType:e})}var ou=p("ZodDefault",(e,t)=>{mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function iu(e,t){return new ou({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():rt(t)}})}var su=p("ZodPrefault",(e,t)=>{ho.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ji(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cu(e,t){return new su({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():rt(t)}})}var ss=p("ZodNonOptional",(e,t)=>{go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uu(e,t){return new ss({type:"nonoptional",innerType:e,...g(t)})}var au=p("ZodCatch",(e,t)=>{_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lu(e,t){return new au({type:"catch",innerType:e,catchValue:typeof t==="function"?t:mr(t)})}var pu=p("ZodPipe",(e,t)=>{xo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Di(e,r,n,o),e.in=t.in,e.out=t.out});function rs(e,t){return new pu({type:"pipe",in:e,out:t})}var fu=p("ZodReadonly",(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Li(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function du(e){return new fu({type:"readonly",innerType:e})}var mu=p("ZodCustom",(e,t)=>{bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o)});function hu(e,t={}){return oi(mu,e,t)}function gu(e,t){return ii(e,t)}var Ge=ce(D(),ee()).nullish();var Xe=ce(D(),D().nullish()).nullish();var Wt=qe({path:D().trim().nonempty(),component:D().trim().nonempty()});var He=Kt([ce(D(),ee()),ee().array()]).nullish();var _u=qe({metadata:Xe,data:Ge,staticData:He});class qt{window;#n;#e=new Map;#t=new Map;#r=new Map;constructor(e){this.window=e;this.#o(),this.#c(),this.#i(),this.#s()}#o(){let e=this.window.document.body.querySelector(`script#${te.routes}[type="application/json"]`);if(!e)return;try{let t=e.textContent.trim(),r=JSON.parse(t);if(!Array.isArray(r))return;this.#n=r.map((n)=>{let o=Wt.safeParse(n);return!o.success?null:o.data}).filter((n)=>!!n)}catch(t){console.error("Error on parse routes:",t);return}}#i(){let e=this.window.document.body.querySelector(`script#${te.staticData}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=He.safeParse(o);if(!i.success)return;this.#e.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse static data:",t);return}}#s(){let e=this.window.document.body.querySelector(`script#${te.data}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=Ge.safeParse(o);if(!i.success)return;this.#t.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse data:",t);return}}#c(){let e=this.window.document.body.querySelector(`script#${te.metadata}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=Xe.safeParse(o);if(!i.success)return;this.#r.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse metadata:",t);return}}async fetchRoute({origin:e,search:t,pathname:r,cache:n}={pathname:this.window.location.pathname,search:this.window.location.search,origin:this.window.location.origin,cache:!1}){let o=`${r}${t}`;if(n&&this.#t.has(o)&&this.#r.has(o)&&this.#e.has(o))return;try{let i=new Headers;i.append("X-Requested-With","XMLHttpRequest"),i.append("Content-Type","application/json");let s=await fetch(`${e}${o}`,{method:"GET",headers:i});if(!s.ok)throw Error(`Can not fetch data [${o}]`);let c=await s.json(),u=_u.safeParse(c);if(!u.success)throw u.error;this.#t.set(o,u.data.data),this.#r.set(o,u.data.metadata),this.#e.set(o,u.data.staticData)}catch(i){console.error("Error on fetch full route data:",i);return}}get routes(){return this.#n}get staticData(){let{pathname:e,search:t}=this.window.location;return this.#e.get(`${e}${t}`)}get data(){let{pathname:e,search:t}=this.window.location;return this.#t.get(`${e}${t}`)}get metadata(){let{pathname:e,search:t}=this.window.location;return this.#r.get(`${e}${t}`)}}export{cs as Vanilla};
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function li(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;li(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var pi=new Set(["type","properties","required","additionalProperties"]),ui=["oneOf","anyOf"];function ai(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Rt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!pi.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ai(a);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:Rt(c)??{allOf:c};j(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ai(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function nc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of pi)if(o in e)return;let r=t.filter((o)=>ui.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Rt(t);else{let o=r[0],i=ui.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>Rt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ye(e,n)}function Ft(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},f=u.ref;if(u.ref=null,f){n(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(h);else ye(a,h);if(ye(a,l),c._zod.parent===f)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(!(x in l))delete a[x]}if(h.$ref&&m.def)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(x in m.def&&JSON.stringify(a[x])===JSON.stringify(m.def[x]))delete a[x]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())li(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])nc(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}ye(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;j(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:be(t,"input",e.processors),output:be(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function O(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return O(n.element,r);if(n.type==="set")return O(n.valueType,r);if(n.type==="lazy")return O(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return O(n.innerType,r);if(n.type==="intersection")return O(n.left,r)||O(n.right,r);if(n.type==="record"||n.type==="map")return O(n.keyType,r)||O(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return O(n.in,r)||O(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(O(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(O(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(O(o,r))return!0;if(n.rest&&O(n.rest,r))return!0;return!1}return!1}var fi=(e,t={})=>(r)=>{let n=Dt({...r,processors:t});return Z(e,n),Lt(n,e),Ft(n,e)},be=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Dt({...o??{},target:i,io:t,processors:r});return Z(e,s),Lt(s,e),Ft(s,e)};var ie=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},se=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},di=(e,t)=>{ie(e,"minimum",t),se(e,"maximum",t)},_i=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},xi=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},yi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},bi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},mi=(e,t)=>ie(e,"minimum",t.minimum),hi=(e,t)=>se(e,"maximum",t.maximum),gi=(e)=>(t,r)=>{bi(t,r.format);let[n,o]=e[r.format];ie(t,"minimum",n),se(t,"maximum",o)},oc={greater_than:(e,t)=>ie(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>se(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>_i(e,t.value),number_format:gi(it),bigint_format:gi(st),min_length:mi,max_length:hi,length_equals:(e,t)=>di(e,t.length),min_size:mi,max_size:hi,size_equals:(e,t)=>di(e,t.size),string_format:(e,t)=>{if(bi(e,t.format),t.pattern)xi(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)=>yi(e,t.mime)};function Q(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)oc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ie(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ie(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)se(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)se(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)_i(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)yi(t,o.mime);for(let i of o.patterns??[])xi(t,i);return t}var ic={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sc=new Map([[vt,Wr],[Fe,qr]]),vi=(e)=>sc.get(e)??e,$i=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=Q(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=ic[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(vi);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}};var zi=(e,t,r,n)=>{r.not={}};var wi=(e,t,r,n)=>{};var ki=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i};var Zi=(e,t,r,n)=>{oe(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Pi=(e,t,r,n)=>{oe(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Si=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=Q(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=Z(i.element,t,{...n,path:[...n.path,"items"]})};function We(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return We(t.out);if(t.type==="catch")return We(t.innerType);return e._zod.optin}var Oi=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oe(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)j(o.properties,l,Z(s[l],t,{...n,path:[...n.path,"properties",l]}));let u=new Set(Object.keys(s)),a=new Set([...u].filter((l)=>{let f=i.shape[l];if(t.io==="input")return We(f)===void 0;else return f._zod.optout===void 0}));if(a.size>0)o.required=Array.from(a);if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=Z(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})};var Ii=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>Z(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},Ei=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=Z(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};function Mt(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let _=Mt(e,h,r);return _===h?t:_}for(let h of["anyOf","oneOf"]){let _=t[h];if(!Array.isArray(_))continue;let x=_.map((w)=>Mt(e,w,r));if(x.some((w,C)=>w!==_[C]))t={...t,[h]:x}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:f,id:d,...m}=t;if(m.enum)m.enum=m.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof m.const==="number")m.const=String(m.const);if(!o)return m;if(m.type="string",!i)m.pattern=(n.includes("number")?je:gt).source;return m}var Ut=new WeakMap;function cc(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Ut.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Mt(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var Ai=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=Q(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=Z(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)j(o.patternProperties,vi(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Z(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Ut.get(t);if(!l)l=[],Ut.set(t,l),t.deferred.push(()=>cc(t));l.push(e)}o.additionalProperties=Z(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&We(i.valueType)!==void 0;if(u&&!i.partial&&!a){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},Ti=(e,t,r,n)=>{let o=e._zod.def,i=Z(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Ni=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Jt=Symbol();function Ci(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return oe(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Jt}var ji=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Ci(o.defaultValue,e,t,r,n);if(s!==Jt)r.default=s},Ri=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ci(o.defaultValue,e,t,r,n);if(s!==Jt)r._prefault=s},Di=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{oe(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Li=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Z(s,t,n);let c=t.seen.get(e);c.ref=s},Fi=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Bt=(e,t,r,n)=>{let o=e._zod.def;Z(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Mi=new WeakSet([Object.prototype,Error.prototype]);function qe(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var yc=(e,t)=>{br.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Mi.has(r))return;Mi.add(r),qe(r,"format",(n)=>(o)=>$r(n,o)),qe(r,"flatten",(n)=>(o)=>vr(n,o)),qe(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,de,2)}),qe(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,de,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var N=p("ZodError",yc,void 0,{Parent:Error});var Ui=Ae(N),Ji=Te(N),Bi=Ne(N),Vi=Ce(N),Ki=wr(N),Wi=kr(N),qi=Zr(N),Gi=Pr(N),Xi=Sr(N),Hi=Or(N),Yi=Ir(N),Qi=Er(N);function vc(){if(!I.localeError)T(kt())}function Xe(){if(!I.memoizer)T({memoizer:Zo()})}var P=p("ZodType",(e,t)=>(vc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gu(e,t))},superRefine(e,t){return this.check(_u(e,t))},overwrite(e){return this.check(q(e))},optional(){return ts(this)},exactOptional(){return nu(this)},nullable(){return rs(this)},nullish(){return ts(rs(this))},nonoptional(e){return au(this,e)},array(){return Gc(this)},or(e){return Wt([this,e])},and(e){return Qc(this,e)},transform(e){return ns(this,ru(e))},default(e){return su(this,e)},prefault(e){return uu(this,e)},catch(e){return pu(this,e)},pipe(e){return ns(this,e)},readonly(){return mu(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ut(this,"~standard",{...bt(this),jsonSchema:{input:be(this,"input"),output:be(this,"output")}})},set "~standard"(e){V(this,"~standard",e)},parse:function e(t,r){return Ui(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ji(this,t,r,{callee:e})},safeParse(e,t){return Bi(this,e,t)},async safeParseAsync(e,t){return Vi(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ft(this,e,t)},validateAsync(e,t){return dt(this,e,t)},encode:function e(t,r){return Ki(this,t,r,{callee:e})},decode:function e(t,r){return Wi(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await qi(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Gi(this,t,r,{callee:e})},safeEncode(e,t){return Xi(this,e,t)},safeDecode(e,t){return Hi(this,e,t)},async safeEncodeAsync(e,t){return Yi(this,e,t)},async safeDecodeAsync(e,t){return Qi(this,e,t)},toJSONSchema(e){return fi(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),os=p("_ZodString",(e,t)=>{Le.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o)},$s({format:(e)=>Q(e).format??null,minLength:(e)=>Q(e).minimum??null,maxLength:(e)=>Q(e).maximum??null},{regex(...e){return this.check(Zt(...e))},includes(...e){return this.check(Ot(...e))},startsWith(...e){return this.check(It(...e))},endsWith(...e){return this.check(Et(...e))},min(...e){return this.check(ne(...e))},max(...e){return this.check(Ve(...e))},length(...e){return this.check(Ke(...e))},nonempty(...e){return this.check(ne(1,...e))},lowercase(e){return this.check(Pt(e))},uppercase(e){return this.check(St(e))},trim(){return this.check(Tt())},normalize(...e){return this.check(At(...e))},toLowerCase(){return this.check(Nt())},toUpperCase(){return this.check(Ct())},slugify(){return this.check(jt())}})),$c=p("ZodString",(e,t)=>{Le.init(e,t),os.init(e,t)},{email(e){return this.check(Io(Pc,e))},url(e){return this.check(jo(Oc,e))},jwt(e){return this.check(Ho(Bc,e))},emoji(e){return this.check(Ro(Ic,e))},guid(e){return this.check(Eo(Sc,e))},uuid(e){return this.check(Ao(Ge,e))},uuidv4(e){return this.check(To(Ge,e))},uuidv6(e){return this.check(No(Ge,e))},uuidv7(e){return this.check(Co(Ge,e))},nanoid(e){return this.check(Do(Ec,e))},cuid(e){return this.check(Lo(Ac,e))},cuid2(e){return this.check(Fo(Tc,e))},ulid(e){return this.check(Mo(Nc,e))},base64(e){return this.check(qo(Mc,e))},base64url(e){return this.check(Go(Uc,e))},xid(e){return this.check(Uo(Cc,e))},ksuid(e){return this.check(Jo(jc,e))},ipv4(e){return this.check(Bo(Rc,e))},ipv6(e){return this.check(Vo(Dc,e))},cidrv4(e){return this.check(Ko(Lc,e))},cidrv6(e){return this.check(Wo(Fc,e))},e164(e){return this.check(Xo(Jc,e))},datetime(e){return this.check(Yo(zc,e))},date(e){return this.check(Qo(wc,e))},time(e){return this.check(ei(kc,e))},duration(e){return this.check(ti(Zc,e))}});function D(e){return Oo($c,e)}var z=p("ZodStringFormat",(e,t)=>{v.init(e,t),os.init(e,t)}),zc=p("ZodISODateTime",(e,t)=>{Mn.init(e,t),z.init(e,t)}),wc=p("ZodISODate",(e,t)=>{Un.init(e,t),z.init(e,t)}),kc=p("ZodISOTime",(e,t)=>{Jn.init(e,t),z.init(e,t)}),Zc=p("ZodISODuration",(e,t)=>{Bn.init(e,t),z.init(e,t)}),Pc=p("ZodEmail",(e,t)=>{In.init(e,t),z.init(e,t)});var Sc=p("ZodGUID",(e,t)=>{Sn.init(e,t),z.init(e,t)});var Ge=p("ZodUUID",(e,t)=>{On.init(e,t),z.init(e,t)});var Oc=p("ZodURL",(e,t)=>{Tn.init(e,t),z.init(e,t)});var Ic=p("ZodEmoji",(e,t)=>{Nn.init(e,t),z.init(e,t)});var Ec=p("ZodNanoID",(e,t)=>{Cn.init(e,t),z.init(e,t)});var Ac=p("ZodCUID",(e,t)=>{jn.init(e,t),z.init(e,t)});var Tc=p("ZodCUID2",(e,t)=>{Rn.init(e,t),z.init(e,t)});var Nc=p("ZodULID",(e,t)=>{Dn.init(e,t),z.init(e,t)});var Cc=p("ZodXID",(e,t)=>{Ln.init(e,t),z.init(e,t)});var jc=p("ZodKSUID",(e,t)=>{Fn.init(e,t),z.init(e,t)});var Rc=p("ZodIPv4",(e,t)=>{Vn.init(e,t),z.init(e,t)});var Dc=p("ZodIPv6",(e,t)=>{Wn.init(e,t),z.init(e,t)});var Lc=p("ZodCIDRv4",(e,t)=>{qn.init(e,t),z.init(e,t)});var Fc=p("ZodCIDRv6",(e,t)=>{Gn.init(e,t),z.init(e,t)});var Mc=p("ZodBase64",(e,t)=>{Hn.init(e,t),z.init(e,t)});var Uc=p("ZodBase64URL",(e,t)=>{Yn.init(e,t),z.init(e,t)});var Jc=p("ZodE164",(e,t)=>{Qn.init(e,t),z.init(e,t)});var Bc=p("ZodJWT",(e,t)=>{eo.init(e,t),z.init(e,t)});var Vc=p("ZodUnknown",(e,t)=>{to.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o)});function ee(){return ri(Vc)}var Kc=p("ZodNever",(e,t)=>{ro.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o)});function Wc(e){return ni(Kc,e)}var qc=p("ZodArray",(e,t)=>{Xe(),no.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ne(e,t))},nonempty(e){return this.check(ne(1,e))},max(e,t){return this.check(Ve(e,t))},length(e,t){return this.check(Ke(e,t))},unwrap(){return this.element}});function Gc(e,t){return oi(qc,e,t)}var Xc=p("ZodObject",(e,t)=>{Xe(),so.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),ks(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return eu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A(this._zod.def,{catchall:ee()}))},loose(){return this.clone(A(this._zod.def,{catchall:ee()}))},strict(){return this.clone(A(this._zod.def,{catchall:Wc()}))},strip(){return this.clone(A(this._zod.def,{catchall:void 0}))},extend(e){return _s(this,e)},safeExtend(e){return xs(this,e)},merge(e){return ys(this,e)},pick(e){return hs(this,e)},omit(e){return gs(this,e)},partial(...e){return pr(is,this,e[0])},exactPartial(...e){return pr(ss,this,e[0],"exactPartial")},required(...e){return bs(cs,this,e[0])}});function He(e,t){let r={type:"object",shape:e??{},...g(t)};return new Xc(r)}var Hc=p("ZodUnion",(e,t)=>{co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.options=t.options});function Wt(e,t){return new Hc({type:"union",options:e,...g(t)})}var Yc=p("ZodIntersection",(e,t)=>{uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ei(e,r,n,o)});function Qc(e,t){return new Yc({type:"intersection",left:e,right:t})}var es=p("ZodRecord",(e,t)=>{Xe(),ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ce(e,t,r){if(!t||!t._zod)return new es({type:"record",keyType:D(),valueType:e,...g(t)});return new es({type:"record",keyType:e,valueType:t,...g(r)})}var Kt=p("ZodEnum",(e,t)=>{lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ki(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Kt({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Kt({...t,checks:[],...g(o),entries:i})}});function eu(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Kt({type:"enum",entries:r,...g(t)})}var tu=p("ZodTransform",(e,t)=>{Xe(),po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new me(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(H(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(H(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function ru(e){return new tu({type:"transform",transform:e})}var is=p("ZodOptional",(e,t)=>{$t.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ts(e){return new is({type:"optional",innerType:e})}var ss=p("ZodExactOptional",(e,t)=>{fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nu(e){return new ss({type:"optional",innerType:e})}var ou=p("ZodNullable",(e,t)=>{mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rs(e){return new ou({type:"nullable",innerType:e})}var iu=p("ZodDefault",(e,t)=>{ho.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ji(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function su(e,t){return new iu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():nt(t)}})}var cu=p("ZodPrefault",(e,t)=>{go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uu(e,t){return new cu({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():nt(t)}})}var cs=p("ZodNonOptional",(e,t)=>{_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function au(e,t){return new cs({type:"nonoptional",innerType:e,...g(t)})}var lu=p("ZodCatch",(e,t)=>{xo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Di(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pu(e,t){return new lu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:hr(t)})}var fu=p("ZodPipe",(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Li(e,r,n,o),e.in=t.in,e.out=t.out});function ns(e,t){return new fu({type:"pipe",in:e,out:t})}var du=p("ZodReadonly",(e,t)=>{bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mu(e){return new du({type:"readonly",innerType:e})}var hu=p("ZodCustom",(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o)});function gu(e,t={}){return ii(hu,e,t)}function _u(e,t){return si(e,t)}var ve=ce(D(),ee()).nullish();var $e=ce(D(),D().nullish()).nullish();var ze=Wt([ce(D(),ee()),ee().array()]).nullish();var qt=He({metadata:$e,data:ve,staticData:ze});var Gt=He({path:D().trim().nonempty(),component:D().trim().nonempty()});class Xt{window;#n;#e=new Map;#t=new Map;#r=new Map;constructor(e){this.window=e;this.#o(),this.#c(),this.#i(),this.#s()}#o(){let e=this.window.document.body.querySelector(`script#${te.routes}[type="application/json"]`);if(!e)return;try{let t=e.textContent.trim(),r=JSON.parse(t);if(!Array.isArray(r))return;this.#n=r.map((n)=>{let o=Gt.safeParse(n);return!o.success?null:o.data}).filter((n)=>!!n)}catch(t){console.error("Error on parse routes:",t);return}}#i(){let e=this.window.document.body.querySelector(`script#${te.staticData}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=ze.safeParse(o);if(!i.success)return;this.#e.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse static data:",t);return}}#s(){let e=this.window.document.body.querySelector(`script#${te.data}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=ve.safeParse(o);if(!i.success)return;this.#t.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse data:",t);return}}#c(){let e=this.window.document.body.querySelector(`script#${te.metadata}[type="application/json"]`);if(!e)return;try{let{pathname:t,search:r}=this.window.location,n=e.textContent.trim(),o=JSON.parse(n),i=$e.safeParse(o);if(!i.success)return;this.#r.set(`${t}${r}`,i.data)}catch(t){console.error("Error on parse metadata:",t);return}}async fetchRoute({cache:e,...t}={pathname:this.window.location.pathname,search:this.window.location.search,origin:this.window.location.origin,cache:!1}){let r="url"in t?`${t.url.pathname}${t.url.search}`:`${t.pathname}${t.search}`;if(e){let n=this.#t.get(r),o=this.#r.get(r),i=this.#e.get(r);if(n&&o&&i)return Object.freeze({data:n,metadata:o,staticData:i})}try{let n=new Headers;n.append("X-Requested-With","XMLHttpRequest"),n.append("Content-Type","application/json");let o=await fetch(`${origin}${r}`,{method:"GET",headers:n});if(!o.ok)throw Error(`Can not fetch data [${r}]`);let i=await o.json(),s=qt.safeParse(i);if(!s.success)throw s.error;return this.#t.set(r,s.data.data),this.#r.set(r,s.data.metadata),this.#e.set(r,s.data.staticData),Object.freeze(s.data)}catch(n){console.error("Error on fetch full route data:",n);return}}get routes(){return this.#n}get staticData(){let{pathname:e,search:t}=this.window.location;return this.#e.get(`${e}${t}`)}get data(){let{pathname:e,search:t}=this.window.location;return this.#t.get(`${e}${t}`)}get metadata(){let{pathname:e,search:t}=this.window.location;return this.#r.get(`${e}${t}`)}}export{us as Vanilla};
|
|
64
59
|
|
|
65
|
-
//# debugId=
|
|
60
|
+
//# debugId=5465A388CB7CE8BF64756E2164756E21
|