game-dev-cli-darwin-arm64 0.25.10 → 0.25.11
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/bin/ai-game-dev +2 -2
- package/package.json +3 -3
- package/runtime/app/daemon/coordinator.cjs +455 -0
- package/runtime/app/daemon/daemon-engine-worker.cjs +385 -0
- package/runtime/app/daemon/daemon-entry.cjs +1819 -0
- package/runtime/app/daemon/daemon-extension-host.cjs +64 -0
- package/runtime/app/daemon/daemon-git-action-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-git-blob-worker.cjs +60 -0
- package/runtime/app/daemon/daemon-git-read-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-git-status-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-project-create-worker.cjs +669 -0
- package/runtime/app/daemon/daemon-replacement-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-search-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-token.cjs +1213 -0
- package/runtime/manifest.json +1 -0
- package/runtime/runtime.json +9 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __aigdRuntimeUrl=require("node:url").pathToFileURL(__filename).href;
|
|
2
|
+
var re=require("node:worker_threads");function de(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 ft(e,t="|"){return e.map((r)=>ht(r)).join(t)}function me(e,t){if(typeof t==="bigint")return t.toString();return t}class lr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function he(e){return new lr(e)}function pr(e){return e===null||e===void 0}function Ie(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function fr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function j(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ge(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function V(e){return ge(e._zod.def)??e._zod.def.shape}function dr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return j(this,t,n),n},enumerable:!0,configurable:!0})}function mr(e,t,r){if(t in e)j(e,t,r);else e[t]=r}function Q(e,t,r,n){let o=V(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)dr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else mr(e,i,n?n(s.value,i):s.value)}}function Gs(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)dr(e,r,()=>t[r]);else mr(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 hr(e){return JSON.stringify(e)}function gr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var dt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ne(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var _r=he(()=>{if(E.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function oe(e){if(ne(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(ne(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function mt(e){if(oe(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 xr=new Set(["string","number","symbol"]);function X(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(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 ht(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function yr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ee=(()=>({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]}))(),gt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Xs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Q(i,e,Ae(e,t)),U(e,A(r,{shape:i,checks:[]}))}function Ae(e,t){let r=V(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 qs(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(Ae(e,t)),s={};return Q(s,e,Reflect.ownKeys(V(e)).filter((c)=>!i.has(c))),U(e,A(r,{shape:s,checks:[]}))}function Ys(e,t){if(!oe(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=V(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 U(e,A(e._zod.def,{shape:vr(e,t)}))}function vr(e,t){let r={};return Q(r,e,Reflect.ownKeys(V(e))),Gs(r,t),r}function Hs(e,t){if(!oe(t))throw Error("Invalid input to safeExtend: expected a plain object");return U(e,A(e._zod.def,{shape:vr(e,t)}))}function Qs(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Q(r,e,Reflect.ownKeys(V(e))),Q(r,t,Reflect.ownKeys(V(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return U(e,n)}function br(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(Ae(t,r)):void 0,u={};return Q(u,t,Reflect.ownKeys(V(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),U(t,A(t._zod.def,{shape:u,checks:[]}))}function ec(e,t,r){let n=r?new Set(Ae(t,r)):void 0,o={};return Q(o,t,Reflect.ownKeys(V(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),U(t,A(t._zod.def,{shape:o}))}function R(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function zr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ie(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function fe(e){return typeof e==="string"?e:e?.message}function _t(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Te(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function q(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:fe(e.inst?._zod.def?.error?.(e))??fe(i?.(e))??fe(t?.error?.(e))??fe(r.customError?.(e))??fe(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 tc=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!tc.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 Ce(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function $r(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 ee(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function wr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else rc(e,r,n.value)}}function K(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Re(e,t,r){return K(e,t,r,!1)}function kr(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return K(this,r,n(this))},set(o){K(this,r,o)}})}return t}function rc(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:K(this,t,r.bind(this))},set(n){K(this,t,n)}})}function nc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var pt,G=!1,oc={configurable:!0,get(){G=!0;return}};function y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&pt!==e._zod){pt=void 0;return}pt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,oc);let o=G;G=!1;try{let i=r(this);if(G)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return G=G||o,i}catch(i){throw delete this[t],G=G||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ic(e,t,r,n){let o=nc(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 sc="~constantCatch";function Zr(e){let t=()=>e;return t[sc]=!0,t}var Pr;var xt={value:void 0,enumerable:!1},Sr="captureStackTrace"in Error?Error:null;function cc(e){let t=Sr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Sr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(f){this.def=f,this.constr=d,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(f,m){if(!f._zod){xt.value=new i(m);try{Object.defineProperty(f,"_zod",xt)}finally{xt.value=void 0}}else if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,m),c){let _=Object.getPrototypeOf(f),x=f._zod.constr.prototype,v=_;while(v&&v!==x)v=Object.getPrototypeOf(v);let C=v??_;if(!c.has(C))c.add(C),wr(C,s)}let h=d.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in f))f[_]=h[_].bind(f)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function d(f){let m=n?.Parent?cc(l):this;u(m,f);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(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:(f)=>{if(n?.Parent&&f instanceof n.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class B extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _e extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Pr=globalThis).__zod_globalConfig??(Pr.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function M(e){if(e)Object.assign(E,e);return E}function uc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,me,2)),e.message}function ac(e){this._zod.message=e}var lc={get:uc,set:ac,enumerable:!0,configurable:!0},vt={value:void 0,enumerable:!1},Or=new WeakSet([Object.prototype,Error.prototype]),Ir=(e,t)=>{e.name="$ZodError",vt.value=t,Object.defineProperty(e,"issues",vt),vt.value=void 0,Object.defineProperty(e,"message",lc);let r=Object.getPrototypeOf(e);if(!Or.has(r))Or.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})}})},Er=p("$ZodError",Ir),pa=p("$ZodError",Ir,void 0,{Parent:Error});function pc(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 Ar(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)pc(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Tr(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],d=a===c.length-1;if(l==="_errors"){if(d)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 f=u[l];if(d)f._errors.push(t(s));u=f,a++}}}};return n(e),r}function De(e,t){return{callee:t?.callee??e,Err:t?.Err}}var je=(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 B;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>q(a,s,M())));throw dt(u,i?.callee??t),u}return c.value};return t};var Le=(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)=>q(a,s,M())));throw dt(u,i?.callee??t),u}return c.value};return t};var Me=(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 B;return i.issues.length?Nr(e,i.issues,o):{success:!0,data:i.value}};function Nr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>q(o,r,M()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Fe=(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?Nr(e,i.issues,o):{success:!0,data:i.value}};var fc=Symbol.for("zod.compile.invalid"),dc=Symbol.for("zod.compile.fallback"),bt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==fc)return!0;if(n.definite===!0&&r===void 0)return!1}return mc(e,t,r)};function mc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[dc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new B;return i.issues.length===0}var zt=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},Cr=(e)=>{let t=je(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,De(r,s))};return r};var Rr=(e)=>{let t=je(e),r=(n,o,i,s)=>t(n,o,i,De(r,s));return r};var Dr=(e)=>{let t=Le(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,De(r,s))};return r};var jr=(e)=>{let t=Le(e),r=async(n,o,i,s)=>await t(n,o,i,De(r,s));return r};var Lr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var Mr=(e)=>(t,r,n)=>Me(e)(t,r,n);var Fr=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Fe(e)(t,r,o)};var Ur=(e)=>async(t,r,n)=>Fe(e)(t,r,n);var Br=/^[cC][0-9a-z]{6,}$/,Jr=/^[0-9a-z]+$/,Vr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Kr=/^[0-9a-vA-V]{20}$/,Wr=/^[A-Za-z0-9]{27}$/,Gr=/^[a-zA-Z0-9_-]{21}$/;function Xr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var qr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Yr=/^([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})$/,wt=(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 Hr=/^(?:[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 hc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Qr(){return new RegExp(hc,"u")}var en=/^(?:(?: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])$/,tn=/^(([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 rn=/^((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])$/,nn=/^(([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])$/,on=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var cn=/^https?$/,un=/^\+[1-9]\d{6,14}$/;var an="(?:(?:\\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 gc(e){return new RegExp(`^${e}$`)}var ln=gc(an);function $t(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function pn(e){return new RegExp(`^${$t(e)}$`)}function fn(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${$t({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${$t({precision:e.precision})}`:r;return new RegExp(`^${an}T(?:${n})$`)}var dn=/^[\s\S]{0,}$/;var kt=/^-?\d+(?:\.\d+)?$/,mn=/^(?:true|false)$/i;var hn=/^[^A-Z]*$/,gn=/^[^a-z]*$/;var O=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Zt=(e)=>{let t=e.value;return!pr(t)&&t.length!==void 0},Ue={number:"number",bigint:"bigint",object:"date"},Pt=p("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=Ue[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ue[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),St=p("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=Ue[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ue[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_n=p("$ZodCheckMultipleOf",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):fr(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),xn=p("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ee[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var yn=p("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Zt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ne(o):i)<=t.maximum)return;let c=Ce(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),vn=p("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Zt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ne(o):i)>=t.minimum)return;let c=Ce(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),bn=p("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Zt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ne(o):i;if(s===t.length)return;let c=Ce(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})}}),ye=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),zn=p("$ZodCheckRegex",(e,t)=>{ye.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})}}),$n=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hn),ye.init(e,t)}),wn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gn),ye.init(e,t)}),kn=p("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=X(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})}}),Zn=p("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${X(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})}}),Pn=p("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${X(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 Sn=p("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Ot{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
|
+
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
|
+
${t.join(`
|
|
5
|
+
`)}
|
|
6
|
+
};`)(...Object.values(this.closed))}}var In={major:4,minor:6,patch:7};var z=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=In;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=R(c),d;for(let f of u){if(f._zod.def.when){if(zr(c))continue;if(!f._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,h=f._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new B;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Te(c.issues,m,e),!l)l=R(c,m)});else{if(c.issues.length===m)continue;if(Te(c.issues,m,e),!l)l=R(c,m)}}if(d)return d.then(()=>c);return c},s=(c,u,a)=>{if(R(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new B;return l.then((d)=>e._zod.parse(d,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((d)=>s(d,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new B;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return Re(this,"~standard",Et(this))},set "~standard"(e){K(this,"~standard",e)}}),Jn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>q(r,t,M()))}:{value:e.value};async function xc(e,t){let r={async:!0};return Jn(await e._zod.run({value:t,issues:[]},r),r)}function Et(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Jn(n,r)}catch(n){}return xc(e,t)},vendor:"zod",version:1}}var Ke=p("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??dn,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}}),w=p("$ZodStringFormat",(e,t)=>{ye.init(e,t),Ke.init(e,t)}),Vn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Yr),w.init(e,t)}),Kn=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=wt(n))}else t.pattern??(t.pattern=wt());w.init(e,t)}),Wn=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hr),w.init(e,t)}),Gn=1,Je=2;function Xn(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function yc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Xn(e)||Je;return vc(e,t)}function vc(e,t){if(!t.normalize&&t.protocol?.source===cn.source&&!/^https?:\/\//i.test(e))return Gn;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Je}return new URL(e)}catch{return Je}}var bc=/[\t\n\r]/g;function En(e){return e.replace(bc,"")}function zc(e,t){return t.lastIndex=0,t.test(e.hostname)}function $c(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var qn=p("$ZodURL",(e,t)=>{w.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=yc(n,t);if(o===Gn){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Je){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=En(n);return}if(t.hostname&&!zc(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&&!$c(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:En(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Yn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qr()),w.init(e,t)}),Hn=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?Gr:Xr(t.length)),w.init(e,t)}),Qn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Br),w.init(e,t)}),eo=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jr),w.init(e,t)}),to=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Vr),w.init(e,t)}),ro=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Kr),w.init(e,t)}),no=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wr),w.init(e,t)}),oo=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=fn(t)),w.init(e,t)}),io=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ln),w.init(e,t)}),so=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pn(t)),w.init(e,t)}),co=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=qr),w.init(e,t)}),uo=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=en),w.init(e,t)}),wc=/^[0-9a-fA-F:.]+$/;function ao(e){if(!wc.test(e))return!1;return Xn(`http://[${e}]`)}var lo=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tn),w.init(e,t),e._zod.check=(r)=>{if(!ao(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var po=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rn),w.init(e,t)});function kc(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 ao(r)}var fo=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=nn),w.init(e,t),e._zod.check=(r)=>{if(!kc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function mo(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 At=/^[0-9a-zA-Z+/]*={0,2}$/,ho=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=At),w.init(e,t),e._zod.check=(r)=>{if(mo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),We=/^[A-Za-z0-9_-]*$/;function Zc(e){if(!We.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return mo(r)}var go=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=We),w.init(e,t),e._zod.check=(r)=>{if(Zc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_o=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=un),w.init(e,t)});function Pc(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 xo=p("$ZodJWT",(e,t)=>{w.init(e,t),e._zod.check=(r)=>{if(Pc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Tt=p("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=kt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),yo=p("$ZodNumberFormat",(e,t)=>{xn.init(e,t),Tt.init(e,t)}),vo=p("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=mn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var bo=p("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(r)=>r}),zo=p("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Sc(e,t){let r=_t(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of _t(e._zod.def.checks))if(c>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,Te(i.issues,l,e),i}}return o(i,s)}}var Oc=(e)=>Array.isArray(e)?e.length:-1;function An(e,t,r){if(e.issues.length)t.issues.push(...ie(r,e.issues));t.value[r]=e.value}var $o=p("$ZodArray",(e,t)=>{z.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>An(d,n,u)));else if(An(l,n,u),c&&l.issues.length!==0&&R(l))break}if(s.length)return Promise.all(s).then(()=>n);return n},Sc(e,Oc)});function Ve(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(...ie(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 Ic=[];function wo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ic,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=yr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ko(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:d,optout:f}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(R(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)=>Ve(x,r,h,t,d,f)));else Ve(_,r,h,t,d,f)}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 Ec=p("$ZodObject",(e,t)=>{z.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=he(()=>wo(t));y(e,"propValues",(a)=>{let l=a.def.shape,d={};for(let f in l){let m=l[f]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(d,f))j(d,f,new Set);for(let h of m.values)d[f].add(h);if(m.optin!==void 0)d[f].add(void 0)}}return d});let i=ne,s=t.catchall,c,u=E.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let d=a.value;if(!i(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let f=[],m=c.shape,h=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(h&&a.issues.length!==_){if(R(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let v=m[x],C=v._zod.optin,le=v._zod.optout,pe=v._zod.run({value:d[x],issues:[]},l);if(pe instanceof Promise)f.push(pe.then((S)=>Ve(S,a,x,d,C,le)));else Ve(pe,a,x,d,C,le)}if(!s)return f.length?Promise.all(f).then(()=>a):a;return ko(f,d,a,l,o.value,e,h===!0)}}),Zo=p("$ZodObjectJIT",(e,t)=>{Ec.init(e,t);let r=e._zod.parse,n=he(()=>wo(t)),o=E.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,x=new Ot(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),v=(S)=>`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`,C=(S,b)=>`
|
|
7
|
+
let ${S}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${S}.issues.length; i++) {
|
|
9
|
+
const iss = ${S}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${b}, ...iss.path] : [${b}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
if (iss.continue !== true) ${S}_ab = true;
|
|
13
|
+
}
|
|
14
|
+
if (${S}_ab && ctx && ctx.abortEarly) {
|
|
15
|
+
payload.value = newResult;
|
|
16
|
+
return payload;
|
|
17
|
+
}`;x.write("const input = payload.value;");let le=Object.create(null),pe=0;for(let S of h.allKeys)le[S]=`key_${pe++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let S of h.allKeys){if(S==="__proto__")continue;let b=le[S],F=typeof S==="symbol"?`syms[${_.indexOf(S)}]`:hr(S),at=`${F} in input`,ur=m[S],lt=ur?._zod?.optin,ar=lt!==void 0,Ks=ur?._zod?.optout==="optional";if(x.write(`const ${b} = ${v(F)};`),ar&&Ks){let Ws=lt==="optional"?`${b}_present`:`${b}.value !== undefined || ${b}_present`;x.write(`
|
|
18
|
+
const ${b}_present = ${at};
|
|
19
|
+
if (!${b}.issues.length || ${b}_present) {
|
|
20
|
+
if (${b}.issues.length) {${C(b,F)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${Ws}) {
|
|
24
|
+
newResult[${F}] = ${b}.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}else if(!ar)x.write(`
|
|
29
|
+
const ${b}_present = ${at};
|
|
30
|
+
if (${b}.issues.length) {${C(b,F)}
|
|
31
|
+
}
|
|
32
|
+
if (!${b}_present && !${b}.issues.length) {
|
|
33
|
+
payload.issues.push({
|
|
34
|
+
code: "invalid_type",
|
|
35
|
+
expected: "nonoptional",
|
|
36
|
+
input: undefined,
|
|
37
|
+
path: [${F}]
|
|
38
|
+
});
|
|
39
|
+
if (ctx && ctx.abortEarly) {
|
|
40
|
+
payload.value = newResult;
|
|
41
|
+
return payload;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (${b}_present) {
|
|
46
|
+
newResult[${F}] = ${b}.value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
`);else if(x.write(`
|
|
50
|
+
if (${b}.issues.length) {${C(b,F)}
|
|
51
|
+
}
|
|
52
|
+
`),lt==="defaulted")x.write(`newResult[${F}] = ${b}.value;`);else x.write(`
|
|
53
|
+
if (${b}.value !== undefined || ${at}) {
|
|
54
|
+
newResult[${F}] = ${b}.value;
|
|
55
|
+
}
|
|
56
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=ne,u=!E.jitless,l=u&&_r.value,d=t.catchall,f;e._zod.parse=(m,h)=>{f??(f=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),!d)return m;return ko([],_,m,h,f,e,h?.abortEarly===!0)}return r(m,h)}});function Tn(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)=>!R(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)=>q(s,n,M())))}),t}var Nt=p("$ZodUnion",(e,t)=>{z.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)=>Ie(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 Tn(s,n,e,o);return Promise.all(s).then((c)=>Tn(c,n,e,o))}});function Ac(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Po=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Nt.init(e,t);let r=e._zod.parse;y(e,"propValues",(o)=>{let i={},s=0;for(let c of o.def.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);if(u[o.def.discriminator]?.has(void 0))s++;for(let[a,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(i,a))j(i,a,new Set);for(let d of l)i[a].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=ge(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=he(()=>Ac(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ne(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],u=n.value.get(c);if(u&&(c!==void 0||i.direction!=="backward"))return u._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((a)=>n.value.get(a)!==null),input:s,path:[t.discriminator],inst:e}),o}}),So=p("$ZodIntersection",(e,t)=>{z.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])=>Nn(r,u,a));return Nn(r,i,s)}});function It(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(oe(e)&&oe(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=It(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=It(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 Nn(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let d;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),d=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let f=String(a.path[0]);if(!i.has(f))i.set(f,a);d=[f]}else return!1;for(let f of d){if(!n.has(f))n.set(f,{});n.get(f)[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=It(t.value,r.value);if(!u.valid){if(R(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var Oo=p("$ZodTuple",(e,t)=>{z.init(e,t);let r=t.items,n=E.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=Cn(r,"optin"),a=Cn(r,"optout");if(!t.rest){if(s.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(r.length),d=t.rest?i?.abortEarly:void 0,f=!1;for(let m=0;m<r.length;m++){let h=r[m]._zod.run({value:s[m],issues:[]},i);if(h instanceof Promise)c.push(h.then((_)=>{l[m]=_}));else if(l[m]=h,d&&!f&&h.issues.length)f=R(h)}if(t.rest&&!f){let m=r.length-1,h=s.slice(r.length),_=o.issues.length;for(let x of h){if(d&&o.issues.length!==_){if(R(o,_))break;_=o.issues.length}m++;let v=t.rest._zod.run({value:x,issues:[]},i);if(v instanceof Promise)c.push(v.then((C)=>Rn(C,o,m)));else Rn(v,o,m)}}if(c.length)return Promise.all(c).then(()=>Dn(l,o,r,s,a));return Dn(l,o,r,s,a)}});function Cn(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Rn(e,t,r){if(e.issues.length)t.issues.push(...ie(r,e.issues));t.value[r]=e.value}function Dn(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...ie(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Io=p("$ZodEnum",(e,t)=>{z.init(e,t);let r=de(t.entries),n=new Set(r);e._zod.values=n,y(e,"pattern",(o)=>{let i=de(o.def.entries).filter((s)=>xr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>X(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}}),Eo=p("$ZodLiteral",(e,t)=>{z.init(e,t);let r=new Set(t.values);e._zod.values=r,y(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?X(i):i?X(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var Ao=p("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(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 B;return r.value=o,r}});function jn(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ct=p("$ZodOptional",(e,t)=>{z.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(`^(${Ie(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)=>jn(r,i));return jn(r,o)}return t.innerType._zod.run(r,n)}}),To=p("$ZodExactOptional",(e,t)=>{Ct.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)}),No=p("$ZodNullable",(e,t)=>{z.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(`^(${Ie(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)}}),Co=p("$ZodDefault",(e,t)=>{z.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)=>Ln(i,t));return Ln(o,t)}});function Ln(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ro=p("$ZodPrefault",(e,t)=>{z.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)}}),Do=p("$ZodNonOptional",(e,t)=>{z.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)=>Mn(i,e));return Mn(o,e)}});function Mn(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 Fn(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)=>q(o,n,M()))},input:e.value}),e}var jo=p("$ZodCatch",(e,t)=>{z.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)=>Fn(r,i,t,n));return Fn(r,o,t,n)}});var Lo=p("$ZodPipe",(e,t)=>{z.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)=>Be(s,t.in,n));return Be(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Be(i,t.out,n));return Be(o,t.out,n)}});function Be(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 Mo=p("$ZodReadonly",(e,t)=>{z.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(Un);return Un(o)}});function Un(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Fo=p("$ZodCustom",(e,t)=>{O.init(e,t),z.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)=>Bn(i,r,n,e));Bn(o,r,n,e);return}});function Bn(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(ee(o))}}class Bo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Dt="~memo",Uo=[];function Jo(e){return e!==null&&typeof e==="object"}function Rt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Vo=new WeakMap,ve=0,qe=1,be=2;function Ye(e,t,r){let n=Vo.get(e);if(n!==void 0)return n?be:ve;if(t.has(e))return be;t.add(e);let o=ve,i=(l)=>{if(o!==be&&l?._zod){let d=Ye(l,t,r);if(d>o)o=d}},s=(l,d)=>{let f=ve;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(d&&!h.enumerable)continue;let _=h.get?qe:h.value?._zod?Ye(h.value,t,r):ve;if(_>f)f=_}return f},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=ge(u);c(l?s(l,!0):qe),i(u.catchall);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?Ye(l,t,!1):qe);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 d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let f=d.value;if(!f||typeof f!=="object")continue;if(f._zod)i(f);else if(Array.isArray(f))for(let m of f)i(m)}}return t.delete(e),Tc(e,o)}function Tc(e,t){if(t!==qe)Vo.set(e,t===be);return t}function Nc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ge,Xe=[],Cc={alloc(e,t,r){let n=Ge;if(!n)return r;Ge=void 0;let o={value:r,issues:null};return n.set(t.value,o),Xe.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"&&Rc(i,o.value))throw new Bo;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 v=Ye(e,new Set,!1);if(v===ve){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(v===be||n)r=!0;else n=!0}let l=u.value;if(!Jo(l))return s(u,a);let d=a[Dt];if(!d)d={buckets:new WeakMap,backEdges:void 0},a[Dt]=d;let f;if(o===a)f=i;else f=Nc(d,e),o=a,i=f;let m=f.get(l);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...Rt(m.issues))}else u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value);return u}Ge=f;let h=Xe.length,_=s(u,a);Ge=void 0;let x=Xe.length>h?Xe.pop():void 0;if(_ instanceof Promise)return _.then((v)=>{if(x)x.issues=v.issues.length?Rt(v.issues):Uo;return v});if(x)x.issues=_.issues.length?Rt(_.issues):Uo;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Ko(){return Cc}function Rc(e,t){let r=e[Dt]?.backEdges;return r!==void 0&&Jo(t)&&r.has(t)}var Dc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=$r(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 ${ht(i.values[0])}`;return`Invalid option: expected one of ${ft(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":""}: ${ft(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 jt(){return{localeError:Dc()}}var Wo;class Go{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 jc(){return new Go}(Wo=globalThis).__zod_globalRegistry??(Wo.__zod_globalRegistry=jc());var te=globalThis.__zod_globalRegistry;function Xo(e){if(e.checks)e.checks=[...e.checks];return e}function qo(e,t){return new e(Xo({type:"string",...g(t)}))}function Yo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Qo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function ni(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function ci(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function ui(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function ai(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function li(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function pi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function fi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function di(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function mi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function hi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function gi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function _i(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function xi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function yi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function vi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function bi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function zi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function $i(e,t){return new e(Xo({type:"number",checks:[],...g(t)}))}function wi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function ki(e,t){return new e({type:"boolean",...g(t)})}function Zi(e){return new e({type:"unknown"})}function Pi(e,t){return new e({type:"never",...g(t)})}function He(e,t){return new Pt({check:"less_than",...g(t),value:e,inclusive:!1})}function ze(e,t){return new Pt({check:"less_than",...g(t),value:e,inclusive:!0})}function Qe(e,t){return new St({check:"greater_than",...g(t),value:e,inclusive:!1})}function $e(e,t){return new St({check:"greater_than",...g(t),value:e,inclusive:!0})}function et(e,t){return new _n({check:"multiple_of",...g(t),value:e})}function tt(e,t){return new yn({check:"max_length",...g(t),maximum:e})}function se(e,t){return new vn({check:"min_length",...g(t),minimum:e})}function rt(e,t){return new bn({check:"length_equals",...g(t),length:e})}function Lt(e,t){return new zn({check:"string_format",format:"regex",...g(t),pattern:e})}function Mt(e){return new $n({check:"string_format",format:"lowercase",...g(e)})}function Ft(e){return new wn({check:"string_format",format:"uppercase",...g(e)})}function Ut(e,t){return new kn({check:"string_format",format:"includes",...g(t),includes:e})}function Bt(e,t){return new Zn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Jt(e,t){return new Pn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function Y(e){return new Sn({check:"overwrite",tx:e})}function Vt(e){return Y((t)=>t.normalize(e))}function Kt(){return Y((e)=>e.trim())}function Wt(){return Y((e)=>e.toLowerCase())}function Gt(){return Y((e)=>e.toUpperCase())}function Xt(){return Y((e)=>gr(e))}function Si(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=Lc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ee(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(ee(i))}},e(n.value,n)),t);return r}function Lc(e,t){let r=new O({check:"custom",...g(t)});return r._zod.check=e,r}function we(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 Yt(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??te,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 W(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 P(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 f=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,f,l)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;P(d,t,l),t.seen.get(d).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)we(s.schema,u);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Ei(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ht(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 d=e.external.registry.get(s[0])?.id,f=e.external.uri??((h)=>h);if(d)return{ref:f(d)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${f("__shared")}#/${c}/${Ei(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+Ei(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 d in l)delete l[d];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>
|
|
57
|
+
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let 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 Ni(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;Ni(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 Ci=new Set(["type","properties","required","additionalProperties"]),Ai=["oneOf","anyOf"];function Ti(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 qt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Ci.has(s))return null;t.push(i)}let r={},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]??Ti(a);if(l===null||l===void 0)continue;if(!c.some((d)=>JSON.stringify(d)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:qt(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=Ti(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 Mc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Ci)if(o in e)return;let r=t.filter((o)=>Ai.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=qt(t);else{let o=r[0],i=Ai.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)=>qt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,we(e,n)}function Qt(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},d=u.ref;if(u.ref=null,d){n(d);let m=e.seen.get(d),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 we(a,h);if(we(a,l),c._zod.parent===d)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 f=c._zod.parent;if(f&&f!==d){n(f);let m=e.seen.get(f);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())Ni(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 d=c.get(l);if(d)d.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])Mc(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)}we(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:ke(t,"input",e.processors),output:ke(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function I(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return I(n.element,r);if(n.type==="set")return I(n.valueType,r);if(n.type==="lazy")return I(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return I(n.innerType,r);if(n.type==="intersection")return I(n.left,r)||I(n.right,r);if(n.type==="record"||n.type==="map")return I(n.keyType,r)||I(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(n.in,r)||I(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(I(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(I(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(I(o,r))return!0;if(n.rest&&I(n.rest,r))return!0;return!1}return!1}var Ri=(e,t={})=>(r)=>{let n=Yt({...r,processors:t});return P(e,n),Ht(n,e),Qt(n,e)},ke=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Yt({...o??{},target:i,io:t,processors:r});return P(e,s),Ht(s,e),Qt(s,e)};var ce=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ue=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Di=(e,t)=>{ce(e,"minimum",t),ue(e,"maximum",t)},Fi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Ui=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Bi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ji=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},ji=(e,t)=>ce(e,"minimum",t.minimum),Li=(e,t)=>ue(e,"maximum",t.maximum),Mi=(e)=>(t,r)=>{Ji(t,r.format);let[n,o]=e[r.format];ce(t,"minimum",n),ue(t,"maximum",o)},Fc={greater_than:(e,t)=>ce(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ue(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Fi(e,t.value),number_format:Mi(Ee),bigint_format:Mi(gt),min_length:ji,max_length:Li,length_equals:(e,t)=>Di(e,t.length),min_size:ji,max_size:Li,size_equals:(e,t)=>Di(e,t.size),string_format:(e,t)=>{if(Ji(e,t.format),t.pattern)Ui(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)=>Bi(e,t.mime)};function D(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Fc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ce(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ce(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ue(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ue(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Fi(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)Bi(t,o.mime);for(let i of o.patterns??[])Ui(t,i);return t}var Uc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bc=new Map([[At,on],[We,sn]]),Jc=(e)=>Bc.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}=D(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=Uc[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 d=[...u].map(Jc);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},Ki=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=D(e);o.type=l?"integer":"number";let d=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),f=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(m)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(f)if(m)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.maximum=s;if(c){let h=new Set;for(let v of c)if(Number.isFinite(v)&&v!==0)h.add(Math.abs(v));else W(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[_,...x]=h;if(_!==void 0)o.multipleOf=_;if(x.length)o.allOf=[...o.allOf??[],...x.map((v)=>({multipleOf:v}))]}},Wi=(e,t,r,n)=>{r.type="boolean"};var Gi=(e,t,r,n)=>{r.not={}};var Xi=(e,t,r,n)=>{};var qi=(e,t,r,n)=>{let o=e._zod.def,i=de(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},Yi=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(W(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(W(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}};var Hi=(e,t,r,n)=>{W(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Qi=(e,t,r,n)=>{W(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var es=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=D(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=P(i.element,t,{...n,path:[...n.path,"items"]})};function nt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return nt(t.out);if(t.type==="catch")return nt(t.innerType);return e._zod.optin}var ts=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&W(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)j(o.properties,a,P(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];if(t.io==="input"?nt(l)===void 0:l._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=P(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},rs=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>P(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},ns=(e,t,r,n)=>{let o=e._zod.def,i=P(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=P(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)},os=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((_,x)=>P(_,t,{...n,path:[...n.path,s,x]})),a=i.rest?P(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let _=i.items[l-1];if(!(t.io==="input"?nt(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=i.items.length,f=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=u,f)o.items=!1;else if(a)o.items=a;if(l>0)o.minItems=l;if(f)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:u},a)o.items.anyOf.push(a);if(l>0)o.minItems=l;if(f)o.maxItems=d}else{if(o.items=u,f)o.additionalItems=!1;else if(a)o.additionalItems=a;if(l>0)o.minItems=l;if(f)o.maxItems=d}let{minimum:m,maximum:h}=D(e);if(typeof m==="number")o.minItems=m;if(typeof h==="number")o.maxItems=h};var is=(e,t,r,n)=>{let o=e._zod.def,i=P(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"}]},ss=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},er=Symbol();function cs(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 W(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),er}var us=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=cs(o.defaultValue,e,t,r,n);if(s!==er)r.default=s},as=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=cs(o.defaultValue,e,t,r,n);if(s!==er)r._prefault=s},ls=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{W(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},ps=(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;P(s,t,n);let c=t.seen.get(e);c.ref=s},fs=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var tr=(e,t,r,n)=>{let o=e._zod.def;P(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var ds=new WeakSet([Object.prototype,Error.prototype]);function ot(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 Hc=(e,t)=>{Er.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ds.has(r))return;ds.add(r),ot(r,"format",(n)=>(o)=>Tr(n,o)),ot(r,"flatten",(n)=>(o)=>Ar(n,o)),ot(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,me,2)}),ot(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,me,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var T=p("ZodError",Hc,void 0,{Parent:Error});var ms=je(T),hs=Le(T),gs=Me(T),_s=Fe(T),xs=Cr(T),ys=Rr(T),vs=Dr(T),bs=jr(T),zs=Lr(T),$s=Mr(T),ws=Fr(T),ks=Ur(T);function eu(){if(!E.localeError)M(jt())}function st(){if(!E.memoizer)M({memoizer:Ko()})}var k=p("ZodType",(e,t)=>(eu(),z.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 U(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ea(e,t))},superRefine(e,t){return this.check(ta(e,t))},overwrite(e){return this.check(Y(e))},optional(){return Ss(this)},exactOptional(){return Fu(this)},nullable(){return Os(this)},nullish(){return Ss(Os(this))},nonoptional(e){return Wu(this,e)},array(){return or(this)},or(e){return Eu([this,e])},and(e){return Cu(this,e)},transform(e){return Is(this,Mu(e))},default(e){return Ju(this,e)},prefault(e){return Ku(this,e)},catch(e){return Xu(this,e)},pipe(e){return Is(this,e)},readonly(){return Hu(this)},describe(e){let t=this.clone();return te.add(t,{description:e}),t},meta(...e){if(e.length===0)return te.get(this);let t=this.clone();return te.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 Re(this,"~standard",{...Et(this),jsonSchema:{input:ke(this,"input"),output:ke(this,"output")}})},set "~standard"(e){K(this,"~standard",e)},parse:function e(t,r){return ms(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await hs(this,t,r,{callee:e})},safeParse(e,t){return gs(this,e,t)},async safeParseAsync(e,t){return _s(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){K(this,"spa",e)},validate(e,t){return bt(this,e,t)},validateAsync(e,t){return zt(this,e,t)},encode:function e(t,r){return xs(this,t,r,{callee:e})},decode:function e(t,r){return ys(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await vs(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await bs(this,t,r,{callee:e})},safeEncode(e,t){return zs(this,e,t)},safeDecode(e,t){return $s(this,e,t)},async safeEncodeAsync(e,t){return ws(this,e,t)},async safeDecodeAsync(e,t){return ks(this,e,t)},toJSONSchema(e){return Ri(this,{})(e)},get description(){return te.get(this)?.description},get _def(){return this._zod.def}}),Es=p("_ZodString",(e,t)=>{Ke.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vi(e,r,n,o)},kr({format:(e)=>D(e).format??null,minLength:(e)=>D(e).minimum??null,maxLength:(e)=>D(e).maximum??null},{regex(...e){return this.check(Lt(...e))},includes(...e){return this.check(Ut(...e))},startsWith(...e){return this.check(Bt(...e))},endsWith(...e){return this.check(Jt(...e))},min(...e){return this.check(se(...e))},max(...e){return this.check(tt(...e))},length(...e){return this.check(rt(...e))},nonempty(...e){return this.check(se(1,...e))},lowercase(e){return this.check(Mt(e))},uppercase(e){return this.check(Ft(e))},trim(){return this.check(Kt())},normalize(...e){return this.check(Vt(...e))},toLowerCase(){return this.check(Wt())},toUpperCase(){return this.check(Gt())},slugify(){return this.check(Xt())}})),tu=p("ZodString",(e,t)=>{Ke.init(e,t),Es.init(e,t)},{email(e){return this.check(Yo(su,e))},url(e){return this.check(ni(uu,e))},jwt(e){return this.check(xi($u,e))},emoji(e){return this.check(oi(au,e))},guid(e){return this.check(Ho(cu,e))},uuid(e){return this.check(Qo(it,e))},uuidv4(e){return this.check(ei(it,e))},uuidv6(e){return this.check(ti(it,e))},uuidv7(e){return this.check(ri(it,e))},nanoid(e){return this.check(ii(lu,e))},cuid(e){return this.check(si(pu,e))},cuid2(e){return this.check(ci(fu,e))},ulid(e){return this.check(ui(du,e))},base64(e){return this.check(hi(vu,e))},base64url(e){return this.check(gi(bu,e))},xid(e){return this.check(ai(mu,e))},ksuid(e){return this.check(li(hu,e))},ipv4(e){return this.check(pi(gu,e))},ipv6(e){return this.check(fi(_u,e))},cidrv4(e){return this.check(di(xu,e))},cidrv6(e){return this.check(mi(yu,e))},e164(e){return this.check(_i(zu,e))},datetime(e){return this.check(yi(ru,e))},date(e){return this.check(vi(nu,e))},time(e){return this.check(bi(ou,e))},duration(e){return this.check(zi(iu,e))}});function J(e){return qo(tu,e)}var Z=p("ZodStringFormat",(e,t)=>{w.init(e,t),Es.init(e,t)}),ru=p("ZodISODateTime",(e,t)=>{oo.init(e,t),Z.init(e,t)}),nu=p("ZodISODate",(e,t)=>{io.init(e,t),Z.init(e,t)}),ou=p("ZodISOTime",(e,t)=>{so.init(e,t),Z.init(e,t)}),iu=p("ZodISODuration",(e,t)=>{co.init(e,t),Z.init(e,t)}),su=p("ZodEmail",(e,t)=>{Wn.init(e,t),Z.init(e,t)});var cu=p("ZodGUID",(e,t)=>{Vn.init(e,t),Z.init(e,t)});var it=p("ZodUUID",(e,t)=>{Kn.init(e,t),Z.init(e,t)});var uu=p("ZodURL",(e,t)=>{qn.init(e,t),Z.init(e,t)});var au=p("ZodEmoji",(e,t)=>{Yn.init(e,t),Z.init(e,t)});var lu=p("ZodNanoID",(e,t)=>{Hn.init(e,t),Z.init(e,t)});var pu=p("ZodCUID",(e,t)=>{Qn.init(e,t),Z.init(e,t)});var fu=p("ZodCUID2",(e,t)=>{eo.init(e,t),Z.init(e,t)});var du=p("ZodULID",(e,t)=>{to.init(e,t),Z.init(e,t)});var mu=p("ZodXID",(e,t)=>{ro.init(e,t),Z.init(e,t)});var hu=p("ZodKSUID",(e,t)=>{no.init(e,t),Z.init(e,t)});var gu=p("ZodIPv4",(e,t)=>{uo.init(e,t),Z.init(e,t)});var _u=p("ZodIPv6",(e,t)=>{lo.init(e,t),Z.init(e,t)});var xu=p("ZodCIDRv4",(e,t)=>{po.init(e,t),Z.init(e,t)});var yu=p("ZodCIDRv6",(e,t)=>{fo.init(e,t),Z.init(e,t)});var vu=p("ZodBase64",(e,t)=>{ho.init(e,t),Z.init(e,t)});var bu=p("ZodBase64URL",(e,t)=>{go.init(e,t),Z.init(e,t)});var zu=p("ZodE164",(e,t)=>{_o.init(e,t),Z.init(e,t)});var $u=p("ZodJWT",(e,t)=>{xo.init(e,t),Z.init(e,t)});var As=p("ZodNumber",(e,t)=>{Tt.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ki(e,r,n,o),e.isFinite=!0},kr({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=D(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=D(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=D(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>D(e).format??null},{gt(e,t){return this.check(Qe(e,t))},gte(e,t){return this.check($e(e,t))},min(e,t){return this.check($e(e,t))},lt(e,t){return this.check(He(e,t))},lte(e,t){return this.check(ze(e,t))},max(e,t){return this.check(ze(e,t))},int(e){return this.check(Zs(e))},safe(e){return this.check(Zs(e))},positive(e){return this.check(Qe(0,e))},nonnegative(e){return this.check($e(0,e))},negative(e){return this.check(He(0,e))},nonpositive(e){return this.check(ze(0,e))},multipleOf(e,t){return this.check(et(e,t))},step(e,t){return this.check(et(e,t))},finite(){return this}}));function N(e){return $i(As,e)}var wu=p("ZodNumberFormat",(e,t)=>{yo.init(e,t),As.init(e,t)});function Zs(e){return wi(wu,e)}var ku=p("ZodBoolean",(e,t)=>{vo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wi(e,r,n,o)});function Ze(e){return ki(ku,e)}var Zu=p("ZodUnknown",(e,t)=>{bo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xi(e,r,n,o)});function Ps(){return Zi(Zu)}var Pu=p("ZodNever",(e,t)=>{zo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gi(e,r,n,o)});function Su(e){return Pi(Pu,e)}var Ou=p("ZodArray",(e,t)=>{st(),$o.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o),e.element=t.element},{min(e,t){return this.check(se(e,t))},nonempty(e){return this.check(se(1,e))},max(e,t){return this.check(tt(e,t))},length(e,t){return this.check(rt(e,t))},unwrap(){return this.element}});function or(e,t){return Si(Ou,e,t)}var Iu=p("ZodObject",(e,t)=>{st(),Zo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ts(e,r,n,o),ic(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return ir(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:Ps()}))},loose(){return this.clone(A(this._zod.def,{catchall:Ps()}))},strict(){return this.clone(A(this._zod.def,{catchall:Su()}))},strip(){return this.clone(A(this._zod.def,{catchall:void 0}))},extend(e){return Ys(this,e)},safeExtend(e){return Hs(this,e)},merge(e){return Qs(this,e)},pick(e){return Xs(this,e)},omit(e){return qs(this,e)},partial(...e){return br(sr,this,e[0])},exactPartial(...e){return br(Ns,this,e[0],"exactPartial")},required(...e){return ec(Cs,this,e[0])}});function H(e,t){let r={type:"object",shape:e??{},...g(t)};return new Iu(r)}var Ts=p("ZodUnion",(e,t)=>{Nt.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rs(e,r,n,o),e.options=t.options});function Eu(e,t){return new Ts({type:"union",options:e,...g(t)})}var Au=p("ZodDiscriminatedUnion",(e,t)=>{Ts.init(e,t),Po.init(e,t)});function Tu(e,t,r){return new Au({type:"union",options:t,discriminator:e,...g(r)})}var Nu=p("ZodIntersection",(e,t)=>{So.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o)});function Cu(e,t){return new Nu({type:"intersection",left:e,right:t})}var Ru=p("ZodTuple",(e,t)=>{st(),Oo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new sr({type:"optional",innerType:t}))})}});function Du(e,t,r){let n=t instanceof z,o=n?r:t;return new Ru({type:"tuple",items:e,rest:n?t:null,...g(o)})}var nr=p("ZodEnum",(e,t)=>{Io.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,i)=>qi(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 nr({...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 nr({...t,checks:[],...g(o),entries:i})}});function ir(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new nr({type:"enum",entries:r,...g(t)})}var ju=p("ZodLiteral",(e,t)=>{Eo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ct(e,t){return new ju({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var Lu=p("ZodTransform",(e,t)=>{st(),Ao.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee(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(ee(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 Mu(e){return new Lu({type:"transform",transform:e})}var sr=p("ZodOptional",(e,t)=>{Ct.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ss(e){return new sr({type:"optional",innerType:e})}var Ns=p("ZodExactOptional",(e,t)=>{To.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fu(e){return new Ns({type:"optional",innerType:e})}var Uu=p("ZodNullable",(e,t)=>{No.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>is(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Uu({type:"nullable",innerType:e})}var Bu=p("ZodDefault",(e,t)=>{Co.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>us(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ju(e,t){return new Bu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():mt(t)}})}var Vu=p("ZodPrefault",(e,t)=>{Ro.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>as(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ku(e,t){return new Vu({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():mt(t)}})}var Cs=p("ZodNonOptional",(e,t)=>{Do.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ss(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wu(e,t){return new Cs({type:"nonoptional",innerType:e,...g(t)})}var Gu=p("ZodCatch",(e,t)=>{jo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ls(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xu(e,t){return new Gu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Zr(t)})}var qu=p("ZodPipe",(e,t)=>{Lo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n,o),e.in=t.in,e.out=t.out});function Is(e,t){return new qu({type:"pipe",in:e,out:t})}var Yu=p("ZodReadonly",(e,t)=>{Mo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hu(e){return new Yu({type:"readonly",innerType:e})}var Qu=p("ZodCustom",(e,t)=>{Fo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hi(e,r,n,o)});function ea(e,t={}){return Oi(Qu,e,t)}function ta(e,t){return Ii(e,t)}var Pe=1e4,Ds=200,Se=8388608;var ae=240;var Dp=H({filesRead:N().int().nonnegative().max(1e4),directoriesRead:N().int().nonnegative().max(256),skippedBinary:N().int().nonnegative().max(1e4),skippedLarge:N().int().nonnegative().max(1e4)}).strict(),js=H({query:J().min(1).max(4096),caseSensitive:Ze(),wholeWord:Ze(),regex:Ze(),include:J().max(4096),exclude:J().max(4096),useGitignore:Ze()}).strict(),jp=H({path:J().min(1).max(4096),name:J().min(1).max(1024),truncated:Ze(),matches:or(H({line:N().int().positive(),start:N().int().nonnegative(),end:N().int().nonnegative(),preview:J().max(ae+1),previewStart:N().int().nonnegative(),previewEnd:N().int().nonnegative()}).strict()).min(1).max(200)}).strict(),Lp=H({type:ct("io"),id:N().int().positive().max(40000),op:ir(["directory","stat","read"]),path:J().max(4096)}).strict();var Oe=100663296;var cr=(e,t)=>{let r=Buffer.from(e,"utf8");return r.length<=t&&r.toString("utf8")===e},ra=Du([N().int().nonnegative().max(Se),N().int().positive().max(Se)]).refine((e)=>e[0]<e[1]),na=or(ra).min(1).max(Pe).refine((e)=>{let t=[...e].sort((r,n)=>r[0]-n[0]);return t.every((r,n)=>n===0||r[0]>=t[n-1][1])}),Ls=H({type:ct("project-replacement-v1"),query:js,text:J().max(Se).refine((e)=>cr(e,Se)),replacement:J().max(65536).refine((e)=>cr(e,65536)),ranges:na}).strict(),Kp=Tu("kind",[H({kind:ct("ready"),text:J().max(Oe).refine((e)=>cr(e,Oe)),replaced:N().int().positive().max(Pe)}).strict(),H({kind:ct("refused"),reason:ir(["invalid_query","stale","file_too_large"])}).strict()]),Ms="project-replacement-thread-v1";function oa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fs(e,t={}){let r=t.regex===!0?e:e.trim();if(r==="")return{ok:!0,pattern:null};let n=t.regex===!0?r:oa(r),o=t.wholeWord===!0?`(?<![A-Za-z0-9_])(?:${n})(?![A-Za-z0-9_])`:n,i=t.caseSensitive===!0?"g":"gi";try{return{ok:!0,pattern:new RegExp(o,i)}}catch(s){return{ok:!1,error:s instanceof Error?s.message.replace(/^Invalid regular expression: [^:]*: /,""):"Invalid regular expression"}}}function Us(e){return Fs(e.query,{caseSensitive:e.caseSensitive,wholeWord:e.wholeWord,regex:e.regex})}function*ia(e){let t=0,r=1;for(;;){let n=e.indexOf(`
|
|
59
|
+
`,t);if(n<0){if(t<e.length)yield{line:r,start:t,text:e.slice(t)};return}let o=n>t&&e[n-1]==="\r"?n-1:n;yield{line:r,start:t,text:e.slice(t,o)},t=n+1,r+=1}}function Bs(e,t,r=Ds){let n=[];for(let o of ia(e)){t.lastIndex=0;for(;;){let i=t.exec(o.text);if(i===null)break;if(i[0].length===0){if(t.lastIndex+=1,t.lastIndex>o.text.length)break;continue}if(n.length>=r)return{matches:n,truncated:!0};n.push(sa(o,i.index,i.index+i[0].length))}}return{matches:n,truncated:!1}}function sa(e,t,r){let n=/^[ \t]*/.exec(e.text)[0].length,o=Math.min(n,t),i=e.text.slice(o),s=t-o,c=r-o;if(i.length>ae){let u=Math.min(s,40),a=Math.max(0,Math.min(s-u,i.length-ae));if(i=i.slice(a,a+ae),s-=a,c-=a,a>0)i=`…${i}`,s+=1,c+=1;if(c>i.length)c=i.length;if(s>i.length)s=i.length}return{line:e.line,start:e.start+t,end:e.start+r,preview:i,previewStart:s,previewEnd:c}}function ca(e,t,r,n){if(!n)return t;r.lastIndex=0;let o=r.exec(e);if(o===null||o.index!==0||o[0].length!==e.length)return null;return r.lastIndex=0,e.replace(r,t)}function Js(e,t,r,n,o,i){let s=new Map(t.map((f)=>[f.start,f])),c=[];for(let[f,m]of r){let h=s.get(f);if(h===void 0||h.end!==m)return null;c.push(h)}c.sort((f,m)=>f.start-m.start);let u=[],a=0,l=(f)=>{if(i!==void 0){if(a+=Buffer.byteLength(f,"utf8"),a>i)throw new ut}u.push(f)},d=0;for(let f of c){let m=ca(e.slice(f.start,f.end),n.replacement,o,n.regex);if(m===null)return null;l(e.slice(d,f.start)),l(m),d=f.end}return l(e.slice(d)),{text:u.join(""),count:c.length}}class ut extends Error{constructor(){super("The replacement exceeds the host output budget.")}}function Vs(e){let t=Ls.parse(e),r=Us(t.query);if(!r.ok||r.pattern===null)return{kind:"refused",reason:"invalid_query"};try{let n=Bs(t.text,r.pattern,Pe).matches,o=new RegExp(r.pattern.source,r.pattern.flags.replace("g","")),i=Js(t.text,n,t.ranges,{...t.query,replacement:t.replacement,targets:[]},o,Oe);return i===null?{kind:"refused",reason:"stale"}:{kind:"ready",text:i.text,replaced:i.count}}catch(n){if(!(n instanceof ut))throw n;return{kind:"refused",reason:"file_too_large"}}}if(re.workerData?.type===Ms)re.parentPort.on("message",(e)=>{re.parentPort.postMessage({id:e.id,result:Vs(e.request)})});else re.parentPort.postMessage(Vs(re.workerData));
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __aigdRuntimeUrl=require("node:url").pathToFileURL(__filename).href;
|
|
2
|
+
var Oe=require("node:worker_threads");var ue=require("node:fs/promises"),xr=require("node:path");function ar(e,t){return e===""?t:`${e}/${t}`}function lr(e){return e===".git"||e.startsWith(".git/")||e.endsWith("/.git")||e.includes("/.git/")}function Vs(e){return e.split(",").map((t)=>t.trim()).filter((t)=>t!=="")}function Ws(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gs(e){let t="";for(let r=0;r<e.length;r+=1){let n=e[r];if(n==="*"){if(e[r+1]==="*"){if(r+=1,e[r+1]==="/")r+=1,t+="(?:.*/)?";else t+=".*";continue}t+="[^/]*";continue}if(n==="?"){t+="[^/]";continue}t+=Ws(n)}return t}var pr={empty:!0,matches:()=>!1};function lt(e){let t=Vs(e);if(t.length===0)return pr;let r=[],n=[];for(let o of t){let i=o.replace(/^\.?\//,"");if(i==="")continue;let s=i.endsWith("/")?i.slice(0,-1):i;if(s==="")continue;let c=s.includes("/");if(s.endsWith("/**"))s=s.slice(0,-3);if(s==="")continue;let u=`^(?:${Gs(s)})(?:/.*)?$`;try{let a=new RegExp(u);if(c)r.push(a);else n.push(a)}catch{continue}}if(r.length===0&&n.length===0)return pr;return{empty:!1,matches(o){if(r.some((i)=>i.test(o)))return!0;if(n.length===0)return!1;return o.split("/").some((i)=>n.some((s)=>s.test(i)))}}}var fr={ignores:()=>!1,truncated:!1};function Xs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t={}){let r=t.regex===!0?e:e.trim();if(r==="")return{ok:!0,pattern:null};let n=t.regex===!0?r:Xs(r),o=t.wholeWord===!0?`(?<![A-Za-z0-9_])(?:${n})(?![A-Za-z0-9_])`:n,i=t.caseSensitive===!0?"g":"gi";try{return{ok:!0,pattern:new RegExp(o,i)}}catch(s){return{ok:!1,error:s instanceof Error?s.message.replace(/^Invalid regular expression: [^:]*: /,""):"Invalid regular expression"}}}var pt=1e4,Ie=200,mr=8388608,hr=8192,ce=240;function gr(e){return dr(e.query,{caseSensitive:e.caseSensitive,wholeWord:e.wholeWord,regex:e.regex})}function*qs(e){let t=0,r=1;for(;;){let n=e.indexOf(`
|
|
3
|
+
`,t);if(n<0){if(t<e.length)yield{line:r,start:t,text:e.slice(t)};return}let o=n>t&&e[n-1]==="\r"?n-1:n;yield{line:r,start:t,text:e.slice(t,o)},t=n+1,r+=1}}function _r(e,t,r=Ie){let n=[];for(let o of qs(e)){t.lastIndex=0;for(;;){let i=t.exec(o.text);if(i===null)break;if(i[0].length===0){if(t.lastIndex+=1,t.lastIndex>o.text.length)break;continue}if(n.length>=r)return{matches:n,truncated:!0};n.push(Ys(o,i.index,i.index+i[0].length))}}return{matches:n,truncated:!1}}function Ys(e,t,r){let n=/^[ \t]*/.exec(e.text)[0].length,o=Math.min(n,t),i=e.text.slice(o),s=t-o,c=r-o;if(i.length>ce){let u=Math.min(s,40),a=Math.max(0,Math.min(s-u,i.length-ce));if(i=i.slice(a,a+ce),s-=a,c-=a,a>0)i=`…${i}`,s+=1,c+=1;if(c>i.length)c=i.length;if(s>i.length)s=i.length}return{line:e.line,start:e.start+t,end:e.start+r,preview:i,previewStart:s,previewEnd:c}}var Hs={readdir:(e)=>ue.readdir(e,{withFileTypes:!0}),stat:(e)=>ue.stat(e),readFile:(e)=>ue.readFile(e)};function Qs(e){return e.subarray(0,hr).indexOf(0)>=0}async function yr(e){let{root:t,request:r,pattern:n,signal:o,onFile:i}=e,s=e.fs??Hs,c=e.ignore??fr,u=lt(r.include),a=lt(r.exclude),p=0,f=0,d=0,m=0,h=0,_=0,x=!1,b=()=>({filesRead:p,directoriesRead:f,skippedBinary:d,skippedLarge:m,totalFiles:h,totalMatches:_,capped:x,cancelled:o.aborted}),E=[{relative:"",absolute:t}];while(E.length>0){if(o.aborted)return b();let J=E.shift(),G;try{G=await s.readdir(J.absolute),f+=1}catch{continue}for(let z of G){if(o.aborted)return b();let y=ar(J.relative,z.name),A=xr.join(J.absolute,z.name);if(lr(y))continue;if(z.isDirectory()){if(a.matches(y))continue;if(r.useGitignore&&c.ignores(y))continue;E.push({relative:y,absolute:A});continue}if(!z.isFile())continue;if(!u.empty&&!u.matches(y))continue;if(a.matches(y))continue;if(r.useGitignore&&c.ignores(y))continue;let oe;try{oe=(await s.stat(A)).size}catch{continue}if(oe>mr){m+=1;continue}if(o.aborted)return b();let ie;try{ie=await s.readFile(A),p+=1}catch{continue}if(Qs(ie)){d+=1;continue}let de=pt-_,{matches:se,truncated:at}=_r(ie.toString("utf8"),n,Math.min(Ie,de));if(se.length===0)continue;if(h+=1,_+=se.length,i({path:y,name:z.name,matches:se,truncated:at}),_>=pt)return x=!0,b()}}return b()}function ge(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 dt(e,t="|"){return e.map((r)=>gt(r)).join(t)}function _e(e,t){if(typeof t==="bigint")return t.toString();return t}class br{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 Ee(e){return new br(e)}function vr(e){return e===null||e===void 0}function Ae(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function L(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Te(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function K(e){return Te(e._zod.def)??e._zod.def.shape}function $r(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return L(this,t,n),n},enumerable:!0,configurable:!0})}function wr(e,t,r){if(t in e)L(e,t,r);else e[t]=r}function Q(e,t,r,n){let o=K(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)$r(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else wr(e,i,n?n(s.value,i):s.value)}}function ec(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)$r(e,r,()=>t[r]);else wr(e,r,n.value)}}function T(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function kr(e){return JSON.stringify(e)}function Zr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function he(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Pr=Ee(()=>{if(N.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ae(e){if(he(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(he(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ht(e){if(ae(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 Sr=new Set(["string","number","symbol"]);function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function gt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Or(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ne=(()=>({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]}))(),_t={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function tc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Q(i,e,Ce(e,t)),M(e,T(r,{shape:i,checks:[]}))}function Ce(e,t){let r=K(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 rc(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(Ce(e,t)),s={};return Q(s,e,Reflect.ownKeys(K(e)).filter((c)=>!i.has(c))),M(e,T(r,{shape:s,checks:[]}))}function nc(e,t){if(!ae(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=K(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,T(e._zod.def,{shape:Ir(e,t)}))}function Ir(e,t){let r={};return Q(r,e,Reflect.ownKeys(K(e))),ec(r,t),r}function oc(e,t){if(!ae(t))throw Error("Invalid input to safeExtend: expected a plain object");return M(e,T(e._zod.def,{shape:Ir(e,t)}))}function ic(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Q(r,e,Reflect.ownKeys(K(e))),Q(r,t,Reflect.ownKeys(K(t)));let n=T(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return M(e,n)}function Er(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(Ce(t,r)):void 0,u={};return Q(u,t,Reflect.ownKeys(K(t)),e&&((a,p)=>c&&!c.has(p)?a:new e({type:"optional",innerType:a}))),M(t,T(t._zod.def,{shape:u,checks:[]}))}function sc(e,t,r){let n=r?new Set(Ce(t,r)):void 0,o={};return Q(o,t,Reflect.ownKeys(K(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),M(t,T(t._zod.def,{shape:o}))}function F(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 Ar(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 Re(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function me(e){return typeof e==="string"?e:e?.message}function xt(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function De(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Y(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:me(e.inst?._zod.def?.error?.(e))??me(i?.(e))??me(t?.error?.(e))??me(r.customError?.(e))??me(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 cc=/[\uD800-\uDBFF]/;function je(e){let t=e.length;if(!cc.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 Le(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Tr(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 ee(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Nr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else uc(e,r,n.value)}}function V(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Me(e,t,r){return V(e,t,r,!1)}function Cr(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 uc(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 ac(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ft,X=!1,lc={configurable:!0,get(){X=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ft!==e._zod){ft=void 0;return}ft=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,lc);let o=X;X=!1;try{let i=r(this);if(X)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return X=X||o,i}catch(i){throw delete this[t],X=X||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function pc(e,t,r,n){let o=ac(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 fc="~constantCatch";function Rr(e){let t=()=>e;return t[fc]=!0,t}var Dr;var yt={value:void 0,enumerable:!1},jr="captureStackTrace"in Error?Error:null;function dc(e){let t=jr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return jr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){yt.value=new i(m);try{Object.defineProperty(d,"_zod",yt)}finally{yt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),x=d._zod.constr.prototype,b=_;while(b&&b!==x)b=Object.getPrototypeOf(b);let E=b??_;if(!c.has(E))c.add(E),Nr(E,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let a=n?.Parent??Object;class p extends a{}Object.defineProperty(p,"name",{value:e});function f(d){let m=n?.Parent?dc(p):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 U extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Dr=globalThis).__zod_globalConfig??(Dr.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function D(e){if(e)Object.assign(N,e);return N}function mc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_e,2)),e.message}function hc(e){this._zod.message=e}var gc={get:mc,set:hc,enumerable:!0,configurable:!0},vt={value:void 0,enumerable:!1},Lr=new WeakSet([Object.prototype,Error.prototype]),Mr=(e,t)=>{e.name="$ZodError",vt.value=t,Object.defineProperty(e,"issues",vt),vt.value=void 0,Object.defineProperty(e,"message",gc);let r=Object.getPrototypeOf(e);if(!Lr.has(r))Lr.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})}})},Fr=l("$ZodError",Mr),Sa=l("$ZodError",Mr,void 0,{Parent:Error});function _c(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 Ur(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)_c(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Br(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let p=c[a],f=a===c.length-1;if(p==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,p))Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[p];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Fe(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ue=(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 U;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>Y(a,s,D())));throw mt(u,i?.callee??t),u}return c.value};return t};var Be=(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)=>Y(a,s,D())));throw mt(u,i?.callee??t),u}return c.value};return t};var Je=(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 U;return i.issues.length?Jr(e,i.issues,o):{success:!0,data:i.value}};function Jr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Y(o,r,D()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Ke=(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?Jr(e,i.issues,o):{success:!0,data:i.value}};var xc=Symbol.for("zod.compile.invalid"),yc=Symbol.for("zod.compile.fallback"),zt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==xc)return!0;if(n.definite===!0&&r===void 0)return!1}return bc(e,t,r)};function bc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[yc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new U;return i.issues.length===0}var $t=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},Kr=(e)=>{let t=Ue(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Fe(r,s))};return r};var Vr=(e)=>{let t=Ue(e),r=(n,o,i,s)=>t(n,o,i,Fe(r,s));return r};var Wr=(e)=>{let t=Be(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Fe(r,s))};return r};var Gr=(e)=>{let t=Be(e),r=async(n,o,i,s)=>await t(n,o,i,Fe(r,s));return r};var Xr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Je(e)(t,r,o)};var qr=(e)=>(t,r,n)=>Je(e)(t,r,n);var Yr=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ke(e)(t,r,o)};var Hr=(e)=>async(t,r,n)=>Ke(e)(t,r,n);var Qr=/^[cC][0-9a-z]{6,}$/,en=/^[0-9a-z]+$/,tn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,rn=/^[0-9a-vA-V]{20}$/,nn=/^[A-Za-z0-9]{27}$/,on=/^[a-zA-Z0-9_-]{21}$/;function sn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var cn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var un=/^([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})$/,kt=(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 an=/^(?:[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 vc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ln(){return new RegExp(vc,"u")}var pn=/^(?:(?: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])$/,fn=/^(([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 dn=/^((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])$/,mn=/^(([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])$/,hn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var _n=/^https?$/,xn=/^\+[1-9]\d{6,14}$/;var yn="(?:(?:\\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 zc(e){return new RegExp(`^${e}$`)}var bn=zc(yn);function wt(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 vn(e){return new RegExp(`^${wt(e)}$`)}function zn(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${wt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${wt({precision:e.precision})}`:r;return new RegExp(`^${yn}T(?:${n})$`)}var $n=/^[\s\S]{0,}$/;var Zt=/^-?\d+(?:\.\d+)?$/,wn=/^(?:true|false)$/i;var kn=/^[^A-Z]*$/,Zn=/^[^a-z]*$/;var O=l("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Pt=(e)=>{let t=e.value;return!vr(t)&&t.length!==void 0},Ve={number:"number",bigint:"bigint",object:"date"},St=l("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=Ve[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ve[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=l("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=Ve[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ve[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pn=l("$ZodCheckMultipleOf",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):zr(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Sn=l("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ne[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var On=l("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?je(o):i)<=t.maximum)return;let c=Le(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),In=l("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?je(o):i)>=t.minimum)return;let c=Le(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),En=l("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?je(o):i;if(s===t.length)return;let c=Le(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})}}),be=l("$ZodCheckStringFormat",(e,t)=>{var r,n;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),An=l("$ZodCheckRegex",(e,t)=>{be.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})}}),Tn=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kn),be.init(e,t)}),Nn=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Zn),be.init(e,t)}),Cn=l("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=q(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})}}),Rn=l("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${q(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=l("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${q(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 jn=l("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class It{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(`
|
|
4
|
+
`).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(", ")}) {
|
|
5
|
+
${t.join(`
|
|
6
|
+
`)}
|
|
7
|
+
};`)(...Object.values(this.closed))}}var Mn={major:4,minor:6,patch:7};var k=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let p=F(c),f;for(let d of u){if(d._zod.def.when){if(Ar(c))continue;if(!d._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new U;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(De(c.issues,m,e),!p)p=F(c,m)});else{if(c.issues.length===m)continue;if(De(c.issues,m,e),!p)p=F(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(F(c))return c.aborted=!0,c;let p=i(u,o,a);if(p instanceof Promise){if(a.async===!1)throw new U;return p.then((f)=>e._zod.parse(f,a))}return e._zod.parse(p,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(p instanceof Promise)return p.then((f)=>s(f,c,u));return s(p,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new U;return a.then((p)=>i(p,o,u))}return i(a,o,u)}}},{get "~standard"(){return Me(this,"~standard",At(this))},set "~standard"(e){V(this,"~standard",e)}}),Yn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Y(r,t,D()))}:{value:e.value};async function wc(e,t){let r={async:!0};return Yn(await e._zod.run({value:t,issues:[]},r),r)}function At(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Yn(n,r)}catch(n){}return wc(e,t)},vendor:"zod",version:1}}var qe=l("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??$n,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}}),w=l("$ZodStringFormat",(e,t)=>{be.init(e,t),qe.init(e,t)}),Hn=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=un),w.init(e,t)}),Qn=l("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=kt(n))}else t.pattern??(t.pattern=kt());w.init(e,t)}),eo=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=an),w.init(e,t)}),to=1,Ge=2;function ro(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function kc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ro(e)||Ge;return Zc(e,t)}function Zc(e,t){if(!t.normalize&&t.protocol?.source===_n.source&&!/^https?:\/\//i.test(e))return to;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Ge}return new URL(e)}catch{return Ge}}var Pc=/[\t\n\r]/g;function Fn(e){return e.replace(Pc,"")}function Sc(e,t){return t.lastIndex=0,t.test(e.hostname)}function Oc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var no=l("$ZodURL",(e,t)=>{w.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=kc(n,t);if(o===to){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Ge){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Fn(n);return}if(t.hostname&&!Sc(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&&!Oc(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:Fn(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),oo=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ln()),w.init(e,t)}),io=l("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?on:sn(t.length)),w.init(e,t)}),so=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qr),w.init(e,t)}),co=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=en),w.init(e,t)}),uo=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tn),w.init(e,t)}),ao=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rn),w.init(e,t)}),lo=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nn),w.init(e,t)}),po=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zn(t)),w.init(e,t)}),fo=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bn),w.init(e,t)}),mo=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vn(t)),w.init(e,t)}),ho=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cn),w.init(e,t)}),go=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=pn),w.init(e,t)}),Ic=/^[0-9a-fA-F:.]+$/;function _o(e){if(!Ic.test(e))return!1;return ro(`http://[${e}]`)}var xo=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fn),w.init(e,t),e._zod.check=(r)=>{if(!_o(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var yo=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=dn),w.init(e,t)});function Ec(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 _o(r)}var bo=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mn),w.init(e,t),e._zod.check=(r)=>{if(!Ec(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function vo(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 Tt=/^[0-9a-zA-Z+/]*={0,2}$/,zo=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Tt),w.init(e,t),e._zod.check=(r)=>{if(vo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ye=/^[A-Za-z0-9_-]*$/;function Ac(e){if(!Ye.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vo(r)}var $o=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ye),w.init(e,t),e._zod.check=(r)=>{if(Ac(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),wo=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xn),w.init(e,t)});function Tc(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 ko=l("$ZodJWT",(e,t)=>{w.init(e,t),e._zod.check=(r)=>{if(Tc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Nt=l("$ZodNumber",(e,t)=>{k.init(e,t),e._zod.pattern=Zt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Zo=l("$ZodNumberFormat",(e,t)=>{Sn.init(e,t),Nt.init(e,t)}),Po=l("$ZodBoolean",(e,t)=>{k.init(e,t),e._zod.pattern=wn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var So=l("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=(r)=>r}),Oo=l("$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 Nc(e,t){let r=xt(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of xt(e._zod.def.checks))if(c>u&&a._zod.def.when(i)){let p=i.issues.length;return a._zod.check(i),i.issues[p].continue=!1,De(i.issues,p,e),i}}return o(i,s)}}var Cc=(e)=>Array.isArray(e)?e.length:-1;function Un(e,t,r){if(e.issues.length)t.issues.push(...Re(r,e.issues));t.value[r]=e.value}var Io=l("$ZodArray",(e,t)=>{k.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],p=t.element._zod.run({value:a,issues:[]},o);if(p instanceof Promise)s.push(p.then((f)=>Un(f,n,u)));else if(Un(p,n,u),c&&p.issues.length!==0&&F(p))break}if(s.length)return Promise.all(s).then(()=>n);return n},Nc(e,Cc)});function Xe(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(...Re(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 Rc=[];function Eo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Rc,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=Or(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ao(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,p=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(F(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(p==="never")c.push(h);continue}if(p==="never"){c.push(h);continue}let _=a.run({value:t[h],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>Xe(x,r,h,t,f,d)));else Xe(_,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 Dc=l("$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 p={...n};return Object.defineProperty(t,"shape",{value:p}),a.raw=p,p};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=Ee(()=>Eo(t));v(e,"propValues",(a)=>{let p=a.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))L(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=he,s=t.catchall,c,u=N.memoizer;u?.attach(e),e._zod.parse=(a,p)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(h&&a.issues.length!==_){if(F(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let b=m[x],E=b._zod.optin,J=b._zod.optout,G=b._zod.run({value:f[x],issues:[]},p);if(G instanceof Promise)d.push(G.then((z)=>Xe(z,a,x,f,E,J)));else Xe(G,a,x,f,E,J)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return Ao(d,f,a,p,o.value,e,h===!0)}}),To=l("$ZodObjectJIT",(e,t)=>{Dc.init(e,t);let r=e._zod.parse,n=Ee(()=>Eo(t)),o=N.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,x=new It(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),b=(z)=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,E=(z,y)=>`
|
|
8
|
+
let ${z}_ab = false;
|
|
9
|
+
for (let i = 0; i < ${z}.issues.length; i++) {
|
|
10
|
+
const iss = ${z}.issues[i];
|
|
11
|
+
iss.path = iss.path ? [${y}, ...iss.path] : [${y}];
|
|
12
|
+
payload.issues.push(iss);
|
|
13
|
+
if (iss.continue !== true) ${z}_ab = true;
|
|
14
|
+
}
|
|
15
|
+
if (${z}_ab && ctx && ctx.abortEarly) {
|
|
16
|
+
payload.value = newResult;
|
|
17
|
+
return payload;
|
|
18
|
+
}`;x.write("const input = payload.value;");let J=Object.create(null),G=0;for(let z of h.allKeys)J[z]=`key_${G++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of h.allKeys){if(z==="__proto__")continue;let y=J[z],A=typeof z==="symbol"?`syms[${_.indexOf(z)}]`:kr(z),oe=`${A} in input`,ie=m[z],de=ie?._zod?.optin,se=de!==void 0,at=ie?._zod?.optout==="optional";if(x.write(`const ${y} = ${b(A)};`),se&&at){let Ks=de==="optional"?`${y}_present`:`${y}.value !== undefined || ${y}_present`;x.write(`
|
|
19
|
+
const ${y}_present = ${oe};
|
|
20
|
+
if (!${y}.issues.length || ${y}_present) {
|
|
21
|
+
if (${y}.issues.length) {${E(y,A)}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (${Ks}) {
|
|
25
|
+
newResult[${A}] = ${y}.value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
`)}else if(!se)x.write(`
|
|
30
|
+
const ${y}_present = ${oe};
|
|
31
|
+
if (${y}.issues.length) {${E(y,A)}
|
|
32
|
+
}
|
|
33
|
+
if (!${y}_present && !${y}.issues.length) {
|
|
34
|
+
payload.issues.push({
|
|
35
|
+
code: "invalid_type",
|
|
36
|
+
expected: "nonoptional",
|
|
37
|
+
input: undefined,
|
|
38
|
+
path: [${A}]
|
|
39
|
+
});
|
|
40
|
+
if (ctx && ctx.abortEarly) {
|
|
41
|
+
payload.value = newResult;
|
|
42
|
+
return payload;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (${y}_present) {
|
|
47
|
+
newResult[${A}] = ${y}.value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
`);else if(x.write(`
|
|
51
|
+
if (${y}.issues.length) {${E(y,A)}
|
|
52
|
+
}
|
|
53
|
+
`),de==="defaulted")x.write(`newResult[${A}] = ${y}.value;`);else x.write(`
|
|
54
|
+
if (${y}.value !== undefined || ${oe}) {
|
|
55
|
+
newResult[${A}] = ${y}.value;
|
|
56
|
+
}
|
|
57
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=he,u=!N.jitless,p=u&&Pr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(u&&p&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return Ao([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function Bn(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)=>!F(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)=>Y(s,n,D())))}),t}var No=l("$ZodUnion",(e,t)=>{k.init(e,t),v(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),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(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}),v(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)=>Ae(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 Bn(s,n,e,o);return Promise.all(s).then((c)=>Bn(c,n,e,o))}});var Co=l("$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])=>Jn(r,u,a));return Jn(r,i,s)}});function Et(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(ae(e)&&ae(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=Et(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=Et(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 Jn(e,t,r){let n=new Map,o,i=new Map,s=(a,p)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[p]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((p)=>o.keys.includes(p)):[];if(a.length)e.issues.push({...o,keys:a});for(let p of c)if(!a.includes(p)&&i.has(p))e.issues.push(i.get(p))}let u=Et(t.value,r.value);if(!u.valid){if(F(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var Ro=l("$ZodEnum",(e,t)=>{k.init(e,t);let r=ge(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=ge(o.def.entries).filter((s)=>Sr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>q(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}}),Do=l("$ZodLiteral",(e,t)=>{k.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?q(i):i?q(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var jo=l("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",N.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xe(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 U;return r.value=o,r}});function Kn(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ct=l("$ZodOptional",(e,t)=>{k.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ae(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)=>Kn(r,i));return Kn(r,o)}return t.innerType._zod.run(r,n)}}),Lo=l("$ZodExactOptional",(e,t)=>{Ct.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Mo=l("$ZodNullable",(e,t)=>{k.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ae(n.source)}|null)$`):void 0}),v(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)}}),Fo=l("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",v(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 Uo=l("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",v(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)}}),Bo=l("$ZodNonOptional",(e,t)=>{k.init(e,t),v(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)=>Wn(i,e));return Wn(o,e)}});function Wn(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 Gn(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)=>Y(o,n,D()))},input:e.value}),e}var Jo=l("$ZodCatch",(e,t)=>{k.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(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)=>Gn(r,i,t,n));return Gn(r,o,t,n)}});var Ko=l("$ZodPipe",(e,t)=>{k.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(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)=>We(s,t.in,n));return We(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>We(i,t.out,n));return We(o,t.out,n)}});function We(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 Vo=l("$ZodReadonly",(e,t)=>{k.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(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(Xn);return Xn(o)}});function Xn(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Wo=l("$ZodCustom",(e,t)=>{O.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)=>qn(i,r,n,e));qn(o,r,n,e);return}});function qn(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(ee(o))}}class Xo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Dt="~memo",Go=[];function qo(e){return e!==null&&typeof e==="object"}function Rt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Yo=new WeakMap,ve=0,et=1,ze=2;function tt(e,t,r){let n=Yo.get(e);if(n!==void 0)return n?ze:ve;if(t.has(e))return ze;t.add(e);let o=ve,i=(p)=>{if(o!==ze&&p?._zod){let f=tt(p,t,r);if(f>o)o=f}},s=(p,f)=>{let d=ve;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let _=h.get?et:h.value?._zod?tt(h.value,t,r):ve;if(_>d)d=_}return d},c=(p)=>{if(p>o)o=p},u=e._zod.def,a=u.type;switch(a){case"object":{let p=Te(u);c(p?s(p,!0):et),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let p of u.items)i(p);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let p of u.options)i(p);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let p=u._cachedInner??(r?e._zod.innerType:void 0);c(p?tt(p,t,!1):et);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in u){let f=Object.getOwnPropertyDescriptor(u,p);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),jc(e,o)}function jc(e,t){if(t!==et)Yo.set(e,t===ze);return t}function Lc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var He,Qe=[],Mc={alloc(e,t,r){let n=He;if(!n)return r;He=void 0;let o={value:r,issues:null};return n.set(t.value,o),Qe.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"&&Fc(i,o.value))throw new Xo;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let b=tt(e,new Set,!1);if(b===ve){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(b===ze||n)r=!0;else n=!0}let p=u.value;if(!qo(p))return s(u,a);let f=a[Dt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Dt]=f;let d;if(o===a)d=i;else d=Lc(f,e),o=a,i=d;let m=d.get(p);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...Rt(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}He=d;let h=Qe.length,_=s(u,a);He=void 0;let x=Qe.length>h?Qe.pop():void 0;if(_ instanceof Promise)return _.then((b)=>{if(x)x.issues=b.issues.length?Rt(b.issues):Go;return b});if(x)x.issues=_.issues.length?Rt(_.issues):Go;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Ho(){return Mc}function Fc(e,t){let r=e[Dt]?.backEdges;return r!==void 0&&qo(t)&&r.has(t)}var Uc=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Tr(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 ${gt(i.values[0])}`;return`Invalid option: expected one of ${dt(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":""}: ${dt(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 jt(){return{localeError:Uc()}}var Qo;class ei{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 Bc(){return new ei}(Qo=globalThis).__zod_globalRegistry??(Qo.__zod_globalRegistry=Bc());var te=globalThis.__zod_globalRegistry;function ti(e){if(e.checks)e.checks=[...e.checks];return e}function ri(e,t){return new e(ti({type:"string",...g(t)}))}function ni(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function ai(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function li(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function pi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function fi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function di(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function mi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function hi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function gi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function _i(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function xi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function yi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function bi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function vi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function zi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function $i(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function wi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function ki(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Zi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Pi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Si(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Oi(e,t){return new e(ti({type:"number",checks:[],...g(t)}))}function Ii(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function Ei(e,t){return new e({type:"boolean",...g(t)})}function Ai(e){return new e({type:"unknown"})}function Ti(e,t){return new e({type:"never",...g(t)})}function rt(e,t){return new St({check:"less_than",...g(t),value:e,inclusive:!1})}function $e(e,t){return new St({check:"less_than",...g(t),value:e,inclusive:!0})}function nt(e,t){return new Ot({check:"greater_than",...g(t),value:e,inclusive:!1})}function we(e,t){return new Ot({check:"greater_than",...g(t),value:e,inclusive:!0})}function ot(e,t){return new Pn({check:"multiple_of",...g(t),value:e})}function it(e,t){return new On({check:"max_length",...g(t),maximum:e})}function le(e,t){return new In({check:"min_length",...g(t),minimum:e})}function st(e,t){return new En({check:"length_equals",...g(t),length:e})}function Lt(e,t){return new An({check:"string_format",format:"regex",...g(t),pattern:e})}function Mt(e){return new Tn({check:"string_format",format:"lowercase",...g(e)})}function Ft(e){return new Nn({check:"string_format",format:"uppercase",...g(e)})}function Ut(e,t){return new Cn({check:"string_format",format:"includes",...g(t),includes:e})}function Bt(e,t){return new Rn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Jt(e,t){return new Dn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new jn({check:"overwrite",tx:e})}function Kt(e){return H((t)=>t.normalize(e))}function Vt(){return H((e)=>e.trim())}function Wt(){return H((e)=>e.toLowerCase())}function Gt(){return H((e)=>e.toUpperCase())}function Xt(){return H((e)=>Zr(e))}function Ni(e,t,r){return new e({type:"array",element:t,...g(r)})}function Ci(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Ri(e,t){let r=Jc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ee(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(ee(i))}},e(n.value,n)),t);return r}function Jc(e,t){let r=new O({check:"custom",...g(t)});return r._zod.check=e,r}function ke(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))L(e,n,r[n]);return e}function Yt(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??te,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 W(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 S(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,p)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;S(f,t,p),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ke(s.schema,u);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Di(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ht(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}/${Di(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:a+Di(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let p=c.schema;for(let f in p)delete p[f];p.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
58
|
+
|
|
59
|
+
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 Mi(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;Mi(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 Fi=new Set(["type","properties","required","additionalProperties"]),ji=["oneOf","anyOf"];function Li(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 qt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Fi.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let p=a.properties?.[s]??Li(a);if(p===null||p===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(p)))c.push(p)}let u=c.length===1?c[0]:qt(c)??{allOf:c};L(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=Li(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 Kc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Fi)if(o in e)return;let r=t.filter((o)=>ji.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=qt(t);else{let o=r[0],i=ji.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)=>qt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ke(e,n)}function Qt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,p={...a},f=u.ref;if(u.ref=null,f){n(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(h);else ke(a,h);if(ke(a,p),c._zod.parent===f)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(!(x in p))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())Mi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let p=a?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);if(f)f.push(a);else c.set(p,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])Kc(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)}ke(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;L(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ze(t,"input",e.processors),output:Ze(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function I(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return I(n.element,r);if(n.type==="set")return I(n.valueType,r);if(n.type==="lazy")return I(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return I(n.innerType,r);if(n.type==="intersection")return I(n.left,r)||I(n.right,r);if(n.type==="record"||n.type==="map")return I(n.keyType,r)||I(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(n.in,r)||I(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(I(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(I(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(I(o,r))return!0;if(n.rest&&I(n.rest,r))return!0;return!1}return!1}var Ui=(e,t={})=>(r)=>{let n=Yt({...r,processors:t});return S(e,n),Ht(n,e),Qt(n,e)},Ze=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Yt({...o??{},target:i,io:t,processors:r});return S(e,s),Ht(s,e),Qt(s,e)};var pe=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},fe=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Bi=(e,t)=>{pe(e,"minimum",t),fe(e,"maximum",t)},Wi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Gi=(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]},qi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ji=(e,t)=>pe(e,"minimum",t.minimum),Ki=(e,t)=>fe(e,"maximum",t.maximum),Vi=(e)=>(t,r)=>{qi(t,r.format);let[n,o]=e[r.format];pe(t,"minimum",n),fe(t,"maximum",o)},Vc={greater_than:(e,t)=>pe(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>fe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Wi(e,t.value),number_format:Vi(Ne),bigint_format:Vi(_t),min_length:Ji,max_length:Ki,length_equals:(e,t)=>Bi(e,t.length),min_size:Ji,max_size:Ki,size_equals:(e,t)=>Bi(e,t.size),string_format:(e,t)=>{if(qi(e,t.format),t.pattern)Gi(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 j(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Vc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)pe(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)pe(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)fe(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)fe(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Wi(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Xi(t,o.mime);for(let i of o.patterns??[])Gi(t,i);return t}var Wc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gc=new Map([[Tt,hn],[Ye,gn]]),Xc=(e)=>Gc.get(e)??e,Yi=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:p}=j(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=Wc[c]??c,o.format==="")delete o.format;if(c==="time"||p)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(Xc);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}))]}},Hi=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:p}=j(e);o.type=p?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),d=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(d)if(m)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else W(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...x]=h;if(_!==void 0)o.multipleOf=_;if(x.length)o.allOf=[...o.allOf??[],...x.map((b)=>({multipleOf:b}))]}},Qi=(e,t,r,n)=>{r.type="boolean"};var es=(e,t,r,n)=>{r.not={}};var ts=(e,t,r,n)=>{};var rs=(e,t,r,n)=>{let o=e._zod.def,i=ge(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},ns=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(W(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(W(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}};var os=(e,t,r,n)=>{W(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var is=(e,t,r,n)=>{W(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var ss=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=j(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=S(i.element,t,{...n,path:[...n.path,"items"]})};function er(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return er(t.out);if(t.type==="catch")return er(t.innerType);return e._zod.optin}var cs=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&W(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)L(o.properties,a,S(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let p=i.shape[a];if(t.io==="input"?er(p)===void 0:p._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=S(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},us=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>S(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},as=(e,t,r,n)=>{let o=e._zod.def,i=S(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=S(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};var ls=(e,t,r,n)=>{let o=e._zod.def,i=S(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"}]},ps=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},tr=Symbol();function fs(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 W(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),tr}var ds=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=fs(o.defaultValue,e,t,r,n);if(s!==tr)r.default=s},ms=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=fs(o.defaultValue,e,t,r,n);if(s!==tr)r._prefault=s},hs=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{W(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},gs=(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;S(s,t,n);let c=t.seen.get(e);c.ref=s},_s=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var rr=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var xs=new WeakSet([Object.prototype,Error.prototype]);function ct(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 nu=(e,t)=>{Fr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(xs.has(r))return;xs.add(r),ct(r,"format",(n)=>(o)=>Br(n,o)),ct(r,"flatten",(n)=>(o)=>Ur(n,o)),ct(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,_e,2)}),ct(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,_e,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var C=l("ZodError",nu,void 0,{Parent:Error});var ys=Ue(C),bs=Be(C),vs=Je(C),zs=Ke(C),$s=Kr(C),ws=Vr(C),ks=Wr(C),Zs=Gr(C),Ps=Xr(C),Ss=qr(C),Os=Yr(C),Is=Hr(C);function iu(){if(!N.localeError)D(jt())}function ir(){if(!N.memoizer)D({memoizer:Ho()})}var P=l("ZodType",(e,t)=>(iu(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return M(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(na(e,t))},superRefine(e,t){return this.check(oa(e,t))},overwrite(e){return this.check(H(e))},optional(){return Ts(this)},exactOptional(){return Ju(this)},nullable(){return Ns(this)},nullish(){return Ts(Ns(this))},nonoptional(e){return qu(this,e)},array(){return js(this)},or(e){return Du([this,e])},and(e){return Lu(this,e)},transform(e){return Cs(this,Bu(e))},default(e){return Wu(this,e)},prefault(e){return Xu(this,e)},catch(e){return Hu(this,e)},pipe(e){return Cs(this,e)},readonly(){return ta(this)},describe(e){let t=this.clone();return te.add(t,{description:e}),t},meta(...e){if(e.length===0)return te.get(this);let t=this.clone();return te.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 Me(this,"~standard",{...At(this),jsonSchema:{input:Ze(this,"input"),output:Ze(this,"output")}})},set "~standard"(e){V(this,"~standard",e)},parse:function e(t,r){return ys(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await bs(this,t,r,{callee:e})},safeParse(e,t){return vs(this,e,t)},async safeParseAsync(e,t){return zs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return zt(this,e,t)},validateAsync(e,t){return $t(this,e,t)},encode:function e(t,r){return $s(this,t,r,{callee:e})},decode:function e(t,r){return ws(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ks(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Zs(this,t,r,{callee:e})},safeEncode(e,t){return Ps(this,e,t)},safeDecode(e,t){return Ss(this,e,t)},async safeEncodeAsync(e,t){return Os(this,e,t)},async safeDecodeAsync(e,t){return Is(this,e,t)},toJSONSchema(e){return Ui(this,{})(e)},get description(){return te.get(this)?.description},get _def(){return this._zod.def}}),Rs=l("_ZodString",(e,t)=>{qe.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o)},Cr({format:(e)=>j(e).format??null,minLength:(e)=>j(e).minimum??null,maxLength:(e)=>j(e).maximum??null},{regex(...e){return this.check(Lt(...e))},includes(...e){return this.check(Ut(...e))},startsWith(...e){return this.check(Bt(...e))},endsWith(...e){return this.check(Jt(...e))},min(...e){return this.check(le(...e))},max(...e){return this.check(it(...e))},length(...e){return this.check(st(...e))},nonempty(...e){return this.check(le(1,...e))},lowercase(e){return this.check(Mt(e))},uppercase(e){return this.check(Ft(e))},trim(){return this.check(Vt())},normalize(...e){return this.check(Kt(...e))},toLowerCase(){return this.check(Wt())},toUpperCase(){return this.check(Gt())},slugify(){return this.check(Xt())}})),su=l("ZodString",(e,t)=>{qe.init(e,t),Rs.init(e,t)},{email(e){return this.check(ni(pu,e))},url(e){return this.check(ai(du,e))},jwt(e){return this.check(wi(Su,e))},emoji(e){return this.check(li(mu,e))},guid(e){return this.check(oi(fu,e))},uuid(e){return this.check(ii(ut,e))},uuidv4(e){return this.check(si(ut,e))},uuidv6(e){return this.check(ci(ut,e))},uuidv7(e){return this.check(ui(ut,e))},nanoid(e){return this.check(pi(hu,e))},cuid(e){return this.check(fi(gu,e))},cuid2(e){return this.check(di(_u,e))},ulid(e){return this.check(mi(xu,e))},base64(e){return this.check(vi(ku,e))},base64url(e){return this.check(zi(Zu,e))},xid(e){return this.check(hi(yu,e))},ksuid(e){return this.check(gi(bu,e))},ipv4(e){return this.check(_i(vu,e))},ipv6(e){return this.check(xi(zu,e))},cidrv4(e){return this.check(yi($u,e))},cidrv6(e){return this.check(bi(wu,e))},e164(e){return this.check($i(Pu,e))},datetime(e){return this.check(ki(cu,e))},date(e){return this.check(Zi(uu,e))},time(e){return this.check(Pi(au,e))},duration(e){return this.check(Si(lu,e))}});function re(e){return ri(su,e)}var Z=l("ZodStringFormat",(e,t)=>{w.init(e,t),Rs.init(e,t)}),cu=l("ZodISODateTime",(e,t)=>{po.init(e,t),Z.init(e,t)}),uu=l("ZodISODate",(e,t)=>{fo.init(e,t),Z.init(e,t)}),au=l("ZodISOTime",(e,t)=>{mo.init(e,t),Z.init(e,t)}),lu=l("ZodISODuration",(e,t)=>{ho.init(e,t),Z.init(e,t)}),pu=l("ZodEmail",(e,t)=>{eo.init(e,t),Z.init(e,t)});var fu=l("ZodGUID",(e,t)=>{Hn.init(e,t),Z.init(e,t)});var ut=l("ZodUUID",(e,t)=>{Qn.init(e,t),Z.init(e,t)});var du=l("ZodURL",(e,t)=>{no.init(e,t),Z.init(e,t)});var mu=l("ZodEmoji",(e,t)=>{oo.init(e,t),Z.init(e,t)});var hu=l("ZodNanoID",(e,t)=>{io.init(e,t),Z.init(e,t)});var gu=l("ZodCUID",(e,t)=>{so.init(e,t),Z.init(e,t)});var _u=l("ZodCUID2",(e,t)=>{co.init(e,t),Z.init(e,t)});var xu=l("ZodULID",(e,t)=>{uo.init(e,t),Z.init(e,t)});var yu=l("ZodXID",(e,t)=>{ao.init(e,t),Z.init(e,t)});var bu=l("ZodKSUID",(e,t)=>{lo.init(e,t),Z.init(e,t)});var vu=l("ZodIPv4",(e,t)=>{go.init(e,t),Z.init(e,t)});var zu=l("ZodIPv6",(e,t)=>{xo.init(e,t),Z.init(e,t)});var $u=l("ZodCIDRv4",(e,t)=>{yo.init(e,t),Z.init(e,t)});var wu=l("ZodCIDRv6",(e,t)=>{bo.init(e,t),Z.init(e,t)});var ku=l("ZodBase64",(e,t)=>{zo.init(e,t),Z.init(e,t)});var Zu=l("ZodBase64URL",(e,t)=>{$o.init(e,t),Z.init(e,t)});var Pu=l("ZodE164",(e,t)=>{wo.init(e,t),Z.init(e,t)});var Su=l("ZodJWT",(e,t)=>{ko.init(e,t),Z.init(e,t)});var Ds=l("ZodNumber",(e,t)=>{Nt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hi(e,r,n,o),e.isFinite=!0},Cr({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=j(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=j(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=j(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>j(e).format??null},{gt(e,t){return this.check(nt(e,t))},gte(e,t){return this.check(we(e,t))},min(e,t){return this.check(we(e,t))},lt(e,t){return this.check(rt(e,t))},lte(e,t){return this.check($e(e,t))},max(e,t){return this.check($e(e,t))},int(e){return this.check(Es(e))},safe(e){return this.check(Es(e))},positive(e){return this.check(nt(0,e))},nonnegative(e){return this.check(we(0,e))},negative(e){return this.check(rt(0,e))},nonpositive(e){return this.check($e(0,e))},multipleOf(e,t){return this.check(ot(e,t))},step(e,t){return this.check(ot(e,t))},finite(){return this}}));function B(e){return Oi(Ds,e)}var Ou=l("ZodNumberFormat",(e,t)=>{Zo.init(e,t),Ds.init(e,t)});function Es(e){return Ii(Ou,e)}var Iu=l("ZodBoolean",(e,t)=>{Po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o)});function Pe(e){return Ei(Iu,e)}var Eu=l("ZodUnknown",(e,t)=>{So.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ts(e,r,n,o)});function As(){return Ai(Eu)}var Au=l("ZodNever",(e,t)=>{Oo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o)});function Tu(e){return Ti(Au,e)}var Nu=l("ZodArray",(e,t)=>{ir(),Io.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ss(e,r,n,o),e.element=t.element},{min(e,t){return this.check(le(e,t))},nonempty(e){return this.check(le(1,e))},max(e,t){return this.check(it(e,t))},length(e,t){return this.check(st(e,t))},unwrap(){return this.element}});function js(e,t){return Ni(Nu,e,t)}var Cu=l("ZodObject",(e,t)=>{ir(),To.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cs(e,r,n,o),pc(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ls(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:As()}))},loose(){return this.clone(T(this._zod.def,{catchall:As()}))},strict(){return this.clone(T(this._zod.def,{catchall:Tu()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return nc(this,e)},safeExtend(e){return oc(this,e)},merge(e){return ic(this,e)},pick(e){return tc(this,e)},omit(e){return rc(this,e)},partial(...e){return Er(Ms,this,e[0])},exactPartial(...e){return Er(Fs,this,e[0],"exactPartial")},required(...e){return sc(Us,this,e[0])}});function Se(e,t){let r={type:"object",shape:e??{},...g(t)};return new Cu(r)}var Ru=l("ZodUnion",(e,t)=>{No.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>us(e,r,n,o),e.options=t.options});function Du(e,t){return new Ru({type:"union",options:e,...g(t)})}var ju=l("ZodIntersection",(e,t)=>{Co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>as(e,r,n,o)});function Lu(e,t){return new ju({type:"intersection",left:e,right:t})}var or=l("ZodEnum",(e,t)=>{Ro.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>rs(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 or({...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 or({...t,checks:[],...g(o),entries:i})}});function Ls(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new or({type:"enum",entries:r,...g(t)})}var Mu=l("ZodLiteral",(e,t)=>{Do.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Fu(e,t){return new Mu({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var Uu=l("ZodTransform",(e,t)=>{ir(),jo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>is(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee(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(ee(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 Bu(e){return new Uu({type:"transform",transform:e})}var Ms=l("ZodOptional",(e,t)=>{Ct.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ts(e){return new Ms({type:"optional",innerType:e})}var Fs=l("ZodExactOptional",(e,t)=>{Lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ju(e){return new Fs({type:"optional",innerType:e})}var Ku=l("ZodNullable",(e,t)=>{Mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ls(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ns(e){return new Ku({type:"nullable",innerType:e})}var Vu=l("ZodDefault",(e,t)=>{Fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ds(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wu(e,t){return new Vu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ht(t)}})}var Gu=l("ZodPrefault",(e,t)=>{Uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xu(e,t){return new Gu({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ht(t)}})}var Us=l("ZodNonOptional",(e,t)=>{Bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function qu(e,t){return new Us({type:"nonoptional",innerType:e,...g(t)})}var Yu=l("ZodCatch",(e,t)=>{Jo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hu(e,t){return new Yu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Rr(t)})}var Qu=l("ZodPipe",(e,t)=>{Ko.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gs(e,r,n,o),e.in=t.in,e.out=t.out});function Cs(e,t){return new Qu({type:"pipe",in:e,out:t})}var ea=l("ZodReadonly",(e,t)=>{Vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_s(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new ea({type:"readonly",innerType:e})}var ra=l("ZodCustom",(e,t)=>{Wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o)});function na(e,t={}){return Ci(ra,e,t)}function oa(e,t){return Ri(e,t)}var rf=Se({filesRead:B().int().nonnegative().max(1e4),directoriesRead:B().int().nonnegative().max(256),skippedBinary:B().int().nonnegative().max(1e4),skippedLarge:B().int().nonnegative().max(1e4)}).strict(),Bs=Se({query:re().min(1).max(4096),caseSensitive:Pe(),wholeWord:Pe(),regex:Pe(),include:re().max(4096),exclude:re().max(4096),useGitignore:Pe()}).strict(),nf=Se({path:re().min(1).max(4096),name:re().min(1).max(1024),truncated:Pe(),matches:js(Se({line:B().int().positive(),start:B().int().nonnegative(),end:B().int().nonnegative(),preview:re().max(ce+1),previewStart:B().int().nonnegative(),previewEnd:B().int().nonnegative()}).strict()).min(1).max(200)}).strict(),of=Se({type:Fu("io"),id:B().int().positive().max(40000),op:Ls(["directory","stat","read"]),path:re().max(4096)}).strict();if(!Oe.parentPort)throw Error("Native search requires its supervised worker thread.");var ne=Oe.parentPort,Js=Bs.parse(Oe.workerData),sr=gr(Js),sa=0,ur=new Map;ne.on("message",(e)=>{let t=ur.get(e.id);if(!t)return;if(ur.delete(e.id),e.ok)t.resolve(e.value);else t.reject(Error("Native search filesystem request refused."))});var cr=(e,t)=>new Promise((r,n)=>{let o=++sa;ur.set(o,{resolve:r,reject:n}),ne.postMessage({type:"io",id:o,op:e,path:t})});async function ca(){if(!sr.ok){ne.postMessage({type:"invalid_query"});return}if(!sr.pattern){ne.postMessage({type:"done",capped:!1,counters:{filesRead:0,directoriesRead:0,skippedBinary:0,skippedLarge:0}});return}let e=await yr({root:"",request:Js,pattern:sr.pattern,signal:new AbortController().signal,fs:{readdir:async(i)=>(await cr("directory",i)).map((s)=>({name:s.name,isDirectory:()=>s.kind==="directory",isFile:()=>s.kind==="file"})),stat:async(i)=>await cr("stat",i),readFile:async(i)=>Buffer.from(await cr("read",i))},onFile:(i)=>ne.postMessage({type:"file",value:i})}),{filesRead:t,directoriesRead:r,skippedBinary:n,skippedLarge:o}=e;ne.postMessage({type:"done",capped:e.capped,counters:{filesRead:t,directoriesRead:r,skippedBinary:n,skippedLarge:o}})}ca().catch(()=>ne.postMessage({type:"failed"}));
|