runpane 2.4.227 → 2.4.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcpSdk.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var S0=Object.create;var zi=Object.defineProperty;var b0=Object.getOwnPropertyDescriptor;var z0=Object.getOwnPropertyNames;var $0=Object.getPrototypeOf,w0=Object.prototype.hasOwnProperty;var Ro=(e,t)=>{for(var r in t)zi(e,r,{get:t[r],enumerable:!0})},Mm=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of z0(t))!w0.call(e,n)&&n!==r&&zi(e,n,{get:()=>t[n],enumerable:!(o=b0(t,n))||o.enumerable});return e};var R0=(e,t,r)=>(r=e!=null?S0($0(e)):{},Mm(t||!e||!e.__esModule?zi(r,"default",{value:e,enumerable:!0}):r,e)),P0=e=>Mm(zi({},"__esModule",{value:!0}),e);var uI={};Ro(uI,{ProtocolError:()=>Q,ProtocolErrorCode:()=>V,Server:()=>Ju,createMcpHandler:()=>p0,hostHeaderValidationResponse:()=>f0,localhostAllowedHostnames:()=>m0,localhostAllowedOrigins:()=>h0,originValidationResponse:()=>g0,serveStdio:()=>v0});module.exports=P0(uI);var E0=Object.create,$i=Object.defineProperty,k0=Object.getOwnPropertyDescriptor,x0=Object.getOwnPropertyNames,T0=Object.getPrototypeOf,I0=Object.prototype.hasOwnProperty,U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qm=(e,t)=>{let r={};for(var o in e)$i(r,o,{get:e[o],enumerable:!0});return t&&$i(r,Symbol.toStringTag,{value:"Module"}),r},O0=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=x0(t),s=0,i=n.length,a;s<i;s++)a=n[s],!I0.call(e,a)&&a!==r&&$i(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(o=k0(t,a))||o.enumerable});return e},wi=(e,t,r)=>(r=e!=null?E0(T0(e)):{},O0(t||!e||!e.__esModule?$i(r,"default",{value:e,enumerable:!0}):r,e));var C0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Zm=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),N0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),j0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Lm(e){return typeof e=="string"&&Zm.has(e.replace(/#$/,""))}function Dm(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(C0.has(r))return"2020-12";if(Zm.has(r))return"2019-09";if(N0.has(r)||j0.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var ae={};Ro(ae,{BIGINT_FORMAT_RANGES:()=>ki,CONSTANT_CATCH:()=>Xm,Class:()=>Xu,NUMBER_FORMAT_RANGES:()=>Un,aborted:()=>At,allowsEval:()=>nl,assert:()=>L0,assertEqual:()=>A0,assertIs:()=>q0,assertNever:()=>Z0,assertNotEqual:()=>M0,assignProp:()=>$t,attachSchema:()=>Fn,base64ToUint8Array:()=>Wm,base64urlToUint8Array:()=>sw,cached:()=>xo,captureStackTrace:()=>Pi,cleanEnum:()=>nw,cleanRegex:()=>Dn,clone:()=>xt,cloneDef:()=>F0,codePointLength:()=>Vn,constantCatch:()=>Qm,createTransparentProxy:()=>G0,defineLazy:()=>tl,defineLazyInternal:()=>Se,derived:()=>uw,esc:()=>rl,escapeRegex:()=>rr,explicitlyAborted:()=>al,extend:()=>X0,finalizeIssue:()=>Mt,floatSafeRemainder:()=>el,getElementAtPath:()=>V0,getEnumValues:()=>Eo,getLengthableOrigin:()=>Jn,getParsedType:()=>K0,getSizableOrigin:()=>Gm,hexToUint8Array:()=>aw,hide:()=>Ii,installLazyProp:()=>mw,isObject:()=>Qr,isPlainObject:()=>Sr,issue:()=>Io,joinValues:()=>Ri,jsonStringifyReplacer:()=>ko,members:()=>ul,merge:()=>ew,mergeDefs:()=>tr,normalizeParams:()=>re,nullish:()=>Qu,numKeys:()=>B0,objectClone:()=>D0,omit:()=>Y0,optionalKeys:()=>il,own:()=>yr,parsedType:()=>cl,partial:()=>tw,pick:()=>W0,prefixIssues:()=>or,primitiveTypes:()=>Bm,promiseAllObject:()=>J0,propertyKeyTypes:()=>sl,randomString:()=>H0,rawShape:()=>To,required:()=>rw,safeExtend:()=>Q0,shallowClone:()=>Hm,sizeCaps:()=>Ti,slugify:()=>ol,stringifyPrimitive:()=>Ei,toZod:()=>Fm,uint8ArrayToBase64:()=>Ym,uint8ArrayToBase64url:()=>iw,uint8ArrayToHex:()=>cw,unwrapMessage:()=>Po});function A0(e){return e}function M0(e){return e}function Fm(){return e=>e}function q0(e){}function Z0(e){throw new Error("Unexpected value in exhaustive check")}function L0(e){}function Eo(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Ri(e,t="|"){return e.map(r=>Ei(r)).join(t)}function ko(e,t){return typeof t=="bigint"?t.toString():t}var Yu=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function xo(e){return new Yu(e)}function Qu(e){return e==null}function Dn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function el(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Um=Symbol("evaluating");function tl(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Um)return o===void 0&&(o=Um,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function D0(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function $t(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function To(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function er(e){return To(e._zod.def)??e._zod.def.shape}function Vm(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return $t(this,t,o),o},enumerable:!0,configurable:!0})}function Jm(e,t,r){t in e?$t(e,t,r):e[t]=r}function Xr(e,t,r,o){let n=er(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);i.enumerable&&(i.get?Vm(e,s,()=>{let a=t._zod.def.shape[s];return o?o(a,s):a}):Jm(e,s,o?o(i.value,s):i.value))}}function U0(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?Vm(e,r,()=>t[r]):Jm(e,r,o.value))}}function tr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function F0(e){return tr(e._zod.def)}function V0(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function J0(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function H0(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function rl(e){return JSON.stringify(e)}function ol(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Pi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var nl=xo(()=>{if(vt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Sr(e){if(Qr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Qr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Hm(e){return Sr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function B0(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var K0=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},sl=new Set(["string","number","symbol"]),Bm=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xt(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function re(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function G0(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Ei(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function il(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Un={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ki={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function W0(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Xr(s,e,xi(e,t)),xt(e,tr(r,{shape:s,checks:[]}))}function xi(e,t){let r=er(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function Y0(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(xi(e,t)),i={};return Xr(i,e,Reflect.ownKeys(er(e)).filter(a=>!s.has(a))),xt(e,tr(r,{shape:i,checks:[]}))}function X0(e,t){if(!Sr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=er(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xt(e,tr(e._zod.def,{shape:Km(e,t)}))}function Km(e,t){let r={};return Xr(r,e,Reflect.ownKeys(er(e))),U0(r,t),r}function Q0(e,t){if(!Sr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return xt(e,tr(e._zod.def,{shape:Km(e,t)}))}function ew(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Xr(r,e,Reflect.ownKeys(er(e))),Xr(r,t,Reflect.ownKeys(er(t)));let o=tr(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xt(e,o)}function tw(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(xi(t,r)):void 0,c={};return Xr(c,t,Reflect.ownKeys(er(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),xt(t,tr(t._zod.def,{shape:c,checks:[]}))}function rw(e,t,r){let o=r?new Set(xi(t,r)):void 0,n={};return Xr(n,t,Reflect.ownKeys(er(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),xt(t,tr(t._zod.def,{shape:n}))}function At(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 al(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 or(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Po(e){return typeof e=="string"?e:e?.message}function Ti(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&t.push([n,r])}return t}function Fn(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function Mt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Po(e.inst?._zod.def?.error?.(e))??Po(s?.(e))??Po(t?.error?.(e))??Po(r.customError?.(e))??Po(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function Gm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var ow=/[\uD800-\uDBFF]/;function Vn(e){let t=e.length;if(!ow.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Jn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function cl(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 Io(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function nw(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Wm(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Ym(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function sw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Wm(t+r)}function iw(e){return Ym(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function aw(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function cw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Xu=class{constructor(...t){}};function ul(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):lw(e,r,o.value)}}function yr(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ii(e,t,r){return yr(e,t,r,!1)}function uw(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return yr(this,r,o(this))},set(n){yr(this,r,n)}})}return t}function lw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:yr(this,t,r.bind(this))},set(o){yr(this,t,o)}})}function dw(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Wu,vr=!1,pw={configurable:!0,get(){vr=!0}};function Se(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&Wu!==e._zod){Wu=void 0;return}Wu=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,pw);let n=vr;vr=!1;try{let s=r(this);return vr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),vr=vr||n,s}catch(s){throw delete this[t],vr=vr||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function mw(e,t,r,o){let n=dw(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var Xm="~constantCatch";function Qm(e){let t=()=>e;return t[Xm]=!0,t}var ef,dl=Object.freeze({status:"aborted"}),ll={value:void 0,enumerable:!1},tf="captureStackTrace"in Error?Error:null;function fw(e){let t=tf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return tf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function q(e,t,r,o){let n={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=n;let i=r,a=i&&new WeakSet;function c(p,g){if(p._zod){if(p._zod.traits.has(e))return}else{ll.value=new s(g);try{Object.defineProperty(p,"_zod",ll)}finally{ll.value=void 0}}if(p._zod.traits.add(e),t(p,g),a){let _=Object.getPrototypeOf(p),m=p._zod.constr.prototype,h=_;for(;h&&h!==m;)h=Object.getPrototypeOf(h);let z=h??_;a.has(z)||(a.add(z),ul(z,i))}let f=d.prototype;for(let _ in f)Object.prototype.hasOwnProperty.call(f,_)&&(_ in p||(p[_]=f[_].bind(p)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let g=o?.Parent?fw(l):this;c(g,p);let f=g._zod.deferred;if(f){for(let m of f)m();g._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(g),g}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>o?.Parent&&p instanceof o.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var qt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Oo=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ef=globalThis).__zod_globalConfig??(ef.__zod_globalConfig={});var vt=globalThis.__zod_globalConfig;function yt(e){return e&&Object.assign(vt,e),vt}function hw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ko,2)),e.message}function gw(e){this._zod.message=e}var _w={get:hw,set:gw,enumerable:!0,configurable:!0},ml={value:void 0,enumerable:!1},rf=new WeakSet([Object.prototype,Error.prototype]),of=(e,t)=>{e.name="$ZodError",ml.value=t,Object.defineProperty(e,"issues",ml),ml.value=void 0,Object.defineProperty(e,"message",_w);let r=Object.getPrototypeOf(e);rf.has(r)||(rf.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},nf=q("$ZodError",of),gI=q("$ZodError",of,void 0,{Parent:Error});function vw(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function fl(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?vw(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function hl(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return o(e),r}function Oi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ci=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new qt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Mt(u,i,yt())));throw Pi(c,s?.callee??t),c}return a.value};return t};var Ni=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Mt(u,i,yt())));throw Pi(c,s?.callee??t),c}return a.value};return t};var ji=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new qt;return s.issues.length?sf(e,s.issues,n):{success:!0,data:s.value}};function sf(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>Mt(n,r,yt()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var Ai=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?sf(e,s.issues,n):{success:!0,data:s.value}};var yw=Symbol.for("zod.compile.invalid"),Sw=Symbol.for("zod.compile.fallback"),gl=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==yw)return!0;if(o.definite===!0&&r===void 0)return!1}return bw(e,t,r)};function bw(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n?(o[Sw]=!0,s=n({value:t,issues:[]},o)):s=e._zod.run({value:t,issues:[]},o),s instanceof Promise)throw new qt;return s.issues.length===0}var _l=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},af=e=>{let t=Ci(e),r=(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,a,Oi(r,i))};return r};var cf=e=>{let t=Ci(e),r=(o,n,s,i)=>t(o,n,s,Oi(r,i));return r};var uf=e=>{let t=Ni(e),r=async(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,a,Oi(r,i))};return r};var lf=e=>{let t=Ni(e),r=async(o,n,s,i)=>await t(o,n,s,Oi(r,i));return r};var df=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ji(e)(t,r,n)};var pf=e=>(t,r,o)=>ji(e)(t,r,o);var mf=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ai(e)(t,r,n)};var ff=e=>async(t,r,o)=>Ai(e)(t,r,o);var hf=/^[cC][0-9a-z]{6,}$/,gf=/^[0-9a-z]+$/,_f=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,vf=/^[0-9a-vA-V]{20}$/,yf=/^[A-Za-z0-9]{27}$/,Sf=/^[a-zA-Z0-9_-]{21}$/;function bf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var zf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var $f=/^([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})$/,yl=e=>e?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})$`):/^([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)$/;var wf=/^(?:[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 zw="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Rf(){return new RegExp(zw,"u")}var Pf=/^(?:(?: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])$/,Ef=/^(([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 kf=/^((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])$/,xf=/^(([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])$/,Tf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,If=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Of=/^https?$/,Cf=/^\+[1-9]\d{6,14}$/;var Nf="(?:(?:\\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 $w(e){return new RegExp(`^${e}$`)}var jf=$w(Nf);function vl(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Af(e){return new RegExp(`^${vl(e)}$`)}function Mf(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${vl({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${vl({precision:e.precision})}`:r;return new RegExp(`^${Nf}T(?:${o})$`)}var qf=/^[\s\S]{0,}$/;var Zf=/^-?\d+n?$/,Sl=/^-?\d+$/,Hn=/^-?\d+(?:\.\d+)?$/,Lf=/^(?:true|false)$/i,Df=/^null$/i;var Uf=/^[^A-Z]*$/,Ff=/^[^a-z]*$/;var st=q("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var bl=e=>{let t=e.value;return!Qu(t)&&t.length!==void 0},Mi={number:"number",bigint:"bigint",object:"date"},zl=q("$ZodCheckLessThan",(e,t)=>{st.init(e,t);let r=Mi[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Mi[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$l=q("$ZodCheckGreaterThan",(e,t)=>{st.init(e,t);let r=Mi[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Mi[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vf=q("$ZodCheckMultipleOf",(e,t)=>{st.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):el(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Jf=q("$ZodCheckNumberFormat",(e,t)=>{st.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Un[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Hf=q("$ZodCheckMaxLength",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?Vn(n):s)<=t.maximum)return;let a=Jn(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Bf=q("$ZodCheckMinLength",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?Vn(n):s)>=t.minimum)return;let a=Jn(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Kf=q("$ZodCheckLengthEquals",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?Vn(n):s;if(i===t.length)return;let a=Jn(n),c=i>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Bn=q("$ZodCheckStringFormat",(e,t)=>{var r,o;st.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Gf=q("$ZodCheckRegex",(e,t)=>{Bn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wf=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Uf),Bn.init(e,t)}),Yf=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ff),Bn.init(e,t)}),Xf=q("$ZodCheckIncludes",(e,t)=>{st.init(e,t);let r=rr(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Qf=q("$ZodCheckStartsWith",(e,t)=>{st.init(e,t);let r=new RegExp(`^${rr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),eh=q("$ZodCheckEndsWith",(e,t)=>{st.init(e,t);let r=new RegExp(`.*${rr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var th=q("$ZodCheckOverwrite",(e,t)=>{st.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var qi=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
1
+ "use strict";var b0=Object.create;var zi=Object.defineProperty;var z0=Object.getOwnPropertyDescriptor;var $0=Object.getOwnPropertyNames;var w0=Object.getPrototypeOf,R0=Object.prototype.hasOwnProperty;var Ro=(e,t)=>{for(var r in t)zi(e,r,{get:t[r],enumerable:!0})},qm=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $0(t))!R0.call(e,n)&&n!==r&&zi(e,n,{get:()=>t[n],enumerable:!(o=z0(t,n))||o.enumerable});return e};var P0=(e,t,r)=>(r=e!=null?b0(w0(e)):{},qm(t||!e||!e.__esModule?zi(r,"default",{value:e,enumerable:!0}):r,e)),E0=e=>qm(zi({},"__esModule",{value:!0}),e);var uI={};Ro(uI,{ProtocolError:()=>Q,ProtocolErrorCode:()=>V,Server:()=>Ju,StdioServerTransport:()=>Am,createMcpHandler:()=>m0,hostHeaderValidationResponse:()=>h0,localhostAllowedHostnames:()=>f0,localhostAllowedOrigins:()=>g0,originValidationResponse:()=>_0,serveStdio:()=>y0});module.exports=E0(uI);var k0=Object.create,$i=Object.defineProperty,x0=Object.getOwnPropertyDescriptor,T0=Object.getOwnPropertyNames,I0=Object.getPrototypeOf,O0=Object.prototype.hasOwnProperty,U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Zm=(e,t)=>{let r={};for(var o in e)$i(r,o,{get:e[o],enumerable:!0});return t&&$i(r,Symbol.toStringTag,{value:"Module"}),r},C0=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=T0(t),s=0,i=n.length,a;s<i;s++)a=n[s],!O0.call(e,a)&&a!==r&&$i(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(o=x0(t,a))||o.enumerable});return e},wi=(e,t,r)=>(r=e!=null?k0(I0(e)):{},C0(t||!e||!e.__esModule?$i(r,"default",{value:e,enumerable:!0}):r,e));var N0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Lm=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),j0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),A0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Dm(e){return typeof e=="string"&&Lm.has(e.replace(/#$/,""))}function Um(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(N0.has(r))return"2020-12";if(Lm.has(r))return"2019-09";if(j0.has(r)||A0.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var ae={};Ro(ae,{BIGINT_FORMAT_RANGES:()=>ki,CONSTANT_CATCH:()=>Qm,Class:()=>Xu,NUMBER_FORMAT_RANGES:()=>Un,aborted:()=>At,allowsEval:()=>nl,assert:()=>D0,assertEqual:()=>M0,assertIs:()=>Z0,assertNever:()=>L0,assertNotEqual:()=>q0,assignProp:()=>$t,attachSchema:()=>Fn,base64ToUint8Array:()=>Ym,base64urlToUint8Array:()=>iw,cached:()=>xo,captureStackTrace:()=>Pi,cleanEnum:()=>sw,cleanRegex:()=>Dn,clone:()=>xt,cloneDef:()=>V0,codePointLength:()=>Vn,constantCatch:()=>ef,createTransparentProxy:()=>W0,defineLazy:()=>tl,defineLazyInternal:()=>Se,derived:()=>lw,esc:()=>rl,escapeRegex:()=>rr,explicitlyAborted:()=>al,extend:()=>Q0,finalizeIssue:()=>Mt,floatSafeRemainder:()=>el,getElementAtPath:()=>J0,getEnumValues:()=>Eo,getLengthableOrigin:()=>Jn,getParsedType:()=>G0,getSizableOrigin:()=>Wm,hexToUint8Array:()=>cw,hide:()=>Ii,installLazyProp:()=>fw,isObject:()=>Qr,isPlainObject:()=>Sr,issue:()=>Io,joinValues:()=>Ri,jsonStringifyReplacer:()=>ko,members:()=>ul,merge:()=>tw,mergeDefs:()=>tr,normalizeParams:()=>re,nullish:()=>Qu,numKeys:()=>K0,objectClone:()=>U0,omit:()=>X0,optionalKeys:()=>il,own:()=>yr,parsedType:()=>cl,partial:()=>rw,pick:()=>Y0,prefixIssues:()=>or,primitiveTypes:()=>Km,promiseAllObject:()=>H0,propertyKeyTypes:()=>sl,randomString:()=>B0,rawShape:()=>To,required:()=>ow,safeExtend:()=>ew,shallowClone:()=>Bm,sizeCaps:()=>Ti,slugify:()=>ol,stringifyPrimitive:()=>Ei,toZod:()=>Vm,uint8ArrayToBase64:()=>Xm,uint8ArrayToBase64url:()=>aw,uint8ArrayToHex:()=>uw,unwrapMessage:()=>Po});function M0(e){return e}function q0(e){return e}function Vm(){return e=>e}function Z0(e){}function L0(e){throw new Error("Unexpected value in exhaustive check")}function D0(e){}function Eo(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Ri(e,t="|"){return e.map(r=>Ei(r)).join(t)}function ko(e,t){return typeof t=="bigint"?t.toString():t}var Yu=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function xo(e){return new Yu(e)}function Qu(e){return e==null}function Dn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function el(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Fm=Symbol("evaluating");function tl(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Fm)return o===void 0&&(o=Fm,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function U0(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function $t(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function To(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function er(e){return To(e._zod.def)??e._zod.def.shape}function Jm(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return $t(this,t,o),o},enumerable:!0,configurable:!0})}function Hm(e,t,r){t in e?$t(e,t,r):e[t]=r}function Xr(e,t,r,o){let n=er(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);i.enumerable&&(i.get?Jm(e,s,()=>{let a=t._zod.def.shape[s];return o?o(a,s):a}):Hm(e,s,o?o(i.value,s):i.value))}}function F0(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?Jm(e,r,()=>t[r]):Hm(e,r,o.value))}}function tr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function V0(e){return tr(e._zod.def)}function J0(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function H0(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function B0(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function rl(e){return JSON.stringify(e)}function ol(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Pi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var nl=xo(()=>{if(vt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Sr(e){if(Qr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Qr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Bm(e){return Sr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function K0(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var G0=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},sl=new Set(["string","number","symbol"]),Km=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xt(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function re(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function W0(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Ei(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function il(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Un={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ki={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Y0(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Xr(s,e,xi(e,t)),xt(e,tr(r,{shape:s,checks:[]}))}function xi(e,t){let r=er(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function X0(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(xi(e,t)),i={};return Xr(i,e,Reflect.ownKeys(er(e)).filter(a=>!s.has(a))),xt(e,tr(r,{shape:i,checks:[]}))}function Q0(e,t){if(!Sr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=er(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xt(e,tr(e._zod.def,{shape:Gm(e,t)}))}function Gm(e,t){let r={};return Xr(r,e,Reflect.ownKeys(er(e))),F0(r,t),r}function ew(e,t){if(!Sr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return xt(e,tr(e._zod.def,{shape:Gm(e,t)}))}function tw(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Xr(r,e,Reflect.ownKeys(er(e))),Xr(r,t,Reflect.ownKeys(er(t)));let o=tr(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xt(e,o)}function rw(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(xi(t,r)):void 0,c={};return Xr(c,t,Reflect.ownKeys(er(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),xt(t,tr(t._zod.def,{shape:c,checks:[]}))}function ow(e,t,r){let o=r?new Set(xi(t,r)):void 0,n={};return Xr(n,t,Reflect.ownKeys(er(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),xt(t,tr(t._zod.def,{shape:n}))}function At(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 al(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 or(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Po(e){return typeof e=="string"?e:e?.message}function Ti(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&t.push([n,r])}return t}function Fn(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function Mt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Po(e.inst?._zod.def?.error?.(e))??Po(s?.(e))??Po(t?.error?.(e))??Po(r.customError?.(e))??Po(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function Wm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var nw=/[\uD800-\uDBFF]/;function Vn(e){let t=e.length;if(!nw.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Jn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function cl(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 Io(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function sw(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ym(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Xm(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function iw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Ym(t+r)}function aw(e){return Xm(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function cw(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function uw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Xu=class{constructor(...t){}};function ul(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):dw(e,r,o.value)}}function yr(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ii(e,t,r){return yr(e,t,r,!1)}function lw(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return yr(this,r,o(this))},set(n){yr(this,r,n)}})}return t}function dw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:yr(this,t,r.bind(this))},set(o){yr(this,t,o)}})}function pw(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Wu,vr=!1,mw={configurable:!0,get(){vr=!0}};function Se(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&Wu!==e._zod){Wu=void 0;return}Wu=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,mw);let n=vr;vr=!1;try{let s=r(this);return vr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),vr=vr||n,s}catch(s){throw delete this[t],vr=vr||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function fw(e,t,r,o){let n=pw(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var Qm="~constantCatch";function ef(e){let t=()=>e;return t[Qm]=!0,t}var tf,dl=Object.freeze({status:"aborted"}),ll={value:void 0,enumerable:!1},rf="captureStackTrace"in Error?Error:null;function hw(e){let t=rf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return rf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function q(e,t,r,o){let n={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=n;let i=r,a=i&&new WeakSet;function c(p,g){if(p._zod){if(p._zod.traits.has(e))return}else{ll.value=new s(g);try{Object.defineProperty(p,"_zod",ll)}finally{ll.value=void 0}}if(p._zod.traits.add(e),t(p,g),a){let _=Object.getPrototypeOf(p),m=p._zod.constr.prototype,h=_;for(;h&&h!==m;)h=Object.getPrototypeOf(h);let z=h??_;a.has(z)||(a.add(z),ul(z,i))}let f=d.prototype;for(let _ in f)Object.prototype.hasOwnProperty.call(f,_)&&(_ in p||(p[_]=f[_].bind(p)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let g=o?.Parent?hw(l):this;c(g,p);let f=g._zod.deferred;if(f){for(let m of f)m();g._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(g),g}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>o?.Parent&&p instanceof o.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var qt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Oo=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(tf=globalThis).__zod_globalConfig??(tf.__zod_globalConfig={});var vt=globalThis.__zod_globalConfig;function yt(e){return e&&Object.assign(vt,e),vt}function gw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ko,2)),e.message}function _w(e){this._zod.message=e}var vw={get:gw,set:_w,enumerable:!0,configurable:!0},ml={value:void 0,enumerable:!1},of=new WeakSet([Object.prototype,Error.prototype]),nf=(e,t)=>{e.name="$ZodError",ml.value=t,Object.defineProperty(e,"issues",ml),ml.value=void 0,Object.defineProperty(e,"message",vw);let r=Object.getPrototypeOf(e);of.has(r)||(of.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},sf=q("$ZodError",nf),gI=q("$ZodError",nf,void 0,{Parent:Error});function yw(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function fl(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?yw(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function hl(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return o(e),r}function Oi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ci=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new qt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Mt(u,i,yt())));throw Pi(c,s?.callee??t),c}return a.value};return t};var Ni=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Mt(u,i,yt())));throw Pi(c,s?.callee??t),c}return a.value};return t};var ji=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new qt;return s.issues.length?af(e,s.issues,n):{success:!0,data:s.value}};function af(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>Mt(n,r,yt()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var Ai=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?af(e,s.issues,n):{success:!0,data:s.value}};var Sw=Symbol.for("zod.compile.invalid"),bw=Symbol.for("zod.compile.fallback"),gl=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Sw)return!0;if(o.definite===!0&&r===void 0)return!1}return zw(e,t,r)};function zw(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n?(o[bw]=!0,s=n({value:t,issues:[]},o)):s=e._zod.run({value:t,issues:[]},o),s instanceof Promise)throw new qt;return s.issues.length===0}var _l=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},cf=e=>{let t=Ci(e),r=(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,a,Oi(r,i))};return r};var uf=e=>{let t=Ci(e),r=(o,n,s,i)=>t(o,n,s,Oi(r,i));return r};var lf=e=>{let t=Ni(e),r=async(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,a,Oi(r,i))};return r};var df=e=>{let t=Ni(e),r=async(o,n,s,i)=>await t(o,n,s,Oi(r,i));return r};var pf=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ji(e)(t,r,n)};var mf=e=>(t,r,o)=>ji(e)(t,r,o);var ff=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ai(e)(t,r,n)};var hf=e=>async(t,r,o)=>Ai(e)(t,r,o);var gf=/^[cC][0-9a-z]{6,}$/,_f=/^[0-9a-z]+$/,vf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yf=/^[0-9a-vA-V]{20}$/,Sf=/^[A-Za-z0-9]{27}$/,bf=/^[a-zA-Z0-9_-]{21}$/;function zf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var $f=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wf=/^([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})$/,yl=e=>e?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})$`):/^([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)$/;var Rf=/^(?:[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 $w="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Pf(){return new RegExp($w,"u")}var Ef=/^(?:(?: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])$/,kf=/^(([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 xf=/^((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])$/,Tf=/^(([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])$/,If=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Of=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Cf=/^https?$/,Nf=/^\+[1-9]\d{6,14}$/;var jf="(?:(?:\\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 ww(e){return new RegExp(`^${e}$`)}var Af=ww(jf);function vl(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Mf(e){return new RegExp(`^${vl(e)}$`)}function qf(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${vl({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${vl({precision:e.precision})}`:r;return new RegExp(`^${jf}T(?:${o})$`)}var Zf=/^[\s\S]{0,}$/;var Lf=/^-?\d+n?$/,Sl=/^-?\d+$/,Hn=/^-?\d+(?:\.\d+)?$/,Df=/^(?:true|false)$/i,Uf=/^null$/i;var Ff=/^[^A-Z]*$/,Vf=/^[^a-z]*$/;var st=q("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var bl=e=>{let t=e.value;return!Qu(t)&&t.length!==void 0},Mi={number:"number",bigint:"bigint",object:"date"},zl=q("$ZodCheckLessThan",(e,t)=>{st.init(e,t);let r=Mi[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Mi[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$l=q("$ZodCheckGreaterThan",(e,t)=>{st.init(e,t);let r=Mi[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Mi[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jf=q("$ZodCheckMultipleOf",(e,t)=>{st.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):el(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Hf=q("$ZodCheckNumberFormat",(e,t)=>{st.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Un[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Bf=q("$ZodCheckMaxLength",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?Vn(n):s)<=t.maximum)return;let a=Jn(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Kf=q("$ZodCheckMinLength",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?Vn(n):s)>=t.minimum)return;let a=Jn(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Gf=q("$ZodCheckLengthEquals",(e,t)=>{var r;st.init(e,t),(r=e._zod.def).when??(r.when=bl),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?Vn(n):s;if(i===t.length)return;let a=Jn(n),c=i>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Bn=q("$ZodCheckStringFormat",(e,t)=>{var r,o;st.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Wf=q("$ZodCheckRegex",(e,t)=>{Bn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yf=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ff),Bn.init(e,t)}),Xf=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vf),Bn.init(e,t)}),Qf=q("$ZodCheckIncludes",(e,t)=>{st.init(e,t);let r=rr(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),eh=q("$ZodCheckStartsWith",(e,t)=>{st.init(e,t);let r=new RegExp(`^${rr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),th=q("$ZodCheckEndsWith",(e,t)=>{st.init(e,t);let r=new RegExp(`.*${rr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var rh=q("$ZodCheckOverwrite",(e,t)=>{st.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var qi=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
2
2
  `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
3
3
  ${r.join(`
4
4
  `)}
5
- };`)(...Object.values(this.closed))}};var oh={major:4,minor:6,patch:7};var ke=q("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=oh;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=At(a),d;for(let p of c){if(p._zod.def.when){if(al(a)||!p._zod.def.when(a))continue}else if(l)continue;let g=a.issues.length,f=p._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new qt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==g&&(Fn(a.issues,g,e),l||(l=At(a,g)))});else{if(a.issues.length===g)continue;Fn(a.issues,g,e),l||(l=At(a,g))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(At(a))return a.aborted=!0,a;let l=s(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new qt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new qt;return u.then(l=>s(l,n,c))}return s(u,n,c)}}},{get"~standard"(){return Ii(this,"~standard",Rl(this))},set"~standard"(e){yr(this,"~standard",e)}}),fh=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Mt(r,t,yt()))}:{value:e.value};async function ww(e,t){let r={async:!0};return fh(await e._zod.run({value:t,issues:[]},r),r)}function Rl(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return fh(o,r)}catch{}return ww(e,t)},vendor:"zod",version:1}}var Ui=q("$ZodString",(e,t)=>{ke.init(e,t),e._zod.pattern=t.pattern??qf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),je=q("$ZodStringFormat",(e,t)=>{Bn.init(e,t),Ui.init(e,t)}),hh=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$f),je.init(e,t)}),gh=q("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yl(o))}else t.pattern??(t.pattern=yl());je.init(e,t)}),_h=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wf),je.init(e,t)}),vh=1,Li=2;function yh(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Rw(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?yh(e)||Li:Pw(e,t)}function Pw(e,t){if(!t.normalize&&t.protocol?.source===Of.source&&!/^https?:\/\//i.test(e))return vh;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Li}return new URL(e)}catch{return Li}}var Ew=/[\t\n\r]/g;function nh(e){return e.replace(Ew,"")}function kw(e,t){return t.lastIndex=0,t.test(e.hostname)}function xw(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Sh=q("$ZodURL",(e,t)=>{je.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=Rw(o,t);if(n===vh){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Li){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=nh(o);return}t.hostname&&!kw(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!xw(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:nh(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),bh=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rf()),je.init(e,t)}),zh=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Sf:bf(t.length)),je.init(e,t)}),$h=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hf),je.init(e,t)}),wh=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gf),je.init(e,t)}),Rh=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_f),je.init(e,t)}),Ph=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vf),je.init(e,t)}),Eh=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yf),je.init(e,t)}),kh=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Mf(t)),je.init(e,t)}),xh=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jf),je.init(e,t)}),Th=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Af(t)),je.init(e,t)}),Ih=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=zf),je.init(e,t)}),Oh=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pf),je.init(e,t)}),Tw=/^[0-9a-fA-F:.]+$/;function Ch(e){return Tw.test(e)?yh(`http://[${e}]`):!1}var Nh=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ef),je.init(e,t),e._zod.check=r=>{Ch(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var jh=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kf),je.init(e,t)});function Iw(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Ch(r)}var Ah=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=xf),je.init(e,t),e._zod.check=r=>{Iw(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Mh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Pl=/^[0-9a-zA-Z+/]*={0,2}$/,qh=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pl),je.init(e,t),e._zod.check=r=>{Mh(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Fi=/^[A-Za-z0-9_-]*$/;function Ow(e){if(!Fi.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mh(r)}var Zh=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fi),je.init(e,t),e._zod.check=r=>{Ow(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Lh=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cf),je.init(e,t)});function Cw(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Dh=q("$ZodJWT",(e,t)=>{je.init(e,t),e._zod.check=r=>{Cw(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var El=q("$ZodNumber",(e,t)=>{ke.init(e,t),e._zod.pattern=Hn,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Uh=q("$ZodNumberFormat",(e,t)=>{Jf.init(e,t),El.init(e,t)}),Fh=q("$ZodBoolean",(e,t)=>{ke.init(e,t),e._zod.pattern=Lf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Vh=q("$ZodBigInt",(e,t)=>{ke.init(e,t),e._zod.pattern=Zf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Jh=q("$ZodNull",(e,t)=>{ke.init(e,t),e._zod.pattern=Df,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Hh=q("$ZodAny",(e,t)=>{ke.init(e,t),e._zod.parse=r=>r}),Bh=q("$ZodUnknown",(e,t)=>{ke.init(e,t),e._zod.parse=r=>r}),Kh=q("$ZodNever",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Gh=q("$ZodDate",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Nw(e,t){let r=Ti(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map(s=>s[0])),n=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>o&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Ti(e._zod.def.checks))if(a>c&&u._zod.def.when(s)){let l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Fn(s.issues,l,e),s}}return n(s,i)}}var jw=e=>Array.isArray(e)?e.length:-1;function sh(e,t,r){e.issues.length&&t.issues.push(...or(r,e.issues)),t.value[r]=e.value}var Wh=q("$ZodArray",(e,t)=>{ke.init(e,t);let r=vt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],a=n?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)i.push(l.then(d=>sh(d,o,c)));else if(sh(l,o,c),a&&l.issues.length!==0&&At(l))break}return i.length?Promise.all(i).then(()=>o):o},Nw(e,jw)});function Di(e,t,r,o,n,s){let i=r in o,a=s==="optional";if(!(!i&&a&&n==="optional")){if(e.issues.length){if(n!==void 0&&a&&!i)return;t.issues.push(...or(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||n==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var Aw=[];function Yh(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Aw,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=il(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Xh(e,t,r,o,n,s,i){let a=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,g=0;for(let f in t){if(i&&r.issues.length!==g){if(At(r,g))break;g=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){l==="never"&&a.push(f);continue}if(l==="never"){a.push(f);continue}let _=u.run({value:t[f],issues:[]},o);_ instanceof Promise?e.push(_.then(m=>Di(m,r,f,t,d,p))):Di(_,r,f,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Mw=q("$ZodObject",(e,t)=>{ke.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=xo(()=>Yh(t));Se(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let g=l[p]._zod;if(g.values){Object.prototype.hasOwnProperty.call(d,p)||$t(d,p,new Set);for(let f of g.values)d[p].add(f);g.optin!==void 0&&d[p].add(void 0)}}return d});let s=Qr,i=t.catchall,a,c=vt.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=n.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],g=a.shape,f=l?.abortEarly,_=u.issues.length;for(let m of a.allKeys){if(f&&u.issues.length!==_){if(At(u,_))break;_=u.issues.length}if(m==="__proto__")continue;let h=g[m],z=h._zod.optin,v=h._zod.optout,S=h._zod.run({value:d[m],issues:[]},l);S instanceof Promise?p.push(S.then(R=>Di(R,u,m,d,z,v))):Di(S,u,m,d,z,v)}return i?Xh(p,d,u,l,n.value,e,f===!0):p.length?Promise.all(p).then(()=>u):u}}),Qh=q("$ZodObjectJIT",(e,t)=>{Mw.init(e,t);let r=e._zod.parse,o=xo(()=>Yh(t)),n=vt.memoizer,s=g=>{let f=o.value,_=f.symbolKeys,m=new qi(["payload","ctx"],{shape:g,inst:e,memo:n,syms:_}),h=R=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,z=(R,b)=>`
5
+ };`)(...Object.values(this.closed))}};var nh={major:4,minor:6,patch:7};var ke=q("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=nh;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=At(a),d;for(let p of c){if(p._zod.def.when){if(al(a)||!p._zod.def.when(a))continue}else if(l)continue;let g=a.issues.length,f=p._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new qt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==g&&(Fn(a.issues,g,e),l||(l=At(a,g)))});else{if(a.issues.length===g)continue;Fn(a.issues,g,e),l||(l=At(a,g))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(At(a))return a.aborted=!0,a;let l=s(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new qt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new qt;return u.then(l=>s(l,n,c))}return s(u,n,c)}}},{get"~standard"(){return Ii(this,"~standard",Rl(this))},set"~standard"(e){yr(this,"~standard",e)}}),hh=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Mt(r,t,yt()))}:{value:e.value};async function Rw(e,t){let r={async:!0};return hh(await e._zod.run({value:t,issues:[]},r),r)}function Rl(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return hh(o,r)}catch{}return Rw(e,t)},vendor:"zod",version:1}}var Ui=q("$ZodString",(e,t)=>{ke.init(e,t),e._zod.pattern=t.pattern??Zf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),je=q("$ZodStringFormat",(e,t)=>{Bn.init(e,t),Ui.init(e,t)}),gh=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wf),je.init(e,t)}),_h=q("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yl(o))}else t.pattern??(t.pattern=yl());je.init(e,t)}),vh=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Rf),je.init(e,t)}),yh=1,Li=2;function Sh(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Pw(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Sh(e)||Li:Ew(e,t)}function Ew(e,t){if(!t.normalize&&t.protocol?.source===Cf.source&&!/^https?:\/\//i.test(e))return yh;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Li}return new URL(e)}catch{return Li}}var kw=/[\t\n\r]/g;function sh(e){return e.replace(kw,"")}function xw(e,t){return t.lastIndex=0,t.test(e.hostname)}function Tw(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var bh=q("$ZodURL",(e,t)=>{je.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=Pw(o,t);if(n===yh){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Li){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=sh(o);return}t.hostname&&!xw(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Tw(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:sh(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),zh=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Pf()),je.init(e,t)}),$h=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?bf:zf(t.length)),je.init(e,t)}),wh=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gf),je.init(e,t)}),Rh=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_f),je.init(e,t)}),Ph=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=vf),je.init(e,t)}),Eh=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yf),je.init(e,t)}),kh=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Sf),je.init(e,t)}),xh=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qf(t)),je.init(e,t)}),Th=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Af),je.init(e,t)}),Ih=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Mf(t)),je.init(e,t)}),Oh=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$f),je.init(e,t)}),Ch=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ef),je.init(e,t)}),Iw=/^[0-9a-fA-F:.]+$/;function Nh(e){return Iw.test(e)?Sh(`http://[${e}]`):!1}var jh=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=kf),je.init(e,t),e._zod.check=r=>{Nh(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ah=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xf),je.init(e,t)});function Ow(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Nh(r)}var Mh=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Tf),je.init(e,t),e._zod.check=r=>{Ow(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function qh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Pl=/^[0-9a-zA-Z+/]*={0,2}$/,Zh=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pl),je.init(e,t),e._zod.check=r=>{qh(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Fi=/^[A-Za-z0-9_-]*$/;function Cw(e){if(!Fi.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qh(r)}var Lh=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fi),je.init(e,t),e._zod.check=r=>{Cw(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Dh=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nf),je.init(e,t)});function Nw(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Uh=q("$ZodJWT",(e,t)=>{je.init(e,t),e._zod.check=r=>{Nw(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var El=q("$ZodNumber",(e,t)=>{ke.init(e,t),e._zod.pattern=Hn,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Fh=q("$ZodNumberFormat",(e,t)=>{Hf.init(e,t),El.init(e,t)}),Vh=q("$ZodBoolean",(e,t)=>{ke.init(e,t),e._zod.pattern=Df,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Jh=q("$ZodBigInt",(e,t)=>{ke.init(e,t),e._zod.pattern=Lf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Hh=q("$ZodNull",(e,t)=>{ke.init(e,t),e._zod.pattern=Uf,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Bh=q("$ZodAny",(e,t)=>{ke.init(e,t),e._zod.parse=r=>r}),Kh=q("$ZodUnknown",(e,t)=>{ke.init(e,t),e._zod.parse=r=>r}),Gh=q("$ZodNever",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Wh=q("$ZodDate",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function jw(e,t){let r=Ti(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map(s=>s[0])),n=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>o&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Ti(e._zod.def.checks))if(a>c&&u._zod.def.when(s)){let l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Fn(s.issues,l,e),s}}return n(s,i)}}var Aw=e=>Array.isArray(e)?e.length:-1;function ih(e,t,r){e.issues.length&&t.issues.push(...or(r,e.issues)),t.value[r]=e.value}var Yh=q("$ZodArray",(e,t)=>{ke.init(e,t);let r=vt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],a=n?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)i.push(l.then(d=>ih(d,o,c)));else if(ih(l,o,c),a&&l.issues.length!==0&&At(l))break}return i.length?Promise.all(i).then(()=>o):o},jw(e,Aw)});function Di(e,t,r,o,n,s){let i=r in o,a=s==="optional";if(!(!i&&a&&n==="optional")){if(e.issues.length){if(n!==void 0&&a&&!i)return;t.issues.push(...or(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||n==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var Mw=[];function Xh(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Mw,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=il(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Qh(e,t,r,o,n,s,i){let a=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,g=0;for(let f in t){if(i&&r.issues.length!==g){if(At(r,g))break;g=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){l==="never"&&a.push(f);continue}if(l==="never"){a.push(f);continue}let _=u.run({value:t[f],issues:[]},o);_ instanceof Promise?e.push(_.then(m=>Di(m,r,f,t,d,p))):Di(_,r,f,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var qw=q("$ZodObject",(e,t)=>{ke.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=xo(()=>Xh(t));Se(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let g=l[p]._zod;if(g.values){Object.prototype.hasOwnProperty.call(d,p)||$t(d,p,new Set);for(let f of g.values)d[p].add(f);g.optin!==void 0&&d[p].add(void 0)}}return d});let s=Qr,i=t.catchall,a,c=vt.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=n.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],g=a.shape,f=l?.abortEarly,_=u.issues.length;for(let m of a.allKeys){if(f&&u.issues.length!==_){if(At(u,_))break;_=u.issues.length}if(m==="__proto__")continue;let h=g[m],z=h._zod.optin,v=h._zod.optout,S=h._zod.run({value:d[m],issues:[]},l);S instanceof Promise?p.push(S.then(R=>Di(R,u,m,d,z,v))):Di(S,u,m,d,z,v)}return i?Qh(p,d,u,l,n.value,e,f===!0):p.length?Promise.all(p).then(()=>u):u}}),eg=q("$ZodObjectJIT",(e,t)=>{qw.init(e,t);let r=e._zod.parse,o=xo(()=>Xh(t)),n=vt.memoizer,s=g=>{let f=o.value,_=f.symbolKeys,m=new qi(["payload","ctx"],{shape:g,inst:e,memo:n,syms:_}),h=R=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,z=(R,b)=>`
6
6
  let ${R}_ab = false;
7
7
  for (let i = 0; i < ${R}.issues.length; i++) {
8
8
  const iss = ${R}.issues[i];
@@ -52,11 +52,11 @@ ${r.join(`
52
52
  newResult[${y}] = ${b}.value;
53
53
  }
54
54
 
55
- `)}return m.write("payload.value = newResult;"),m.write("return payload;"),m.compile()},i,a=Qr,c=!vt.jitless,l=c&&nl.value,d=t.catchall,p;e._zod.parse=(g,f)=>{p??(p=o.value);let _=g.value;return a(_)?c&&l&&f?.async===!1&&f.jitless!==!0?(i||(i=s(t.shape)),g=i(g,f),d?Xh([],_,g,f,p,e,f?.abortEarly===!0):g):r(g,f):(g.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),g)}});function ih(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!At(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Mt(i,o,yt())))}),t)}var kl=q("$ZodUnion",(e,t)=>{ke.init(e,t),Se(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),Se(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Se(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),Se(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Dn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ih(a,o,e,n)):ih(i,o,e,n)}});function qw(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var eg=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kl.init(e,t);let r=e._zod.parse;Se(e,"propValues",n=>{let s={},i=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);c[n.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||$t(s,u,new Set);for(let d of l)s[u].add(d)}}return!n.def.unionFallback&&i>1&&s[n.def.discriminator]?.delete(void 0),s}),t.options.forEach((n,s)=>{let i=To(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=xo(()=>qw(t));e._zod.parse=(n,s)=>{let i=n.value;if(!Qr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=i?.[t.discriminator],c=o.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(u=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n)}}),tg=q("$ZodIntersection",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ah(r,c,u)):ah(r,s,i)}});function wl(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(Sr(e)&&Sr(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=wl(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=wl(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ah(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)o.has(p)||o.set(p,{}),o.get(p)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let a=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=n?a.filter(l=>n.keys.includes(l)):[];u.length&&e.issues.push({...n,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=wl(t.value,r.value);if(!c.valid){if(At(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var rg=q("$ZodRecord",(e,t)=>{ke.init(e,t);let r=vt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Sr(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Mt(f,n,yt())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:s[l],issues:[]},n);g instanceof Promise?i.push(g.then(f=>{f.issues.length&&o.issues.push(...or(l,f.issues)),o.value[p]=f.value})):(g.issues.length&&o.issues.push(...or(l,g.issues)),o.value[p]=g.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Hn.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},n);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode==="loose"?o.value[u]=s[u]:a?(c=c??[],c.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Mt(f,n,yt())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:s[u],issues:[]},n);g instanceof Promise?i.push(g.then(f=>{f.issues.length&&o.issues.push(...or(u,f.issues)),o.value[p]=f.value})):(g.issues.length&&o.issues.push(...or(u,g.issues)),o.value[p]=g.value)}c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var og=q("$ZodEnum",(e,t)=>{ke.init(e,t);let r=Eo(t.entries),o=new Set(r);e._zod.values=o,Se(e,"pattern",n=>{let s=Eo(n.def.entries).filter(i=>sl.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>rr(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),ng=q("$ZodLiteral",(e,t)=>{ke.init(e,t);let r=new Set(t.values);e._zod.values=r,Se(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(s=>typeof s=="string"?rr(s):s?rr(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var sg=q("$ZodTransform",(e,t)=>{ke.init(e,t),e._zod.optin="optional",vt.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Oo(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new qt;return r.value=n,r}});function ch(e,t){return e.value=t.issues.length?void 0:t.value,e}var xl=q("$ZodOptional",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Se(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),Se(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Dn(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>ch(r,s)):ch(r,n)}return t.innerType._zod.run(r,o)}}),ig=q("$ZodExactOptional",(e,t)=>{xl.init(e,t),Se(e,"values",r=>r.def.innerType._zod.values),Se(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ag=q("$ZodNullable",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin),Se(e,"optout",r=>r.def.innerType._zod.optout),Se(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Dn(o.source)}|null)$`):void 0}),Se(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),cg=q("$ZodDefault",(e,t)=>{ke.init(e,t),e._zod.optin="defaulted",Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>uh(s,t)):uh(n,t)}});function uh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ug=q("$ZodPrefault",(e,t)=>{ke.init(e,t),e._zod.optin="defaulted",Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),lg=q("$ZodNonOptional",(e,t)=>{ke.init(e,t),Se(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>lh(s,e)):lh(n,e)}});function lh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function dh(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>Mt(n,o,yt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var dg=q("$ZodCatch",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Se(e,"optout",r=>r.def.innerType._zod.optout),Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>dh(r,s,t,o)):dh(r,n,t,o)}});var Tl=q("$ZodPipe",(e,t)=>{ke.init(e,t),Se(e,"values",r=>r.def.in._zod.values),Se(e,"optin",r=>r.def.in._zod.optin),Se(e,"optout",r=>r.def.out._zod.optout),Se(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Zi(i,t.in,o)):Zi(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Zi(s,t.out,o)):Zi(n,t.out,o)}});function Zi(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var pg=q("$ZodPreprocess",(e,t)=>{Tl.init(e,t)}),mg=q("$ZodReadonly",(e,t)=>{ke.init(e,t),Se(e,"propValues",r=>r.def.innerType._zod.propValues),Se(e,"values",r=>r.def.innerType._zod.values),Se(e,"optin",r=>r.def.innerType?._zod?.optin),Se(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(ph):ph(n)}});function ph(e){return e.memo||(e.value=Object.freeze(e.value)),e}var fg=q("$ZodLazy",(e,t)=>{ke.init(e,t),tl(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),Se(e,"pattern",r=>r.innerType?._zod?.pattern),Se(e,"propValues",r=>r.innerType?._zod?.propValues),Se(e,"optin",r=>r.innerType?._zod?.optin??void 0),Se(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),hg=q("$ZodCustom",(e,t)=>{st.init(e,t),ke.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>mh(s,r,o,e));mh(n,r,o,e)}});function mh(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Io(n))}}var Ol=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Cl="~memo",gg=[];function _g(e){return e!==null&&typeof e=="object"}function Il(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var vg=new WeakMap,Kn=0,Hi=1,Gn=2;function Bi(e,t,r){let o=vg.get(e);if(o!==void 0)return o?Gn:Kn;if(t.has(e))return Gn;t.add(e);let n=Kn,s=l=>{if(n!==Gn&&l?._zod){let d=Bi(l,t,r);d>n&&(n=d)}},i=(l,d)=>{let p=Kn;for(let g of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,g);if(d&&!f.enumerable)continue;let _=f.get?Hi:f.value?._zod?Bi(f.value,t,r):Kn;_>p&&(p=_)}return p},a=l=>{l>n&&(n=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=To(c);a(l?i(l,!0):Hi),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Bi(l,t,!1):Hi);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 c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let g of p)s(g)}}}return t.delete(e),Zw(e,n)}function Zw(e,t){return t!==Hi&&vg.set(e,t===Gn),t}function Lw(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Vi,Ji=[],Dw={alloc(e,t,r){let o=Vi;if(!o)return r;Vi=void 0;let n={value:r,issues:null};return o.set(t.value,n),Ji.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&Uw(s,n.value))throw new Ol;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let h=Bi(e,new Set,!1);if(h===Kn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);h===Gn||o?r=!0:o=!0}let l=c.value;if(!_g(l))return i(c,u);let d=u[Cl];d||(d={buckets:new WeakMap,backEdges:void 0},u[Cl]=d);let p;n===u?p=s:(p=Lw(d,e),n=u,s=p);let g=p.get(l);if(g)return c.value=g.value,g.issues?g.issues.length&&c.issues.push(...Il(g.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(g.value)),c;Vi=p;let f=Ji.length,_=i(c,u);Vi=void 0;let m=Ji.length>f?Ji.pop():void 0;return _ instanceof Promise?_.then(h=>(m&&(m.issues=h.issues.length?Il(h.issues):gg),h)):(m&&(m.issues=_.issues.length?Il(_.issues):gg),_)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function Nl(){return Dw}function Uw(e,t){let r=e[Cl]?.backEdges;return r!==void 0&&_g(t)&&r.has(t)}var Fw=()=>{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(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),a=cl(s.input),c=n(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${Ei(s.values[0])}`:`Invalid option: expected one of ${Ri(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ri(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function yg(){return{localeError:Fw()}}var Sg;var jl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function bg(){return new jl}(Sg=globalThis).__zod_globalRegistry??(Sg.__zod_globalRegistry=bg());var br=globalThis.__zod_globalRegistry;function Ki(e){return e.checks&&(e.checks=[...e.checks]),e}function zg(e,t){return new e(Ki({type:"string",...re(t)}))}function $g(e,t){return new e(Ki({type:"string",coerce:!0,...re(t)}))}function wg(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function Rg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function Pg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function Eg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function kg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function xg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function Al(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Tg(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Ig(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Og(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Cg(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function Ng(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function jg(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function Ag(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function Mg(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function qg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function Zg(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function Lg(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function Dg(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function Ug(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function Fg(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function Vg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function Gi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function Wi(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function Yi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function Xi(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function Jg(e,t){return new e(Ki({type:"number",checks:[],...re(t)}))}function Hg(e,t){return new e(Ki({type:"number",coerce:!0,checks:[],...re(t)}))}function Bg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function Kg(e,t){return new e({type:"boolean",...re(t)})}function Gg(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function Wg(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function Yg(e,t){return new e({type:"null",...re(t)})}function Xg(e){return new e({type:"any"})}function Qg(e){return new e({type:"unknown"})}function e_(e,t){return new e({type:"never",...re(t)})}function t_(e,t){return new e({type:"date",coerce:!0,...re(t)})}function No(e,t){return new zl({check:"less_than",...re(t),value:e,inclusive:!1})}function nr(e,t){return new zl({check:"less_than",...re(t),value:e,inclusive:!0})}function jo(e,t){return new $l({check:"greater_than",...re(t),value:e,inclusive:!1})}function sr(e,t){return new $l({check:"greater_than",...re(t),value:e,inclusive:!0})}function Wn(e,t){return new Vf({check:"multiple_of",...re(t),value:e})}function Qi(e,t){return new Hf({check:"max_length",...re(t),maximum:e})}function Ao(e,t){return new Bf({check:"min_length",...re(t),minimum:e})}function ea(e,t){return new Kf({check:"length_equals",...re(t),length:e})}function Ml(e,t){return new Gf({check:"string_format",format:"regex",...re(t),pattern:e})}function ql(e){return new Wf({check:"string_format",format:"lowercase",...re(e)})}function Zl(e){return new Yf({check:"string_format",format:"uppercase",...re(e)})}function Ll(e,t){return new Xf({check:"string_format",format:"includes",...re(t),includes:e})}function Dl(e,t){return new Qf({check:"string_format",format:"starts_with",...re(t),prefix:e})}function Ul(e,t){return new eh({check:"string_format",format:"ends_with",...re(t),suffix:e})}function zr(e){return new th({check:"overwrite",tx:e})}function Fl(e){return zr(t=>t.normalize(e))}function Vl(){return zr(e=>e.trim())}function Jl(){return zr(e=>e.toLowerCase())}function Hl(){return zr(e=>e.toUpperCase())}function Bl(){return zr(e=>ol(e))}function r_(e,t,r){return new e({type:"array",element:t,...re(r)})}function o_(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function n_(e,t){let r=Vw(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Io(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Io(s))}},e(o.value,o)),t);return r}function Vw(e,t){let r=new st({check:"custom",...re(t)});return r._zod.check=e,r}function Yn(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&$t(e,o,r[o]);return e}function Gl(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??br,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 Zt(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function Je(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,g=t.processors[n.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);g(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Je(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Yn(i.schema,c),t.io==="input"&&ft(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function s_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wl(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(f=>f);if(d)return{ref:p(d)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${p("__shared")}#/${a}/${s_(g)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+s_(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
55
+ `)}return m.write("payload.value = newResult;"),m.write("return payload;"),m.compile()},i,a=Qr,c=!vt.jitless,l=c&&nl.value,d=t.catchall,p;e._zod.parse=(g,f)=>{p??(p=o.value);let _=g.value;return a(_)?c&&l&&f?.async===!1&&f.jitless!==!0?(i||(i=s(t.shape)),g=i(g,f),d?Qh([],_,g,f,p,e,f?.abortEarly===!0):g):r(g,f):(g.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),g)}});function ah(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!At(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Mt(i,o,yt())))}),t)}var kl=q("$ZodUnion",(e,t)=>{ke.init(e,t),Se(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),Se(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Se(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),Se(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Dn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ah(a,o,e,n)):ah(i,o,e,n)}});function Zw(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var tg=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kl.init(e,t);let r=e._zod.parse;Se(e,"propValues",n=>{let s={},i=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);c[n.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||$t(s,u,new Set);for(let d of l)s[u].add(d)}}return!n.def.unionFallback&&i>1&&s[n.def.discriminator]?.delete(void 0),s}),t.options.forEach((n,s)=>{let i=To(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=xo(()=>Zw(t));e._zod.parse=(n,s)=>{let i=n.value;if(!Qr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=i?.[t.discriminator],c=o.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(u=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n)}}),rg=q("$ZodIntersection",(e,t)=>{ke.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ch(r,c,u)):ch(r,s,i)}});function wl(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(Sr(e)&&Sr(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=wl(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=wl(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ch(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)o.has(p)||o.set(p,{}),o.get(p)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let a=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=n?a.filter(l=>n.keys.includes(l)):[];u.length&&e.issues.push({...n,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=wl(t.value,r.value);if(!c.valid){if(At(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var og=q("$ZodRecord",(e,t)=>{ke.init(e,t);let r=vt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Sr(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Mt(f,n,yt())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:s[l],issues:[]},n);g instanceof Promise?i.push(g.then(f=>{f.issues.length&&o.issues.push(...or(l,f.issues)),o.value[p]=f.value})):(g.issues.length&&o.issues.push(...or(l,g.issues)),o.value[p]=g.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Hn.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},n);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode==="loose"?o.value[u]=s[u]:a?(c=c??[],c.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Mt(f,n,yt())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:s[u],issues:[]},n);g instanceof Promise?i.push(g.then(f=>{f.issues.length&&o.issues.push(...or(u,f.issues)),o.value[p]=f.value})):(g.issues.length&&o.issues.push(...or(u,g.issues)),o.value[p]=g.value)}c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var ng=q("$ZodEnum",(e,t)=>{ke.init(e,t);let r=Eo(t.entries),o=new Set(r);e._zod.values=o,Se(e,"pattern",n=>{let s=Eo(n.def.entries).filter(i=>sl.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>rr(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),sg=q("$ZodLiteral",(e,t)=>{ke.init(e,t);let r=new Set(t.values);e._zod.values=r,Se(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(s=>typeof s=="string"?rr(s):s?rr(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var ig=q("$ZodTransform",(e,t)=>{ke.init(e,t),e._zod.optin="optional",vt.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Oo(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new qt;return r.value=n,r}});function uh(e,t){return e.value=t.issues.length?void 0:t.value,e}var xl=q("$ZodOptional",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Se(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),Se(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Dn(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>uh(r,s)):uh(r,n)}return t.innerType._zod.run(r,o)}}),ag=q("$ZodExactOptional",(e,t)=>{xl.init(e,t),Se(e,"values",r=>r.def.innerType._zod.values),Se(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),cg=q("$ZodNullable",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin),Se(e,"optout",r=>r.def.innerType._zod.optout),Se(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Dn(o.source)}|null)$`):void 0}),Se(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),ug=q("$ZodDefault",(e,t)=>{ke.init(e,t),e._zod.optin="defaulted",Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>lh(s,t)):lh(n,t)}});function lh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var lg=q("$ZodPrefault",(e,t)=>{ke.init(e,t),e._zod.optin="defaulted",Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),dg=q("$ZodNonOptional",(e,t)=>{ke.init(e,t),Se(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>dh(s,e)):dh(n,e)}});function dh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ph(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>Mt(n,o,yt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var pg=q("$ZodCatch",(e,t)=>{ke.init(e,t),Se(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Se(e,"optout",r=>r.def.innerType._zod.optout),Se(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>ph(r,s,t,o)):ph(r,n,t,o)}});var Tl=q("$ZodPipe",(e,t)=>{ke.init(e,t),Se(e,"values",r=>r.def.in._zod.values),Se(e,"optin",r=>r.def.in._zod.optin),Se(e,"optout",r=>r.def.out._zod.optout),Se(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Zi(i,t.in,o)):Zi(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Zi(s,t.out,o)):Zi(n,t.out,o)}});function Zi(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var mg=q("$ZodPreprocess",(e,t)=>{Tl.init(e,t)}),fg=q("$ZodReadonly",(e,t)=>{ke.init(e,t),Se(e,"propValues",r=>r.def.innerType._zod.propValues),Se(e,"values",r=>r.def.innerType._zod.values),Se(e,"optin",r=>r.def.innerType?._zod?.optin),Se(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(mh):mh(n)}});function mh(e){return e.memo||(e.value=Object.freeze(e.value)),e}var hg=q("$ZodLazy",(e,t)=>{ke.init(e,t),tl(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),Se(e,"pattern",r=>r.innerType?._zod?.pattern),Se(e,"propValues",r=>r.innerType?._zod?.propValues),Se(e,"optin",r=>r.innerType?._zod?.optin??void 0),Se(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),gg=q("$ZodCustom",(e,t)=>{st.init(e,t),ke.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>fh(s,r,o,e));fh(n,r,o,e)}});function fh(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Io(n))}}var Ol=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Cl="~memo",_g=[];function vg(e){return e!==null&&typeof e=="object"}function Il(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var yg=new WeakMap,Kn=0,Hi=1,Gn=2;function Bi(e,t,r){let o=yg.get(e);if(o!==void 0)return o?Gn:Kn;if(t.has(e))return Gn;t.add(e);let n=Kn,s=l=>{if(n!==Gn&&l?._zod){let d=Bi(l,t,r);d>n&&(n=d)}},i=(l,d)=>{let p=Kn;for(let g of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,g);if(d&&!f.enumerable)continue;let _=f.get?Hi:f.value?._zod?Bi(f.value,t,r):Kn;_>p&&(p=_)}return p},a=l=>{l>n&&(n=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=To(c);a(l?i(l,!0):Hi),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Bi(l,t,!1):Hi);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 c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let g of p)s(g)}}}return t.delete(e),Lw(e,n)}function Lw(e,t){return t!==Hi&&yg.set(e,t===Gn),t}function Dw(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Vi,Ji=[],Uw={alloc(e,t,r){let o=Vi;if(!o)return r;Vi=void 0;let n={value:r,issues:null};return o.set(t.value,n),Ji.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&Fw(s,n.value))throw new Ol;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let h=Bi(e,new Set,!1);if(h===Kn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);h===Gn||o?r=!0:o=!0}let l=c.value;if(!vg(l))return i(c,u);let d=u[Cl];d||(d={buckets:new WeakMap,backEdges:void 0},u[Cl]=d);let p;n===u?p=s:(p=Dw(d,e),n=u,s=p);let g=p.get(l);if(g)return c.value=g.value,g.issues?g.issues.length&&c.issues.push(...Il(g.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(g.value)),c;Vi=p;let f=Ji.length,_=i(c,u);Vi=void 0;let m=Ji.length>f?Ji.pop():void 0;return _ instanceof Promise?_.then(h=>(m&&(m.issues=h.issues.length?Il(h.issues):_g),h)):(m&&(m.issues=_.issues.length?Il(_.issues):_g),_)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function Nl(){return Uw}function Fw(e,t){let r=e[Cl]?.backEdges;return r!==void 0&&vg(t)&&r.has(t)}var Vw=()=>{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(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),a=cl(s.input),c=n(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${Ei(s.values[0])}`:`Invalid option: expected one of ${Ri(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ri(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Sg(){return{localeError:Vw()}}var bg;var jl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function zg(){return new jl}(bg=globalThis).__zod_globalRegistry??(bg.__zod_globalRegistry=zg());var br=globalThis.__zod_globalRegistry;function Ki(e){return e.checks&&(e.checks=[...e.checks]),e}function $g(e,t){return new e(Ki({type:"string",...re(t)}))}function wg(e,t){return new e(Ki({type:"string",coerce:!0,...re(t)}))}function Rg(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function Pg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function Eg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function kg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function xg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function Tg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function Al(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Ig(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Og(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Cg(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Ng(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function jg(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function Ag(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function Mg(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function qg(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function Zg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function Lg(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function Dg(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function Ug(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function Fg(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function Vg(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function Jg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function Gi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function Wi(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function Yi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function Xi(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function Hg(e,t){return new e(Ki({type:"number",checks:[],...re(t)}))}function Bg(e,t){return new e(Ki({type:"number",coerce:!0,checks:[],...re(t)}))}function Kg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function Gg(e,t){return new e({type:"boolean",...re(t)})}function Wg(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function Yg(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function Xg(e,t){return new e({type:"null",...re(t)})}function Qg(e){return new e({type:"any"})}function e_(e){return new e({type:"unknown"})}function t_(e,t){return new e({type:"never",...re(t)})}function r_(e,t){return new e({type:"date",coerce:!0,...re(t)})}function No(e,t){return new zl({check:"less_than",...re(t),value:e,inclusive:!1})}function nr(e,t){return new zl({check:"less_than",...re(t),value:e,inclusive:!0})}function jo(e,t){return new $l({check:"greater_than",...re(t),value:e,inclusive:!1})}function sr(e,t){return new $l({check:"greater_than",...re(t),value:e,inclusive:!0})}function Wn(e,t){return new Jf({check:"multiple_of",...re(t),value:e})}function Qi(e,t){return new Bf({check:"max_length",...re(t),maximum:e})}function Ao(e,t){return new Kf({check:"min_length",...re(t),minimum:e})}function ea(e,t){return new Gf({check:"length_equals",...re(t),length:e})}function Ml(e,t){return new Wf({check:"string_format",format:"regex",...re(t),pattern:e})}function ql(e){return new Yf({check:"string_format",format:"lowercase",...re(e)})}function Zl(e){return new Xf({check:"string_format",format:"uppercase",...re(e)})}function Ll(e,t){return new Qf({check:"string_format",format:"includes",...re(t),includes:e})}function Dl(e,t){return new eh({check:"string_format",format:"starts_with",...re(t),prefix:e})}function Ul(e,t){return new th({check:"string_format",format:"ends_with",...re(t),suffix:e})}function zr(e){return new rh({check:"overwrite",tx:e})}function Fl(e){return zr(t=>t.normalize(e))}function Vl(){return zr(e=>e.trim())}function Jl(){return zr(e=>e.toLowerCase())}function Hl(){return zr(e=>e.toUpperCase())}function Bl(){return zr(e=>ol(e))}function o_(e,t,r){return new e({type:"array",element:t,...re(r)})}function n_(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function s_(e,t){let r=Jw(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Io(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Io(s))}},e(o.value,o)),t);return r}function Jw(e,t){let r=new st({check:"custom",...re(t)});return r._zod.check=e,r}function Yn(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&$t(e,o,r[o]);return e}function Gl(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??br,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 Zt(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function Je(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,g=t.processors[n.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);g(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Je(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Yn(i.schema,c),t.io==="input"&&ft(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function i_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wl(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(f=>f);if(d)return{ref:p(d)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${p("__shared")}#/${a}/${i_(g)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+i_(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
56
56
 
57
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function c_(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;c_(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var u_=new Set(["type","properties","required","additionalProperties"]),i_=["oneOf","anyOf"];function a_(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Kl(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!u_.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??a_(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Kl(a)??{allOf:a};$t(r,i,c)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let a=a_(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function Jw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of u_)if(n in e)return;let r=t.filter(n=>i_.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=Kl(t);else{let n=r[0],s=i_.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let i=t.filter(c=>c!==n),a=n[s].map(c=>Kl([...i,c]));if(a.some(c=>!c))return;o={[s]:a}}o&&(delete e.allOf,Yn(e,o))}function Yl(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let g=e.seen.get(d),f=g.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Yn(u,f),Yn(u,l),a._zod.parent===d)for(let m in u)m==="$ref"||m==="allOf"||m in l||delete u[m];if(f.$ref&&g.def)for(let m in u)m==="$ref"||m==="allOf"||m in g.def&&JSON.stringify(u[m])===JSON.stringify(g.def[m])&&delete u[m]}let p=a._zod.parent;if(p&&p!==d){o(p);let g=e.seen.get(p);if(g?.schema.$ref&&(u.$ref=g.schema.$ref,g.def))for(let f in u)f==="$ref"||f==="allOf"||f in g.def&&JSON.stringify(u[f])===JSON.stringify(g.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())c_(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Jw(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Yn(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,$t(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Xn(t,"input",e.processors),output:Xn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ft(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ft(o.element,r);if(o.type==="set")return ft(o.valueType,r);if(o.type==="lazy")return ft(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ft(o.innerType,r);if(o.type==="intersection")return ft(o.left,r)||ft(o.right,r);if(o.type==="record"||o.type==="map")return ft(o.keyType,r)||ft(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ft(o.in,r)||ft(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ft(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ft(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ft(n,r))return!0;return!!(o.rest&&ft(o.rest,r))}return!1}var l_=(e,t={})=>r=>{let o=Gl({...r,processors:t});return Je(e,o),Wl(o,e),Yl(o,e)},Xn=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Gl({...n??{},target:s,io:t,processors:r});return Je(e,i),Wl(i,e),Yl(i,e)};var Mo=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},qo=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},d_=(e,t)=>{Mo(e,"minimum",t),qo(e,"maximum",t)},h_=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},g_=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},__=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},v_=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},p_=(e,t)=>Mo(e,"minimum",t.minimum),m_=(e,t)=>qo(e,"maximum",t.maximum),f_=e=>(t,r)=>{v_(t,r.format);let[o,n]=e[r.format];Mo(t,"minimum",o),qo(t,"maximum",n)},Hw={greater_than:(e,t)=>Mo(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qo(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>h_(e,t.value),number_format:f_(Un),bigint_format:f_(ki),min_length:p_,max_length:m_,length_equals:(e,t)=>d_(e,t.length),min_size:p_,max_size:m_,size_equals:(e,t)=>d_(e,t.size),string_format:(e,t)=>{v_(e,t.format),t.pattern&&g_(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>__(e,t.mime)};function it(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)Hw[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Mo(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Mo(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&qo(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&qo(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&h_(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&__(t,n.mime);for(let s of n.patterns??[])g_(t,s);return t}var Bw={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Kw=new Map([[Pl,Tf],[Fi,If]]),y_=e=>Kw.get(e)??e,S_=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=it(e);if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Bw[a]??a,n.format===""&&delete n.format,(a==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(y_);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},b_=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=it(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof s=="number"&&(n.minimum=s),p?g?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof i=="number"&&(n.maximum=i),a){let f=new Set;for(let h of a)Number.isFinite(h)&&h!==0?f.add(Math.abs(h)):Zt(e,t,n,o,`A multipleOf divisor of ${h} cannot be represented in JSON Schema`);let[_,...m]=f;_!==void 0&&(n.multipleOf=_),m.length&&(n.allOf=[...n.allOf??[],...m.map(h=>({multipleOf:h}))])}},z_=(e,t,r,o)=>{r.type="boolean"},$_=(e,t,r,o)=>{Zt(e,t,r,o,"BigInt cannot be represented in JSON Schema")};var w_=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var R_=(e,t,r,o)=>{r.not={}},P_=(e,t,r,o)=>{},E_=(e,t,r,o)=>{},k_=(e,t,r,o)=>{Zt(e,t,r,o,"Date cannot be represented in JSON Schema")},x_=(e,t,r,o)=>{let n=e._zod.def,s=Eo(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},T_=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(Zt(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Zt(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var I_=(e,t,r,o)=>{Zt(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var O_=(e,t,r,o)=>{Zt(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var C_=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=it(e);typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Je(s.element,t,{...o,path:[...o.path,"items"]})};function ta(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ta(t.out):t.type==="catch"?ta(t.innerType):e._zod.optin}var N_=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Zt(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)$t(n.properties,u,Je(i[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?ta(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=Je(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},j_=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Je(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},A_=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Je(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function Xl(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let _=Xl(e,f,r);return _===f?t:_}for(let f of["anyOf","oneOf"]){let _=t[f];if(!Array.isArray(_))continue;let m=_.map(h=>Xl(e,h,r));m.some((h,z)=>h!==_[z])&&(t={...t,[f]:m})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(f=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(f=>typeof f=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...g}=t;return g.enum?g.enum=g.enum.map(f=>typeof f=="number"?String(f):f):typeof g.const=="number"&&(g.const=String(g.const)),n&&(g.type="string",s||(g.pattern=(o.includes("number")?Hn:Sl).source)),g}var Ql=new WeakMap;function Gw(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Ql.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Xl(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var M_=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,a=it(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=Je(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)$t(n.patternProperties,y_(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=Je(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Ql.get(t);l||(l=[],Ql.set(t,l),t.deferred.push(()=>Gw(t))),l.push(e)}n.additionalProperties=Je(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&ta(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},q_=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Z_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},ed=Symbol();function L_(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Zt(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),ed):JSON.parse(i)}var D_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=L_(n.defaultValue,e,t,r,o);i!==ed&&(r.default=i)},U_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=L_(n.defaultValue,e,t,r,o);i!==ed&&(r._prefault=i)},F_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{Zt(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},V_=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Je(i,t,o);let a=t.seen.get(e);a.ref=i},J_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var td=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},H_=(e,t,r,o)=>{let n=e._zod.innerType;Je(n,t,o);let s=t.seen.get(e);s.ref=n};var B_=new WeakSet([Object.prototype,Error.prototype]);function ra(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var nR=(e,t)=>{nf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);B_.has(r)||(B_.add(r),ra(r,"format",o=>n=>hl(o,n)),ra(r,"flatten",o=>n=>fl(o,n)),ra(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,ko,2)}),ra(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,ko,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var wt=q("ZodError",nR,void 0,{Parent:Error});var K_=Ci(wt),G_=Ni(wt),W_=ji(wt),Y_=Ai(wt),X_=af(wt),Q_=cf(wt),ev=uf(wt),tv=lf(wt),rv=df(wt),ov=pf(wt),nv=mf(wt),sv=ff(wt);function iR(){vt.localeError||yt(yg())}function na(){vt.memoizer||yt({memoizer:Nl()})}var xe=q("ZodType",(e,t)=>(iR(),ke.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ae.mergeDefs(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 xt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(GR(e,t))},superRefine(e,t){return this.check(WR(e,t))},overwrite(e){return this.check(zr(e))},optional(){return Ze(this)},exactOptional(){return jR(this)},nullable(){return cv(this)},nullish(){return Ze(cv(this))},nonoptional(e){return DR(this,e)},array(){return K(this)},or(e){return Ce([this,e])},and(e){return ia(this,e)},transform(e){return uv(this,vv(e))},default(e){return qR(this,e)},prefault(e){return LR(this,e)},catch(e){return FR(this,e)},pipe(e){return uv(this,e)},readonly(){return HR(this)},describe(e){let t=this.clone();return br.add(t,{description:e}),t},meta(...e){if(e.length===0)return br.get(this);let t=this.clone();return br.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ae.hide(this,"~standard",{...Rl(this),jsonSchema:{input:Xn(this,"input"),output:Xn(this,"output")}})},set"~standard"(e){ae.own(this,"~standard",e)},parse:function e(t,r){return K_(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await G_(this,t,r,{callee:e})},safeParse(e,t){return W_(this,e,t)},async safeParseAsync(e,t){return Y_(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ae.own(this,"spa",e)},validate(e,t){return gl(this,e,t)},validateAsync(e,t){return _l(this,e,t)},encode:function e(t,r){return X_(this,t,r,{callee:e})},decode:function e(t,r){return Q_(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ev(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await tv(this,t,r,{callee:e})},safeEncode(e,t){return rv(this,e,t)},safeDecode(e,t){return ov(this,e,t)},async safeEncodeAsync(e,t){return nv(this,e,t)},async safeDecodeAsync(e,t){return sv(this,e,t)},toJSONSchema(e){return l_(this,{})(e)},get description(){return br.get(this)?.description},get _def(){return this._zod.def}}),lv=q("_ZodString",(e,t)=>{Ui.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>S_(e,r,o,n)},ae.derived({format:e=>it(e).format??null,minLength:e=>it(e).minimum??null,maxLength:e=>it(e).maximum??null},{regex(...e){return this.check(Ml(...e))},includes(...e){return this.check(Ll(...e))},startsWith(...e){return this.check(Dl(...e))},endsWith(...e){return this.check(Ul(...e))},min(...e){return this.check(Ao(...e))},max(...e){return this.check(Qi(...e))},length(...e){return this.check(ea(...e))},nonempty(...e){return this.check(Ao(1,...e))},lowercase(e){return this.check(ql(e))},uppercase(e){return this.check(Zl(e))},trim(){return this.check(Vl())},normalize(...e){return this.check(Fl(...e))},toLowerCase(){return this.check(Jl())},toUpperCase(){return this.check(Hl())},slugify(){return this.check(Bl())}})),od=q("ZodString",(e,t)=>{Ui.init(e,t),lv.init(e,t)},{email(e){return this.check(wg(aR,e))},url(e){return this.check(Al(dv,e))},jwt(e){return this.check(Vg($R,e))},emoji(e){return this.check(Tg(uR,e))},guid(e){return this.check(Rg(cR,e))},uuid(e){return this.check(Pg(oa,e))},uuidv4(e){return this.check(Eg(oa,e))},uuidv6(e){return this.check(kg(oa,e))},uuidv7(e){return this.check(xg(oa,e))},nanoid(e){return this.check(Ig(lR,e))},cuid(e){return this.check(Og(dR,e))},cuid2(e){return this.check(Cg(pR,e))},ulid(e){return this.check(Ng(mR,e))},base64(e){return this.check(Dg(SR,e))},base64url(e){return this.check(Ug(bR,e))},xid(e){return this.check(jg(fR,e))},ksuid(e){return this.check(Ag(hR,e))},ipv4(e){return this.check(Mg(gR,e))},ipv6(e){return this.check(qg(_R,e))},cidrv4(e){return this.check(Zg(vR,e))},cidrv6(e){return this.check(Lg(yR,e))},e164(e){return this.check(Fg(zR,e))},datetime(e){return this.check(Gi(Qn,e))},date(e){return this.check(Wi(es,e))},time(e){return this.check(Yi(ts,e))},duration(e){return this.check(Xi(rs,e))}});function k(e){return zg(od,e)}var Ve=q("ZodStringFormat",(e,t)=>{je.init(e,t),lv.init(e,t)}),Qn=q("ZodISODateTime",(e,t)=>{kh.init(e,t),Ve.init(e,t)}),es=q("ZodISODate",(e,t)=>{xh.init(e,t),Ve.init(e,t)}),ts=q("ZodISOTime",(e,t)=>{Th.init(e,t),Ve.init(e,t)}),rs=q("ZodISODuration",(e,t)=>{Ih.init(e,t),Ve.init(e,t)}),aR=q("ZodEmail",(e,t)=>{_h.init(e,t),Ve.init(e,t)});var cR=q("ZodGUID",(e,t)=>{hh.init(e,t),Ve.init(e,t)});var oa=q("ZodUUID",(e,t)=>{gh.init(e,t),Ve.init(e,t)});var dv=q("ZodURL",(e,t)=>{Sh.init(e,t),Ve.init(e,t)});function pv(e){return Al(dv,e)}var uR=q("ZodEmoji",(e,t)=>{bh.init(e,t),Ve.init(e,t)});var lR=q("ZodNanoID",(e,t)=>{zh.init(e,t),Ve.init(e,t)});var dR=q("ZodCUID",(e,t)=>{$h.init(e,t),Ve.init(e,t)});var pR=q("ZodCUID2",(e,t)=>{wh.init(e,t),Ve.init(e,t)});var mR=q("ZodULID",(e,t)=>{Rh.init(e,t),Ve.init(e,t)});var fR=q("ZodXID",(e,t)=>{Ph.init(e,t),Ve.init(e,t)});var hR=q("ZodKSUID",(e,t)=>{Eh.init(e,t),Ve.init(e,t)});var gR=q("ZodIPv4",(e,t)=>{Oh.init(e,t),Ve.init(e,t)});var _R=q("ZodIPv6",(e,t)=>{Nh.init(e,t),Ve.init(e,t)});var vR=q("ZodCIDRv4",(e,t)=>{jh.init(e,t),Ve.init(e,t)});var yR=q("ZodCIDRv6",(e,t)=>{Ah.init(e,t),Ve.init(e,t)});var SR=q("ZodBase64",(e,t)=>{qh.init(e,t),Ve.init(e,t)});var bR=q("ZodBase64URL",(e,t)=>{Zh.init(e,t),Ve.init(e,t)});var zR=q("ZodE164",(e,t)=>{Lh.init(e,t),Ve.init(e,t)});var $R=q("ZodJWT",(e,t)=>{Dh.init(e,t),Ve.init(e,t)});var sa=q("ZodNumber",(e,t)=>{El.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>b_(e,r,o,n),e.isFinite=!0},ae.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=it(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=it(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=it(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>it(e).format??null},{gt(e,t){return this.check(jo(e,t))},gte(e,t){return this.check(sr(e,t))},min(e,t){return this.check(sr(e,t))},lt(e,t){return this.check(No(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},int(e){return this.check(iv(e))},safe(e){return this.check(iv(e))},positive(e){return this.check(jo(0,e))},nonnegative(e){return this.check(sr(0,e))},negative(e){return this.check(No(0,e))},nonpositive(e){return this.check(nr(0,e))},multipleOf(e,t){return this.check(Wn(e,t))},step(e,t){return this.check(Wn(e,t))},finite(){return this}}));function Re(e){return Jg(sa,e)}var wR=q("ZodNumberFormat",(e,t)=>{Uh.init(e,t),sa.init(e,t)});function iv(e){return Bg(wR,e)}var nd=q("ZodBoolean",(e,t)=>{Fh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>z_(e,r,o,n)});function Ee(e){return Kg(nd,e)}var mv=q("ZodBigInt",(e,t)=>{Vh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$_(e,r,o,n)},ae.derived({minValue:e=>it(e).minimum??null,maxValue:e=>it(e).maximum??null,format:e=>it(e).format??null},{gte(e,t){return this.check(sr(e,t))},min(e,t){return this.check(sr(e,t))},gt(e,t){return this.check(jo(e,t))},lt(e,t){return this.check(No(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},positive(e){return this.check(jo(BigInt(0),e))},negative(e){return this.check(No(BigInt(0),e))},nonpositive(e){return this.check(nr(BigInt(0),e))},nonnegative(e){return this.check(sr(BigInt(0),e))},multipleOf(e,t){return this.check(Wn(e,t))}}));var RR=q("ZodNull",(e,t)=>{Jh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>w_(e,r,o,n)});function sd(e){return Yg(RR,e)}var PR=q("ZodAny",(e,t)=>{Hh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>P_(e,r,o,n)});function fv(){return Xg(PR)}var ER=q("ZodUnknown",(e,t)=>{Bh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E_(e,r,o,n)});function Fe(){return Qg(ER)}var kR=q("ZodNever",(e,t)=>{Kh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>R_(e,r,o,n)});function xR(e){return e_(kR,e)}var hv=q("ZodDate",(e,t)=>{Gh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k_(e,r,o,n),e.min=(r,o)=>e.check(sr(r,o)),e.max=(r,o)=>e.check(nr(r,o))},ae.derived({minDate:e=>{let{minimum:t}=it(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=it(e);return t?new Date(t):null}},{}));var TR=q("ZodArray",(e,t)=>{na(),Wh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>C_(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Ao(e,t))},nonempty(e){return this.check(Ao(1,e))},max(e,t){return this.check(Qi(e,t))},length(e,t){return this.check(ea(e,t))},unwrap(){return this.element}});function K(e,t){return r_(TR,e,t)}var gv=q("ZodObject",(e,t)=>{na(),Qh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>N_(e,r,o,n),ae.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return St(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ae.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:Fe()}))},loose(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:Fe()}))},strict(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:xR()}))},strip(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return ae.extend(this,e)},safeExtend(e){return ae.safeExtend(this,e)},merge(e){return ae.merge(this,e)},pick(e){return ae.pick(this,e)},omit(e){return ae.omit(this,e)},partial(...e){return ae.partial(yv,this,e[0])},exactPartial(...e){return ae.partial(Sv,this,e[0],"exactPartial")},required(...e){return ae.required(bv,this,e[0])}});function Y(e,t){let r={type:"object",shape:e??{},...ae.normalizeParams(t)};return new gv(r)}function Qe(e,t){return new gv({type:"object",shape:e,catchall:Fe(),...ae.normalizeParams(t)})}var _v=q("ZodUnion",(e,t)=>{kl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>j_(e,r,o,n),e.options=t.options});function Ce(e,t){return new _v({type:"union",options:e,...ae.normalizeParams(t)})}var IR=q("ZodDiscriminatedUnion",(e,t)=>{_v.init(e,t),eg.init(e,t)});function id(e,t,r){return new IR({type:"union",options:t,discriminator:e,...ae.normalizeParams(r)})}var OR=q("ZodIntersection",(e,t)=>{tg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>A_(e,r,o,n)});function ia(e,t){return new OR({type:"intersection",left:e,right:t})}var av=q("ZodRecord",(e,t)=>{na(),rg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>M_(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Le(e,t,r){return!t||!t._zod?new av({type:"record",keyType:k(),valueType:e,...ae.normalizeParams(t)}):new av({type:"record",keyType:e,valueType:t,...ae.normalizeParams(r)})}var rd=q("ZodEnum",(e,t)=>{og.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(o,n,s)=>x_(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new rd({...t,checks:[],...ae.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new rd({...t,checks:[],...ae.normalizeParams(n),entries:s})}});function St(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new rd({type:"enum",entries:r,...ae.normalizeParams(t)})}var CR=q("ZodLiteral",(e,t)=>{ng.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>T_(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ee(e,t){return new CR({type:"literal",values:Array.isArray(e)?e:[e],...ae.normalizeParams(t)})}var NR=q("ZodTransform",(e,t)=>{na(),sg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O_(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Oo(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ae.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ae.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function vv(e){return new NR({type:"transform",transform:e})}var yv=q("ZodOptional",(e,t)=>{xl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ze(e){return new yv({type:"optional",innerType:e})}var Sv=q("ZodExactOptional",(e,t)=>{ig.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jR(e){return new Sv({type:"optional",innerType:e})}var AR=q("ZodNullable",(e,t)=>{ag.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>q_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function cv(e){return new AR({type:"nullable",innerType:e})}var MR=q("ZodDefault",(e,t)=>{cg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>D_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qR(e,t){return new MR({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ae.shallowClone(t)}})}var ZR=q("ZodPrefault",(e,t)=>{ug.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>U_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function LR(e,t){return new ZR({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ae.shallowClone(t)}})}var bv=q("ZodNonOptional",(e,t)=>{lg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Z_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function DR(e,t){return new bv({type:"nonoptional",innerType:e,...ae.normalizeParams(t)})}var UR=q("ZodCatch",(e,t)=>{dg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>F_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function FR(e,t){return new UR({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ae.constantCatch(t)})}var zv=q("ZodPipe",(e,t)=>{Tl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>V_(e,r,o,n),e.in=t.in,e.out=t.out});function uv(e,t){return new zv({type:"pipe",in:e,out:t})}var VR=q("ZodPreprocess",(e,t)=>{zv.init(e,t),pg.init(e,t)}),JR=q("ZodReadonly",(e,t)=>{mg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>J_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function HR(e){return new JR({type:"readonly",innerType:e})}var BR=q("ZodLazy",(e,t)=>{fg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>H_(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function $v(e){return new BR({type:"lazy",getter:e})}var KR=q("ZodCustom",(e,t)=>{hg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I_(e,r,o,n)});function GR(e,t={}){return o_(KR,e,t)}function WR(e,t){return n_(e,t)}function ad(e,t){return new VR({type:"pipe",in:vv(e),out:t})}var Rv={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var wv;wv||(wv={});var aa={};Ro(aa,{ZodISODate:()=>es,ZodISODateTime:()=>Qn,ZodISODuration:()=>rs,ZodISOTime:()=>ts,date:()=>QR,datetime:()=>XR,duration:()=>tP,time:()=>eP});function XR(e){return Gi(Qn,e)}function QR(e){return Wi(es,e)}function eP(e){return Yi(ts,e)}function tP(e){return Xi(rs,e)}var ca={};Ro(ca,{bigint:()=>sP,boolean:()=>nP,date:()=>iP,number:()=>oP,string:()=>rP});function rP(e){return $g(od,e)}function oP(e){return Hg(sa,e)}function nP(e){return Gg(nd,e)}function sP(e){return Wg(mv,e)}function iP(e){return t_(hv,e)}var to="2025-11-25",ua="2025-03-26",os=[to,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],la="io.modelcontextprotocol/related-task",Tt="io.modelcontextprotocol/protocolVersion",ro="io.modelcontextprotocol/clientInfo",Lt="io.modelcontextprotocol/serverInfo",Kt="io.modelcontextprotocol/clientCapabilities",wr="io.modelcontextprotocol/subscriptionId",Rr="io.modelcontextprotocol/logLevel";var oo="2.0";var $r=$v(()=>Ce([k(),Re(),Ee(),sd(),Le(k(),$r),K($r)])),He=Le(k(),$r),ud=K($r),ns=Ce([k(),Re().int()]),ss=k(),da=Y({ttl:Re().optional()}),pa=Y({taskId:k()}),is=Qe({progressToken:ns.optional(),[la]:pa.optional()}),nt=Y({_meta:is.optional()}),no=nt.extend({task:da.optional()}),Be=Y({method:k(),params:nt.loose().optional()}),dt=Y({_meta:is.optional()}),pt=Y({method:k(),params:dt.loose().optional()}),as=Qe({get[Lt](){return Uo.optional().catch(void 0)}}),Ke=Qe({_meta:as.optional()}),Pr=Ce([k(),Re().int()]),cs=Y({jsonrpc:ee(oo),id:Pr,...Be.shape}).strict(),us=Y({jsonrpc:ee(oo),...pt.shape}).strict(),Lo=Y({jsonrpc:ee(oo),id:Pr,result:Ke}).strict(),Do=Y({jsonrpc:ee(oo),id:Pr.optional(),error:Y({code:Re().int(),message:k(),data:Fe().optional()})}).strict(),so=Ce([cs,us,Lo,Do]),ld=Ce([Lo,Do]),ls=Ke.strict(),ma=dt.extend({requestId:Pr.optional(),reason:k().optional()}),ds=pt.extend({method:ee("notifications/cancelled"),params:ma}),fa=Y({src:k(),mimeType:k().optional(),sizes:K(k()).optional(),theme:St(["light","dark"]).optional()}),Er=Y({icons:K(fa).optional()}),ir=Y({name:k(),title:k().optional()}),Uo=ir.extend({...ir.shape,...Er.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),aP=ia(Y({applyDefaults:Ee().optional()}),He),cP=ad(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ia(Y({form:aP.optional(),url:He.optional()}),He.optional())),ha=Qe({list:He.optional(),cancel:He.optional(),requests:Qe({sampling:Qe({createMessage:He.optional()}).optional(),elicitation:Qe({create:He.optional()}).optional()}).optional()}),ga=Qe({list:He.optional(),cancel:He.optional(),requests:Qe({tools:Qe({call:He.optional()}).optional()}).optional()}),_a=Y({experimental:Le(k(),He).optional(),sampling:Y({context:He.optional(),tools:He.optional()}).optional(),elicitation:cP.optional(),roots:Y({listChanged:Ee().optional()}).optional(),tasks:ha.optional(),extensions:Le(k(),He).optional()}),va=nt.extend({protocolVersion:k(),capabilities:_a,clientInfo:Uo}),ps=Be.extend({method:ee("initialize"),params:va}),ms=Y({experimental:Le(k(),He).optional(),logging:He.optional(),completions:He.optional(),prompts:Y({listChanged:Ee().optional()}).optional(),resources:Y({subscribe:Ee().optional(),listChanged:Ee().optional()}).optional(),tools:Y({listChanged:Ee().optional()}).optional(),tasks:ga.optional(),extensions:Le(k(),He).optional()}),ya=Ke.extend({protocolVersion:k(),capabilities:ms,serverInfo:Uo,instructions:k().optional()}),Sa=pt.extend({method:ee("notifications/initialized"),params:dt.optional()}),ba=Be.extend({method:ee("server/discover"),params:nt.optional()}),za=Ke.extend({supportedVersions:K(k()),capabilities:ms,instructions:k().optional()}),fs=Be.extend({method:ee("ping"),params:nt.optional()}),$a=Y({progress:Re(),total:Ze(Re()),message:Ze(k())}),wa=Y({...dt.shape,...$a.shape,progressToken:ns}),hs=pt.extend({method:ee("notifications/progress"),params:wa}),Ra=nt.extend({cursor:ss.optional()}),kr=Be.extend({params:Ra.optional()}),xr=Ke.extend({nextCursor:ss.optional()}),gs=Y({uri:k(),mimeType:Ze(k()),_meta:Le(k(),Fe()).optional()}),_s=gs.extend({text:k()}),dd=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),vs=gs.extend({blob:dd}),Tr=St(["user","assistant"]),ar=Y({audience:K(Tr).optional(),priority:Re().min(0).max(1).optional(),lastModified:aa.datetime({offset:!0}).optional()}),ys=Y({...ir.shape,...Er.shape,uri:k(),description:Ze(k()),mimeType:Ze(k()),size:Ze(Re()),annotations:ar.optional(),_meta:Ze(Qe({}))}),Pa=Y({...ir.shape,...Er.shape,uriTemplate:k(),description:Ze(k()),mimeType:Ze(k()),annotations:ar.optional(),_meta:Ze(Qe({}))}),Ea=kr.extend({method:ee("resources/list")}),ka=xr.extend({resources:K(ys)}),xa=kr.extend({method:ee("resources/templates/list")}),Ta=xr.extend({resourceTemplates:K(Pa)}),Fo=nt.extend({uri:k()}),Ia=Fo,Oa=Be.extend({method:ee("resources/read"),params:Ia}),Ca=Ke.extend({contents:K(Ce([_s,vs]))}),Na=pt.extend({method:ee("notifications/resources/list_changed"),params:dt.optional()}),ja=Fo,Aa=Be.extend({method:ee("resources/subscribe"),params:ja}),Ma=Fo,qa=Be.extend({method:ee("resources/unsubscribe"),params:Ma}),Ss=Y({toolsListChanged:Ee().optional(),promptsListChanged:Ee().optional(),resourcesListChanged:Ee().optional(),resourceSubscriptions:K(k()).optional()}),Za=nt.extend({notifications:Ss}),La=Be.extend({method:ee("subscriptions/listen"),params:Za}),Da=dt.extend({notifications:Ss}),Ua=pt.extend({method:ee("notifications/subscriptions/acknowledged"),params:Da}),Fa=as.extend({[wr]:Pr}),Va=Ke.extend({_meta:Fa}),Ja=dt.extend({uri:k()}),Ha=pt.extend({method:ee("notifications/resources/updated"),params:Ja}),Ba=Y({name:k(),description:Ze(k()),required:Ze(Ee())}),Ka=Y({...ir.shape,...Er.shape,description:Ze(k()),arguments:Ze(K(Ba)),_meta:Ze(Qe({}))}),Ga=kr.extend({method:ee("prompts/list")}),Wa=xr.extend({prompts:K(Ka)}),Ya=nt.extend({name:k(),arguments:Le(k(),k()).optional()}),Xa=Be.extend({method:ee("prompts/get"),params:Ya}),Vo=Y({type:ee("text"),text:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Jo=Y({type:ee("image"),data:dd,mimeType:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Ho=Y({type:ee("audio"),data:dd,mimeType:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Qa=Y({type:ee("tool_use"),name:k(),id:k(),input:Le(k(),Fe()),_meta:Le(k(),Fe()).optional()}),ec=Y({type:ee("resource"),resource:Ce([_s,vs]),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),tc=ys.extend({type:ee("resource_link")}),Bo=Ce([Vo,Jo,Ho,tc,ec]),rc=Y({role:Tr,content:Bo}),oc=Ke.extend({description:k().optional(),messages:K(rc)}),nc=pt.extend({method:ee("notifications/prompts/list_changed"),params:dt.optional()}),sc=Y({title:k().optional(),readOnlyHint:Ee().optional(),destructiveHint:Ee().optional(),idempotentHint:Ee().optional(),openWorldHint:Ee().optional()}),ic=Y({taskSupport:St(["required","optional","forbidden"]).optional()}),bs=Y({...ir.shape,...Er.shape,description:k().optional(),inputSchema:Y({type:ee("object"),properties:Le(k(),$r).optional(),required:K(k()).optional()}).catchall(Fe()),outputSchema:Qe({$schema:k().optional()}).optional(),annotations:sc.optional(),execution:ic.optional(),_meta:Le(k(),Fe()).optional()}),ac=kr.extend({method:ee("tools/list")}),cc=xr.extend({tools:K(bs)}),zs=Ke.extend({content:K(Bo).default([]),structuredContent:Fe().optional(),isError:Ee().optional()}),pd=zs.or(Ke.extend({toolResult:Fe()})),uc=no.extend({name:k(),arguments:Le(k(),Fe()).optional()}),lc=Be.extend({method:ee("tools/call"),params:uc}),dc=pt.extend({method:ee("notifications/tools/list_changed"),params:dt.optional()}),md=Y({autoRefresh:Ee().default(!0),debounceMs:Re().int().nonnegative().default(300)}),Ir=St(["debug","info","notice","warning","error","critical","alert","emergency"]),pc=nt.extend({level:Ir}),mc=Be.extend({method:ee("logging/setLevel"),params:pc}),fc=dt.extend({level:Ir,logger:k().optional(),data:Fe()}),hc=pt.extend({method:ee("notifications/message"),params:fc}),gc=Y({name:k().optional()}),_c=Y({hints:K(gc).optional(),costPriority:Re().min(0).max(1).optional(),speedPriority:Re().min(0).max(1).optional(),intelligencePriority:Re().min(0).max(1).optional()}),vc=Y({mode:St(["auto","required","none"]).optional()}),yc=Y({type:ee("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:K(Bo),structuredContent:Fe().optional(),isError:Ee().optional(),_meta:Le(k(),Fe()).optional()}),Sc=id("type",[Vo,Jo,Ho]),eo=id("type",[Vo,Jo,Ho,Qa,yc]),bc=Y({role:Tr,content:Ce([eo,K(eo)]),_meta:Le(k(),Fe()).optional()}),zc=no.extend({messages:K(bc),modelPreferences:_c.optional(),systemPrompt:k().optional(),includeContext:St(["none","thisServer","allServers"]).optional(),temperature:Re().optional(),maxTokens:Re().int(),stopSequences:K(k()).optional(),metadata:He.optional(),tools:K(bs).optional(),toolChoice:vc.optional()}),$c=Be.extend({method:ee("sampling/createMessage"),params:zc}),wc=Ke.extend({model:k(),stopReason:Ze(St(["endTurn","stopSequence","maxTokens"]).or(k())),role:Tr,content:Sc}),Rc=Ke.extend({model:k(),stopReason:Ze(St(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Tr,content:Ce([eo,K(eo)])}),$s=Y({type:ee("boolean"),title:k().optional(),description:k().optional(),default:Ee().optional()}),Ko=Y({type:ee("string"),title:k().optional(),description:k().optional(),minLength:Re().optional(),maxLength:Re().optional(),format:St(["email","uri","date","date-time"]).optional(),default:k().optional()}),Go=Y({type:St(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Re().optional(),maximum:Re().optional(),default:Re().optional()}),ws=Y({type:ee("string"),title:k().optional(),description:k().optional(),enum:K(k()),default:k().optional()}),Rs=Y({type:ee("string"),title:k().optional(),description:k().optional(),oneOf:K(Y({const:k(),title:k()})),default:k().optional()}),Ps=Y({type:ee("string"),title:k().optional(),description:k().optional(),enum:K(k()),enumNames:K(k()).optional(),default:k().optional()}),Pc=Ce([ws,Rs]),Es=Y({type:ee("array"),title:k().optional(),description:k().optional(),minItems:Re().optional(),maxItems:Re().optional(),items:Y({type:ee("string"),enum:K(k())}),default:K(k()).optional()}),ks=Y({type:ee("array"),title:k().optional(),description:k().optional(),minItems:Re().optional(),maxItems:Re().optional(),items:Y({anyOf:K(Y({const:k(),title:k()}))}),default:K(k()).optional()}),Ec=Ce([Es,ks]),kc=Ce([Ps,Pc,Ec]),xs=Ce([kc,$s,Ko,Go]),Wo=no.extend({mode:ee("form").optional(),message:k(),requestedSchema:Y({type:ee("object"),properties:Le(k(),xs),required:K(k()).optional()}).catchall(Fe())}),xc=no.extend({mode:ee("url"),message:k(),elicitationId:k(),url:k().url()}),Tc=Ce([Wo,xc]),Ic=Be.extend({method:ee("elicitation/create"),params:Tc}),Oc=dt.extend({elicitationId:k()}),Cc=pt.extend({method:ee("notifications/elicitation/complete"),params:Oc}),Nc=Ke.extend({action:St(["accept","decline","cancel"]),content:ad(e=>e===null?void 0:e,Le(k(),Ce([k(),Re(),Ee(),K(k())])).optional())}),jc=Y({type:ee("ref/resource"),uri:k()}),Ac=Y({type:ee("ref/prompt"),name:k()}),Mc=nt.extend({ref:Ce([Ac,jc]),argument:Y({name:k(),value:k()}),context:Y({arguments:Le(k(),k()).optional()}).optional()}),qc=Be.extend({method:ee("completion/complete"),params:Mc}),Zc=Ke.extend({completion:Qe({values:K(k()).max(100),total:Ze(Re().int()),hasMore:Ze(Ee())})}),Lc=Y({uri:k().startsWith("file://"),name:k().optional(),_meta:Le(k(),Fe()).optional()}),Dc=Be.extend({method:ee("roots/list"),params:nt.optional()}),Uc=Ke.extend({roots:K(Lc)}),Fc=pt.extend({method:ee("notifications/roots/list_changed"),params:dt.optional()}),fd=Qe({ttl:Re().optional(),pollInterval:Re().optional()}),Vc=St(["working","input_required","completed","failed","cancelled"]),Or=Y({taskId:k(),status:Vc,ttl:Ce([Re(),sd()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:Ze(Re()),statusMessage:Ze(k())}),hd=Ke.extend({task:Or}),Jc=dt.merge(Or),gd=pt.extend({method:ee("notifications/tasks/status"),params:Jc}),_d=Be.extend({method:ee("tasks/get"),params:nt.extend({taskId:k()})}),vd=Ke.merge(Or),yd=Be.extend({method:ee("tasks/result"),params:nt.extend({taskId:k()})}),Sd=Ke.loose(),bd=kr.extend({method:ee("tasks/list")}),zd=xr.extend({tasks:K(Or)}),$d=Be.extend({method:ee("tasks/cancel"),params:nt.extend({taskId:k()})}),wd=Ke.merge(Or),Rd=Ce([fs,ps,ba,qc,mc,Xa,Ga,Ea,xa,Oa,Aa,qa,La,lc,ac]),Pd=Ce([ds,hs,Sa,Fc]),Ed=Ce([ls,wc,Rc,Nc,Uc]),kd=Ce([fs,$c,Ic,Dc]),xd=Ce([ds,hs,hc,Ha,Na,dc,nc,Ua,Cc]),Td=Ce([ls,ya,za,Zc,oc,Wa,ka,Ta,Ca,zs,cc,Va]),ot=pv().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Rv.custom,message:"URL must be parseable",fatal:!0}),dl}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Id=Qe({resource:k().url(),authorization_servers:K(ot).optional(),jwks_uri:k().url().optional(),scopes_supported:K(k()).optional(),bearer_methods_supported:K(k()).optional(),resource_signing_alg_values_supported:K(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:Ee().optional(),authorization_details_types_supported:K(k()).optional(),dpop_signing_alg_values_supported:K(k()).optional(),dpop_bound_access_tokens_required:Ee().optional()}),Hc=Qe({issuer:k(),authorization_endpoint:ot,token_endpoint:ot,registration_endpoint:ot.optional(),scopes_supported:K(k()).optional(),response_types_supported:K(k()),response_modes_supported:K(k()).optional(),grant_types_supported:K(k()).optional(),token_endpoint_auth_methods_supported:K(k()).optional(),token_endpoint_auth_signing_alg_values_supported:K(k()).optional(),service_documentation:ot.optional(),revocation_endpoint:ot.optional(),revocation_endpoint_auth_methods_supported:K(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:K(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:K(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:K(k()).optional(),code_challenge_methods_supported:K(k()).optional(),client_id_metadata_document_supported:Ee().optional(),authorization_response_iss_parameter_supported:Ee().optional().catch(void 0)}),Bc=Qe({issuer:k(),authorization_endpoint:ot,token_endpoint:ot,userinfo_endpoint:ot.optional(),jwks_uri:ot,registration_endpoint:ot.optional(),scopes_supported:K(k()).optional(),response_types_supported:K(k()),response_modes_supported:K(k()).optional(),grant_types_supported:K(k()).optional(),acr_values_supported:K(k()).optional(),subject_types_supported:K(k()),id_token_signing_alg_values_supported:K(k()),id_token_encryption_alg_values_supported:K(k()).optional(),id_token_encryption_enc_values_supported:K(k()).optional(),userinfo_signing_alg_values_supported:K(k()).optional(),userinfo_encryption_alg_values_supported:K(k()).optional(),userinfo_encryption_enc_values_supported:K(k()).optional(),request_object_signing_alg_values_supported:K(k()).optional(),request_object_encryption_alg_values_supported:K(k()).optional(),request_object_encryption_enc_values_supported:K(k()).optional(),token_endpoint_auth_methods_supported:K(k()).optional(),token_endpoint_auth_signing_alg_values_supported:K(k()).optional(),display_values_supported:K(k()).optional(),claim_types_supported:K(k()).optional(),claims_supported:K(k()).optional(),service_documentation:k().optional(),claims_locales_supported:K(k()).optional(),ui_locales_supported:K(k()).optional(),claims_parameter_supported:Ee().optional(),request_parameter_supported:Ee().optional(),request_uri_parameter_supported:Ee().optional(),require_request_uri_registration:Ee().optional(),op_policy_uri:ot.optional(),op_tos_uri:ot.optional(),client_id_metadata_document_supported:Ee().optional(),authorization_response_iss_parameter_supported:Ee().optional().catch(void 0)}),Od=Y({...Bc.shape,...Hc.pick({code_challenge_methods_supported:!0}).shape}),Cd=Y({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:ca.number().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),Nd=Y({issued_token_type:ee("urn:ietf:params:oauth:token-type:id-jag"),access_token:k(),token_type:k().optional(),expires_in:Re().optional(),scope:k().optional()}).strip(),jd=Y({error:k(),error_description:k().optional(),error_uri:k().optional()}),cd=ot.optional().or(ee("").transform(()=>{})),Kc=Y({redirect_uris:K(ot),token_endpoint_auth_method:k().optional(),grant_types:K(k()).optional(),response_types:K(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:ot.optional(),logo_uri:cd,scope:k().optional(),contacts:K(k()).optional(),tos_uri:cd,policy_uri:k().optional(),jwks_uri:ot.optional(),jwks:fv().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Gc=Y({client_id:k(),client_secret:k().optional(),client_id_issued_at:Re().optional(),client_secret_expires_at:Re().optional()}).strip(),Ad=Kc.merge(Gc),Md=Y({error:k(),error_description:k().optional()}).strip(),qd=Y({token:k(),token_type_hint:k().optional()}).strip();var Nv;function Z(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var FC=Symbol("zod_brand"),Gt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Yo=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Nv=globalThis).__zod_globalConfig??(Nv.__zod_globalConfig={});var Xo=globalThis.__zod_globalConfig;function Rt(e){return e&&Object.assign(Xo,e),Xo}var Pe={};Ro(Pe,{BIGINT_FORMAT_RANGES:()=>qv,Class:()=>Ld,NUMBER_FORMAT_RANGES:()=>Hd,aborted:()=>jr,allowsEval:()=>Fd,assert:()=>mP,assertEqual:()=>uP,assertIs:()=>dP,assertNever:()=>pP,assertNotEqual:()=>lP,assignProp:()=>Cr,base64ToUint8Array:()=>Lv,base64urlToUint8Array:()=>TP,cached:()=>en,captureStackTrace:()=>Xc,cleanEnum:()=>xP,cleanRegex:()=>Cs,clone:()=>Dt,cloneDef:()=>hP,createTransparentProxy:()=>bP,defineLazy:()=>$e,esc:()=>Yc,escapeRegex:()=>ur,explicitlyAborted:()=>Bd,extend:()=>wP,finalizeIssue:()=>It,floatSafeRemainder:()=>Dd,getElementAtPath:()=>gP,getEnumValues:()=>Is,getLengthableOrigin:()=>Ns,getParsedType:()=>SP,getSizableOrigin:()=>Zv,hexToUint8Array:()=>OP,isObject:()=>io,isPlainObject:()=>Nr,issue:()=>tn,joinValues:()=>Wc,jsonStringifyReplacer:()=>Qo,merge:()=>PP,mergeDefs:()=>cr,normalizeParams:()=>ce,nullish:()=>Os,numKeys:()=>yP,objectClone:()=>fP,omit:()=>$P,optionalKeys:()=>Jd,parsedType:()=>Kd,partial:()=>EP,pick:()=>zP,prefixIssues:()=>lr,primitiveTypes:()=>Mv,promiseAllObject:()=>_P,propertyKeyTypes:()=>Vd,randomString:()=>vP,required:()=>kP,safeExtend:()=>RP,shallowClone:()=>Av,slugify:()=>Ud,stringifyPrimitive:()=>Qc,uint8ArrayToBase64:()=>Dv,uint8ArrayToBase64url:()=>IP,uint8ArrayToHex:()=>CP,unwrapMessage:()=>Ts});function uP(e){return e}function lP(e){return e}function dP(e){}function pP(e){throw new Error("Unexpected value in exhaustive check")}function mP(e){}function Is(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Wc(e,t="|"){return e.map(r=>Qc(r)).join(t)}function Qo(e,t){return typeof t=="bigint"?t.toString():t}function en(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Os(e){return e==null}function Cs(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Dd(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var jv=Symbol("evaluating");function $e(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==jv)return o===void 0&&(o=jv,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function fP(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Cr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function cr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function hP(e){return cr(e._zod.def)}function gP(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function _P(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function vP(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Yc(e){return JSON.stringify(e)}function Ud(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Xc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function io(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Fd=en(()=>{if(Xo.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Nr(e){if(io(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(io(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Av(e){return Nr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function yP(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var SP=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Vd=new Set(["string","number","symbol"]),Mv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ur(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dt(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function ce(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function bP(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Qc(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Jd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Hd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zP(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=cr(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return Cr(this,"shape",i),i},checks:[]});return Dt(e,s)}function $P(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=cr(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Cr(this,"shape",i),i},checks:[]});return Dt(e,s)}function wP(e,t){if(!Nr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=cr(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Cr(this,"shape",s),s}});return Dt(e,n)}function RP(e,t){if(!Nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Cr(this,"shape",o),o}});return Dt(e,r)}function PP(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Cr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Dt(e,r)}function EP(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=cr(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Cr(this,"shape",c),c},checks:[]});return Dt(t,i)}function kP(e,t,r){let o=cr(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return Cr(this,"shape",s),s}});return Dt(t,o)}function jr(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 Bd(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 lr(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ts(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let o=e.message?e.message:Ts(e.inst?._zod.def?.error?.(e))??Ts(t?.error?.(e))??Ts(r.customError?.(e))??Ts(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function Zv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ns(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Kd(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 tn(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function xP(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Lv(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Dv(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function TP(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Lv(t+r)}function IP(e){return Dv(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function OP(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function CP(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ld=class{constructor(...t){}};var Uv=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Qo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eu=Z("$ZodError",Uv),Gd=Z("$ZodError",Uv,{Parent:Error});function Fv(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Vv(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var tu=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Gt;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>It(c,s,Rt())));throw Xc(a,n?.callee),a}return i.value};var ru=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>It(c,s,Rt())));throw Xc(a,n?.callee),a}return i.value};var js=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Gt;return s.issues.length?{success:!1,error:new(e??eu)(s.issues.map(i=>It(i,n,Rt())))}:{success:!0,data:s.value}},Jv=js(Gd),As=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>It(i,n,Rt())))}:{success:!0,data:s.value}},Hv=As(Gd),Bv=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return tu(e)(t,r,n)};var Kv=e=>(t,r,o)=>tu(e)(t,r,o);var Gv=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ru(e)(t,r,n)};var Wv=e=>async(t,r,o)=>ru(e)(t,r,o);var Yv=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return js(e)(t,r,n)};var Xv=e=>(t,r,o)=>js(e)(t,r,o);var Qv=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return As(e)(t,r,n)};var ey=e=>async(t,r,o)=>As(e)(t,r,o);var ty=/^[cC][0-9a-z]{6,}$/,ry=/^[0-9a-z]+$/,oy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ny=/^[0-9a-vA-V]{20}$/,sy=/^[A-Za-z0-9]{27}$/,iy=/^[a-zA-Z0-9_-]{21}$/,ay=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var cy=/^([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})$/,Wd=e=>e?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})$`):/^([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)$/;var uy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var jP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ly(){return new RegExp(jP,"u")}var dy=/^(?:(?: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])$/,py=/^(([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 my=/^((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])$/,fy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yd=/^[A-Za-z0-9_-]*$/;var gy=/^https?$/,_y=/^\+[1-9]\d{6,14}$/,vy="(?:(?:\\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])))",yy=new RegExp(`^${vy}$`);function Sy(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function by(e){return new RegExp(`^${Sy(e)}$`)}function zy(e){let t=Sy({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${vy}T(?:${o})$`)}var $y=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var wy=/^-?\d+$/,Xd=/^-?\d+(?:\.\d+)?$/,Ry=/^(?:true|false)$/i,Py=/^null$/i;var Ey=/^[^A-Z]*$/,ky=/^[^a-z]*$/;var at=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),xy={number:"number",bigint:"bigint",object:"date"},Qd=Z("$ZodCheckLessThan",(e,t)=>{at.init(e,t);let r=xy[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ep=Z("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);let r=xy[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ty=Z("$ZodCheckMultipleOf",(e,t)=>{at.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Dd(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Iy=Z("$ZodCheckNumberFormat",(e,t)=>{at.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Hd[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=wy)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Oy=Z("$ZodCheckMaxLength",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Ns(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cy=Z("$ZodCheckMinLength",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Ns(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ny=Z("$ZodCheckLengthEquals",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Ns(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ms=Z("$ZodCheckStringFormat",(e,t)=>{var r,o;at.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),jy=Z("$ZodCheckRegex",(e,t)=>{Ms.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ay=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ey),Ms.init(e,t)}),My=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ky),Ms.init(e,t)}),qy=Z("$ZodCheckIncludes",(e,t)=>{at.init(e,t);let r=ur(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Zy=Z("$ZodCheckStartsWith",(e,t)=>{at.init(e,t);let r=new RegExp(`^${ur(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ly=Z("$ZodCheckEndsWith",(e,t)=>{at.init(e,t);let r=new RegExp(`.*${ur(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Dy=Z("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var nu=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
57
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function u_(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;u_(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var l_=new Set(["type","properties","required","additionalProperties"]),a_=["oneOf","anyOf"];function c_(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Kl(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!l_.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??c_(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Kl(a)??{allOf:a};$t(r,i,c)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let a=c_(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function Hw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of l_)if(n in e)return;let r=t.filter(n=>a_.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=Kl(t);else{let n=r[0],s=a_.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let i=t.filter(c=>c!==n),a=n[s].map(c=>Kl([...i,c]));if(a.some(c=>!c))return;o={[s]:a}}o&&(delete e.allOf,Yn(e,o))}function Yl(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let g=e.seen.get(d),f=g.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Yn(u,f),Yn(u,l),a._zod.parent===d)for(let m in u)m==="$ref"||m==="allOf"||m in l||delete u[m];if(f.$ref&&g.def)for(let m in u)m==="$ref"||m==="allOf"||m in g.def&&JSON.stringify(u[m])===JSON.stringify(g.def[m])&&delete u[m]}let p=a._zod.parent;if(p&&p!==d){o(p);let g=e.seen.get(p);if(g?.schema.$ref&&(u.$ref=g.schema.$ref,g.def))for(let f in u)f==="$ref"||f==="allOf"||f in g.def&&JSON.stringify(u[f])===JSON.stringify(g.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())u_(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Hw(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Yn(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,$t(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Xn(t,"input",e.processors),output:Xn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ft(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ft(o.element,r);if(o.type==="set")return ft(o.valueType,r);if(o.type==="lazy")return ft(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ft(o.innerType,r);if(o.type==="intersection")return ft(o.left,r)||ft(o.right,r);if(o.type==="record"||o.type==="map")return ft(o.keyType,r)||ft(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ft(o.in,r)||ft(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ft(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ft(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ft(n,r))return!0;return!!(o.rest&&ft(o.rest,r))}return!1}var d_=(e,t={})=>r=>{let o=Gl({...r,processors:t});return Je(e,o),Wl(o,e),Yl(o,e)},Xn=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Gl({...n??{},target:s,io:t,processors:r});return Je(e,i),Wl(i,e),Yl(i,e)};var Mo=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},qo=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},p_=(e,t)=>{Mo(e,"minimum",t),qo(e,"maximum",t)},g_=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},__=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},v_=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},y_=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},m_=(e,t)=>Mo(e,"minimum",t.minimum),f_=(e,t)=>qo(e,"maximum",t.maximum),h_=e=>(t,r)=>{y_(t,r.format);let[o,n]=e[r.format];Mo(t,"minimum",o),qo(t,"maximum",n)},Bw={greater_than:(e,t)=>Mo(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qo(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>g_(e,t.value),number_format:h_(Un),bigint_format:h_(ki),min_length:m_,max_length:f_,length_equals:(e,t)=>p_(e,t.length),min_size:m_,max_size:f_,size_equals:(e,t)=>p_(e,t.size),string_format:(e,t)=>{y_(e,t.format),t.pattern&&__(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>v_(e,t.mime)};function it(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)Bw[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Mo(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Mo(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&qo(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&qo(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&g_(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&v_(t,n.mime);for(let s of n.patterns??[])__(t,s);return t}var Kw={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gw=new Map([[Pl,If],[Fi,Of]]),S_=e=>Gw.get(e)??e,b_=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=it(e);if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Kw[a]??a,n.format===""&&delete n.format,(a==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(S_);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},z_=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=it(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof s=="number"&&(n.minimum=s),p?g?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof i=="number"&&(n.maximum=i),a){let f=new Set;for(let h of a)Number.isFinite(h)&&h!==0?f.add(Math.abs(h)):Zt(e,t,n,o,`A multipleOf divisor of ${h} cannot be represented in JSON Schema`);let[_,...m]=f;_!==void 0&&(n.multipleOf=_),m.length&&(n.allOf=[...n.allOf??[],...m.map(h=>({multipleOf:h}))])}},$_=(e,t,r,o)=>{r.type="boolean"},w_=(e,t,r,o)=>{Zt(e,t,r,o,"BigInt cannot be represented in JSON Schema")};var R_=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var P_=(e,t,r,o)=>{r.not={}},E_=(e,t,r,o)=>{},k_=(e,t,r,o)=>{},x_=(e,t,r,o)=>{Zt(e,t,r,o,"Date cannot be represented in JSON Schema")},T_=(e,t,r,o)=>{let n=e._zod.def,s=Eo(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},I_=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(Zt(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Zt(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var O_=(e,t,r,o)=>{Zt(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var C_=(e,t,r,o)=>{Zt(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var N_=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=it(e);typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Je(s.element,t,{...o,path:[...o.path,"items"]})};function ta(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ta(t.out):t.type==="catch"?ta(t.innerType):e._zod.optin}var j_=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Zt(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)$t(n.properties,u,Je(i[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?ta(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=Je(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},A_=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Je(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},M_=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Je(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function Xl(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let _=Xl(e,f,r);return _===f?t:_}for(let f of["anyOf","oneOf"]){let _=t[f];if(!Array.isArray(_))continue;let m=_.map(h=>Xl(e,h,r));m.some((h,z)=>h!==_[z])&&(t={...t,[f]:m})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(f=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(f=>typeof f=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...g}=t;return g.enum?g.enum=g.enum.map(f=>typeof f=="number"?String(f):f):typeof g.const=="number"&&(g.const=String(g.const)),n&&(g.type="string",s||(g.pattern=(o.includes("number")?Hn:Sl).source)),g}var Ql=new WeakMap;function Ww(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Ql.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Xl(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var q_=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,a=it(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=Je(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)$t(n.patternProperties,S_(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=Je(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Ql.get(t);l||(l=[],Ql.set(t,l),t.deferred.push(()=>Ww(t))),l.push(e)}n.additionalProperties=Je(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&ta(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},Z_=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},L_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},ed=Symbol();function D_(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Zt(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),ed):JSON.parse(i)}var U_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=D_(n.defaultValue,e,t,r,o);i!==ed&&(r.default=i)},F_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=D_(n.defaultValue,e,t,r,o);i!==ed&&(r._prefault=i)},V_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{Zt(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},J_=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Je(i,t,o);let a=t.seen.get(e);a.ref=i},H_=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var td=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},B_=(e,t,r,o)=>{let n=e._zod.innerType;Je(n,t,o);let s=t.seen.get(e);s.ref=n};var K_=new WeakSet([Object.prototype,Error.prototype]);function ra(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var sR=(e,t)=>{sf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);K_.has(r)||(K_.add(r),ra(r,"format",o=>n=>hl(o,n)),ra(r,"flatten",o=>n=>fl(o,n)),ra(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,ko,2)}),ra(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,ko,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var wt=q("ZodError",sR,void 0,{Parent:Error});var G_=Ci(wt),W_=Ni(wt),Y_=ji(wt),X_=Ai(wt),Q_=cf(wt),ev=uf(wt),tv=lf(wt),rv=df(wt),ov=pf(wt),nv=mf(wt),sv=ff(wt),iv=hf(wt);function aR(){vt.localeError||yt(Sg())}function na(){vt.memoizer||yt({memoizer:Nl()})}var xe=q("ZodType",(e,t)=>(aR(),ke.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ae.mergeDefs(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 xt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(WR(e,t))},superRefine(e,t){return this.check(YR(e,t))},overwrite(e){return this.check(zr(e))},optional(){return Ze(this)},exactOptional(){return AR(this)},nullable(){return uv(this)},nullish(){return Ze(uv(this))},nonoptional(e){return UR(this,e)},array(){return K(this)},or(e){return Ce([this,e])},and(e){return ia(this,e)},transform(e){return lv(this,yv(e))},default(e){return ZR(this,e)},prefault(e){return DR(this,e)},catch(e){return VR(this,e)},pipe(e){return lv(this,e)},readonly(){return BR(this)},describe(e){let t=this.clone();return br.add(t,{description:e}),t},meta(...e){if(e.length===0)return br.get(this);let t=this.clone();return br.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ae.hide(this,"~standard",{...Rl(this),jsonSchema:{input:Xn(this,"input"),output:Xn(this,"output")}})},set"~standard"(e){ae.own(this,"~standard",e)},parse:function e(t,r){return G_(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await W_(this,t,r,{callee:e})},safeParse(e,t){return Y_(this,e,t)},async safeParseAsync(e,t){return X_(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ae.own(this,"spa",e)},validate(e,t){return gl(this,e,t)},validateAsync(e,t){return _l(this,e,t)},encode:function e(t,r){return Q_(this,t,r,{callee:e})},decode:function e(t,r){return ev(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await tv(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await rv(this,t,r,{callee:e})},safeEncode(e,t){return ov(this,e,t)},safeDecode(e,t){return nv(this,e,t)},async safeEncodeAsync(e,t){return sv(this,e,t)},async safeDecodeAsync(e,t){return iv(this,e,t)},toJSONSchema(e){return d_(this,{})(e)},get description(){return br.get(this)?.description},get _def(){return this._zod.def}}),dv=q("_ZodString",(e,t)=>{Ui.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>b_(e,r,o,n)},ae.derived({format:e=>it(e).format??null,minLength:e=>it(e).minimum??null,maxLength:e=>it(e).maximum??null},{regex(...e){return this.check(Ml(...e))},includes(...e){return this.check(Ll(...e))},startsWith(...e){return this.check(Dl(...e))},endsWith(...e){return this.check(Ul(...e))},min(...e){return this.check(Ao(...e))},max(...e){return this.check(Qi(...e))},length(...e){return this.check(ea(...e))},nonempty(...e){return this.check(Ao(1,...e))},lowercase(e){return this.check(ql(e))},uppercase(e){return this.check(Zl(e))},trim(){return this.check(Vl())},normalize(...e){return this.check(Fl(...e))},toLowerCase(){return this.check(Jl())},toUpperCase(){return this.check(Hl())},slugify(){return this.check(Bl())}})),od=q("ZodString",(e,t)=>{Ui.init(e,t),dv.init(e,t)},{email(e){return this.check(Rg(cR,e))},url(e){return this.check(Al(pv,e))},jwt(e){return this.check(Jg(wR,e))},emoji(e){return this.check(Ig(lR,e))},guid(e){return this.check(Pg(uR,e))},uuid(e){return this.check(Eg(oa,e))},uuidv4(e){return this.check(kg(oa,e))},uuidv6(e){return this.check(xg(oa,e))},uuidv7(e){return this.check(Tg(oa,e))},nanoid(e){return this.check(Og(dR,e))},cuid(e){return this.check(Cg(pR,e))},cuid2(e){return this.check(Ng(mR,e))},ulid(e){return this.check(jg(fR,e))},base64(e){return this.check(Ug(bR,e))},base64url(e){return this.check(Fg(zR,e))},xid(e){return this.check(Ag(hR,e))},ksuid(e){return this.check(Mg(gR,e))},ipv4(e){return this.check(qg(_R,e))},ipv6(e){return this.check(Zg(vR,e))},cidrv4(e){return this.check(Lg(yR,e))},cidrv6(e){return this.check(Dg(SR,e))},e164(e){return this.check(Vg($R,e))},datetime(e){return this.check(Gi(Qn,e))},date(e){return this.check(Wi(es,e))},time(e){return this.check(Yi(ts,e))},duration(e){return this.check(Xi(rs,e))}});function k(e){return $g(od,e)}var Ve=q("ZodStringFormat",(e,t)=>{je.init(e,t),dv.init(e,t)}),Qn=q("ZodISODateTime",(e,t)=>{xh.init(e,t),Ve.init(e,t)}),es=q("ZodISODate",(e,t)=>{Th.init(e,t),Ve.init(e,t)}),ts=q("ZodISOTime",(e,t)=>{Ih.init(e,t),Ve.init(e,t)}),rs=q("ZodISODuration",(e,t)=>{Oh.init(e,t),Ve.init(e,t)}),cR=q("ZodEmail",(e,t)=>{vh.init(e,t),Ve.init(e,t)});var uR=q("ZodGUID",(e,t)=>{gh.init(e,t),Ve.init(e,t)});var oa=q("ZodUUID",(e,t)=>{_h.init(e,t),Ve.init(e,t)});var pv=q("ZodURL",(e,t)=>{bh.init(e,t),Ve.init(e,t)});function mv(e){return Al(pv,e)}var lR=q("ZodEmoji",(e,t)=>{zh.init(e,t),Ve.init(e,t)});var dR=q("ZodNanoID",(e,t)=>{$h.init(e,t),Ve.init(e,t)});var pR=q("ZodCUID",(e,t)=>{wh.init(e,t),Ve.init(e,t)});var mR=q("ZodCUID2",(e,t)=>{Rh.init(e,t),Ve.init(e,t)});var fR=q("ZodULID",(e,t)=>{Ph.init(e,t),Ve.init(e,t)});var hR=q("ZodXID",(e,t)=>{Eh.init(e,t),Ve.init(e,t)});var gR=q("ZodKSUID",(e,t)=>{kh.init(e,t),Ve.init(e,t)});var _R=q("ZodIPv4",(e,t)=>{Ch.init(e,t),Ve.init(e,t)});var vR=q("ZodIPv6",(e,t)=>{jh.init(e,t),Ve.init(e,t)});var yR=q("ZodCIDRv4",(e,t)=>{Ah.init(e,t),Ve.init(e,t)});var SR=q("ZodCIDRv6",(e,t)=>{Mh.init(e,t),Ve.init(e,t)});var bR=q("ZodBase64",(e,t)=>{Zh.init(e,t),Ve.init(e,t)});var zR=q("ZodBase64URL",(e,t)=>{Lh.init(e,t),Ve.init(e,t)});var $R=q("ZodE164",(e,t)=>{Dh.init(e,t),Ve.init(e,t)});var wR=q("ZodJWT",(e,t)=>{Uh.init(e,t),Ve.init(e,t)});var sa=q("ZodNumber",(e,t)=>{El.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>z_(e,r,o,n),e.isFinite=!0},ae.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=it(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=it(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=it(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>it(e).format??null},{gt(e,t){return this.check(jo(e,t))},gte(e,t){return this.check(sr(e,t))},min(e,t){return this.check(sr(e,t))},lt(e,t){return this.check(No(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},int(e){return this.check(av(e))},safe(e){return this.check(av(e))},positive(e){return this.check(jo(0,e))},nonnegative(e){return this.check(sr(0,e))},negative(e){return this.check(No(0,e))},nonpositive(e){return this.check(nr(0,e))},multipleOf(e,t){return this.check(Wn(e,t))},step(e,t){return this.check(Wn(e,t))},finite(){return this}}));function Re(e){return Hg(sa,e)}var RR=q("ZodNumberFormat",(e,t)=>{Fh.init(e,t),sa.init(e,t)});function av(e){return Kg(RR,e)}var nd=q("ZodBoolean",(e,t)=>{Vh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$_(e,r,o,n)});function Ee(e){return Gg(nd,e)}var fv=q("ZodBigInt",(e,t)=>{Jh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>w_(e,r,o,n)},ae.derived({minValue:e=>it(e).minimum??null,maxValue:e=>it(e).maximum??null,format:e=>it(e).format??null},{gte(e,t){return this.check(sr(e,t))},min(e,t){return this.check(sr(e,t))},gt(e,t){return this.check(jo(e,t))},lt(e,t){return this.check(No(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},positive(e){return this.check(jo(BigInt(0),e))},negative(e){return this.check(No(BigInt(0),e))},nonpositive(e){return this.check(nr(BigInt(0),e))},nonnegative(e){return this.check(sr(BigInt(0),e))},multipleOf(e,t){return this.check(Wn(e,t))}}));var PR=q("ZodNull",(e,t)=>{Hh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>R_(e,r,o,n)});function sd(e){return Xg(PR,e)}var ER=q("ZodAny",(e,t)=>{Bh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E_(e,r,o,n)});function hv(){return Qg(ER)}var kR=q("ZodUnknown",(e,t)=>{Kh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k_(e,r,o,n)});function Fe(){return e_(kR)}var xR=q("ZodNever",(e,t)=>{Gh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>P_(e,r,o,n)});function TR(e){return t_(xR,e)}var gv=q("ZodDate",(e,t)=>{Wh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>x_(e,r,o,n),e.min=(r,o)=>e.check(sr(r,o)),e.max=(r,o)=>e.check(nr(r,o))},ae.derived({minDate:e=>{let{minimum:t}=it(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=it(e);return t?new Date(t):null}},{}));var IR=q("ZodArray",(e,t)=>{na(),Yh.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>N_(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Ao(e,t))},nonempty(e){return this.check(Ao(1,e))},max(e,t){return this.check(Qi(e,t))},length(e,t){return this.check(ea(e,t))},unwrap(){return this.element}});function K(e,t){return o_(IR,e,t)}var _v=q("ZodObject",(e,t)=>{na(),eg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>j_(e,r,o,n),ae.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return St(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ae.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:Fe()}))},loose(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:Fe()}))},strict(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:TR()}))},strip(){return this.clone(ae.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return ae.extend(this,e)},safeExtend(e){return ae.safeExtend(this,e)},merge(e){return ae.merge(this,e)},pick(e){return ae.pick(this,e)},omit(e){return ae.omit(this,e)},partial(...e){return ae.partial(Sv,this,e[0])},exactPartial(...e){return ae.partial(bv,this,e[0],"exactPartial")},required(...e){return ae.required(zv,this,e[0])}});function Y(e,t){let r={type:"object",shape:e??{},...ae.normalizeParams(t)};return new _v(r)}function Qe(e,t){return new _v({type:"object",shape:e,catchall:Fe(),...ae.normalizeParams(t)})}var vv=q("ZodUnion",(e,t)=>{kl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>A_(e,r,o,n),e.options=t.options});function Ce(e,t){return new vv({type:"union",options:e,...ae.normalizeParams(t)})}var OR=q("ZodDiscriminatedUnion",(e,t)=>{vv.init(e,t),tg.init(e,t)});function id(e,t,r){return new OR({type:"union",options:t,discriminator:e,...ae.normalizeParams(r)})}var CR=q("ZodIntersection",(e,t)=>{rg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>M_(e,r,o,n)});function ia(e,t){return new CR({type:"intersection",left:e,right:t})}var cv=q("ZodRecord",(e,t)=>{na(),og.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>q_(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Le(e,t,r){return!t||!t._zod?new cv({type:"record",keyType:k(),valueType:e,...ae.normalizeParams(t)}):new cv({type:"record",keyType:e,valueType:t,...ae.normalizeParams(r)})}var rd=q("ZodEnum",(e,t)=>{ng.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(o,n,s)=>T_(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new rd({...t,checks:[],...ae.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new rd({...t,checks:[],...ae.normalizeParams(n),entries:s})}});function St(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new rd({type:"enum",entries:r,...ae.normalizeParams(t)})}var NR=q("ZodLiteral",(e,t)=>{sg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I_(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ee(e,t){return new NR({type:"literal",values:Array.isArray(e)?e:[e],...ae.normalizeParams(t)})}var jR=q("ZodTransform",(e,t)=>{na(),ig.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>C_(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Oo(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ae.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ae.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function yv(e){return new jR({type:"transform",transform:e})}var Sv=q("ZodOptional",(e,t)=>{xl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ze(e){return new Sv({type:"optional",innerType:e})}var bv=q("ZodExactOptional",(e,t)=>{ag.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function AR(e){return new bv({type:"optional",innerType:e})}var MR=q("ZodNullable",(e,t)=>{cg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Z_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function uv(e){return new MR({type:"nullable",innerType:e})}var qR=q("ZodDefault",(e,t)=>{ug.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>U_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ZR(e,t){return new qR({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ae.shallowClone(t)}})}var LR=q("ZodPrefault",(e,t)=>{lg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>F_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function DR(e,t){return new LR({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ae.shallowClone(t)}})}var zv=q("ZodNonOptional",(e,t)=>{dg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>L_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function UR(e,t){return new zv({type:"nonoptional",innerType:e,...ae.normalizeParams(t)})}var FR=q("ZodCatch",(e,t)=>{pg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>V_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function VR(e,t){return new FR({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ae.constantCatch(t)})}var $v=q("ZodPipe",(e,t)=>{Tl.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>J_(e,r,o,n),e.in=t.in,e.out=t.out});function lv(e,t){return new $v({type:"pipe",in:e,out:t})}var JR=q("ZodPreprocess",(e,t)=>{$v.init(e,t),mg.init(e,t)}),HR=q("ZodReadonly",(e,t)=>{fg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>H_(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function BR(e){return new HR({type:"readonly",innerType:e})}var KR=q("ZodLazy",(e,t)=>{hg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>B_(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function wv(e){return new KR({type:"lazy",getter:e})}var GR=q("ZodCustom",(e,t)=>{gg.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O_(e,r,o,n)});function WR(e,t={}){return n_(GR,e,t)}function YR(e,t){return s_(e,t)}function ad(e,t){return new JR({type:"pipe",in:yv(e),out:t})}var Pv={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Rv;Rv||(Rv={});var aa={};Ro(aa,{ZodISODate:()=>es,ZodISODateTime:()=>Qn,ZodISODuration:()=>rs,ZodISOTime:()=>ts,date:()=>eP,datetime:()=>QR,duration:()=>rP,time:()=>tP});function QR(e){return Gi(Qn,e)}function eP(e){return Wi(es,e)}function tP(e){return Yi(ts,e)}function rP(e){return Xi(rs,e)}var ca={};Ro(ca,{bigint:()=>iP,boolean:()=>sP,date:()=>aP,number:()=>nP,string:()=>oP});function oP(e){return wg(od,e)}function nP(e){return Bg(sa,e)}function sP(e){return Wg(nd,e)}function iP(e){return Yg(fv,e)}function aP(e){return r_(gv,e)}var to="2025-11-25",ua="2025-03-26",os=[to,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],la="io.modelcontextprotocol/related-task",Tt="io.modelcontextprotocol/protocolVersion",ro="io.modelcontextprotocol/clientInfo",Lt="io.modelcontextprotocol/serverInfo",Kt="io.modelcontextprotocol/clientCapabilities",wr="io.modelcontextprotocol/subscriptionId",Rr="io.modelcontextprotocol/logLevel";var oo="2.0";var $r=wv(()=>Ce([k(),Re(),Ee(),sd(),Le(k(),$r),K($r)])),He=Le(k(),$r),ud=K($r),ns=Ce([k(),Re().int()]),ss=k(),da=Y({ttl:Re().optional()}),pa=Y({taskId:k()}),is=Qe({progressToken:ns.optional(),[la]:pa.optional()}),nt=Y({_meta:is.optional()}),no=nt.extend({task:da.optional()}),Be=Y({method:k(),params:nt.loose().optional()}),dt=Y({_meta:is.optional()}),pt=Y({method:k(),params:dt.loose().optional()}),as=Qe({get[Lt](){return Uo.optional().catch(void 0)}}),Ke=Qe({_meta:as.optional()}),Pr=Ce([k(),Re().int()]),cs=Y({jsonrpc:ee(oo),id:Pr,...Be.shape}).strict(),us=Y({jsonrpc:ee(oo),...pt.shape}).strict(),Lo=Y({jsonrpc:ee(oo),id:Pr,result:Ke}).strict(),Do=Y({jsonrpc:ee(oo),id:Pr.optional(),error:Y({code:Re().int(),message:k(),data:Fe().optional()})}).strict(),so=Ce([cs,us,Lo,Do]),ld=Ce([Lo,Do]),ls=Ke.strict(),ma=dt.extend({requestId:Pr.optional(),reason:k().optional()}),ds=pt.extend({method:ee("notifications/cancelled"),params:ma}),fa=Y({src:k(),mimeType:k().optional(),sizes:K(k()).optional(),theme:St(["light","dark"]).optional()}),Er=Y({icons:K(fa).optional()}),ir=Y({name:k(),title:k().optional()}),Uo=ir.extend({...ir.shape,...Er.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),cP=ia(Y({applyDefaults:Ee().optional()}),He),uP=ad(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ia(Y({form:cP.optional(),url:He.optional()}),He.optional())),ha=Qe({list:He.optional(),cancel:He.optional(),requests:Qe({sampling:Qe({createMessage:He.optional()}).optional(),elicitation:Qe({create:He.optional()}).optional()}).optional()}),ga=Qe({list:He.optional(),cancel:He.optional(),requests:Qe({tools:Qe({call:He.optional()}).optional()}).optional()}),_a=Y({experimental:Le(k(),He).optional(),sampling:Y({context:He.optional(),tools:He.optional()}).optional(),elicitation:uP.optional(),roots:Y({listChanged:Ee().optional()}).optional(),tasks:ha.optional(),extensions:Le(k(),He).optional()}),va=nt.extend({protocolVersion:k(),capabilities:_a,clientInfo:Uo}),ps=Be.extend({method:ee("initialize"),params:va}),ms=Y({experimental:Le(k(),He).optional(),logging:He.optional(),completions:He.optional(),prompts:Y({listChanged:Ee().optional()}).optional(),resources:Y({subscribe:Ee().optional(),listChanged:Ee().optional()}).optional(),tools:Y({listChanged:Ee().optional()}).optional(),tasks:ga.optional(),extensions:Le(k(),He).optional()}),ya=Ke.extend({protocolVersion:k(),capabilities:ms,serverInfo:Uo,instructions:k().optional()}),Sa=pt.extend({method:ee("notifications/initialized"),params:dt.optional()}),ba=Be.extend({method:ee("server/discover"),params:nt.optional()}),za=Ke.extend({supportedVersions:K(k()),capabilities:ms,instructions:k().optional()}),fs=Be.extend({method:ee("ping"),params:nt.optional()}),$a=Y({progress:Re(),total:Ze(Re()),message:Ze(k())}),wa=Y({...dt.shape,...$a.shape,progressToken:ns}),hs=pt.extend({method:ee("notifications/progress"),params:wa}),Ra=nt.extend({cursor:ss.optional()}),kr=Be.extend({params:Ra.optional()}),xr=Ke.extend({nextCursor:ss.optional()}),gs=Y({uri:k(),mimeType:Ze(k()),_meta:Le(k(),Fe()).optional()}),_s=gs.extend({text:k()}),dd=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),vs=gs.extend({blob:dd}),Tr=St(["user","assistant"]),ar=Y({audience:K(Tr).optional(),priority:Re().min(0).max(1).optional(),lastModified:aa.datetime({offset:!0}).optional()}),ys=Y({...ir.shape,...Er.shape,uri:k(),description:Ze(k()),mimeType:Ze(k()),size:Ze(Re()),annotations:ar.optional(),_meta:Ze(Qe({}))}),Pa=Y({...ir.shape,...Er.shape,uriTemplate:k(),description:Ze(k()),mimeType:Ze(k()),annotations:ar.optional(),_meta:Ze(Qe({}))}),Ea=kr.extend({method:ee("resources/list")}),ka=xr.extend({resources:K(ys)}),xa=kr.extend({method:ee("resources/templates/list")}),Ta=xr.extend({resourceTemplates:K(Pa)}),Fo=nt.extend({uri:k()}),Ia=Fo,Oa=Be.extend({method:ee("resources/read"),params:Ia}),Ca=Ke.extend({contents:K(Ce([_s,vs]))}),Na=pt.extend({method:ee("notifications/resources/list_changed"),params:dt.optional()}),ja=Fo,Aa=Be.extend({method:ee("resources/subscribe"),params:ja}),Ma=Fo,qa=Be.extend({method:ee("resources/unsubscribe"),params:Ma}),Ss=Y({toolsListChanged:Ee().optional(),promptsListChanged:Ee().optional(),resourcesListChanged:Ee().optional(),resourceSubscriptions:K(k()).optional()}),Za=nt.extend({notifications:Ss}),La=Be.extend({method:ee("subscriptions/listen"),params:Za}),Da=dt.extend({notifications:Ss}),Ua=pt.extend({method:ee("notifications/subscriptions/acknowledged"),params:Da}),Fa=as.extend({[wr]:Pr}),Va=Ke.extend({_meta:Fa}),Ja=dt.extend({uri:k()}),Ha=pt.extend({method:ee("notifications/resources/updated"),params:Ja}),Ba=Y({name:k(),description:Ze(k()),required:Ze(Ee())}),Ka=Y({...ir.shape,...Er.shape,description:Ze(k()),arguments:Ze(K(Ba)),_meta:Ze(Qe({}))}),Ga=kr.extend({method:ee("prompts/list")}),Wa=xr.extend({prompts:K(Ka)}),Ya=nt.extend({name:k(),arguments:Le(k(),k()).optional()}),Xa=Be.extend({method:ee("prompts/get"),params:Ya}),Vo=Y({type:ee("text"),text:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Jo=Y({type:ee("image"),data:dd,mimeType:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Ho=Y({type:ee("audio"),data:dd,mimeType:k(),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),Qa=Y({type:ee("tool_use"),name:k(),id:k(),input:Le(k(),Fe()),_meta:Le(k(),Fe()).optional()}),ec=Y({type:ee("resource"),resource:Ce([_s,vs]),annotations:ar.optional(),_meta:Le(k(),Fe()).optional()}),tc=ys.extend({type:ee("resource_link")}),Bo=Ce([Vo,Jo,Ho,tc,ec]),rc=Y({role:Tr,content:Bo}),oc=Ke.extend({description:k().optional(),messages:K(rc)}),nc=pt.extend({method:ee("notifications/prompts/list_changed"),params:dt.optional()}),sc=Y({title:k().optional(),readOnlyHint:Ee().optional(),destructiveHint:Ee().optional(),idempotentHint:Ee().optional(),openWorldHint:Ee().optional()}),ic=Y({taskSupport:St(["required","optional","forbidden"]).optional()}),bs=Y({...ir.shape,...Er.shape,description:k().optional(),inputSchema:Y({type:ee("object"),properties:Le(k(),$r).optional(),required:K(k()).optional()}).catchall(Fe()),outputSchema:Qe({$schema:k().optional()}).optional(),annotations:sc.optional(),execution:ic.optional(),_meta:Le(k(),Fe()).optional()}),ac=kr.extend({method:ee("tools/list")}),cc=xr.extend({tools:K(bs)}),zs=Ke.extend({content:K(Bo).default([]),structuredContent:Fe().optional(),isError:Ee().optional()}),pd=zs.or(Ke.extend({toolResult:Fe()})),uc=no.extend({name:k(),arguments:Le(k(),Fe()).optional()}),lc=Be.extend({method:ee("tools/call"),params:uc}),dc=pt.extend({method:ee("notifications/tools/list_changed"),params:dt.optional()}),md=Y({autoRefresh:Ee().default(!0),debounceMs:Re().int().nonnegative().default(300)}),Ir=St(["debug","info","notice","warning","error","critical","alert","emergency"]),pc=nt.extend({level:Ir}),mc=Be.extend({method:ee("logging/setLevel"),params:pc}),fc=dt.extend({level:Ir,logger:k().optional(),data:Fe()}),hc=pt.extend({method:ee("notifications/message"),params:fc}),gc=Y({name:k().optional()}),_c=Y({hints:K(gc).optional(),costPriority:Re().min(0).max(1).optional(),speedPriority:Re().min(0).max(1).optional(),intelligencePriority:Re().min(0).max(1).optional()}),vc=Y({mode:St(["auto","required","none"]).optional()}),yc=Y({type:ee("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:K(Bo),structuredContent:Fe().optional(),isError:Ee().optional(),_meta:Le(k(),Fe()).optional()}),Sc=id("type",[Vo,Jo,Ho]),eo=id("type",[Vo,Jo,Ho,Qa,yc]),bc=Y({role:Tr,content:Ce([eo,K(eo)]),_meta:Le(k(),Fe()).optional()}),zc=no.extend({messages:K(bc),modelPreferences:_c.optional(),systemPrompt:k().optional(),includeContext:St(["none","thisServer","allServers"]).optional(),temperature:Re().optional(),maxTokens:Re().int(),stopSequences:K(k()).optional(),metadata:He.optional(),tools:K(bs).optional(),toolChoice:vc.optional()}),$c=Be.extend({method:ee("sampling/createMessage"),params:zc}),wc=Ke.extend({model:k(),stopReason:Ze(St(["endTurn","stopSequence","maxTokens"]).or(k())),role:Tr,content:Sc}),Rc=Ke.extend({model:k(),stopReason:Ze(St(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Tr,content:Ce([eo,K(eo)])}),$s=Y({type:ee("boolean"),title:k().optional(),description:k().optional(),default:Ee().optional()}),Ko=Y({type:ee("string"),title:k().optional(),description:k().optional(),minLength:Re().optional(),maxLength:Re().optional(),format:St(["email","uri","date","date-time"]).optional(),default:k().optional()}),Go=Y({type:St(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Re().optional(),maximum:Re().optional(),default:Re().optional()}),ws=Y({type:ee("string"),title:k().optional(),description:k().optional(),enum:K(k()),default:k().optional()}),Rs=Y({type:ee("string"),title:k().optional(),description:k().optional(),oneOf:K(Y({const:k(),title:k()})),default:k().optional()}),Ps=Y({type:ee("string"),title:k().optional(),description:k().optional(),enum:K(k()),enumNames:K(k()).optional(),default:k().optional()}),Pc=Ce([ws,Rs]),Es=Y({type:ee("array"),title:k().optional(),description:k().optional(),minItems:Re().optional(),maxItems:Re().optional(),items:Y({type:ee("string"),enum:K(k())}),default:K(k()).optional()}),ks=Y({type:ee("array"),title:k().optional(),description:k().optional(),minItems:Re().optional(),maxItems:Re().optional(),items:Y({anyOf:K(Y({const:k(),title:k()}))}),default:K(k()).optional()}),Ec=Ce([Es,ks]),kc=Ce([Ps,Pc,Ec]),xs=Ce([kc,$s,Ko,Go]),Wo=no.extend({mode:ee("form").optional(),message:k(),requestedSchema:Y({type:ee("object"),properties:Le(k(),xs),required:K(k()).optional()}).catchall(Fe())}),xc=no.extend({mode:ee("url"),message:k(),elicitationId:k(),url:k().url()}),Tc=Ce([Wo,xc]),Ic=Be.extend({method:ee("elicitation/create"),params:Tc}),Oc=dt.extend({elicitationId:k()}),Cc=pt.extend({method:ee("notifications/elicitation/complete"),params:Oc}),Nc=Ke.extend({action:St(["accept","decline","cancel"]),content:ad(e=>e===null?void 0:e,Le(k(),Ce([k(),Re(),Ee(),K(k())])).optional())}),jc=Y({type:ee("ref/resource"),uri:k()}),Ac=Y({type:ee("ref/prompt"),name:k()}),Mc=nt.extend({ref:Ce([Ac,jc]),argument:Y({name:k(),value:k()}),context:Y({arguments:Le(k(),k()).optional()}).optional()}),qc=Be.extend({method:ee("completion/complete"),params:Mc}),Zc=Ke.extend({completion:Qe({values:K(k()).max(100),total:Ze(Re().int()),hasMore:Ze(Ee())})}),Lc=Y({uri:k().startsWith("file://"),name:k().optional(),_meta:Le(k(),Fe()).optional()}),Dc=Be.extend({method:ee("roots/list"),params:nt.optional()}),Uc=Ke.extend({roots:K(Lc)}),Fc=pt.extend({method:ee("notifications/roots/list_changed"),params:dt.optional()}),fd=Qe({ttl:Re().optional(),pollInterval:Re().optional()}),Vc=St(["working","input_required","completed","failed","cancelled"]),Or=Y({taskId:k(),status:Vc,ttl:Ce([Re(),sd()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:Ze(Re()),statusMessage:Ze(k())}),hd=Ke.extend({task:Or}),Jc=dt.merge(Or),gd=pt.extend({method:ee("notifications/tasks/status"),params:Jc}),_d=Be.extend({method:ee("tasks/get"),params:nt.extend({taskId:k()})}),vd=Ke.merge(Or),yd=Be.extend({method:ee("tasks/result"),params:nt.extend({taskId:k()})}),Sd=Ke.loose(),bd=kr.extend({method:ee("tasks/list")}),zd=xr.extend({tasks:K(Or)}),$d=Be.extend({method:ee("tasks/cancel"),params:nt.extend({taskId:k()})}),wd=Ke.merge(Or),Rd=Ce([fs,ps,ba,qc,mc,Xa,Ga,Ea,xa,Oa,Aa,qa,La,lc,ac]),Pd=Ce([ds,hs,Sa,Fc]),Ed=Ce([ls,wc,Rc,Nc,Uc]),kd=Ce([fs,$c,Ic,Dc]),xd=Ce([ds,hs,hc,Ha,Na,dc,nc,Ua,Cc]),Td=Ce([ls,ya,za,Zc,oc,Wa,ka,Ta,Ca,zs,cc,Va]),ot=mv().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Pv.custom,message:"URL must be parseable",fatal:!0}),dl}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Id=Qe({resource:k().url(),authorization_servers:K(ot).optional(),jwks_uri:k().url().optional(),scopes_supported:K(k()).optional(),bearer_methods_supported:K(k()).optional(),resource_signing_alg_values_supported:K(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:Ee().optional(),authorization_details_types_supported:K(k()).optional(),dpop_signing_alg_values_supported:K(k()).optional(),dpop_bound_access_tokens_required:Ee().optional()}),Hc=Qe({issuer:k(),authorization_endpoint:ot,token_endpoint:ot,registration_endpoint:ot.optional(),scopes_supported:K(k()).optional(),response_types_supported:K(k()),response_modes_supported:K(k()).optional(),grant_types_supported:K(k()).optional(),token_endpoint_auth_methods_supported:K(k()).optional(),token_endpoint_auth_signing_alg_values_supported:K(k()).optional(),service_documentation:ot.optional(),revocation_endpoint:ot.optional(),revocation_endpoint_auth_methods_supported:K(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:K(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:K(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:K(k()).optional(),code_challenge_methods_supported:K(k()).optional(),client_id_metadata_document_supported:Ee().optional(),authorization_response_iss_parameter_supported:Ee().optional().catch(void 0)}),Bc=Qe({issuer:k(),authorization_endpoint:ot,token_endpoint:ot,userinfo_endpoint:ot.optional(),jwks_uri:ot,registration_endpoint:ot.optional(),scopes_supported:K(k()).optional(),response_types_supported:K(k()),response_modes_supported:K(k()).optional(),grant_types_supported:K(k()).optional(),acr_values_supported:K(k()).optional(),subject_types_supported:K(k()),id_token_signing_alg_values_supported:K(k()),id_token_encryption_alg_values_supported:K(k()).optional(),id_token_encryption_enc_values_supported:K(k()).optional(),userinfo_signing_alg_values_supported:K(k()).optional(),userinfo_encryption_alg_values_supported:K(k()).optional(),userinfo_encryption_enc_values_supported:K(k()).optional(),request_object_signing_alg_values_supported:K(k()).optional(),request_object_encryption_alg_values_supported:K(k()).optional(),request_object_encryption_enc_values_supported:K(k()).optional(),token_endpoint_auth_methods_supported:K(k()).optional(),token_endpoint_auth_signing_alg_values_supported:K(k()).optional(),display_values_supported:K(k()).optional(),claim_types_supported:K(k()).optional(),claims_supported:K(k()).optional(),service_documentation:k().optional(),claims_locales_supported:K(k()).optional(),ui_locales_supported:K(k()).optional(),claims_parameter_supported:Ee().optional(),request_parameter_supported:Ee().optional(),request_uri_parameter_supported:Ee().optional(),require_request_uri_registration:Ee().optional(),op_policy_uri:ot.optional(),op_tos_uri:ot.optional(),client_id_metadata_document_supported:Ee().optional(),authorization_response_iss_parameter_supported:Ee().optional().catch(void 0)}),Od=Y({...Bc.shape,...Hc.pick({code_challenge_methods_supported:!0}).shape}),Cd=Y({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:ca.number().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),Nd=Y({issued_token_type:ee("urn:ietf:params:oauth:token-type:id-jag"),access_token:k(),token_type:k().optional(),expires_in:Re().optional(),scope:k().optional()}).strip(),jd=Y({error:k(),error_description:k().optional(),error_uri:k().optional()}),cd=ot.optional().or(ee("").transform(()=>{})),Kc=Y({redirect_uris:K(ot),token_endpoint_auth_method:k().optional(),grant_types:K(k()).optional(),response_types:K(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:ot.optional(),logo_uri:cd,scope:k().optional(),contacts:K(k()).optional(),tos_uri:cd,policy_uri:k().optional(),jwks_uri:ot.optional(),jwks:hv().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Gc=Y({client_id:k(),client_secret:k().optional(),client_id_issued_at:Re().optional(),client_secret_expires_at:Re().optional()}).strip(),Ad=Kc.merge(Gc),Md=Y({error:k(),error_description:k().optional()}).strip(),qd=Y({token:k(),token_type_hint:k().optional()}).strip();var jv;function Z(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var FC=Symbol("zod_brand"),Gt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Yo=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(jv=globalThis).__zod_globalConfig??(jv.__zod_globalConfig={});var Xo=globalThis.__zod_globalConfig;function Rt(e){return e&&Object.assign(Xo,e),Xo}var Pe={};Ro(Pe,{BIGINT_FORMAT_RANGES:()=>Zv,Class:()=>Ld,NUMBER_FORMAT_RANGES:()=>Hd,aborted:()=>jr,allowsEval:()=>Fd,assert:()=>fP,assertEqual:()=>lP,assertIs:()=>pP,assertNever:()=>mP,assertNotEqual:()=>dP,assignProp:()=>Cr,base64ToUint8Array:()=>Dv,base64urlToUint8Array:()=>IP,cached:()=>en,captureStackTrace:()=>Xc,cleanEnum:()=>TP,cleanRegex:()=>Cs,clone:()=>Dt,cloneDef:()=>gP,createTransparentProxy:()=>zP,defineLazy:()=>$e,esc:()=>Yc,escapeRegex:()=>ur,explicitlyAborted:()=>Bd,extend:()=>RP,finalizeIssue:()=>It,floatSafeRemainder:()=>Dd,getElementAtPath:()=>_P,getEnumValues:()=>Is,getLengthableOrigin:()=>Ns,getParsedType:()=>bP,getSizableOrigin:()=>Lv,hexToUint8Array:()=>CP,isObject:()=>io,isPlainObject:()=>Nr,issue:()=>tn,joinValues:()=>Wc,jsonStringifyReplacer:()=>Qo,merge:()=>EP,mergeDefs:()=>cr,normalizeParams:()=>ce,nullish:()=>Os,numKeys:()=>SP,objectClone:()=>hP,omit:()=>wP,optionalKeys:()=>Jd,parsedType:()=>Kd,partial:()=>kP,pick:()=>$P,prefixIssues:()=>lr,primitiveTypes:()=>qv,promiseAllObject:()=>vP,propertyKeyTypes:()=>Vd,randomString:()=>yP,required:()=>xP,safeExtend:()=>PP,shallowClone:()=>Mv,slugify:()=>Ud,stringifyPrimitive:()=>Qc,uint8ArrayToBase64:()=>Uv,uint8ArrayToBase64url:()=>OP,uint8ArrayToHex:()=>NP,unwrapMessage:()=>Ts});function lP(e){return e}function dP(e){return e}function pP(e){}function mP(e){throw new Error("Unexpected value in exhaustive check")}function fP(e){}function Is(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Wc(e,t="|"){return e.map(r=>Qc(r)).join(t)}function Qo(e,t){return typeof t=="bigint"?t.toString():t}function en(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Os(e){return e==null}function Cs(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Dd(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Av=Symbol("evaluating");function $e(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Av)return o===void 0&&(o=Av,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function hP(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Cr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function cr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function gP(e){return cr(e._zod.def)}function _P(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function vP(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function yP(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Yc(e){return JSON.stringify(e)}function Ud(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Xc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function io(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Fd=en(()=>{if(Xo.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Nr(e){if(io(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(io(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mv(e){return Nr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function SP(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var bP=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Vd=new Set(["string","number","symbol"]),qv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ur(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dt(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function ce(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function zP(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Qc(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Jd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Hd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Zv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $P(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=cr(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return Cr(this,"shape",i),i},checks:[]});return Dt(e,s)}function wP(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=cr(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Cr(this,"shape",i),i},checks:[]});return Dt(e,s)}function RP(e,t){if(!Nr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=cr(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Cr(this,"shape",s),s}});return Dt(e,n)}function PP(e,t){if(!Nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Cr(this,"shape",o),o}});return Dt(e,r)}function EP(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=cr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Cr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Dt(e,r)}function kP(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=cr(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Cr(this,"shape",c),c},checks:[]});return Dt(t,i)}function xP(e,t,r){let o=cr(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return Cr(this,"shape",s),s}});return Dt(t,o)}function jr(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 Bd(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 lr(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ts(e){return typeof e=="string"?e:e?.message}function It(e,t,r){let o=e.message?e.message:Ts(e.inst?._zod.def?.error?.(e))??Ts(t?.error?.(e))??Ts(r.customError?.(e))??Ts(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function Lv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ns(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Kd(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 tn(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function TP(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Dv(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Uv(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function IP(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Dv(t+r)}function OP(e){return Uv(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function CP(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function NP(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ld=class{constructor(...t){}};var Fv=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Qo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eu=Z("$ZodError",Fv),Gd=Z("$ZodError",Fv,{Parent:Error});function Vv(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Jv(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var tu=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Gt;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>It(c,s,Rt())));throw Xc(a,n?.callee),a}return i.value};var ru=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>It(c,s,Rt())));throw Xc(a,n?.callee),a}return i.value};var js=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Gt;return s.issues.length?{success:!1,error:new(e??eu)(s.issues.map(i=>It(i,n,Rt())))}:{success:!0,data:s.value}},Hv=js(Gd),As=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>It(i,n,Rt())))}:{success:!0,data:s.value}},Bv=As(Gd),Kv=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return tu(e)(t,r,n)};var Gv=e=>(t,r,o)=>tu(e)(t,r,o);var Wv=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ru(e)(t,r,n)};var Yv=e=>async(t,r,o)=>ru(e)(t,r,o);var Xv=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return js(e)(t,r,n)};var Qv=e=>(t,r,o)=>js(e)(t,r,o);var ey=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return As(e)(t,r,n)};var ty=e=>async(t,r,o)=>As(e)(t,r,o);var ry=/^[cC][0-9a-z]{6,}$/,oy=/^[0-9a-z]+$/,ny=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sy=/^[0-9a-vA-V]{20}$/,iy=/^[A-Za-z0-9]{27}$/,ay=/^[a-zA-Z0-9_-]{21}$/,cy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var uy=/^([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})$/,Wd=e=>e?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})$`):/^([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)$/;var ly=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var AP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dy(){return new RegExp(AP,"u")}var py=/^(?:(?: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])$/,my=/^(([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 fy=/^((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])$/,hy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yd=/^[A-Za-z0-9_-]*$/;var _y=/^https?$/,vy=/^\+[1-9]\d{6,14}$/,yy="(?:(?:\\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])))",Sy=new RegExp(`^${yy}$`);function by(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zy(e){return new RegExp(`^${by(e)}$`)}function $y(e){let t=by({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${yy}T(?:${o})$`)}var wy=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Ry=/^-?\d+$/,Xd=/^-?\d+(?:\.\d+)?$/,Py=/^(?:true|false)$/i,Ey=/^null$/i;var ky=/^[^A-Z]*$/,xy=/^[^a-z]*$/;var at=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ty={number:"number",bigint:"bigint",object:"date"},Qd=Z("$ZodCheckLessThan",(e,t)=>{at.init(e,t);let r=Ty[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ep=Z("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);let r=Ty[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Iy=Z("$ZodCheckMultipleOf",(e,t)=>{at.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Dd(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Oy=Z("$ZodCheckNumberFormat",(e,t)=>{at.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Hd[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Ry)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Cy=Z("$ZodCheckMaxLength",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Ns(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ny=Z("$ZodCheckMinLength",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Ns(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),jy=Z("$ZodCheckLengthEquals",(e,t)=>{var r;at.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Os(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Ns(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ms=Z("$ZodCheckStringFormat",(e,t)=>{var r,o;at.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ay=Z("$ZodCheckRegex",(e,t)=>{Ms.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),My=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ky),Ms.init(e,t)}),qy=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xy),Ms.init(e,t)}),Zy=Z("$ZodCheckIncludes",(e,t)=>{at.init(e,t);let r=ur(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ly=Z("$ZodCheckStartsWith",(e,t)=>{at.init(e,t);let r=new RegExp(`^${ur(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Dy=Z("$ZodCheckEndsWith",(e,t)=>{at.init(e,t);let r=new RegExp(`.*${ur(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Uy=Z("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var nu=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
58
58
  `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
59
- `))}};var Fy={major:4,minor:4,patch:3};var Ne=Z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fy;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._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 n=(i,a,c)=>{let u=jr(i),l;for(let d of a){if(d._zod.def.when){if(Bd(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,g=d._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Gt;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,i.issues.length!==p&&(u||(u=jr(i,p)))});else{if(i.issues.length===p)continue;u||(u=jr(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(jr(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Gt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Gt;return c.then(u=>n(u,o,a))}return n(c,o,a)}}$e(e,"~standard",()=>({validate:n=>{try{let s=Jv(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Hv(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),au=Z("$ZodString",(e,t)=>{Ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$y(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ae=Z("$ZodStringFormat",(e,t)=>{Ms.init(e,t),au.init(e,t)}),Xy=Z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cy),Ae.init(e,t)}),Qy=Z("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wd(o))}else t.pattern??(t.pattern=Wd());Ae.init(e,t)}),eS=Z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uy),Ae.init(e,t)}),tS=Z("$ZodURL",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===gy.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rS=Z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ly()),Ae.init(e,t)}),oS=Z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=iy),Ae.init(e,t)}),nS=Z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ty),Ae.init(e,t)}),sS=Z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ry),Ae.init(e,t)}),iS=Z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=oy),Ae.init(e,t)}),aS=Z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ny),Ae.init(e,t)}),cS=Z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sy),Ae.init(e,t)}),uS=Z("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zy(t)),Ae.init(e,t)}),lS=Z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yy),Ae.init(e,t)}),dS=Z("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=by(t)),Ae.init(e,t)}),pS=Z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ay),Ae.init(e,t)}),mS=Z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dy),Ae.init(e,t),e._zod.bag.format="ipv4"}),fS=Z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=py),Ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var hS=Z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=my),Ae.init(e,t)}),gS=Z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fy),Ae.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _S(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var vS=Z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hy),Ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{_S(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function AP(e){if(!Yd.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _S(r)}var yS=Z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yd),Ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{AP(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),SS=Z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_y),Ae.init(e,t)});function MP(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var bS=Z("$ZodJWT",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{MP(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var rp=Z("$ZodNumber",(e,t)=>{Ne.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xd,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),zS=Z("$ZodNumberFormat",(e,t)=>{Iy.init(e,t),rp.init(e,t)}),$S=Z("$ZodBoolean",(e,t)=>{Ne.init(e,t),e._zod.pattern=Ry,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var wS=Z("$ZodNull",(e,t)=>{Ne.init(e,t),e._zod.pattern=Py,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var RS=Z("$ZodUnknown",(e,t)=>{Ne.init(e,t),e._zod.parse=r=>r}),PS=Z("$ZodNever",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Vy(e,t,r){e.issues.length&&t.issues.push(...lr(r,e.issues)),t.value[r]=e.value}var ES=Z("$ZodArray",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Vy(u,r,i))):Vy(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function iu(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...lr(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function kS(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Jd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function xS(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let g=c.run({value:t[p],issues:[]},o);g instanceof Promise?e.push(g.then(f=>iu(f,r,p,t,l,d))):iu(g,r,p,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var qP=Z("$ZodObject",(e,t)=>{if(Ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=en(()=>kS(t));$e(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=io,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let g=d[p],f=g._zod.optin==="optional",_=g._zod.optout==="optional",m=g._zod.run({value:u[p],issues:[]},c);m instanceof Promise?l.push(m.then(h=>iu(h,a,p,u,f,_))):iu(m,a,p,u,f,_)}return s?xS(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),TS=Z("$ZodObjectJIT",(e,t)=>{qP.init(e,t);let r=e._zod.parse,o=en(()=>kS(t)),n=p=>{let g=new nu(["shape","payload","ctx"]),f=o.value,_=v=>{let S=Yc(v);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};g.write("const input = payload.value;");let m=Object.create(null),h=0;for(let v of f.keys)m[v]=`key_${h++}`;g.write("const newResult = {};");for(let v of f.keys){let S=m[v],R=Yc(v),b=p[v],y=b?._zod?.optin==="optional",$=b?._zod?.optout==="optional";g.write(`const ${S} = ${_(v)};`),y&&$?g.write(`
59
+ `))}};var Vy={major:4,minor:4,patch:3};var Ne=Z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vy;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._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 n=(i,a,c)=>{let u=jr(i),l;for(let d of a){if(d._zod.def.when){if(Bd(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,g=d._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Gt;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,i.issues.length!==p&&(u||(u=jr(i,p)))});else{if(i.issues.length===p)continue;u||(u=jr(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(jr(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Gt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Gt;return c.then(u=>n(u,o,a))}return n(c,o,a)}}$e(e,"~standard",()=>({validate:n=>{try{let s=Hv(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Bv(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),au=Z("$ZodString",(e,t)=>{Ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wy(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ae=Z("$ZodStringFormat",(e,t)=>{Ms.init(e,t),au.init(e,t)}),Qy=Z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uy),Ae.init(e,t)}),eS=Z("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wd(o))}else t.pattern??(t.pattern=Wd());Ae.init(e,t)}),tS=Z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ly),Ae.init(e,t)}),rS=Z("$ZodURL",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===_y.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),oS=Z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=dy()),Ae.init(e,t)}),nS=Z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ay),Ae.init(e,t)}),sS=Z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ry),Ae.init(e,t)}),iS=Z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oy),Ae.init(e,t)}),aS=Z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ny),Ae.init(e,t)}),cS=Z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sy),Ae.init(e,t)}),uS=Z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=iy),Ae.init(e,t)}),lS=Z("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$y(t)),Ae.init(e,t)}),dS=Z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sy),Ae.init(e,t)}),pS=Z("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=zy(t)),Ae.init(e,t)}),mS=Z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cy),Ae.init(e,t)}),fS=Z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=py),Ae.init(e,t),e._zod.bag.format="ipv4"}),hS=Z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=my),Ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var gS=Z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fy),Ae.init(e,t)}),_S=Z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hy),Ae.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function vS(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var yS=Z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gy),Ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{vS(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function MP(e){if(!Yd.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vS(r)}var SS=Z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yd),Ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{MP(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bS=Z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vy),Ae.init(e,t)});function qP(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var zS=Z("$ZodJWT",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{qP(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var rp=Z("$ZodNumber",(e,t)=>{Ne.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xd,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),$S=Z("$ZodNumberFormat",(e,t)=>{Oy.init(e,t),rp.init(e,t)}),wS=Z("$ZodBoolean",(e,t)=>{Ne.init(e,t),e._zod.pattern=Py,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var RS=Z("$ZodNull",(e,t)=>{Ne.init(e,t),e._zod.pattern=Ey,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var PS=Z("$ZodUnknown",(e,t)=>{Ne.init(e,t),e._zod.parse=r=>r}),ES=Z("$ZodNever",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Jy(e,t,r){e.issues.length&&t.issues.push(...lr(r,e.issues)),t.value[r]=e.value}var kS=Z("$ZodArray",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Jy(u,r,i))):Jy(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function iu(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...lr(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function xS(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Jd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function TS(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let g=c.run({value:t[p],issues:[]},o);g instanceof Promise?e.push(g.then(f=>iu(f,r,p,t,l,d))):iu(g,r,p,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var ZP=Z("$ZodObject",(e,t)=>{if(Ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=en(()=>xS(t));$e(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=io,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let g=d[p],f=g._zod.optin==="optional",_=g._zod.optout==="optional",m=g._zod.run({value:u[p],issues:[]},c);m instanceof Promise?l.push(m.then(h=>iu(h,a,p,u,f,_))):iu(m,a,p,u,f,_)}return s?TS(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),IS=Z("$ZodObjectJIT",(e,t)=>{ZP.init(e,t);let r=e._zod.parse,o=en(()=>xS(t)),n=p=>{let g=new nu(["shape","payload","ctx"]),f=o.value,_=v=>{let S=Yc(v);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};g.write("const input = payload.value;");let m=Object.create(null),h=0;for(let v of f.keys)m[v]=`key_${h++}`;g.write("const newResult = {};");for(let v of f.keys){let S=m[v],R=Yc(v),b=p[v],y=b?._zod?.optin==="optional",$=b?._zod?.optout==="optional";g.write(`const ${S} = ${_(v)};`),y&&$?g.write(`
60
60
  if (${S}.issues.length) {
61
61
  if (${R} in input) {
62
62
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
@@ -115,33 +115,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
115
115
  }
116
116
  }
117
117
 
118
- `)}g.write("payload.value = newResult;"),g.write("return payload;");let z=g.compile();return(v,S)=>z(p,v,S)},s,i=io,a=!Xo.jitless,u=a&&Fd.value,l=t.catchall,d;e._zod.parse=(p,g)=>{d??(d=o.value);let f=p.value;return i(f)?a&&u&&g?.async===!1&&g.jitless!==!0?(s||(s=n(t.shape)),p=s(p,g),l?xS([],f,p,g,d,e):p):r(p,g):(p.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),p)}});function Jy(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!jr(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>It(i,o,Rt())))}),t)}var op=Z("$ZodUnion",(e,t)=>{Ne.init(e,t),$e(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),$e(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),$e(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),$e(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>Cs(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Jy(a,o,e,n)):Jy(i,o,e,n)}});var IS=Z("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,op.init(e,t);let r=e._zod.parse;$e(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=en(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!io(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),OS=Z("$ZodIntersection",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Hy(r,c,u)):Hy(r,s,i)}});function tp(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(Nr(e)&&Nr(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=tp(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=tp(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Hy(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),jr(e))return e;let i=tp(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var CS=Z("$ZodRecord",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Nr(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>It(g,o,Rt())),input:u,path:[u],inst:e});continue}let d=l.value,p=t.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(g=>{g.issues.length&&r.issues.push(...lr(u,g.issues)),r.value[d]=g.value})):(p.issues.length&&r.issues.push(...lr(u,p.issues)),r.value[d]=p.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Xd.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>It(d,o,Rt())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...lr(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...lr(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var NS=Z("$ZodEnum",(e,t)=>{Ne.init(e,t);let r=Is(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Vd.has(typeof n)).map(n=>typeof n=="string"?ur(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),jS=Z("$ZodLiteral",(e,t)=>{if(Ne.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?ur(o):o?ur(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var AS=Z("$ZodTransform",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Yo(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Gt;return r.value=n,r.fallback=!0,r}});function By(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var np=Z("$ZodOptional",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$e(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cs(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>By(i,n)):By(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),MS=Z("$ZodExactOptional",(e,t)=>{np.init(e,t),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),qS=Z("$ZodNullable",(e,t)=>{Ne.init(e,t),$e(e._zod,"optin",()=>t.innerType._zod.optin),$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cs(r.source)}|null)$`):void 0}),$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),ZS=Z("$ZodDefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Ky(s,t)):Ky(n,t)}});function Ky(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var LS=Z("$ZodPrefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),DS=Z("$ZodNonOptional",(e,t)=>{Ne.init(e,t),$e(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Gy(s,e)):Gy(n,e)}});function Gy(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var US=Z("$ZodCatch",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>It(i,o,Rt()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>It(s,o,Rt()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var sp=Z("$ZodPipe",(e,t)=>{Ne.init(e,t),$e(e._zod,"values",()=>t.in._zod.values),$e(e._zod,"optin",()=>t.in._zod.optin),$e(e._zod,"optout",()=>t.out._zod.optout),$e(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>su(i,t.in,o)):su(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>su(s,t.out,o)):su(n,t.out,o)}});function su(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var FS=Z("$ZodPreprocess",(e,t)=>{sp.init(e,t)}),VS=Z("$ZodReadonly",(e,t)=>{Ne.init(e,t),$e(e._zod,"propValues",()=>t.innerType._zod.propValues),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"optin",()=>t.innerType?._zod?.optin),$e(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Wy):Wy(n)}});function Wy(e){return e.value=Object.freeze(e.value),e}var JS=Z("$ZodLazy",(e,t)=>{Ne.init(e,t),$e(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),$e(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),$e(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),$e(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),$e(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),HS=Z("$ZodCustom",(e,t)=>{at.init(e,t),Ne.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Yy(s,r,o,e));Yy(n,r,o,e)}});function Yy(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(tn(n))}}var ZP=()=>{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(n){return e[n]??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",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Kd(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${Qc(n.values[0])}`:`Invalid option: expected one of ${Wc(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Wc(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function BS(){return{localeError:ZP()}}var KS,aN=Symbol("ZodOutput"),cN=Symbol("ZodInput"),ip=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function LP(){return new ip}(KS=globalThis).__zod_globalRegistry??(KS.__zod_globalRegistry=LP());var ao=globalThis.__zod_globalRegistry;function GS(e,t){return new e({type:"string",...ce(t)})}function ap(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ce(t)})}function cp(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ce(t)})}function WS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ce(t)})}function YS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ce(t)})}function XS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ce(t)})}function QS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ce(t)})}function up(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ce(t)})}function eb(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ce(t)})}function tb(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ce(t)})}function rb(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ce(t)})}function ob(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ce(t)})}function nb(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ce(t)})}function sb(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ce(t)})}function ib(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ce(t)})}function ab(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ce(t)})}function cb(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ce(t)})}function ub(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ce(t)})}function lb(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ce(t)})}function db(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ce(t)})}function pb(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ce(t)})}function mb(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ce(t)})}function fb(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ce(t)})}function hb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ce(t)})}function gb(e,t){return new e({type:"string",format:"date",check:"string_format",...ce(t)})}function _b(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ce(t)})}function vb(e,t){return new e({type:"string",format:"duration",check:"string_format",...ce(t)})}function yb(e,t){return new e({type:"number",checks:[],...ce(t)})}function Sb(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ce(t)})}function bb(e,t){return new e({type:"boolean",...ce(t)})}function zb(e,t){return new e({type:"null",...ce(t)})}function $b(e){return new e({type:"unknown"})}function wb(e,t){return new e({type:"never",...ce(t)})}function cu(e,t){return new Qd({check:"less_than",...ce(t),value:e,inclusive:!1})}function qs(e,t){return new Qd({check:"less_than",...ce(t),value:e,inclusive:!0})}function uu(e,t){return new ep({check:"greater_than",...ce(t),value:e,inclusive:!1})}function Zs(e,t){return new ep({check:"greater_than",...ce(t),value:e,inclusive:!0})}function lu(e,t){return new Ty({check:"multiple_of",...ce(t),value:e})}function du(e,t){return new Oy({check:"max_length",...ce(t),maximum:e})}function rn(e,t){return new Cy({check:"min_length",...ce(t),minimum:e})}function pu(e,t){return new Ny({check:"length_equals",...ce(t),length:e})}function lp(e,t){return new jy({check:"string_format",format:"regex",...ce(t),pattern:e})}function dp(e){return new Ay({check:"string_format",format:"lowercase",...ce(e)})}function pp(e){return new My({check:"string_format",format:"uppercase",...ce(e)})}function mp(e,t){return new qy({check:"string_format",format:"includes",...ce(t),includes:e})}function fp(e,t){return new Zy({check:"string_format",format:"starts_with",...ce(t),prefix:e})}function hp(e,t){return new Ly({check:"string_format",format:"ends_with",...ce(t),suffix:e})}function Ar(e){return new Dy({check:"overwrite",tx:e})}function gp(e){return Ar(t=>t.normalize(e))}function _p(){return Ar(e=>e.trim())}function vp(){return Ar(e=>e.toLowerCase())}function yp(){return Ar(e=>e.toUpperCase())}function Sp(){return Ar(e=>Ud(e))}function Rb(e,t,r){return new e({type:"array",element:t,...ce(r)})}function Pb(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ce(r)})}function Eb(e,t){let r=DP(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(tn(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(tn(s))}},e(o.value,o)),t);return r}function DP(e,t){let r=new at({check:"custom",...ce(t)});return r._zod.check=e,r}function Ds(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ao,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Te(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,g=t.processors[n.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);g(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Te(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ht(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Us(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(f=>f);if(d)return{ref:p(d)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${p("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
118
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");let z=g.compile();return(v,S)=>z(p,v,S)},s,i=io,a=!Xo.jitless,u=a&&Fd.value,l=t.catchall,d;e._zod.parse=(p,g)=>{d??(d=o.value);let f=p.value;return i(f)?a&&u&&g?.async===!1&&g.jitless!==!0?(s||(s=n(t.shape)),p=s(p,g),l?TS([],f,p,g,d,e):p):r(p,g):(p.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),p)}});function Hy(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!jr(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>It(i,o,Rt())))}),t)}var op=Z("$ZodUnion",(e,t)=>{Ne.init(e,t),$e(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),$e(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),$e(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),$e(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>Cs(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Hy(a,o,e,n)):Hy(i,o,e,n)}});var OS=Z("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,op.init(e,t);let r=e._zod.parse;$e(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=en(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!io(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),CS=Z("$ZodIntersection",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>By(r,c,u)):By(r,s,i)}});function tp(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(Nr(e)&&Nr(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=tp(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=tp(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function By(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),jr(e))return e;let i=tp(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var NS=Z("$ZodRecord",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Nr(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>It(g,o,Rt())),input:u,path:[u],inst:e});continue}let d=l.value,p=t.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(g=>{g.issues.length&&r.issues.push(...lr(u,g.issues)),r.value[d]=g.value})):(p.issues.length&&r.issues.push(...lr(u,p.issues)),r.value[d]=p.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Xd.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>It(d,o,Rt())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...lr(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...lr(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var jS=Z("$ZodEnum",(e,t)=>{Ne.init(e,t);let r=Is(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Vd.has(typeof n)).map(n=>typeof n=="string"?ur(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),AS=Z("$ZodLiteral",(e,t)=>{if(Ne.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?ur(o):o?ur(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var MS=Z("$ZodTransform",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Yo(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Gt;return r.value=n,r.fallback=!0,r}});function Ky(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var np=Z("$ZodOptional",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$e(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cs(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Ky(i,n)):Ky(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),qS=Z("$ZodExactOptional",(e,t)=>{np.init(e,t),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ZS=Z("$ZodNullable",(e,t)=>{Ne.init(e,t),$e(e._zod,"optin",()=>t.innerType._zod.optin),$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cs(r.source)}|null)$`):void 0}),$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),LS=Z("$ZodDefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Gy(s,t)):Gy(n,t)}});function Gy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var DS=Z("$ZodPrefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),US=Z("$ZodNonOptional",(e,t)=>{Ne.init(e,t),$e(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Wy(s,e)):Wy(n,e)}});function Wy(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var FS=Z("$ZodCatch",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>It(i,o,Rt()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>It(s,o,Rt()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var sp=Z("$ZodPipe",(e,t)=>{Ne.init(e,t),$e(e._zod,"values",()=>t.in._zod.values),$e(e._zod,"optin",()=>t.in._zod.optin),$e(e._zod,"optout",()=>t.out._zod.optout),$e(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>su(i,t.in,o)):su(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>su(s,t.out,o)):su(n,t.out,o)}});function su(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var VS=Z("$ZodPreprocess",(e,t)=>{sp.init(e,t)}),JS=Z("$ZodReadonly",(e,t)=>{Ne.init(e,t),$e(e._zod,"propValues",()=>t.innerType._zod.propValues),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"optin",()=>t.innerType?._zod?.optin),$e(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Yy):Yy(n)}});function Yy(e){return e.value=Object.freeze(e.value),e}var HS=Z("$ZodLazy",(e,t)=>{Ne.init(e,t),$e(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),$e(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),$e(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),$e(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),$e(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),BS=Z("$ZodCustom",(e,t)=>{at.init(e,t),Ne.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Xy(s,r,o,e));Xy(n,r,o,e)}});function Xy(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(tn(n))}}var LP=()=>{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(n){return e[n]??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",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Kd(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${Qc(n.values[0])}`:`Invalid option: expected one of ${Wc(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Wc(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function KS(){return{localeError:LP()}}var GS,aN=Symbol("ZodOutput"),cN=Symbol("ZodInput"),ip=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function DP(){return new ip}(GS=globalThis).__zod_globalRegistry??(GS.__zod_globalRegistry=DP());var ao=globalThis.__zod_globalRegistry;function WS(e,t){return new e({type:"string",...ce(t)})}function ap(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ce(t)})}function cp(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ce(t)})}function YS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ce(t)})}function XS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ce(t)})}function QS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ce(t)})}function eb(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ce(t)})}function up(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ce(t)})}function tb(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ce(t)})}function rb(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ce(t)})}function ob(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ce(t)})}function nb(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ce(t)})}function sb(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ce(t)})}function ib(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ce(t)})}function ab(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ce(t)})}function cb(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ce(t)})}function ub(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ce(t)})}function lb(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ce(t)})}function db(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ce(t)})}function pb(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ce(t)})}function mb(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ce(t)})}function fb(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ce(t)})}function hb(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ce(t)})}function gb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ce(t)})}function _b(e,t){return new e({type:"string",format:"date",check:"string_format",...ce(t)})}function vb(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ce(t)})}function yb(e,t){return new e({type:"string",format:"duration",check:"string_format",...ce(t)})}function Sb(e,t){return new e({type:"number",checks:[],...ce(t)})}function bb(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ce(t)})}function zb(e,t){return new e({type:"boolean",...ce(t)})}function $b(e,t){return new e({type:"null",...ce(t)})}function wb(e){return new e({type:"unknown"})}function Rb(e,t){return new e({type:"never",...ce(t)})}function cu(e,t){return new Qd({check:"less_than",...ce(t),value:e,inclusive:!1})}function qs(e,t){return new Qd({check:"less_than",...ce(t),value:e,inclusive:!0})}function uu(e,t){return new ep({check:"greater_than",...ce(t),value:e,inclusive:!1})}function Zs(e,t){return new ep({check:"greater_than",...ce(t),value:e,inclusive:!0})}function lu(e,t){return new Iy({check:"multiple_of",...ce(t),value:e})}function du(e,t){return new Cy({check:"max_length",...ce(t),maximum:e})}function rn(e,t){return new Ny({check:"min_length",...ce(t),minimum:e})}function pu(e,t){return new jy({check:"length_equals",...ce(t),length:e})}function lp(e,t){return new Ay({check:"string_format",format:"regex",...ce(t),pattern:e})}function dp(e){return new My({check:"string_format",format:"lowercase",...ce(e)})}function pp(e){return new qy({check:"string_format",format:"uppercase",...ce(e)})}function mp(e,t){return new Zy({check:"string_format",format:"includes",...ce(t),includes:e})}function fp(e,t){return new Ly({check:"string_format",format:"starts_with",...ce(t),prefix:e})}function hp(e,t){return new Dy({check:"string_format",format:"ends_with",...ce(t),suffix:e})}function Ar(e){return new Uy({check:"overwrite",tx:e})}function gp(e){return Ar(t=>t.normalize(e))}function _p(){return Ar(e=>e.trim())}function vp(){return Ar(e=>e.toLowerCase())}function yp(){return Ar(e=>e.toUpperCase())}function Sp(){return Ar(e=>Ud(e))}function Pb(e,t,r){return new e({type:"array",element:t,...ce(r)})}function Eb(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ce(r)})}function kb(e,t){let r=UP(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(tn(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(tn(s))}},e(o.value,o)),t);return r}function UP(e,t){let r=new at({check:"custom",...ce(t)});return r._zod.check=e,r}function Ds(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ao,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Te(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,g=t.processors[n.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);g(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Te(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ht(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Us(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(f=>f);if(d)return{ref:p(d)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${p("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
119
119
 
120
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Fs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let g=e.seen.get(d),f=g.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,l),a._zod.parent===d)for(let m in u)m==="$ref"||m==="allOf"||m in l||delete u[m];if(f.$ref&&g.def)for(let m in u)m==="$ref"||m==="allOf"||m in g.def&&JSON.stringify(u[m])===JSON.stringify(g.def[m])&&delete u[m]}let p=a._zod.parent;if(p&&p!==d){o(p);let g=e.seen.get(p);if(g?.schema.$ref&&(u.$ref=g.schema.$ref,g.def))for(let f in u)f==="$ref"||f==="allOf"||f in g.def&&JSON.stringify(u[f])===JSON.stringify(g.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ls(t,"input",e.processors),output:Ls(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ht(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ht(o.element,r);if(o.type==="set")return ht(o.valueType,r);if(o.type==="lazy")return ht(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return ht(o.innerType,r);if(o.type==="intersection")return ht(o.left,r)||ht(o.right,r);if(o.type==="record"||o.type==="map")return ht(o.keyType,r)||ht(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ht(o.in,r)||ht(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ht(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ht(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ht(n,r))return!0;return!!(o.rest&&ht(o.rest,r))}return!1}var kb=(e,t={})=>r=>{let o=Ds({...r,processors:t});return Te(e,o),Us(o,e),Fs(o,e)},Ls=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Ds({...n??{},target:s,io:t,processors:r});return Te(e,i),Us(i,e),Fs(i,e)};var UP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=UP[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";d?g?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?g?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},$p=(e,t,r,o)=>{r.type="boolean"},Tb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ib=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},wp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ob=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Cb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Rp=(e,t,r,o)=>{r.not={}},Nb=(e,t,r,o)=>{},Pp=(e,t,r,o)=>{},jb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Ep=(e,t,r,o)=>{let n=e._zod.def,s=Is(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},kp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},Ab=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Mb=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},qb=(e,t,r,o)=>{let n=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),c?c.length===1?(s.contentMediaType=c[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(n,s)},Zb=(e,t,r,o)=>{r.type="boolean"},xp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Lb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Tp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Db=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Ub=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ip=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Te(s.element,t,{...o,path:[...o.path,"items"]})},Op=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=Te(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=Te(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Cp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Te(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Np=(e,t,r,o)=>{let n=e._zod.def,s=Te(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Te(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c},Fb=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((p,g)=>Te(p,t,{...o,path:[...o.path,i,g]})),u=s.rest?Te(s.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=c,u&&(n.items=u)):t.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),n.minItems=c.length,u||(n.maxItems=c.length)):(n.items=c,u&&(n.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(n.minItems=l),typeof d=="number"&&(n.maxItems=d)},jp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Te(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=Te(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=Te(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},Ap=(e,t,r,o)=>{let n=e._zod.def,s=Te(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Mp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},qp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Zp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Lp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Dp=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Te(i,t,o);let a=t.seen.get(e);a.ref=i},Up=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Vb=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},mu=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Fp=(e,t,r,o)=>{let n=e._zod.innerType;Te(n,t,o);let s=t.seen.get(e);s.ref=n},xb={string:bp,number:zp,boolean:$p,bigint:Tb,symbol:Ib,null:wp,undefined:Ob,void:Cb,never:Rp,any:Nb,unknown:Pp,date:jb,enum:Ep,literal:kp,nan:Ab,template_literal:Mb,file:qb,success:Zb,custom:xp,function:Lb,transform:Tp,map:Db,set:Ub,array:Ip,object:Op,union:Cp,intersection:Np,tuple:Fb,record:jp,nullable:Ap,nonoptional:Mp,default:qp,prefault:Zp,catch:Lp,pipe:Dp,readonly:Up,promise:Vb,optional:mu,lazy:Fp};function fu(e,t){if("_idmap"in e){let o=e,n=Ds({...t,processors:xb}),s={};for(let c of o._idmap.entries()){let[u,l]=c;Te(l,n)}let i={},a={registry:o,uri:t?.uri,defs:s};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Us(n,l),i[u]=Fs(n,l)}if(Object.keys(s).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=Ds({...t,processors:xb});return Te(e,r),Us(r,e),Fs(r,e)}var Mr={};Ro(Mr,{ZodISODate:()=>Hb,ZodISODateTime:()=>Jb,ZodISODuration:()=>Kb,ZodISOTime:()=>Bb,date:()=>Jp,datetime:()=>Vp,duration:()=>Bp,time:()=>Hp});var Jb=Z("ZodISODateTime",(e,t)=>{uS.init(e,t),De.init(e,t)});function Vp(e){return hb(Jb,e)}var Hb=Z("ZodISODate",(e,t)=>{lS.init(e,t),De.init(e,t)});function Jp(e){return gb(Hb,e)}var Bb=Z("ZodISOTime",(e,t)=>{dS.init(e,t),De.init(e,t)});function Hp(e){return _b(Bb,e)}var Kb=Z("ZodISODuration",(e,t)=>{pS.init(e,t),De.init(e,t)});function Bp(e){return vb(Kb,e)}var YP=(e,t)=>{eu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Vv(e,r)},flatten:{value:r=>Fv(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Qo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Qo,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Pt=Z("ZodError",YP,{Parent:Error});var Gb=tu(Pt),Wb=ru(Pt),hu=js(Pt),Yb=As(Pt),Xb=Bv(Pt),Qb=Kv(Pt),ez=Gv(Pt),tz=Wv(Pt),rz=Yv(Pt),oz=Xv(Pt),nz=Qv(Pt),sz=ey(Pt);var iz=new WeakMap;function Js(e,t,r){let o=Object.getPrototypeOf(e),n=iz.get(o);if(n||(n=new Set,iz.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Me=Z("ZodType",(e,t)=>(Ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ls(e,"input"),output:Ls(e,"output")}}),e.toJSONSchema=kb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Gb(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>hu(e,r,o),e.parseAsync=async(r,o)=>Wb(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Yb(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Xb(e,r,o),e.decode=(r,o)=>Qb(e,r,o),e.encodeAsync=async(r,o)=>ez(e,r,o),e.decodeAsync=async(r,o)=>tz(e,r,o),e.safeEncode=(r,o)=>rz(e,r,o),e.safeDecode=(r,o)=>oz(e,r,o),e.safeEncodeAsync=async(r,o)=>nz(e,r,o),e.safeDecodeAsync=async(r,o)=>sz(e,r,o),Js(e,"ZodType",{check(...r){let o=this.def;return this.clone(Pe.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Dt(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(DE(r,o))},superRefine(r,o){return this.check(UE(r,o))},overwrite(r){return this.check(Ar(r))},optional(){return ve(this)},exactOptional(){return EE(this)},nullable(){return lz(this)},nullish(){return ve(lz(this))},nonoptional(r){return CE(this,r)},array(){return W(this)},or(r){return le([this,r])},and(r){return on(this,r)},transform(r){return dz(this,Sz(r))},default(r){return TE(this,r)},prefault(r){return OE(this,r)},catch(r){return jE(this,r)},pipe(r){return dz(this,r)},readonly(){return qE(this)},describe(r){let o=this.clone();return ao.add(o,{description:r}),o},meta(...r){if(r.length===0)return ao.get(this);let o=this.clone();return ao.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return ao.get(e)?.description},configurable:!0}),e)),pz=Z("_ZodString",(e,t)=>{au.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>bp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Js(e,"_ZodString",{regex(...o){return this.check(lp(...o))},includes(...o){return this.check(mp(...o))},startsWith(...o){return this.check(fp(...o))},endsWith(...o){return this.check(hp(...o))},min(...o){return this.check(rn(...o))},max(...o){return this.check(du(...o))},length(...o){return this.check(pu(...o))},nonempty(...o){return this.check(rn(1,...o))},lowercase(o){return this.check(dp(o))},uppercase(o){return this.check(pp(o))},trim(){return this.check(_p())},normalize(...o){return this.check(gp(...o))},toLowerCase(){return this.check(vp())},toUpperCase(){return this.check(yp())},slugify(){return this.check(Sp())}})}),QP=Z("ZodString",(e,t)=>{au.init(e,t),pz.init(e,t),e.email=r=>e.check(ap(mz,r)),e.url=r=>e.check(up(hz,r)),e.jwt=r=>e.check(fb(fE,r)),e.emoji=r=>e.check(eb(eE,r)),e.guid=r=>e.check(cp(az,r)),e.uuid=r=>e.check(WS(gu,r)),e.uuidv4=r=>e.check(YS(gu,r)),e.uuidv6=r=>e.check(XS(gu,r)),e.uuidv7=r=>e.check(QS(gu,r)),e.nanoid=r=>e.check(tb(tE,r)),e.guid=r=>e.check(cp(az,r)),e.cuid=r=>e.check(rb(rE,r)),e.cuid2=r=>e.check(ob(oE,r)),e.ulid=r=>e.check(nb(nE,r)),e.base64=r=>e.check(db(dE,r)),e.base64url=r=>e.check(pb(pE,r)),e.xid=r=>e.check(sb(sE,r)),e.ksuid=r=>e.check(ib(iE,r)),e.ipv4=r=>e.check(ab(aE,r)),e.ipv6=r=>e.check(cb(cE,r)),e.cidrv4=r=>e.check(ub(uE,r)),e.cidrv6=r=>e.check(lb(lE,r)),e.e164=r=>e.check(mb(mE,r)),e.datetime=r=>e.check(Vp(r)),e.date=r=>e.check(Jp(r)),e.time=r=>e.check(Hp(r)),e.duration=r=>e.check(Bp(r))});function P(e){return GS(QP,e)}var De=Z("ZodStringFormat",(e,t)=>{Ae.init(e,t),pz.init(e,t)}),mz=Z("ZodEmail",(e,t)=>{eS.init(e,t),De.init(e,t)});function fz(e){return ap(mz,e)}var az=Z("ZodGUID",(e,t)=>{Xy.init(e,t),De.init(e,t)});var gu=Z("ZodUUID",(e,t)=>{Qy.init(e,t),De.init(e,t)});var hz=Z("ZodURL",(e,t)=>{tS.init(e,t),De.init(e,t)});function gz(e){return up(hz,e)}var eE=Z("ZodEmoji",(e,t)=>{rS.init(e,t),De.init(e,t)});var tE=Z("ZodNanoID",(e,t)=>{oS.init(e,t),De.init(e,t)});var rE=Z("ZodCUID",(e,t)=>{nS.init(e,t),De.init(e,t)});var oE=Z("ZodCUID2",(e,t)=>{sS.init(e,t),De.init(e,t)});var nE=Z("ZodULID",(e,t)=>{iS.init(e,t),De.init(e,t)});var sE=Z("ZodXID",(e,t)=>{aS.init(e,t),De.init(e,t)});var iE=Z("ZodKSUID",(e,t)=>{cS.init(e,t),De.init(e,t)});var aE=Z("ZodIPv4",(e,t)=>{mS.init(e,t),De.init(e,t)});var cE=Z("ZodIPv6",(e,t)=>{fS.init(e,t),De.init(e,t)});var uE=Z("ZodCIDRv4",(e,t)=>{hS.init(e,t),De.init(e,t)});var lE=Z("ZodCIDRv6",(e,t)=>{gS.init(e,t),De.init(e,t)});var dE=Z("ZodBase64",(e,t)=>{vS.init(e,t),De.init(e,t)});var pE=Z("ZodBase64URL",(e,t)=>{yS.init(e,t),De.init(e,t)});var mE=Z("ZodE164",(e,t)=>{SS.init(e,t),De.init(e,t)});var fE=Z("ZodJWT",(e,t)=>{bS.init(e,t),De.init(e,t)});var _z=Z("ZodNumber",(e,t)=>{rp.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>zp(e,o,n,s),Js(e,"ZodNumber",{gt(o,n){return this.check(uu(o,n))},gte(o,n){return this.check(Zs(o,n))},min(o,n){return this.check(Zs(o,n))},lt(o,n){return this.check(cu(o,n))},lte(o,n){return this.check(qs(o,n))},max(o,n){return this.check(qs(o,n))},int(o){return this.check(cz(o))},safe(o){return this.check(cz(o))},positive(o){return this.check(uu(0,o))},nonnegative(o){return this.check(Zs(0,o))},negative(o){return this.check(cu(0,o))},nonpositive(o){return this.check(qs(0,o))},multipleOf(o,n){return this.check(lu(o,n))},step(o,n){return this.check(lu(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function X(e){return yb(_z,e)}var hE=Z("ZodNumberFormat",(e,t)=>{zS.init(e,t),_z.init(e,t)});function cz(e){return Sb(hE,e)}var gE=Z("ZodBoolean",(e,t)=>{$S.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$p(e,r,o,n)});function _e(e){return bb(gE,e)}var _E=Z("ZodNull",(e,t)=>{wS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wp(e,r,o,n)});function _u(e){return zb(_E,e)}var vE=Z("ZodUnknown",(e,t)=>{RS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n)});function ge(){return $b(vE)}var yE=Z("ZodNever",(e,t)=>{PS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n)});function SE(e){return wb(yE,e)}var bE=Z("ZodArray",(e,t)=>{ES.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n),e.element=t.element,Js(e,"ZodArray",{min(r,o){return this.check(rn(r,o))},nonempty(r){return this.check(rn(1,r))},max(r,o){return this.check(du(r,o))},length(r,o){return this.check(pu(r,o))},unwrap(){return this.element}})});function W(e,t){return Rb(bE,e,t)}var vz=Z("ZodObject",(e,t)=>{TS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),Pe.defineLazy(e,"shape",()=>t.shape),Js(e,"ZodObject",{keyof(){return we(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ge()})},loose(){return this.clone({...this._zod.def,catchall:ge()})},strict(){return this.clone({...this._zod.def,catchall:SE()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Pe.extend(this,r)},safeExtend(r){return Pe.safeExtend(this,r)},merge(r){return Pe.merge(this,r)},pick(r){return Pe.pick(this,r)},omit(r){return Pe.omit(this,r)},partial(...r){return Pe.partial(bz,this,r[0])},required(...r){return Pe.required(zz,this,r[0])}})});function j(e,t){let r={type:"object",shape:e??{},...Pe.normalizeParams(t)};return new vz(r)}function ze(e,t){return new vz({type:"object",shape:e,catchall:ge(),...Pe.normalizeParams(t)})}var yz=Z("ZodUnion",(e,t)=>{op.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cp(e,r,o,n),e.options=t.options});function le(e,t){return new yz({type:"union",options:e,...Pe.normalizeParams(t)})}var zE=Z("ZodDiscriminatedUnion",(e,t)=>{yz.init(e,t),IS.init(e,t)});function Gp(e,t,r){return new zE({type:"union",options:t,discriminator:e,...Pe.normalizeParams(r)})}var $E=Z("ZodIntersection",(e,t)=>{OS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n)});function on(e,t){return new $E({type:"intersection",left:e,right:t})}var uz=Z("ZodRecord",(e,t)=>{CS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ie(e,t,r){return!t||!t._zod?new uz({type:"record",keyType:P(),valueType:e,...Pe.normalizeParams(t)}):new uz({type:"record",keyType:e,valueType:t,...Pe.normalizeParams(r)})}var Kp=Z("ZodEnum",(e,t)=>{NS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Ep(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Kp({...t,checks:[],...Pe.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Kp({...t,checks:[],...Pe.normalizeParams(n),entries:s})}});function we(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Kp({type:"enum",entries:r,...Pe.normalizeParams(t)})}var wE=Z("ZodLiteral",(e,t)=>{jS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new wE({type:"literal",values:Array.isArray(e)?e:[e],...Pe.normalizeParams(t)})}var RE=Z("ZodTransform",(e,t)=>{AS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Yo(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Pe.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Pe.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function Sz(e){return new RE({type:"transform",transform:e})}var bz=Z("ZodOptional",(e,t)=>{np.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ve(e){return new bz({type:"optional",innerType:e})}var PE=Z("ZodExactOptional",(e,t)=>{MS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function EE(e){return new PE({type:"optional",innerType:e})}var kE=Z("ZodNullable",(e,t)=>{qS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function lz(e){return new kE({type:"nullable",innerType:e})}var xE=Z("ZodDefault",(e,t)=>{ZS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function TE(e,t){return new xE({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Pe.shallowClone(t)}})}var IE=Z("ZodPrefault",(e,t)=>{LS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function OE(e,t){return new IE({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Pe.shallowClone(t)}})}var zz=Z("ZodNonOptional",(e,t)=>{DS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function CE(e,t){return new zz({type:"nonoptional",innerType:e,...Pe.normalizeParams(t)})}var NE=Z("ZodCatch",(e,t)=>{US.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jE(e,t){return new NE({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var $z=Z("ZodPipe",(e,t)=>{sp.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dp(e,r,o,n),e.in=t.in,e.out=t.out});function dz(e,t){return new $z({type:"pipe",in:e,out:t})}var AE=Z("ZodPreprocess",(e,t)=>{$z.init(e,t),FS.init(e,t)}),ME=Z("ZodReadonly",(e,t)=>{VS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Up(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qE(e){return new ME({type:"readonly",innerType:e})}var ZE=Z("ZodLazy",(e,t)=>{JS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fp(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Wp(e){return new ZE({type:"lazy",getter:e})}var LE=Z("ZodCustom",(e,t)=>{HS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xp(e,r,o,n)});function DE(e,t={}){return Pb(LE,e,t)}function UE(e,t){return Eb(e,t)}function vu(e,t){return new AE({type:"pipe",in:Sz(e),out:t})}Rt(BS());var tm=Symbol.for("mcp.sdk.errorBrands");function sm(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,tm,{value:r,enumerable:!1,configurable:!0})}function cn(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,tm)){let r=t[tm];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var FE=class qz extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return cn(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",sm(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new qz(t.error,t.error_description??t.error,t.error_uri)}},me=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),ue=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return cn(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",sm(this,new.target)}},VE=class extends ue{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var wz={};function Zz(e){return Object.hasOwn(wz,e)?wz[e]:void 0}function Rz(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function JE(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Lz(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function Ys(e,t){let r={};for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let s=t===void 0?void 0:t[o];if(s===void 0){r[o]=n;continue}if(Rz(n)&&Rz(s)){let i={};for(let[a,c]of Object.entries(n))c!==void 0&&s[a]===void 0&&!JE(o,a,s)&&(i[a]=c);Object.keys(i).length>0&&(r[o]=i)}}return Object.keys(r).length>0?r:void 0}var Dz="2026-07-28",Ct=[Dz];function dr(e){return e>=Dz}function Uz(e){return e.filter(t=>!dr(t))}function im(e){return e.filter(t=>dr(t))}function Fz(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Vz=["task","inputRequests","requestState"];function am(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Vz.some(t=>t in e)?e:{...e,content:[]}}function HE(){let e=Wp(()=>le([P(),X(),_e(),_u(),ie(P(),e),W(e)])),t=ie(P(),e),r=le([P(),X().int()]),o=P(),n=j({ttl:X().optional()}),s=j({taskId:P()}),i=ze({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=j({_meta:i.optional()}),c=a.extend({task:n.optional()}),u=j({method:P(),params:a.loose().optional()}),l=j({_meta:i.optional()}),d=j({method:P(),params:l.loose().optional()}),p=ze({_meta:i.optional()}),g=le([P(),X().int()]),f=p.strict(),_=l.extend({requestId:g.optional(),reason:P().optional()}),m=d.extend({method:J("notifications/cancelled"),params:_}),h=j({src:P(),mimeType:P().optional(),sizes:W(P()).optional(),theme:we(["light","dark"]).optional()}),z=j({icons:W(h).optional()}),v=j({name:P(),title:P().optional()}),S=v.extend({...v.shape,...z.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),R=on(j({applyDefaults:_e().optional()}),t),b=vu(lt=>lt&&typeof lt=="object"&&!Array.isArray(lt)&&Object.keys(lt).length===0?{form:{}}:lt,on(j({form:R.optional(),url:t.optional()}),t.optional())),y=ze({list:t.optional(),cancel:t.optional(),requests:ze({sampling:ze({createMessage:t.optional()}).optional(),elicitation:ze({create:t.optional()}).optional()}).optional()}),$=ze({list:t.optional(),cancel:t.optional(),requests:ze({tools:ze({call:t.optional()}).optional()}).optional()}),T=j({experimental:ie(P(),t).optional(),sampling:j({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:j({listChanged:_e().optional()}).optional(),tasks:y.optional(),extensions:ie(P(),t).optional()}),C=a.extend({protocolVersion:P(),capabilities:T,clientInfo:S}),O=u.extend({method:J("initialize"),params:C}),L=j({experimental:ie(P(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:j({listChanged:_e().optional()}).optional(),resources:j({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:j({listChanged:_e().optional()}).optional(),tasks:$.optional(),extensions:ie(P(),t).optional()}),H=p.extend({protocolVersion:P(),capabilities:L,serverInfo:S,instructions:P().optional()}),G=d.extend({method:J("notifications/initialized"),params:l.optional()}),he=u.extend({method:J("ping"),params:a.optional()}),qe=j({progress:X(),total:ve(X()),message:ve(P())}),Ie=j({...l.shape,...qe.shape,progressToken:r}),Ye=d.extend({method:J("notifications/progress"),params:Ie}),ye=a.extend({cursor:o.optional()}),I=u.extend({params:ye.optional()}),A=p.extend({nextCursor:o.optional()}),F=j({uri:P(),mimeType:ve(P()),_meta:ie(P(),ge()).optional()}),w=F.extend({text:P()}),x=P().refine(lt=>{try{return atob(lt),!0}catch{return!1}},{message:"Invalid Base64 string"}),N=F.extend({blob:x}),B=we(["user","assistant"]),te=j({audience:W(B).optional(),priority:X().min(0).max(1).optional(),lastModified:Mr.datetime({offset:!0}).optional()}),fe=j({...v.shape,...z.shape,uri:P(),description:ve(P()),mimeType:ve(P()),size:ve(X()),annotations:te.optional(),_meta:ve(ze({}))}),se=j({...v.shape,...z.shape,uriTemplate:P(),description:ve(P()),mimeType:ve(P()),annotations:te.optional(),_meta:ve(ze({}))}),Oe=I.extend({method:J("resources/list")}),mt=A.extend({resources:W(fe)}),E=I.extend({method:J("resources/templates/list")}),M=A.extend({resourceTemplates:W(se)}),D=a.extend({uri:P()}),oe=D,ne=u.extend({method:J("resources/read"),params:oe}),pe=p.extend({contents:W(le([w,N]))}),Ge=d.extend({method:J("notifications/resources/list_changed"),params:l.optional()}),et=D,ct=u.extend({method:J("resources/subscribe"),params:et}),Xe=D,Ue=u.extend({method:J("resources/unsubscribe"),params:Xe}),Et=l.extend({uri:P()}),rt=d.extend({method:J("notifications/resources/updated"),params:Et}),Xt=j({name:P(),description:ve(P()),required:ve(_e())}),Nt=j({...v.shape,...z.shape,description:ve(P()),arguments:ve(W(Xt)),_meta:ve(ze({}))}),Qt=I.extend({method:J("prompts/list")}),mr=A.extend({prompts:W(Nt)}),fr=a.extend({name:P(),arguments:ie(P(),P()).optional()}),Ur=u.extend({method:J("prompts/get"),params:fr}),Fr=j({type:J("text"),text:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),Vr=j({type:J("image"),data:x,mimeType:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),Jr=j({type:J("audio"),data:x,mimeType:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),fn=j({type:J("tool_use"),name:P(),id:P(),input:ie(P(),ge()),_meta:ie(P(),ge()).optional()}),hr=j({type:J("resource"),resource:le([w,N]),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),hn=fe.extend({type:J("resource_link")}),kt=le([Fr,Vr,Jr,hn,hr]),fo=j({role:B,content:kt}),ho=p.extend({description:P().optional(),messages:W(fo)}),Hr=d.extend({method:J("notifications/prompts/list_changed"),params:l.optional()}),gn=j({title:P().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),go=j({taskSupport:we(["required","optional","forbidden"]).optional()}),Br=j({...v.shape,...z.shape,description:P().optional(),inputSchema:j({type:J("object"),properties:ie(P(),e).optional(),required:W(P()).optional()}).catchall(ge()),outputSchema:j({type:J("object"),properties:ie(P(),e).optional(),required:W(P()).optional()}).catchall(ge()).optional(),annotations:gn.optional(),execution:go.optional(),_meta:ie(P(),ge()).optional()}),_o=I.extend({method:J("tools/list")}),vo=A.extend({tools:W(Br)}),yo=p.extend({content:W(kt),structuredContent:ie(P(),ge()).optional(),isError:_e().optional()}),ut=c.extend({name:P(),arguments:ie(P(),ge()).optional()}),_n=u.extend({method:J("tools/call"),params:ut}),si=d.extend({method:J("notifications/tools/list_changed"),params:l.optional()}),So=we(["debug","info","notice","warning","error","critical","alert","emergency"]),vn=a.extend({level:So}),yn=u.extend({method:J("logging/setLevel"),params:vn}),Sn=l.extend({level:So,logger:P().optional(),data:ge()}),bn=d.extend({method:J("notifications/message"),params:Sn}),zn=j({name:P().optional()}),$n=j({hints:W(zn).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),wn=j({mode:we(["auto","required","none"]).optional()}),ii=j({type:J("tool_result"),toolUseId:P().describe("The unique identifier for the corresponding tool call."),content:W(kt),structuredContent:j({}).loose().optional(),isError:_e().optional(),_meta:ie(P(),ge()).optional()}),Rn=Gp("type",[Fr,Vr,Jr]),gr=Gp("type",[Fr,Vr,Jr,fn,ii]),Pn=j({role:B,content:le([gr,W(gr)]),_meta:ie(P(),ge()).optional()}),En=c.extend({messages:W(Pn),modelPreferences:$n.optional(),systemPrompt:P().optional(),includeContext:we(["none","thisServer","allServers"]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:W(P()).optional(),metadata:t.optional(),tools:W(Br).optional(),toolChoice:wn.optional()}),kn=u.extend({method:J("sampling/createMessage"),params:En}),xn=p.extend({model:P(),stopReason:ve(we(["endTurn","stopSequence","maxTokens"]).or(P())),role:B,content:Rn}),Tn=p.extend({model:P(),stopReason:ve(we(["endTurn","stopSequence","maxTokens","toolUse"]).or(P())),role:B,content:le([gr,W(gr)])}),In=j({type:J("boolean"),title:P().optional(),description:P().optional(),default:_e().optional()}),On=j({type:J("string"),title:P().optional(),description:P().optional(),minLength:X().optional(),maxLength:X().optional(),format:we(["email","uri","date","date-time"]).optional(),default:P().optional()}),Cn=j({type:we(["number","integer"]),title:P().optional(),description:P().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Nn=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),default:P().optional()}),jn=j({type:J("string"),title:P().optional(),description:P().optional(),oneOf:W(j({const:P(),title:P()})),default:P().optional()}),An=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),enumNames:W(P()).optional(),default:P().optional()}),Mn=le([Nn,jn]),Kr=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({type:J("string"),enum:W(P())}),default:W(P()).optional()}),Gr=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({anyOf:W(j({const:P(),title:P()}))}),default:W(P()).optional()}),ai=le([Kr,Gr]),ci=le([An,Mn,ai]),bt=le([ci,In,On,Cn]),zt=c.extend({mode:J("form").optional(),message:P(),requestedSchema:j({type:J("object"),properties:ie(P(),bt),required:W(P()).optional()}).catchall(ge())}),qn=c.extend({mode:J("url"),message:P(),elicitationId:P(),url:P().url()}),jt=le([zt,qn]),ui=u.extend({method:J("elicitation/create"),params:jt}),li=l.extend({elicitationId:P()}),di=d.extend({method:J("notifications/elicitation/complete"),params:li}),pi=p.extend({action:we(["accept","decline","cancel"]),content:vu(lt=>lt===null?void 0:lt,ie(P(),le([P(),X(),_e(),W(P())])).optional())}),mi=j({type:J("ref/resource"),uri:P()}),fi=j({type:J("ref/prompt"),name:P()}),hi=a.extend({ref:le([fi,mi]),argument:j({name:P(),value:P()}),context:j({arguments:ie(P(),P()).optional()}).optional()}),Zn=u.extend({method:J("completion/complete"),params:hi}),gi=p.extend({completion:ze({values:W(P()).max(100),total:ve(X().int()),hasMore:ve(_e())})}),_i=j({uri:P().startsWith("file://"),name:P().optional(),_meta:ie(P(),ge()).optional()}),bo=u.extend({method:J("roots/list"),params:a.optional()}),Ln=p.extend({roots:W(_i)}),vi=d.extend({method:J("notifications/roots/list_changed"),params:l.optional()}),yi=ze({ttl:X().optional(),pollInterval:X().optional()}),Si=we(["working","input_required","completed","failed","cancelled"]),_r=j({taskId:P(),status:Si,ttl:le([X(),_u()]),createdAt:P(),lastUpdatedAt:P(),pollInterval:ve(X()),statusMessage:ve(P())}),gt=p.extend({task:_r}),bi=l.merge(_r),Wr=d.extend({method:J("notifications/tasks/status"),params:bi}),zo=u.extend({method:J("tasks/get"),params:a.extend({taskId:P()})}),$o=p.merge(_r),wo=u.extend({method:J("tasks/result"),params:a.extend({taskId:P()})}),Gu=p.loose(),_t=I.extend({method:J("tasks/list")}),We=A.extend({tasks:W(_r)}),Yr=u.extend({method:J("tasks/cancel"),params:a.extend({taskId:P()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:d,ResultSchema:p,RequestIdSchema:g,EmptyResultSchema:f,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:m,IconSchema:h,IconsSchema:z,BaseMetadataSchema:v,ImplementationSchema:S,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:T,InitializeRequestParamsSchema:C,InitializeRequestSchema:O,ServerCapabilitiesSchema:L,InitializeResultSchema:H,InitializedNotificationSchema:G,PingRequestSchema:he,ProgressSchema:qe,ProgressNotificationParamsSchema:Ie,ProgressNotificationSchema:Ye,PaginatedRequestParamsSchema:ye,PaginatedRequestSchema:I,PaginatedResultSchema:A,ResourceContentsSchema:F,TextResourceContentsSchema:w,BlobResourceContentsSchema:N,RoleSchema:B,AnnotationsSchema:te,ResourceSchema:fe,ResourceTemplateSchema:se,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:mt,ListResourceTemplatesRequestSchema:E,ListResourceTemplatesResultSchema:M,ResourceRequestParamsSchema:D,ReadResourceRequestParamsSchema:oe,ReadResourceRequestSchema:ne,ReadResourceResultSchema:pe,ResourceListChangedNotificationSchema:Ge,SubscribeRequestParamsSchema:et,SubscribeRequestSchema:ct,UnsubscribeRequestParamsSchema:Xe,UnsubscribeRequestSchema:Ue,ResourceUpdatedNotificationParamsSchema:Et,ResourceUpdatedNotificationSchema:rt,PromptArgumentSchema:Xt,PromptSchema:Nt,ListPromptsRequestSchema:Qt,ListPromptsResultSchema:mr,GetPromptRequestParamsSchema:fr,GetPromptRequestSchema:Ur,TextContentSchema:Fr,ImageContentSchema:Vr,AudioContentSchema:Jr,ToolUseContentSchema:fn,EmbeddedResourceSchema:hr,ResourceLinkSchema:hn,ContentBlockSchema:kt,PromptMessageSchema:fo,GetPromptResultSchema:ho,PromptListChangedNotificationSchema:Hr,ToolAnnotationsSchema:gn,ToolExecutionSchema:go,ToolSchema:Br,ListToolsRequestSchema:_o,ListToolsResultSchema:vo,CallToolResultSchema:yo,CallToolRequestParamsSchema:ut,CallToolRequestSchema:_n,ToolListChangedNotificationSchema:si,LoggingLevelSchema:So,SetLevelRequestParamsSchema:vn,SetLevelRequestSchema:yn,LoggingMessageNotificationParamsSchema:Sn,LoggingMessageNotificationSchema:bn,ModelHintSchema:zn,ModelPreferencesSchema:$n,ToolChoiceSchema:wn,ToolResultContentSchema:ii,SamplingContentSchema:Rn,SamplingMessageContentBlockSchema:gr,SamplingMessageSchema:Pn,CreateMessageRequestParamsSchema:En,CreateMessageRequestSchema:kn,CreateMessageResultSchema:xn,CreateMessageResultWithToolsSchema:Tn,BooleanSchemaSchema:In,StringSchemaSchema:On,NumberSchemaSchema:Cn,UntitledSingleSelectEnumSchemaSchema:Nn,TitledSingleSelectEnumSchemaSchema:jn,LegacyTitledEnumSchemaSchema:An,SingleSelectEnumSchemaSchema:Mn,UntitledMultiSelectEnumSchemaSchema:Kr,TitledMultiSelectEnumSchemaSchema:Gr,MultiSelectEnumSchemaSchema:ai,EnumSchemaSchema:ci,PrimitiveSchemaDefinitionSchema:bt,ElicitRequestFormParamsSchema:zt,ElicitRequestURLParamsSchema:qn,ElicitRequestParamsSchema:jt,ElicitRequestSchema:ui,ElicitationCompleteNotificationParamsSchema:li,ElicitationCompleteNotificationSchema:di,ElicitResultSchema:pi,ResourceTemplateReferenceSchema:mi,PromptReferenceSchema:fi,CompleteRequestParamsSchema:hi,CompleteRequestSchema:Zn,CompleteResultSchema:gi,RootSchema:_i,ListRootsRequestSchema:bo,ListRootsResultSchema:Ln,RootsListChangedNotificationSchema:vi,TaskCreationParamsSchema:yi,TaskStatusSchema:Si,TaskSchema:_r,CreateTaskResultSchema:gt,TaskStatusNotificationParamsSchema:bi,TaskStatusNotificationSchema:Wr,GetTaskRequestSchema:zo,GetTaskResultSchema:$o,GetTaskPayloadRequestSchema:wo,GetTaskPayloadResultSchema:Gu,ListTasksRequestSchema:_t,ListTasksResultSchema:We,CancelTaskRequestSchema:Yr,CancelTaskResultSchema:p.merge(_r),ClientRequestSchema:le([he,O,Zn,yn,Ur,Qt,Oe,E,ne,ct,Ue,_n,_o,zo,wo,_t,Yr]),ClientNotificationSchema:le([m,Ye,G,vi,Wr]),ClientResultSchema:le([f,xn,Tn,pi,Ln,$o,We,gt]),ServerRequestSchema:le([he,kn,ui,bo,zo,wo,_t,Yr]),ServerNotificationSchema:le([m,Ye,bn,rt,Ge,si,Hr,Wr,di]),ServerResultSchema:le([f,H,gi,ho,mr,mt,M,pe,yo,vo,$o,We,gt]),CallToolResultWireSchema:ge().superRefine((lt,y0)=>{if(!(typeof lt!="object"||lt===null||Array.isArray(lt)||lt.content!==void 0)){for(let Am of Vz)if(Am in lt){y0.addIssue({code:"custom",message:`content is required when the body carries '${Am}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(am).pipe(yo)}}var BE;function Jz(){return BE??=HE()}function Hz(e){return e.type!=="object"}var KE=new Set(["const","enum","default","examples"]),GE=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Pz(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function WE(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(Pz(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Lm(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(c=>o(c,!1));if(n===null||typeof n!="object"||!s&&Pz(n.$id))return n;let i={},a=!1;for(let[c,u]of Object.entries(n))s?i[c]=o(u,!1):(c==="$ref"||c==="$dynamicRef")&&typeof u=="string"?i[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:c==="$recursiveRef"&&u==="#"&&r?a=!0:KE.has(c)?i[c]=u:GE.has(c)?i[c]=o(u,!0):i[c]=o(u,!1);return a&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var Bz={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Kz={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},YE={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},yu;function cm(){if(yu)return yu;let e=Jz();return yu={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},yu}function Gz(e){return Object.prototype.hasOwnProperty.call(Bz,e)}function Wz(e){return Object.prototype.hasOwnProperty.call(Kz,e)}function XE(e){return Object.prototype.hasOwnProperty.call(YE,e)}function QE(e){return XE(e)?cm().resultSchemas[e]:void 0}function ek(e){return Gz(e)?cm().requestSchemas[e]:void 0}function tk(e){return Wz(e)?cm().notificationSchemas[e]:void 0}var Uj=Object.keys(Bz),Fj=Object.keys(Kz);function rm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Su(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Ez={ok:!1,reason:"not-in-era"};function kz(e){return rm(e)&&rm(e.outputSchema)&&Hz(e.outputSchema)}var um={era:"2025-11-25",hasRequestMethod:Gz,hasNotificationMethod:Wz,validateRequest:(e,t)=>Su(ek(e),t),validateResult:(e,t)=>Su(QE(e),t),validateNotification:(e,t)=>Su(tk(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ez,validateInputResponse:()=>Ez,samplingResultVariant:(e,t)=>{let r=Jz();return Su(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Fz(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&Hz(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(rm(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>kz(o))?t:{...t,tools:r.map(o=>kz(o)?{...o,outputSchema:WE(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function rk(){let e=Wp(()=>le([P(),X(),_e(),_u(),ie(P(),e),W(e)])),t=ie(P(),e),r=le([P(),X().int()]),o=P(),n=le([P(),X().int()]),s=we(["user","assistant"]),i=we(["debug","info","notice","warning","error","critical","alert","emergency"]),a=P().refine(We=>{try{return atob(We),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=j({ttl:X().optional()}),u=j({taskId:P()}),l=ze({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=j({_meta:l.optional()}),p=d.extend({task:c.optional()}),g=j({_meta:l.optional()}),f=j({method:P(),params:g.loose().optional()}),_=j({src:P(),mimeType:P().optional(),sizes:W(P()).optional(),theme:we(["light","dark"]).optional()}),m=j({icons:W(_).optional()}),h=j({name:P(),title:P().optional()}),z=h.extend({...h.shape,...m.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),v=on(j({applyDefaults:_e().optional()}),t),S=vu(We=>We&&typeof We=="object"&&!Array.isArray(We)&&Object.keys(We).length===0?{form:{}}:We,on(j({form:v.optional(),url:t.optional()}),t.optional())),R=ze({list:t.optional(),cancel:t.optional(),requests:ze({sampling:ze({createMessage:t.optional()}).optional(),elicitation:ze({create:t.optional()}).optional()}).optional()}),b=ze({list:t.optional(),cancel:t.optional(),requests:ze({tools:ze({call:t.optional()}).optional()}).optional()}),y=j({experimental:ie(P(),t).optional(),sampling:j({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:j({listChanged:_e().optional()}).optional(),tasks:R.optional(),extensions:ie(P(),t).optional()}),$=j({experimental:ie(P(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:j({listChanged:_e().optional()}).optional(),resources:j({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:j({listChanged:_e().optional()}).optional(),tasks:b.optional(),extensions:ie(P(),t).optional()}),T=j({progress:X(),total:ve(X()),message:ve(P())}),C=j({...g.shape,...T.shape,progressToken:r}),O=f.extend({method:J("notifications/progress"),params:C}),L=g.extend({level:i,logger:P().optional(),data:ge()}),H=f.extend({method:J("notifications/message"),params:L}),G=j({uri:P(),mimeType:ve(P()),_meta:ie(P(),ge()).optional()}),he=G.extend({text:P()}),qe=G.extend({blob:a}),Ie=j({audience:W(s).optional(),priority:X().min(0).max(1).optional(),lastModified:Mr.datetime({offset:!0}).optional()}),Ye=j({...h.shape,...m.shape,uri:P(),description:ve(P()),mimeType:ve(P()),size:ve(X()),annotations:Ie.optional(),_meta:ve(ze({}))}),ye=j({...h.shape,...m.shape,uriTemplate:P(),description:ve(P()),mimeType:ve(P()),annotations:Ie.optional(),_meta:ve(ze({}))}),I=f.extend({method:J("notifications/resources/list_changed"),params:g.optional()}),A=g.extend({uri:P()}),F=f.extend({method:J("notifications/resources/updated"),params:A}),w=j({name:P(),description:ve(P()),required:ve(_e())}),x=j({...h.shape,...m.shape,description:ve(P()),arguments:ve(W(w)),_meta:ve(ze({}))}),N=f.extend({method:J("notifications/prompts/list_changed"),params:g.optional()}),B=j({type:J("text"),text:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),te=j({type:J("image"),data:a,mimeType:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),fe=j({type:J("audio"),data:a,mimeType:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),se=j({type:J("tool_use"),name:P(),id:P(),input:ie(P(),ge()),_meta:ie(P(),ge()).optional()}),Oe=j({type:J("resource"),resource:le([he,qe]),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),mt=Ye.extend({type:J("resource_link")}),E=le([B,te,fe,mt,Oe]),M=j({role:s,content:E}),D=j({title:P().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),oe=f.extend({method:J("notifications/tools/list_changed"),params:g.optional()}),ne=j({name:P().optional()}),pe=j({hints:W(ne).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),Ge=j({mode:we(["auto","required","none"]).optional()}),et=j({type:J("boolean"),title:P().optional(),description:P().optional(),default:_e().optional()}),ct=j({type:J("string"),title:P().optional(),description:P().optional(),minLength:X().optional(),maxLength:X().optional(),format:we(["email","uri","date","date-time"]).optional(),default:P().optional()}),Xe=j({type:we(["number","integer"]),title:P().optional(),description:P().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Ue=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),default:P().optional()}),Et=j({type:J("string"),title:P().optional(),description:P().optional(),oneOf:W(j({const:P(),title:P()})),default:P().optional()}),rt=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),enumNames:W(P()).optional(),default:P().optional()}),Xt=le([Ue,Et]),Nt=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({type:J("string"),enum:W(P())}),default:W(P()).optional()}),Qt=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({anyOf:W(j({const:P(),title:P()}))}),default:W(P()).optional()}),mr=le([Nt,Qt]),fr=le([rt,Xt,mr]),Ur=le([fr,et,ct,Xe]),Fr=p.extend({mode:J("form").optional(),message:P(),requestedSchema:j({type:J("object"),properties:ie(P(),Ur),required:W(P()).optional()}).catchall(ge())}),Vr=j({type:J("ref/resource"),uri:P()}),Jr=j({type:J("ref/prompt"),name:P()}),fn=j({uri:P().startsWith("file://"),name:P().optional(),_meta:ie(P(),ge()).optional()}),hr=y.shape,hn=j({experimental:hr.experimental,sampling:hr.sampling,elicitation:hr.elicitation,roots:hr.roots,extensions:hr.extensions}),kt=$.shape,fo=j({experimental:kt.experimental,logging:kt.logging,completions:kt.completions,prompts:kt.prompts,resources:kt.resources,tools:kt.tools,extensions:kt.extensions}),ho=ze({progressToken:r.optional(),[Tt]:P(),[ro]:z.optional(),[Kt]:hn,[Rr]:i.optional()}),Hr=j({...h.shape,...m.shape,description:P().optional(),inputSchema:ze({$schema:P().optional(),type:J("object")}),outputSchema:ze({$schema:P().optional()}).optional(),annotations:D.optional(),_meta:ie(P(),ge()).optional()}),gn=j({type:J("tool_result"),toolUseId:P(),content:W(E),structuredContent:ge().optional(),isError:_e().optional(),_meta:ie(P(),ge()).optional()}),go=le([B,te,fe,se,gn]),Br=j({role:s,content:le([go,W(go)]),_meta:ie(P(),ge()).optional()}),_o=P(),vo=ze({[Lt]:z.optional().catch(void 0)}),yo=vo.optional();function ut(We){return ze({_meta:yo,resultType:_o.default("complete"),...We})}let _n=ut({}),si=ut({nextCursor:o.optional()}),So=ut({content:W(E),structuredContent:ge().optional(),isError:_e().optional()}),vn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),tools:W(Hr),nextCursor:o.optional()}),yn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),prompts:W(x),nextCursor:o.optional()}),Sn=ut({description:P().optional(),messages:W(M)}),bn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resources:W(Ye),nextCursor:o.optional()}),zn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resourceTemplates:W(ye),nextCursor:o.optional()}),$n=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),contents:W(le([he,qe]))}),wn=ut({completion:j({values:W(P()).max(100),total:X().int().optional(),hasMore:_e().optional()}).loose()}),ii=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"])}),Rn=ut({ttlMs:X().int().min(0).catch(0),cacheScope:we(["public","private"]).catch("private"),supportedVersions:W(P()),capabilities:fo,instructions:P().optional()}),gr=j({messages:W(Br),modelPreferences:pe.optional(),systemPrompt:P().optional(),includeContext:we(["none","thisServer","allServers"]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:W(P()).optional(),metadata:t.optional(),tools:W(Hr).optional(),toolChoice:Ge.optional()}),Pn=j({method:J("sampling/createMessage"),params:gr}),En=j({method:J("roots/list"),params:j({_meta:ie(P(),ge()).optional()}).optional()}),kn=j({...Br.shape,model:P(),stopReason:P().optional()}),xn=j({roots:W(fn)}),Tn=j({action:we(["accept","decline","cancel"]),content:ie(P(),le([P(),X(),_e(),W(P())])).optional()}),In=j({mode:J("url"),message:P(),url:P().url()}),On=le([Fr,In]),Cn=j({method:J("elicitation/create"),params:On}),Nn=le([Pn,En,Cn]),jn=le([kn,xn,Tn]),An=ie(P(),Nn),Mn=ie(P(),jn),Kr=ut({inputRequests:An.optional(),requestState:P().optional()}),Gr={inputResponses:Mn.optional(),requestState:P().optional()},ai=j({_meta:ho,...Gr}),ci=ze({progressToken:r.optional()});function bt(We,Yr){return j({method:J(We),params:j({_meta:ho,...Yr})})}function zt(We,Yr){return j({method:J(We),params:j({_meta:ci.optional(),...Yr}).optional()})}let qn={name:P(),arguments:ie(P(),ge()).optional(),...Gr},jt={cursor:o.optional()},ui=bt("tools/call",qn),li=bt("tools/list",jt),di=bt("prompts/list",jt),pi=bt("prompts/get",{name:P(),arguments:ie(P(),P()).optional(),...Gr}),mi=bt("resources/list",jt),fi=bt("resources/templates/list",jt),hi=bt("resources/read",{uri:P(),...Gr}),Zn={ref:le([Jr,Vr]),argument:j({name:P(),value:P()}),context:j({arguments:ie(P(),P()).optional()}).optional()},gi=bt("completion/complete",Zn),_i=bt("server/discover",{}),bo=j({toolsListChanged:_e().optional(),promptsListChanged:_e().optional(),resourcesListChanged:_e().optional(),resourceSubscriptions:W(P()).optional()}),Ln={notifications:bo},vi=bt("subscriptions/listen",Ln),yi=vo.extend({"io.modelcontextprotocol/subscriptionId":n}),Si=ze({_meta:yi,resultType:_o.default("complete")}),_r={"tools/call":zt("tools/call",qn),"tools/list":zt("tools/list",jt),"prompts/get":zt("prompts/get",{name:P(),arguments:ie(P(),P()).optional()}),"prompts/list":zt("prompts/list",jt),"resources/list":zt("resources/list",jt),"resources/templates/list":zt("resources/templates/list",jt),"resources/read":zt("resources/read",{uri:P()}),"completion/complete":zt("completion/complete",Zn),"server/discover":zt("server/discover",{}),"subscriptions/listen":zt("subscriptions/listen",Ln)};function gt(We){return ze({_meta:yo,...We})}let bi={"tools/call":gt({content:W(E),structuredContent:ge().optional(),isError:_e().optional()}),"tools/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),tools:W(Hr),nextCursor:o.optional()}),"prompts/get":gt({description:P().optional(),messages:W(M)}),"prompts/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),prompts:W(x),nextCursor:o.optional()}),"resources/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resources:W(Ye),nextCursor:o.optional()}),"resources/templates/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resourceTemplates:W(ye),nextCursor:o.optional()}),"resources/read":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),contents:W(le([he,qe]))}),"completion/complete":gt({completion:j({values:W(P()).max(100),total:X().int().optional(),hasMore:_e().optional()}).loose()}),"server/discover":gt({ttlMs:X().int().min(0).catch(0),cacheScope:we(["public","private"]).catch("private"),supportedVersions:W(P()),capabilities:fo,instructions:P().optional()}),"subscriptions/listen":gt({})},Wr=ze({"io.modelcontextprotocol/subscriptionId":n.optional()}),zo=j({method:J("notifications/subscriptions/acknowledged"),params:j({_meta:Wr.optional(),notifications:bo})}),$o=j({_meta:Wr.optional(),requestId:n,reason:P().optional()}),wo=j({method:J("notifications/cancelled"),params:$o}),Gu={"notifications/cancelled":wo,"notifications/progress":O,"notifications/message":H,"notifications/resources/updated":F,"notifications/resources/list_changed":I,"notifications/tools/list_changed":oe,"notifications/prompts/list_changed":N,"notifications/subscriptions/acknowledged":zo},_t=We=>j({jsonrpc:J("2.0"),id:le([P(),X().int()]),result:We}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:g,NotificationSchema:f,IconSchema:_,IconsSchema:m,BaseMetadataSchema:h,ImplementationSchema:z,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:$,ProgressSchema:T,ProgressNotificationParamsSchema:C,ProgressNotificationSchema:O,LoggingMessageNotificationParamsSchema:L,LoggingMessageNotificationSchema:H,ResourceContentsSchema:G,TextResourceContentsSchema:he,BlobResourceContentsSchema:qe,AnnotationsSchema:Ie,ResourceSchema:Ye,ResourceTemplateSchema:ye,ResourceListChangedNotificationSchema:I,ResourceUpdatedNotificationParamsSchema:A,ResourceUpdatedNotificationSchema:F,PromptArgumentSchema:w,PromptSchema:x,PromptListChangedNotificationSchema:N,TextContentSchema:B,ImageContentSchema:te,AudioContentSchema:fe,ToolUseContentSchema:se,EmbeddedResourceSchema:Oe,ResourceLinkSchema:mt,ContentBlockSchema:E,PromptMessageSchema:M,ToolAnnotationsSchema:D,ToolListChangedNotificationSchema:oe,ModelHintSchema:ne,ModelPreferencesSchema:pe,ToolChoiceSchema:Ge,BooleanSchemaSchema:et,StringSchemaSchema:ct,NumberSchemaSchema:Xe,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:Et,LegacyTitledEnumSchemaSchema:rt,SingleSelectEnumSchemaSchema:Xt,UntitledMultiSelectEnumSchemaSchema:Nt,TitledMultiSelectEnumSchemaSchema:Qt,MultiSelectEnumSchemaSchema:mr,EnumSchemaSchema:fr,PrimitiveSchemaDefinitionSchema:Ur,ElicitRequestFormParamsSchema:Fr,ResourceTemplateReferenceSchema:Vr,PromptReferenceSchema:Jr,RootSchema:fn,ClientCapabilities2026Schema:hn,ServerCapabilities2026Schema:fo,RequestMetaEnvelopeSchema:ho,ToolSchema:Hr,ToolResultContentSchema:gn,SamplingMessageContentBlockSchema:go,SamplingMessageSchema:Br,ResultTypeSchema:_o,ResultMetaSchema:vo,ResultSchema:_n,PaginatedResultSchema:si,CallToolResultSchema:So,ListToolsResultSchema:vn,ListPromptsResultSchema:yn,GetPromptResultSchema:Sn,ListResourcesResultSchema:bn,ListResourceTemplatesResultSchema:zn,ReadResourceResultSchema:$n,CompleteResultSchema:wn,CacheableResultSchema:ii,DiscoverResultSchema:Rn,CreateMessageRequestParamsSchema:gr,CreateMessageRequestSchema:Pn,ListRootsRequestSchema:En,CreateMessageResultSchema:kn,ListRootsResultSchema:xn,ElicitResultSchema:Tn,ElicitRequestURLParamsSchema:In,ElicitRequestParamsSchema:On,ElicitRequestSchema:Cn,InputRequestSchema:Nn,InputResponseSchema:jn,InputRequestsSchema:An,InputResponsesSchema:Mn,InputRequiredResultSchema:Kr,InputResponseRequestParamsSchema:ai,CallToolRequestSchema:ui,ListToolsRequestSchema:li,ListPromptsRequestSchema:di,GetPromptRequestSchema:pi,ListResourcesRequestSchema:mi,ListResourceTemplatesRequestSchema:fi,ReadResourceRequestSchema:hi,CompleteRequestSchema:gi,DiscoverRequestSchema:_i,SubscriptionFilterSchema:bo,SubscriptionsListenRequestSchema:vi,SubscriptionsListenResultMetaSchema:yi,SubscriptionsListenResultSchema:Si,dispatchRequestSchemas:_r,dispatchResultSchemas:bi,NotificationMetaSchema:Wr,SubscriptionsAcknowledgedNotificationSchema:zo,CancelledNotificationParamsSchema:$o,CancelledNotificationSchema:wo,notificationSchemas2026:Gu,JSONRPCResultResponseSchema:_t(_n),CallToolResultResponseSchema:_t(le([So,Kr])),ListToolsResultResponseSchema:_t(vn),ListPromptsResultResponseSchema:_t(yn),GetPromptResultResponseSchema:_t(le([Sn,Kr])),ListResourcesResultResponseSchema:_t(bn),ListResourceTemplatesResultResponseSchema:_t(zn),ReadResourceResultResponseSchema:_t(le([$n,Kr])),CompleteResultResponseSchema:_t(wn),DiscoverResultResponseSchema:_t(Rn)}}var ok;function uo(){return ok??=rk()}var nk=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function sk(e){return nk.includes(e)}var sn=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ru(e,t){if(t===void 0)return e;let r=e[sn];if(r===void 0)return{...e,[sn]:t};let o={},n=r.ttlMs??t.ttlMs;n!==void 0&&(o.ttlMs=n);let s=r.cacheScope??t.cacheScope;return s!==void 0&&(o.cacheScope=s),{...e,[sn]:o}}function ik(e){return e[sn]}function lm(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function dm(e){return e==="public"||e==="private"}function pm(e,t){if(e.ttlMs!==void 0&&!lm(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!dm(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var V=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),Q=class Yz extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return cn(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",sm(this,new.target)}static fromError(t,r,o){if(t===V.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Xz(n.elicitations,r)}if(t===V.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new po({supported:n.supported,requested:n.requested},r)}if(t===V.InvalidParams||t===V.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===V.ResourceNotFound||Object.keys(n).length===1))return new Pu(n.uri,r)}if(t===V.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new Xs({requiredCapabilities:n.requiredCapabilities},r)}return new Yz(t,r,o)}},Pu=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(V.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Xz=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(V.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},po=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(V.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Xs=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(V.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ak=0,ck="private",uk=["tools/call","prompts/get","resources/read"];function lk(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||uk.includes(e))return t;throw new Q(V.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function dk(e,t){let r=ik(t);if(t.resultType!=="complete"||!sk(e))return r===void 0?t:gk(t);let o=t,n=lm(o.ttlMs)?o.ttlMs:fk(r),s=dm(o.cacheScope)?o.cacheScope:hk(r),i={...o,ttlMs:n,cacheScope:s};return delete i[sn],i}function pk(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function mk(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Lt]:t}}:!pk(r)||r[Lt]!==void 0?e:{...e,_meta:{...r,[Lt]:t}}}function fk(e){return e!==void 0&&lm(e.ttlMs)?e.ttlMs:ak}function hk(e){return e!==void 0&&dm(e.cacheScope)?e.cacheScope:ck}function gk(e){let t={...e};return delete t[sn],t}var _k=["elicitation/create","sampling/createMessage","roots/list"],bu;function Qz(){if(bu)return bu;let e=uo();return bu={request:{"elicitation/create":j({method:J("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":j({method:J("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":j({method:J("roots/list"),params:ze({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},bu}function e$(e){return _k.includes(e)}function Yp(e){return e$(e)?Qz().request[e]:void 0}function vk(e){return e$(e)?Qz().response[e]:void 0}var mm={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},t$={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function r$(e){return Object.prototype.hasOwnProperty.call(mm,e)}function o$(e){return Object.prototype.hasOwnProperty.call(t$,e)}function yk(e){return Object.prototype.hasOwnProperty.call(mm,e)}function Sk(e){return r$(e)?uo().dispatchRequestSchemas[e]:void 0}function bk(e){return yk(e)?uo().dispatchResultSchemas[e]:void 0}function zk(e){return o$(e)?uo().notificationSchemas2026[e]:void 0}var Vj=Object.keys(mm),Jj=Object.keys(t$);function Ks(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Hs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var $k={ok:!1,reason:"not-in-era"},wk=[Tt,Kt];function Rk(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(a=>Ks(a)&&"execution"in a)&&(n().tools=s.map(a=>{if(!Ks(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c}));let i=t.capabilities;if(Ks(i)&&"tasks"in i){let a={...i};delete a.tasks,n().capabilities=a}return r}var fm={era:"2026-07-28",hasRequestMethod:r$,hasNotificationMethod:o$,hasInputRequestMethod:e=>Yp(e)!==void 0,validateRequest:(e,t)=>Hs(Sk(e),t),validateResult:(e,t)=>Hs(bk(e),t),validateNotification:(e,t)=>Hs(zk(e),t),validateInputRequest:(e,t)=>Hs(Yp(e),t),validateInputResponse:(e,t)=>Hs(vk(e),t),samplingResultVariant:()=>$k,outboundEnvelope(e){return{[Tt]:e.protocolVersion,[ro]:e.clientInfo,[Kt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Rr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of wk)o in e||t.push({key:o,problem:"missing"});let r=uo().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>Fz(e),inputRequestSchema:Yp,decodeResult(e,t){if(!Ks(t))return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=Ks(i)?i:{},c=t.requestState;return Object.keys(a).length===0&&typeof c!="string"?{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,...typeof c=="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new ue(me.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Pk(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return mk(dk(e,lk(e,Rk(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=uo().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},zu;function Pk(){if(zu)return zu;let e=uo();return zu={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},zu}var Qs="2026-07-28";function qr(e){return e!==void 0&&dr(e)?fm:um}function xz(e){return e.revision!==void 0?qr(e.revision).era:e.era==="modern"?fm.era:um.era}function Xp(e){return n$.some(t=>t.hasRequestMethod(e))}function Qp(e){return n$.some(t=>t.hasNotificationMethod(e))}var n$=[um,fm];function Tz(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ut(e){if(!Tz(e))return;let t=e._meta;return Tz(t)?t:void 0}function mo(e){let t=Ut(e);return t!==void 0&&Tt in t}function ln(e){let t=Ut(e)?.[Tt];return typeof t=="string"?t:void 0}function lo(e){return qr(Qs).validateEnvelopeMeta(e)}var Ek=qm({AnnotationsSchema:()=>ar,AudioContentSchema:()=>Ho,BaseMetadataSchema:()=>ir,BaseRequestParamsSchema:()=>nt,BlobResourceContentsSchema:()=>vs,BooleanSchemaSchema:()=>$s,CallToolRequestParamsSchema:()=>uc,CallToolRequestSchema:()=>lc,CallToolResultSchema:()=>zs,CancelTaskRequestSchema:()=>$d,CancelTaskResultSchema:()=>wd,CancelledNotificationParamsSchema:()=>ma,CancelledNotificationSchema:()=>ds,ClientCapabilitiesSchema:()=>_a,ClientNotificationSchema:()=>Pd,ClientRequestSchema:()=>Rd,ClientResultSchema:()=>Ed,ClientTasksCapabilitySchema:()=>ha,CompatibilityCallToolResultSchema:()=>pd,CompleteRequestParamsSchema:()=>Mc,CompleteRequestSchema:()=>qc,CompleteResultSchema:()=>Zc,ContentBlockSchema:()=>Bo,CreateMessageRequestParamsSchema:()=>zc,CreateMessageRequestSchema:()=>$c,CreateMessageResultSchema:()=>wc,CreateMessageResultWithToolsSchema:()=>Rc,CreateTaskResultSchema:()=>hd,CursorSchema:()=>ss,DiscoverRequestSchema:()=>ba,DiscoverResultSchema:()=>za,ElicitRequestFormParamsSchema:()=>Wo,ElicitRequestParamsSchema:()=>Tc,ElicitRequestSchema:()=>Ic,ElicitRequestURLParamsSchema:()=>xc,ElicitResultSchema:()=>Nc,ElicitationCompleteNotificationParamsSchema:()=>Oc,ElicitationCompleteNotificationSchema:()=>Cc,EmbeddedResourceSchema:()=>ec,EmptyResultSchema:()=>ls,EnumSchemaSchema:()=>kc,GetPromptRequestParamsSchema:()=>Ya,GetPromptRequestSchema:()=>Xa,GetPromptResultSchema:()=>oc,GetTaskPayloadRequestSchema:()=>yd,GetTaskPayloadResultSchema:()=>Sd,GetTaskRequestSchema:()=>_d,GetTaskResultSchema:()=>vd,IconSchema:()=>fa,IconsSchema:()=>Er,ImageContentSchema:()=>Jo,ImplementationSchema:()=>Uo,InitializeRequestParamsSchema:()=>va,InitializeRequestSchema:()=>ps,InitializeResultSchema:()=>ya,InitializedNotificationSchema:()=>Sa,JSONArraySchema:()=>ud,JSONObjectSchema:()=>He,JSONRPCErrorResponseSchema:()=>Do,JSONRPCMessageSchema:()=>so,JSONRPCNotificationSchema:()=>us,JSONRPCRequestSchema:()=>cs,JSONRPCResponseSchema:()=>ld,JSONRPCResultResponseSchema:()=>Lo,JSONValueSchema:()=>$r,LegacyTitledEnumSchemaSchema:()=>Ps,ListChangedOptionsBaseSchema:()=>md,ListPromptsRequestSchema:()=>Ga,ListPromptsResultSchema:()=>Wa,ListResourceTemplatesRequestSchema:()=>xa,ListResourceTemplatesResultSchema:()=>Ta,ListResourcesRequestSchema:()=>Ea,ListResourcesResultSchema:()=>ka,ListRootsRequestSchema:()=>Dc,ListRootsResultSchema:()=>Uc,ListTasksRequestSchema:()=>bd,ListTasksResultSchema:()=>zd,ListToolsRequestSchema:()=>ac,ListToolsResultSchema:()=>cc,LoggingLevelSchema:()=>Ir,LoggingMessageNotificationParamsSchema:()=>fc,LoggingMessageNotificationSchema:()=>hc,ModelHintSchema:()=>gc,ModelPreferencesSchema:()=>_c,MultiSelectEnumSchemaSchema:()=>Ec,NotificationSchema:()=>pt,NotificationsParamsSchema:()=>dt,NumberSchemaSchema:()=>Go,PaginatedRequestParamsSchema:()=>Ra,PaginatedRequestSchema:()=>kr,PaginatedResultSchema:()=>xr,PingRequestSchema:()=>fs,PrimitiveSchemaDefinitionSchema:()=>xs,ProgressNotificationParamsSchema:()=>wa,ProgressNotificationSchema:()=>hs,ProgressSchema:()=>$a,ProgressTokenSchema:()=>ns,PromptArgumentSchema:()=>Ba,PromptListChangedNotificationSchema:()=>nc,PromptMessageSchema:()=>rc,PromptReferenceSchema:()=>Ac,PromptSchema:()=>Ka,ReadResourceRequestParamsSchema:()=>Ia,ReadResourceRequestSchema:()=>Oa,ReadResourceResultSchema:()=>Ca,RelatedTaskMetadataSchema:()=>pa,RequestIdSchema:()=>Pr,RequestMetaSchema:()=>is,RequestSchema:()=>Be,ResourceContentsSchema:()=>gs,ResourceLinkSchema:()=>tc,ResourceListChangedNotificationSchema:()=>Na,ResourceRequestParamsSchema:()=>Fo,ResourceSchema:()=>ys,ResourceTemplateReferenceSchema:()=>jc,ResourceTemplateSchema:()=>Pa,ResourceUpdatedNotificationParamsSchema:()=>Ja,ResourceUpdatedNotificationSchema:()=>Ha,ResultMetaObjectSchema:()=>as,ResultSchema:()=>Ke,RoleSchema:()=>Tr,RootSchema:()=>Lc,RootsListChangedNotificationSchema:()=>Fc,SamplingContentSchema:()=>Sc,SamplingMessageContentBlockSchema:()=>eo,SamplingMessageSchema:()=>bc,ServerCapabilitiesSchema:()=>ms,ServerNotificationSchema:()=>xd,ServerRequestSchema:()=>kd,ServerResultSchema:()=>Td,ServerTasksCapabilitySchema:()=>ga,SetLevelRequestParamsSchema:()=>pc,SetLevelRequestSchema:()=>mc,SingleSelectEnumSchemaSchema:()=>Pc,StringSchemaSchema:()=>Ko,SubscribeRequestParamsSchema:()=>ja,SubscribeRequestSchema:()=>Aa,SubscriptionFilterSchema:()=>Ss,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Da,SubscriptionsAcknowledgedNotificationSchema:()=>Ua,SubscriptionsListenRequestParamsSchema:()=>Za,SubscriptionsListenRequestSchema:()=>La,SubscriptionsListenResultMetaSchema:()=>Fa,SubscriptionsListenResultSchema:()=>Va,TaskAugmentedRequestParamsSchema:()=>no,TaskCreationParamsSchema:()=>fd,TaskMetadataSchema:()=>da,TaskSchema:()=>Or,TaskStatusNotificationParamsSchema:()=>Jc,TaskStatusNotificationSchema:()=>gd,TaskStatusSchema:()=>Vc,TextContentSchema:()=>Vo,TextResourceContentsSchema:()=>_s,TitledMultiSelectEnumSchemaSchema:()=>ks,TitledSingleSelectEnumSchemaSchema:()=>Rs,ToolAnnotationsSchema:()=>sc,ToolChoiceSchema:()=>vc,ToolExecutionSchema:()=>ic,ToolListChangedNotificationSchema:()=>dc,ToolResultContentSchema:()=>yc,ToolSchema:()=>bs,ToolUseContentSchema:()=>Qa,UnsubscribeRequestParamsSchema:()=>Ma,UnsubscribeRequestSchema:()=>qa,UntitledMultiSelectEnumSchemaSchema:()=>Es,UntitledSingleSelectEnumSchemaSchema:()=>ws});var tt=e=>cs.safeParse(e).success,Yt=e=>us.safeParse(e).success,Ft=e=>Lo.safeParse(e).success,Vt=e=>Do.safeParse(e).success;var pr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var hm=e=>ps.safeParse(e).success;function gm(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function _m(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var kk="Mcp-Param-",Iz="x-mcp-header",xk=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Tk=new Set(["string","integer","boolean","number"]);function Eu(e){let t=[],r=new Map,o=(s,i,a)=>{if(s===null||typeof s!="object")return;let c=s;if(Iz in c){if(!a||i.length===0)return`${nn(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let l=c[Iz];if(typeof l!="string"||l.length===0)return`${nn(i)}: x-mcp-header MUST be a non-empty string`;if(!xk.test(l))return`${nn(i)}: x-mcp-header '${l}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!Tk.has(d))return`${nn(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;let p=l.toLowerCase(),g=r.get(p);if(g!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${g}')`;r.set(p,l),t.push({path:i,headerName:l,type:d})}let u=c.properties;if(u!==null&&typeof u=="object")for(let[l,d]of Object.entries(u)){let p=o(d,[...i,l],a);if(p!==void 0)return p}for(let l of Ik){let d=c[l];if(d===void 0)continue;let p=Array.isArray(d)?d:d!==null&&typeof d=="object"&&Ok.has(l)?Object.values(d):[d];for(let g of p){let f=o(g,[...i,`<${l}>`],!1);if(f!==void 0)return f}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var Ik=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Ok=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function nn(e){return e.length===0?"<root>":e.join(".")}var Ck="=?base64?",Nk="?=",jk=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ak=/^-?\d+(\.\d+)?$/;function Mk(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function qk(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.codePointAt(o);return new TextDecoder("utf-8",{fatal:!0}).decode(r)}function s$(e){if(!(e.startsWith(Ck)&&e.endsWith(Nk)))return e;let t=e.slice(9,e.length-2);if(jk.test(t))try{return qk(t)}catch{return}}function Zk(e,t){let r=e;for(let o of t){if(r===null||typeof r!="object")return;r=r[o]}return r}function i$(e,t,r){for(let o of e){let n=`${kk}${o.headerName}`,s=r.get(n),i=Zk(t,o.path);if(i==null)continue;let a=Mk(i);if(a===void 0)continue;if(s===null)return em("param-header-missing",n,`the body carries ${nn(o.path)}=${JSON.stringify(i)} but the ${n} header is absent`);let c=s$(s);if(c===void 0)return em("param-header-invalid-encoding",n,`the ${n} header carries an invalid Base64 sentinel value`);if(!((o.type==="integer"||o.type==="number")&&Ak.test(c)&&typeof i=="number"?Number(c)===i:c===a))return em("param-header-mismatch",n,`the ${n} header decodes to ${JSON.stringify(c)} but the body carries ${nn(o.path)}=${JSON.stringify(i)}`)}}function em(e,t,r){return{kind:"reject",rung:"param-header-validation",cell:e,httpStatus:400,code:an,message:`Bad Request: the request headers and body disagree: ${r}`,data:{mismatch:{header:t,body:r}},settled:!0}}var an=-32020,Hj=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[V.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[an,V.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[V.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[V.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[V.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[an],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[V.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[an],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],vm={[V.ParseError]:400,[V.InvalidRequest]:400,[V.MethodNotFound]:404,[V.UnsupportedProtocolVersion]:400,[V.MissingRequiredClientCapability]:400,[an]:400};function a$(e,t){return t==="in-band"?e===V.MissingRequiredClientCapability?400:200:vm[e]??400}function Ot(e,t,r,o,n){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:o.code,message:o.message,...o.data!==void 0&&{data:o.data},settled:n}}function Wt(e,t,r,o="era-classification"){return Ot(o,e,400,new Q(an,`Bad Request: the request headers and body disagree: ${r}`,{mismatch:{header:t,body:r}}),!0)}var Oz={"tools/call":"name","prompts/get":"name","resources/read":"uri"};function $u(e){let t=0;for(;t<e.length;){let o=e.codePointAt(t);if(o!==9&&o!==32)break;t+=1}let r=e.length;for(;r>t;){let o=e.codePointAt(r-1);if(o!==9&&o!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}function c$(e,t){if(t.messageKind!=="request")return;let r=t.message.method;if(e.mcpMethodHeader===void 0)return Wt("method-header-missing","(missing)",`the body names method ${r} but the required Mcp-Method header is absent`,"standard-header-validation");let o=Object.hasOwn(Oz,r)?Oz[r]:void 0;if(o===void 0)return;let n=t.message.params?.[o],s=typeof n=="string"?n:void 0;if(e.mcpNameHeader===void 0)return s===void 0?void 0:Wt("name-header-missing","(missing)",`the body carries params.${o}="${s}" but the required Mcp-Name header is absent`,"standard-header-validation");let i=$u(e.mcpNameHeader),a=s$(i);if(a===void 0)return Wt("name-header-invalid-encoding",i,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation");if(s!==void 0&&a!==s)return Wt("name-header-mismatch",i,`the body carries params.${o}="${s}" but the Mcp-Name header names "${a}"`,"standard-header-validation")}function wu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function u$(e){return e===void 0?{era:"modern"}:{era:dr(e)?"modern":"legacy",revision:e}}function ku(e){if(!mo(e))return!1;let t=ln(e);if(t===void 0||!dr(t))return!1;let r=Ut(e);return r!==void 0&&lo(r).length===0}function Lk(e){if(e.length===0)return Ot("jsonrpc-shape","empty-batch",400,new Q(V.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let t of e){if(mo(wu(t)?t.params:void 0))return Ot("jsonrpc-shape","batch-with-modern-element",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(tt(t)||Yt(t)||Ft(t)||Vt(t)))return Ot("jsonrpc-shape","batch-with-invalid-element",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}function Dk(e,t){let r=t.params,o=t.method,n=e.protocolVersionHeader,s=n!==void 0&&dr(n);if(o==="initialize"&&!ku(r)){if(s)return Wt("initialize-with-modern-header",n,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let i=wu(r)&&typeof r.protocolVersion=="string"?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...i!==void 0&&{requestedVersion:i}}}if(mo(r)){let i=Ut(r),a=(i===void 0?[]:lo(i))[0];if(a!==void 0)return Ot("envelope","envelope-invalid",400,new Q(V.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${a.key}: ${a.problem}`,{envelope:a}),!0);let c=ln(r);return n!==void 0&&c!==void 0&&n!==c?Wt("header-body-version-mismatch",n,`the body envelope names protocol version ${c} but the MCP-Protocol-Version header names ${n}`):e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("method-header-mismatch",e.mcpMethodHeader,`the body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:t,classification:u$(c)}}if(s){let i=Ut(r),a=lo(i??{}).filter(u=>u.problem==="missing").map(u=>u.key),c=i===void 0?["_meta"]:a.length>0?a:[Tt];return Ot("envelope","modern-header-without-claim",400,new Q(V.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${n}, but the request is missing the required per-request envelope key(s): ${c.join(", ")}`,{envelope:{missing:c}}),!0)}return{kind:"legacy",reason:"no-claim",...n!==void 0&&{requestedVersion:n}}}function Uk(e,t){let r=t.params,o=t.method,n=e.protocolVersionHeader,s=n!==void 0&&dr(n);if(mo(r)){let i=ln(r);if(i===void 0){let c=Ut(r),u=(c===void 0?[]:lo(c)).find(l=>l.key===Tt)??{key:Tt,problem:"expected a protocol version string"};return Ot("envelope","notification-envelope-invalid",400,new Q(V.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${u.key}: ${u.problem}`,{envelope:u}),!0)}if(n!==void 0&&n!==i)return Wt("notification-header-body-version-mismatch",n,`the notification envelope names protocol version ${i} but the MCP-Protocol-Version header names ${n}`);let a=u$(i);return a.era==="modern"&&e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:a}}return s?e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:{era:"modern",revision:n}}:{kind:"legacy",reason:"notification",...n!==void 0&&{requestedVersion:n}}}function l$(e){if(e={...e,...e.protocolVersionHeader!==void 0&&{protocolVersionHeader:$u(e.protocolVersionHeader)},...e.mcpMethodHeader!==void 0&&{mcpMethodHeader:$u(e.mcpMethodHeader)},...e.mcpNameHeader!==void 0&&{mcpNameHeader:$u(e.mcpNameHeader)}},e.httpMethod.toUpperCase()!=="POST")return{kind:"legacy",reason:"http-method"};let t=e.body;return Array.isArray(t)?Lk(t):Ft(t)||Vt(t)?{kind:"legacy",reason:"response"}:wu(t)&&tt(t)?Dk(e,t):wu(t)&&Yt(t)?Uk(e,t):Ot("jsonrpc-shape","invalid-json-rpc-body",400,new Q(V.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}function xu(e,t){switch(e.reason){case"http-method":return Ot("http-method","modern-only-method-not-allowed",405,new Q(-32e3,"Method not allowed."),!0);case"batch":return Ot("jsonrpc-shape","modern-only-batch-not-supported",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return Ot("jsonrpc-shape","modern-only-response-post",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return Ot("era-classification","modern-only-missing-envelope",400,r===void 0?new Q(V.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new po({supported:[...t],requested:r}),!0)}}}function Tu(e,t){return hu(e,t)}function Bs(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function un(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var Cz=!1,om="draft-2020-12";function Zr(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:om});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");Cz||(Cz=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),o=fu(e,{target:om,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:d$(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function d$(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(o=>o!==null&&typeof o=="object"&&(o.type==="object"||d$(o)))}return!1}function Fk(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function co(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>Fk(o)).join(", ")}:{success:!0,data:r.value}}function Vk(e){let t=fu(e,{target:om,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var Jk=/\\\.\\d\{(\d+)\}/;function Hk(e){let t=Jk.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>Mr.datetime({local:o,offset:n,precision:s}))))}function Bk(e,t){let r;switch(e){case"email":r=[fz()];break;case"uri":r=[gz()];break;case"date":r=[Mr.date()];break;case"date-time":r=Hk(t);break}return new Set(r.map(o=>Vk(o)).filter(o=>o!==void 0))}function Kk(e,t,r){return r!=="zod"?!0:Bk(e,t).has(t)}function p$(e){let t=Zr(e,"input"),r=t.properties||{},o=t.required||[];return Object.entries(r).map(([n,s])=>({name:n,description:s?.description,required:o.includes(n)}))}function Ws(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Gk(e){try{return Zr(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new Q(V.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Wk=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ym(e){return Wk.has(e)||e.startsWith("x-")}var Yk=new Set(["$schema",...Object.keys(Wo.shape.requestedSchema.shape)]),Nz={string:Bs([Ko,ws,Rs,Ps]),number:Bs([Go]),integer:Bs([Go]),boolean:Bs([$s]),array:Bs([Es,ks])},Xk=new Set(Ko.shape.format.unwrap().options);function Qk(e,t,r,o){if(!Ws(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(Nz,e.type)?Nz[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,a]of Object.entries(e))n.has(i)||ym(i)?s[i]=a:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?Xk.has(e.format)?(typeof a!="string"||!Kk(e.format,a,r))&&o.push(`${t}.${i}`):s[i]=a:o.push(`${t}.${i}`);return s}function ex(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&Ws(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,Qk(a,`properties.${i}`,t,o)])):Yk.has(n)?r[n]=s:ym(n)||o.push(n);if(o.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function tx(e,t){if(!Ws(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Tu(xs,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function nm(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>nm(o,t[n],`${r}[${n}]`)):!Ws(e)||!Ws(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?nm(n,t[o],s):ym(o)?[]:[s]})}function rx(e){if(!un(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=ex(Gk(e.requestedSchema),t),o=Tu(Wo.shape.requestedSchema,r);if(!o.success)throw new Q(V.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${tx(r,o.error.message)}`);let n=nm(r,o.data);if(n.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function ox(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var nx=Object.assign(ox,{elicit(e){try{return{method:"elicitation/create",params:rx(e)}}catch(t){throw t instanceof Q?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var m$=250;function f$(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function h$(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function g$(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}var sx=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],ix={IdJagTokenExchangeResponseSchema:Nd,OAuthClientInformationFullSchema:Ad,OAuthClientInformationSchema:Gc,OAuthClientMetadataSchema:Kc,OAuthClientRegistrationErrorSchema:Md,OAuthErrorResponseSchema:jd,OAuthMetadataSchema:Hc,OAuthProtectedResourceMetadataSchema:Id,OAuthTokenRevocationRequestSchema:qd,OAuthTokensSchema:Cd,OpenIdProviderDiscoveryMetadataSchema:Od,OpenIdProviderMetadataSchema:Bc},_$={},v$={};function y$(e,t){let r=e.slice(0,-6);_$[r]=t,v$[r]=o=>t.safeParse(o).success}for(let e of sx)y$(e,Ek[e]);for(let[e,t]of Object.entries(ix))y$(e,t);var ax=Object.freeze(_$),cx=Object.freeze(v$);function ux(e){switch(e){case"initialize":case"notifications/initialized":return qr(void 0);case"server/discover":return qr(Qs);default:return}}var S$=6e4,lx=[Tt,ro,Kt,Rr],dx=["inputResponses","requestState"];function jz(e,t){let r=e.params;if(!Gs(r))return{message:e,lifted:{}};let o=r._meta,n=Gs(o)?lx.filter(c=>c in o):[],s=t==="request"?dx.filter(c=>c in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(n.length>0&&Gs(o)){let c={},u={...o};for(let l of n)c[l]=o[l],delete u[l];i.envelope=c,Object.keys(u).length>0?a._meta=u:delete a._meta}for(let c of s)c==="inputResponses"&&(i.inputResponses=a[c]),c==="requestState"&&(i.requestState=a[c]),delete a[c];return{message:{...e,params:a},lifted:i}}function Az(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function ei(e){return()=>e}var px=ei(void 0);function Sm(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:ei(t)}}}var b$;function Iu(e,t){b$(e,t)}var bm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{b$=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??os,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ue(me.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ue(me.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),Ft(n)||Vt(n)?this._onresponse(n):tt(n)?this._onrequest(n,s):Yt(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new ue(me.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=jz(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=xz(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Qp(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=jz(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(_,m,h)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:_,message:m,...h!==void 0&&{data:h}}};s?.send(z).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let _=xz(t.classification);if(_!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${n.era}`));let m=t.classification.revision??_;i(V.UnsupportedProtocolVersion,`Unsupported protocol version: ${m}`,{supported:this._supportedProtocolVersions,requested:m});return}}if(Xp(r.method)&&!n.hasRequestMethod(r.method)){i(V.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(V.MethodNotFound,"Method not found");return}let c=n.checkInboundEnvelope(o);if(c!==void 0){i(V.InvalidParams,c);return}let u=(_,m)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...m,relatedRequestId:r.id}),l=(_,m,h)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,m,{...h,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let p=o.inputResponses===void 0?void 0:mx(o.inputResponses),g={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...p!==void 0&&{inputResponses:p.accepted},...p!==void 0&&p.droppedKeys.length>0&&{droppedInputResponseKeys:p.droppedKeys},requestState:o.requestState===void 0?px:ei(o.requestState),signal:d.signal,send:(_,m,h)=>{let z=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(z,_.method),un(m))return l(_,m,h);let v=Az(z,_.method);if(v===void 0)throw new TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(_,v,m)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(g,t);Promise.resolve().then(()=>a(r,f)).then(async _=>{if(d.signal.aborted)return;let m;try{m=n.encodeResult(r.method,_,this._outboundServerInfo())}catch(z){this._onerror(new Error(`Failed to encode result for ${r.method}: ${z}`)),i(V.InternalError,"Internal error");return}let h={result:m,jsonrpc:"2.0",id:r.id};await s?.send(h)},async _=>{if(d.signal.aborted)return;let m=Number.isSafeInteger(_.code)?_.code:V.InternalError,h={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(m),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await s?.send(h)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===d&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ft(e)?r(e):r(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),un(t))return this._requestWithSchemaViaCodec(o,e,t,r);let n=Az(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return qr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=ux(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Xp(t)&&!e.hasRequestMethod(t))throw new ue(me.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),u,l;return new Promise((d,p)=>{let g=b=>{p(b)};if(!this._transport){g(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(b){g(b);return}if(o?.signal?.aborted){let b=o.signal.reason;throw b instanceof ue?b:new ue(me.RequestTimeout,String(b))}let f=e.era===Qs&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;l=_;let m={...t,jsonrpc:"2.0",id:_};o?.onprogress&&(this._progressHandlers.set(_,o.onprogress),m.params={...t.params,_meta:{...t.params?._meta,progressToken:_}});let h=this._envelopeOutbound(m),z=!1,v=b=>{z||(this._progressHandlers.delete(_),f===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(b)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(y=>this._onerror(new Error(`Failed to send cancellation: ${y}`))):f.abort(),p(b instanceof ue?b:new ue(me.RequestTimeout,String(b))))};this._responseHandlers.set(_,b=>{if(o?.signal?.aborted)return;if(z=!0,b instanceof Error)return p(b);let y;try{y=e.decodeResult(t.method,b.result)}catch(T){return p(T instanceof Error?T:new Error(String(T)))}if(y.kind==="invalid")return p(y.error);if(y.kind==="input_required"){if(o?.allowInputRequired===!0)return d(fx(y));let T={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(C,O)=>this._requestWithSchemaViaCodec(e,C===void 0?{method:t.method}:{method:t.method,params:C},r,O)};return d(this._resolveNonCompleteResult(y,T))}let $=y.result;co(r,$).then(T=>{T.success?d(T.data):p(new ue(me.InvalidResult,`Invalid result for ${t.method}: ${T.error}`))},p)}),u=()=>v(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let S=o?.timeout??S$,R=()=>v(new ue(me.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(_,S,o?.maxTotalTimeout,R,o?.resetTimeoutOnProgress??!1),this._transport.send(h,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:f?.signal}).catch(b=>{this._progressHandlers.delete(_),p(b)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),l!==void 0&&(this._responseHandlers.delete(l),this._cleanupTimeout(l))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new ue(me.NotConnected,"Not connected");if(Qp(t.method)&&!e.hasNotificationMethod(t.method))throw new ue(me.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!Xp(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason==="not-in-era"&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason==="not-in-era"?new Q(V.InternalError,`No wire schema for ${e} in the resolved era`):new Error(a.message);return Promise.resolve(t(a.value,s))}}else if(r)o=async(n,s)=>{let i=await co(t.params,{...n.params});if(!i.success)throw new Q(V.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!Qp(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new Q(V.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await co(t.params,{...o.params});if(!n.success)throw new Q(V.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Gs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function zm(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Gs(i)&&Gs(s)?{...i,...s}:s}return r}function Mz(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mx(e){let t={},r=[];if(!Mz(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!Mz(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function fx(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var hx=U(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw new TypeError("argument string is required");var c=typeof a=="object"?s(a):a;if(typeof c!="string")throw new TypeError("argument string is required to be a string");var u=c.indexOf(";"),l=u!==-1?c.slice(0,u).trim():c.trim();if(!o.test(l))throw new TypeError("invalid media type");var d=new i(l.toLowerCase());if(u!==-1){var p,g,f;for(t.lastIndex=u;g=t.exec(c);){if(g.index!==u)throw new TypeError("invalid parameter format");u+=g[0].length,p=g[1].toLowerCase(),f=g[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf("\\")!==-1&&(f=f.replace(r,"$1"))),d.parameters[p]=f}if(u!==c.length)throw new TypeError("invalid parameter format")}return d}function s(a){var c;if(typeof a.getHeader=="function"?c=a.getHeader("content-type"):typeof a.headers=="object"&&(c=a.headers&&a.headers["content-type"]),typeof c!="string")throw new TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),gx=wi(hx(),1);function $m(e){if(e)try{return gx.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function wm(e){return e==="application/json"?!0:$m(e)==="application/json"}var z$=10*1024*1024,Rm=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??z$}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
121
- `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return $$(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function $$(e){return so.parse(JSON.parse(e))}function Pm(e){return JSON.stringify(e)+`
122
- `}var _x=/^[A-Za-z0-9._-]{1,128}$/;function vx(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!_x.test(e)){let r=[...e].filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function yx(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Em(e){let t=vx(e);return yx(e,t.warnings),t.isValid}function Sx(e){return typeof e=="object"&&e!==null&&"_zod"in e}function bx(e){return typeof e=="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName=="string"}function zx(e){if(typeof e!="object"||e===null||un(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(r=>Sx(r))}function Ou(e){if(e!==void 0){if(zx(e))return j(e);if(typeof e=="object"&&e!==null&&!un(e)&&Object.values(e).some(t=>bx(t)))throw new TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!un(e))throw new TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var Nu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(h){if(super(),!e.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let h=this._items[0];return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.reduce((z,v)=>`${z}${v}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((z,v)=>(v instanceof r&&(z[v.str]=(z[v.str]||0)+1),z),{})}};e._Code=o,e.nil=new o("");function n(h,...z){let v=[h[0]],S=0;for(;S<z.length;)a(v,z[S]),v.push(h[++S]);return new o(v)}e._=n;let s=new o("+");function i(h,...z){let v=[g(h[0])],S=0;for(;S<z.length;)v.push(s),a(v,z[S]),v.push(s,g(h[++S]));return c(v),new o(v)}e.str=i;function a(h,z){z instanceof o?h.push(...z._items):z instanceof r?h.push(z):h.push(d(z))}e.addCodeArg=a;function c(h){let z=1;for(;z<h.length-1;){if(h[z]===s){let v=u(h[z-1],h[z+1]);if(v!==void 0){h.splice(z-1,3,v);continue}h[z++]="+"}z++}}function u(h,z){if(z==='""')return h;if(h==='""')return z;if(typeof h=="string")return z instanceof r||h[h.length-1]!=='"'?void 0:typeof z!="string"?`${h.slice(0,-1)}${z}"`:z[0]==='"'?h.slice(0,-1)+z.slice(1):void 0;if(typeof z=="string"&&z[0]==='"'&&!(h instanceof r))return`"${h}${z.slice(1)}`}function l(h,z){return z.emptyStr()?h:h.emptyStr()?z:i`${h}${z}`}e.strConcat=l;function d(h){return typeof h=="number"||typeof h=="boolean"||h===null?h:g(Array.isArray(h)?h.join(","):h)}function p(h){return new o(g(h))}e.stringify=p;function g(h){return JSON.stringify(h).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=g;function f(h){return typeof h=="string"&&e.IDENTIFIER.test(h)?new o(`.${h}`):n`[${h}]`}e.getProperty=f;function _(h){if(typeof h=="string"&&e.IDENTIFIER.test(h))return new o(`${h}`);throw new Error(`CodeGen: invalid export name: ${h}, use explicit $id name mapping`)}e.getEsmExportName=_;function m(h){return new o(h.toString())}e.regexpCode=m}),w$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Nu();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}},o;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,l;if(!((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0)&&l.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:l}){this.value=c,this.scopePath=(0,t._)`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var a=class extends n{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:t.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var l;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let d=this.toName(c),{prefix:p}=d,g=(l=u.key)!==null&&l!==void 0?l:u.ref,f=this._values[p];if(f){let h=f.get(g);if(h)return h}else f=this._values[p]=new Map;f.set(g,d);let _=this._scope[p]||(this._scope[p]=[]),m=_.length;return _[m]=u.ref,d.setValue(u,{property:p,itemIndex:m}),d}getValue(c,u){let l=this._values[c];if(l)return l.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${c}${l.scopePath}`})}scopeCode(c=this._values,u,l){return this._reduceValues(c,d=>{if(d.value===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return d.value.code},u,l)}_reduceValues(c,u,l={},d){let p=t.nil;for(let g in c){let f=c[g];if(!f)continue;let _=l[g]=l[g]||new Map;f.forEach(m=>{if(_.has(m))return;_.set(m,o.Started);let h=u(m);if(h){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;p=(0,t._)`${p}${z} ${m} = ${h};${this.opts._n}`}else if(h=d?.(m))p=(0,t._)`${p}${h}${this.opts._n}`;else throw new r(m);_.set(m,o.Completed)})}return p}};e.ValueScope=a}),de=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=Nu(),r=w$();var o=Nu();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=w$();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(w,x){return this}},i=class extends s{constructor(w,x,N){super(),this.varKind=w,this.name=x,this.rhs=N}render({es5:w,_n:x}){let N=w?r.varKinds.var:this.varKind,B=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${B};`+x}optimizeNames(w,x){if(w[this.name.str])return this.rhs&&(this.rhs=G(this.rhs,w,x)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(w,x,N){super(),this.lhs=w,this.rhs=x,this.sideEffects=N}render({_n:w}){return`${this.lhs} = ${this.rhs};`+w}optimizeNames(w,x){if(!(this.lhs instanceof t.Name&&!w[this.lhs.str]&&!this.sideEffects))return this.rhs=G(this.rhs,w,x),this}get names(){return H(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(w,x,N,B){super(w,N,B),this.op=x}render({_n:w}){return`${this.lhs} ${this.op}= ${this.rhs};`+w}},u=class extends s{constructor(w){super(),this.label=w,this.names={}}render({_n:w}){return`${this.label}:`+w}},l=class extends s{constructor(w){super(),this.label=w,this.names={}}render({_n:w}){return`break${this.label?` ${this.label}`:""};`+w}},d=class extends s{constructor(w){super(),this.error=w}render({_n:w}){return`throw ${this.error};`+w}get names(){return this.error.names}},p=class extends s{constructor(w){super(),this.code=w}render({_n:w}){return`${this.code};`+w}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(w,x){return this.code=G(this.code,w,x),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},g=class extends s{constructor(w=[]){super(),this.nodes=w}render(w){return this.nodes.reduce((x,N)=>x+N.render(w),"")}optimizeNodes(){let{nodes:w}=this,x=w.length;for(;x--;){let N=w[x].optimizeNodes();Array.isArray(N)?w.splice(x,1,...N):N?w[x]=N:w.splice(x,1)}return w.length>0?this:void 0}optimizeNames(w,x){let{nodes:N}=this,B=N.length;for(;B--;){let te=N[B];te.optimizeNames(w,x)||(he(w,te.names),N.splice(B,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((w,x)=>L(w,x.names),{})}},f=class extends g{render(w){return"{"+w._n+super.render(w)+"}"+w._n}},_=class extends g{},m=class extends f{};m.kind="else";var h=class Cu extends f{constructor(x,N){super(N),this.condition=x}render(x){let N=`if(${this.condition})`+super.render(x);return this.else&&(N+="else "+this.else.render(x)),N}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let N=this.else;if(N){let B=N.optimizeNodes();N=this.else=Array.isArray(B)?new m(B):B}if(N)return x===!1?N instanceof Cu?N:N.nodes:this.nodes.length?this:new Cu(qe(x),N instanceof Cu?[N]:N.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,N){var B;if(this.else=(B=this.else)===null||B===void 0?void 0:B.optimizeNames(x,N),!!(super.optimizeNames(x,N)||this.else))return this.condition=G(this.condition,x,N),this}get names(){let x=super.names;return H(x,this.condition),this.else&&L(x,this.else.names),x}};h.kind="if";var z=class extends f{};z.kind="for";var v=class extends z{constructor(w){super(),this.iteration=w}render(w){return`for(${this.iteration})`+super.render(w)}optimizeNames(w,x){if(super.optimizeNames(w,x))return this.iteration=G(this.iteration,w,x),this}get names(){return L(super.names,this.iteration.names)}},S=class extends z{constructor(w,x,N,B){super(),this.varKind=w,this.name=x,this.from=N,this.to=B}render(w){let x=w.es5?r.varKinds.var:this.varKind,{name:N,from:B,to:te}=this;return`for(${x} ${N}=${B}; ${N}<${te}; ${N}++)`+super.render(w)}get names(){return H(H(super.names,this.from),this.to)}},R=class extends z{constructor(w,x,N,B){super(),this.loop=w,this.varKind=x,this.name=N,this.iterable=B}render(w){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(w)}optimizeNames(w,x){if(super.optimizeNames(w,x))return this.iterable=G(this.iterable,w,x),this}get names(){return L(super.names,this.iterable.names)}},b=class extends f{constructor(w,x,N){super(),this.name=w,this.args=x,this.async=N}render(w){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(w)}};b.kind="func";var y=class extends g{render(w){return"return "+super.render(w)}};y.kind="return";var $=class extends f{render(w){let x="try"+super.render(w);return this.catch&&(x+=this.catch.render(w)),this.finally&&(x+=this.finally.render(w)),x}optimizeNodes(){var w,x;return super.optimizeNodes(),(w=this.catch)===null||w===void 0||w.optimizeNodes(),(x=this.finally)===null||x===void 0||x.optimizeNodes(),this}optimizeNames(w,x){var N,B;return super.optimizeNames(w,x),(N=this.catch)===null||N===void 0||N.optimizeNames(w,x),(B=this.finally)===null||B===void 0||B.optimizeNames(w,x),this}get names(){let w=super.names;return this.catch&&L(w,this.catch.names),this.finally&&L(w,this.finally.names),w}},T=class extends f{constructor(w){super(),this.error=w}render(w){return`catch(${this.error})`+super.render(w)}};T.kind="catch";var C=class extends f{render(w){return"finally"+super.render(w)}};C.kind="finally";var O=class{constructor(w,x={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...x,_n:x.lines?`
123
- `:""},this._extScope=w,this._scope=new r.Scope({parent:w}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name(w){return this._scope.name(w)}scopeName(w){return this._extScope.name(w)}scopeValue(w,x){let N=this._extScope.value(w,x);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(w,x){return this._extScope.getValue(w,x)}scopeRefs(w){return this._extScope.scopeRefs(w,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(w,x,N,B){let te=this._scope.toName(x);return N!==void 0&&B&&(this._constants[te.str]=N),this._leafNode(new i(w,te,N)),te}const(w,x,N){return this._def(r.varKinds.const,w,x,N)}let(w,x,N){return this._def(r.varKinds.let,w,x,N)}var(w,x,N){return this._def(r.varKinds.var,w,x,N)}assign(w,x,N){return this._leafNode(new a(w,x,N))}add(w,x){return this._leafNode(new c(w,e.operators.ADD,x))}code(w){return typeof w=="function"?w():w!==t.nil&&this._leafNode(new p(w)),this}object(...w){let x=["{"];for(let[N,B]of w)x.length>1&&x.push(","),x.push(N),(N!==B||this.opts.es5)&&(x.push(":"),(0,t.addCodeArg)(x,B));return x.push("}"),new t._Code(x)}if(w,x,N){if(this._blockNode(new h(w)),x&&N)this.code(x).else().code(N).endIf();else if(x)this.code(x).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(w){return this._elseNode(new h(w))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(h,m)}_for(w,x){return this._blockNode(w),x&&this.code(x).endFor(),this}for(w,x){return this._for(new v(w),x)}forRange(w,x,N,B,te=this.opts.es5?r.varKinds.var:r.varKinds.let){let fe=this._scope.toName(w);return this._for(new S(te,fe,x,N),()=>B(fe))}forOf(w,x,N,B=r.varKinds.const){let te=this._scope.toName(w);if(this.opts.es5){let fe=x instanceof t.Name?x:this.var("_arr",x);return this.forRange("_i",0,(0,t._)`${fe}.length`,se=>{this.var(te,(0,t._)`${fe}[${se}]`),N(te)})}return this._for(new R("of",B,te,x),()=>N(te))}forIn(w,x,N,B=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(w,(0,t._)`Object.keys(${x})`,N);let te=this._scope.toName(w);return this._for(new R("in",B,te,x),()=>N(te))}endFor(){return this._endBlockNode(z)}label(w){return this._leafNode(new u(w))}break(w){return this._leafNode(new l(w))}return(w){let x=new y;if(this._blockNode(x),this.code(w),x.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try(w,x,N){if(!x&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');let B=new $;if(this._blockNode(B),this.code(w),x){let te=this.name("e");this._currNode=B.catch=new T(te),x(te)}return N&&(this._currNode=B.finally=new C,this.code(N)),this._endBlockNode(T,C)}throw(w){return this._leafNode(new d(w))}block(w,x){return this._blockStarts.push(this._nodes.length),w&&this.code(w).endBlock(x),this}endBlock(w){let x=this._blockStarts.pop();if(x===void 0)throw new Error("CodeGen: not in self-balancing block");let N=this._nodes.length-x;if(N<0||w!==void 0&&N!==w)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${w} expected`);return this._nodes.length=x,this}func(w,x=t.nil,N,B){return this._blockNode(new b(w,x,N)),B&&this.code(B).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(w=1){for(;w-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(w){return this._currNode.nodes.push(w),this}_blockNode(w){this._currNode.nodes.push(w),this._nodes.push(w)}_endBlockNode(w,x){let N=this._currNode;if(N instanceof w||x&&N instanceof x)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${x?`${w.kind}/${x.kind}`:w.kind}"`)}_elseNode(w){let x=this._currNode;if(!(x instanceof h))throw new Error('CodeGen: "else" without "if"');return this._currNode=x.else=w,this}get _root(){return this._nodes[0]}get _currNode(){let w=this._nodes;return w[w.length-1]}set _currNode(w){let x=this._nodes;x[x.length-1]=w}};e.CodeGen=O;function L(w,x){for(let N in x)w[N]=(w[N]||0)+(x[N]||0);return w}function H(w,x){return x instanceof t._CodeOrName?L(w,x.names):w}function G(w,x,N){if(w instanceof t.Name)return B(w);if(!te(w))return w;return new t._Code(w._items.reduce((fe,se)=>(se instanceof t.Name&&(se=B(se)),se instanceof t._Code?fe.push(...se._items):fe.push(se),fe),[]));function B(fe){let se=N[fe.str];return se===void 0||x[fe.str]!==1?fe:(delete x[fe.str],se)}function te(fe){return fe instanceof t._Code&&fe._items.some(se=>se instanceof t.Name&&x[se.str]===1&&N[se.str]!==void 0)}}function he(w,x){for(let N in x)w[N]=(w[N]||0)-(x[N]||0)}function qe(w){return typeof w=="boolean"||typeof w=="number"||w===null?!w:(0,t._)`!${F(w)}`}e.not=qe;let Ie=A(e.operators.AND);function Ye(...w){return w.reduce(Ie)}e.and=Ye;let ye=A(e.operators.OR);function I(...w){return w.reduce(ye)}e.or=I;function A(w){return(x,N)=>x===t.nil?N:N===t.nil?x:(0,t._)`${F(x)} ${w} ${F(N)}`}function F(w){return w instanceof t.Name?w:(0,t._)`(${w})`}}),be=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=de(),r=Nu();function o(b){let y={};for(let $ of b)y[$]=!0;return y}e.toHash=o;function n(b,y){return typeof y=="boolean"?y:Object.keys(y).length===0?!0:(s(b,y),!i(y,b.self.RULES.all))}e.alwaysValidSchema=n;function s(b,y=b.schema){let{opts:$,self:T}=b;if(!$.strictSchema||typeof y=="boolean")return;let C=T.RULES.keywords;for(let O in y)C[O]||R(b,`unknown keyword: "${O}"`)}e.checkUnknownRules=s;function i(b,y){if(typeof b=="boolean")return!b;for(let $ in b)if(y[$])return!0;return!1}e.schemaHasRules=i;function a(b,y){if(typeof b=="boolean")return!b;for(let $ in b)if($!=="$ref"&&y.all[$])return!0;return!1}e.schemaHasRulesButRef=a;function c({topSchemaRef:b,schemaPath:y},$,T,C){if(!C){if(typeof $=="number"||typeof $=="boolean")return $;if(typeof $=="string")return(0,t._)`${$}`}return(0,t._)`${b}${y}${(0,t.getProperty)(T)}`}e.schemaRefOrVal=c;function u(b){return p(decodeURIComponent(b))}e.unescapeFragment=u;function l(b){return encodeURIComponent(d(b))}e.escapeFragment=l;function d(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function p(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function g(b,y){if(Array.isArray(b))for(let $ of b)y($);else y(b)}e.eachItem=g;function f({mergeNames:b,mergeToName:y,mergeValues:$,resultToName:T}){return(C,O,L,H)=>{let G=L===void 0?O:L instanceof t.Name?(O instanceof t.Name?b(C,O,L):y(C,O,L),L):O instanceof t.Name?(y(C,L,O),O):$(O,L);return H===t.Name&&!(G instanceof t.Name)?T(C,G):G}}e.mergeEvaluated={props:f({mergeNames:(b,y,$)=>b.if((0,t._)`${$} !== true && ${y} !== undefined`,()=>{b.if((0,t._)`${y} === true`,()=>b.assign($,!0),()=>b.assign($,(0,t._)`${$} || {}`).code((0,t._)`Object.assign(${$}, ${y})`))}),mergeToName:(b,y,$)=>b.if((0,t._)`${$} !== true`,()=>{y===!0?b.assign($,!0):(b.assign($,(0,t._)`${$} || {}`),m(b,$,y))}),mergeValues:(b,y)=>b===!0?!0:{...b,...y},resultToName:_}),items:f({mergeNames:(b,y,$)=>b.if((0,t._)`${$} !== true && ${y} !== undefined`,()=>b.assign($,(0,t._)`${y} === true ? true : ${$} > ${y} ? ${$} : ${y}`)),mergeToName:(b,y,$)=>b.if((0,t._)`${$} !== true`,()=>b.assign($,y===!0?!0:(0,t._)`${$} > ${y} ? ${$} : ${y}`)),mergeValues:(b,y)=>b===!0?!0:Math.max(b,y),resultToName:(b,y)=>b.var("items",y)})};function _(b,y){if(y===!0)return b.var("props",!0);let $=b.var("props",(0,t._)`{}`);return y!==void 0&&m(b,$,y),$}e.evaluatedPropsToName=_;function m(b,y,$){Object.keys($).forEach(T=>b.assign((0,t._)`${y}${(0,t.getProperty)(T)}`,!0))}e.setEvaluated=m;let h={};function z(b,y){return b.scopeValue("func",{ref:y,code:h[y.code]||(h[y.code]=new r._Code(y.code))})}e.useFunc=z;var v;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(v||(e.Type=v={}));function S(b,y,$){if(b instanceof t.Name){let T=y===v.Num;return $?T?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:T?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return $?(0,t.getProperty)(b).toString():"/"+d(b)}e.getErrorPath=S;function R(b,y,$=b.opts.strictSchema){if($){if(y=`strict mode: ${y}`,$===!0)throw new Error(y);b.self.logger.warn(y)}}e.checkStrictMode=R}),Jt=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Au=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=de(),r=be(),o=Jt();e.keywordError={message:({keyword:m})=>(0,t.str)`must pass "${m}" keyword validation`},e.keyword$DataError={message:({keyword:m,schemaType:h})=>h?(0,t.str)`"${m}" keyword must be ${h} ($data)`:(0,t.str)`"${m}" keyword is invalid ($data)`};function n(m,h=e.keywordError,z,v){let{it:S}=m,{gen:R,compositeRule:b,allErrors:y}=S,$=d(m,h,z);v??(b||y)?c(R,$):u(S,(0,t._)`[${$}]`)}e.reportError=n;function s(m,h=e.keywordError,z){let{it:v}=m,{gen:S,compositeRule:R,allErrors:b}=v;c(S,d(m,h,z)),R||b||u(v,o.default.vErrors)}e.reportExtraError=s;function i(m,h){m.assign(o.default.errors,h),m.if((0,t._)`${o.default.vErrors} !== null`,()=>m.if(h,()=>m.assign((0,t._)`${o.default.vErrors}.length`,h),()=>m.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:m,keyword:h,schemaValue:z,data:v,errsCount:S,it:R}){if(S===void 0)throw new Error("ajv implementation error");let b=m.name("err");m.forRange("i",S,o.default.errors,y=>{m.const(b,(0,t._)`${o.default.vErrors}[${y}]`),m.if((0,t._)`${b}.instancePath === undefined`,()=>m.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(o.default.instancePath,R.errorPath))),m.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${R.errSchemaPath}/${h}`),R.opts.verbose&&(m.assign((0,t._)`${b}.schema`,z),m.assign((0,t._)`${b}.data`,v))})}e.extendErrors=a;function c(m,h){let z=m.const("err",h);m.if((0,t._)`${o.default.vErrors} === null`,()=>m.assign(o.default.vErrors,(0,t._)`[${z}]`),(0,t._)`${o.default.vErrors}.push(${z})`),m.code((0,t._)`${o.default.errors}++`)}function u(m,h){let{gen:z,validateName:v,schemaEnv:S}=m;S.$async?z.throw((0,t._)`new ${m.ValidationError}(${h})`):(z.assign((0,t._)`${v}.errors`,h),z.return(!1))}let l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(m,h,z){let{createErrors:v}=m.it;return v===!1?(0,t._)`{}`:p(m,h,z)}function p(m,h,z={}){let{gen:v,it:S}=m,R=[g(S,z),f(m,z)];return _(m,h,R),v.object(...R)}function g({errorPath:m},{instancePath:h}){let z=h?(0,t.str)`${m}${(0,r.getErrorPath)(h,r.Type.Str)}`:m;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,z)]}function f({keyword:m,it:{errSchemaPath:h}},{schemaPath:z,parentSchema:v}){let S=v?h:(0,t.str)`${h}/${m}`;return z&&(S=(0,t.str)`${S}${(0,r.getErrorPath)(z,r.Type.Str)}`),[l.schemaPath,S]}function _(m,{params:h,message:z},v){let{keyword:S,data:R,schemaValue:b,it:y}=m,{opts:$,propertyName:T,topSchemaRef:C,schemaPath:O}=y;v.push([l.keyword,S],[l.params,typeof h=="function"?h(m):h||(0,t._)`{}`]),$.messages&&v.push([l.message,typeof z=="function"?z(m):z]),$.verbose&&v.push([l.schema,b],[l.parentSchema,(0,t._)`${C}${O}`],[o.default.data,R]),T&&v.push([l.propertyName,T])}}),$x=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Au(),r=de(),o=Jt(),n={message:"boolean schema is false"};function s(c){let{gen:u,schema:l,validateName:d}=c;l===!1?a(c,!1):typeof l=="object"&&l.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${d}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(c,u){let{gen:l,schema:d}=c;d===!1?(l.var(u,!1),a(c)):l.var(u,!0)}e.boolOrEmptySchema=i;function a(c,u){let{gen:l,data:d}=c,p={gen:l,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(p,n,void 0,u)}}),R$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o}),P$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let a=s.RULES.types[i];return a&&a!==!0&&r(n,a)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(a=>n[a]!==void 0))}e.shouldUseRule=o}),ju=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=R$(),r=P$(),o=Au(),n=de(),s=be();var i;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function a(v){let S=c(v.type);if(S.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!S.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&S.push("null")}return S}e.getSchemaTypes=a;function c(v){let S=Array.isArray(v)?v:v?[v]:[];if(S.every(t.isJSONType))return S;throw new Error("type must be JSONType or JSONType[]: "+S.join(","))}e.getJSONTypes=c;function u(v,S){let{gen:R,data:b,opts:y}=v,$=d(S,y.coerceTypes),T=S.length>0&&!($.length===0&&S.length===1&&(0,r.schemaHasRulesForType)(v,S[0]));if(T){let C=_(S,b,y.strictNumbers,i.Wrong);R.if(C,()=>{$.length?p(v,S,$):h(v)})}return T}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function d(v,S){return S?v.filter(R=>l.has(R)||S==="array"&&R==="array"):[]}function p(v,S,R){let{gen:b,data:y,opts:$}=v,T=b.let("dataType",(0,n._)`typeof ${y}`),C=b.let("coerced",(0,n._)`undefined`);$.coerceTypes==="array"&&b.if((0,n._)`${T} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>b.assign(y,(0,n._)`${y}[0]`).assign(T,(0,n._)`typeof ${y}`).if(_(S,y,$.strictNumbers),()=>b.assign(C,y))),b.if((0,n._)`${C} !== undefined`);for(let L of R)(l.has(L)||L==="array"&&$.coerceTypes==="array")&&O(L);b.else(),h(v),b.endIf(),b.if((0,n._)`${C} !== undefined`,()=>{b.assign(y,C),g(v,C)});function O(L){switch(L){case"string":b.elseIf((0,n._)`${T} == "number" || ${T} == "boolean"`).assign(C,(0,n._)`"" + ${y}`).elseIf((0,n._)`${y} === null`).assign(C,(0,n._)`""`);return;case"number":b.elseIf((0,n._)`${T} == "boolean" || ${y} === null
120
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Fs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let g=e.seen.get(d),f=g.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,l),a._zod.parent===d)for(let m in u)m==="$ref"||m==="allOf"||m in l||delete u[m];if(f.$ref&&g.def)for(let m in u)m==="$ref"||m==="allOf"||m in g.def&&JSON.stringify(u[m])===JSON.stringify(g.def[m])&&delete u[m]}let p=a._zod.parent;if(p&&p!==d){o(p);let g=e.seen.get(p);if(g?.schema.$ref&&(u.$ref=g.schema.$ref,g.def))for(let f in u)f==="$ref"||f==="allOf"||f in g.def&&JSON.stringify(u[f])===JSON.stringify(g.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ls(t,"input",e.processors),output:Ls(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ht(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ht(o.element,r);if(o.type==="set")return ht(o.valueType,r);if(o.type==="lazy")return ht(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return ht(o.innerType,r);if(o.type==="intersection")return ht(o.left,r)||ht(o.right,r);if(o.type==="record"||o.type==="map")return ht(o.keyType,r)||ht(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ht(o.in,r)||ht(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ht(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ht(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ht(n,r))return!0;return!!(o.rest&&ht(o.rest,r))}return!1}var xb=(e,t={})=>r=>{let o=Ds({...r,processors:t});return Te(e,o),Us(o,e),Fs(o,e)},Ls=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Ds({...n??{},target:s,io:t,processors:r});return Te(e,i),Us(i,e),Fs(i,e)};var FP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=FP[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";d?g?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?g?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},$p=(e,t,r,o)=>{r.type="boolean"},Ib=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ob=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},wp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Cb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Nb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Rp=(e,t,r,o)=>{r.not={}},jb=(e,t,r,o)=>{},Pp=(e,t,r,o)=>{},Ab=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Ep=(e,t,r,o)=>{let n=e._zod.def,s=Is(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},kp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},Mb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},qb=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},Zb=(e,t,r,o)=>{let n=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),c?c.length===1?(s.contentMediaType=c[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(n,s)},Lb=(e,t,r,o)=>{r.type="boolean"},xp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Db=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Tp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ub=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Fb=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ip=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Te(s.element,t,{...o,path:[...o.path,"items"]})},Op=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=Te(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=Te(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Cp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Te(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Np=(e,t,r,o)=>{let n=e._zod.def,s=Te(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Te(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c},Vb=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((p,g)=>Te(p,t,{...o,path:[...o.path,i,g]})),u=s.rest?Te(s.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=c,u&&(n.items=u)):t.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),n.minItems=c.length,u||(n.maxItems=c.length)):(n.items=c,u&&(n.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(n.minItems=l),typeof d=="number"&&(n.maxItems=d)},jp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Te(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=Te(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=Te(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},Ap=(e,t,r,o)=>{let n=e._zod.def,s=Te(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Mp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},qp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Zp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Lp=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Dp=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Te(i,t,o);let a=t.seen.get(e);a.ref=i},Up=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Jb=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},mu=(e,t,r,o)=>{let n=e._zod.def;Te(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Fp=(e,t,r,o)=>{let n=e._zod.innerType;Te(n,t,o);let s=t.seen.get(e);s.ref=n},Tb={string:bp,number:zp,boolean:$p,bigint:Ib,symbol:Ob,null:wp,undefined:Cb,void:Nb,never:Rp,any:jb,unknown:Pp,date:Ab,enum:Ep,literal:kp,nan:Mb,template_literal:qb,file:Zb,success:Lb,custom:xp,function:Db,transform:Tp,map:Ub,set:Fb,array:Ip,object:Op,union:Cp,intersection:Np,tuple:Vb,record:jp,nullable:Ap,nonoptional:Mp,default:qp,prefault:Zp,catch:Lp,pipe:Dp,readonly:Up,promise:Jb,optional:mu,lazy:Fp};function fu(e,t){if("_idmap"in e){let o=e,n=Ds({...t,processors:Tb}),s={};for(let c of o._idmap.entries()){let[u,l]=c;Te(l,n)}let i={},a={registry:o,uri:t?.uri,defs:s};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Us(n,l),i[u]=Fs(n,l)}if(Object.keys(s).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=Ds({...t,processors:Tb});return Te(e,r),Us(r,e),Fs(r,e)}var Mr={};Ro(Mr,{ZodISODate:()=>Bb,ZodISODateTime:()=>Hb,ZodISODuration:()=>Gb,ZodISOTime:()=>Kb,date:()=>Jp,datetime:()=>Vp,duration:()=>Bp,time:()=>Hp});var Hb=Z("ZodISODateTime",(e,t)=>{lS.init(e,t),De.init(e,t)});function Vp(e){return gb(Hb,e)}var Bb=Z("ZodISODate",(e,t)=>{dS.init(e,t),De.init(e,t)});function Jp(e){return _b(Bb,e)}var Kb=Z("ZodISOTime",(e,t)=>{pS.init(e,t),De.init(e,t)});function Hp(e){return vb(Kb,e)}var Gb=Z("ZodISODuration",(e,t)=>{mS.init(e,t),De.init(e,t)});function Bp(e){return yb(Gb,e)}var XP=(e,t)=>{eu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Jv(e,r)},flatten:{value:r=>Vv(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Qo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Qo,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Pt=Z("ZodError",XP,{Parent:Error});var Wb=tu(Pt),Yb=ru(Pt),hu=js(Pt),Xb=As(Pt),Qb=Kv(Pt),ez=Gv(Pt),tz=Wv(Pt),rz=Yv(Pt),oz=Xv(Pt),nz=Qv(Pt),sz=ey(Pt),iz=ty(Pt);var az=new WeakMap;function Js(e,t,r){let o=Object.getPrototypeOf(e),n=az.get(o);if(n||(n=new Set,az.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Me=Z("ZodType",(e,t)=>(Ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ls(e,"input"),output:Ls(e,"output")}}),e.toJSONSchema=xb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Wb(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>hu(e,r,o),e.parseAsync=async(r,o)=>Yb(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Xb(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Qb(e,r,o),e.decode=(r,o)=>ez(e,r,o),e.encodeAsync=async(r,o)=>tz(e,r,o),e.decodeAsync=async(r,o)=>rz(e,r,o),e.safeEncode=(r,o)=>oz(e,r,o),e.safeDecode=(r,o)=>nz(e,r,o),e.safeEncodeAsync=async(r,o)=>sz(e,r,o),e.safeDecodeAsync=async(r,o)=>iz(e,r,o),Js(e,"ZodType",{check(...r){let o=this.def;return this.clone(Pe.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Dt(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(UE(r,o))},superRefine(r,o){return this.check(FE(r,o))},overwrite(r){return this.check(Ar(r))},optional(){return ve(this)},exactOptional(){return kE(this)},nullable(){return dz(this)},nullish(){return ve(dz(this))},nonoptional(r){return NE(this,r)},array(){return W(this)},or(r){return le([this,r])},and(r){return on(this,r)},transform(r){return pz(this,bz(r))},default(r){return IE(this,r)},prefault(r){return CE(this,r)},catch(r){return AE(this,r)},pipe(r){return pz(this,r)},readonly(){return ZE(this)},describe(r){let o=this.clone();return ao.add(o,{description:r}),o},meta(...r){if(r.length===0)return ao.get(this);let o=this.clone();return ao.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return ao.get(e)?.description},configurable:!0}),e)),mz=Z("_ZodString",(e,t)=>{au.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>bp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Js(e,"_ZodString",{regex(...o){return this.check(lp(...o))},includes(...o){return this.check(mp(...o))},startsWith(...o){return this.check(fp(...o))},endsWith(...o){return this.check(hp(...o))},min(...o){return this.check(rn(...o))},max(...o){return this.check(du(...o))},length(...o){return this.check(pu(...o))},nonempty(...o){return this.check(rn(1,...o))},lowercase(o){return this.check(dp(o))},uppercase(o){return this.check(pp(o))},trim(){return this.check(_p())},normalize(...o){return this.check(gp(...o))},toLowerCase(){return this.check(vp())},toUpperCase(){return this.check(yp())},slugify(){return this.check(Sp())}})}),eE=Z("ZodString",(e,t)=>{au.init(e,t),mz.init(e,t),e.email=r=>e.check(ap(fz,r)),e.url=r=>e.check(up(gz,r)),e.jwt=r=>e.check(hb(hE,r)),e.emoji=r=>e.check(tb(tE,r)),e.guid=r=>e.check(cp(cz,r)),e.uuid=r=>e.check(YS(gu,r)),e.uuidv4=r=>e.check(XS(gu,r)),e.uuidv6=r=>e.check(QS(gu,r)),e.uuidv7=r=>e.check(eb(gu,r)),e.nanoid=r=>e.check(rb(rE,r)),e.guid=r=>e.check(cp(cz,r)),e.cuid=r=>e.check(ob(oE,r)),e.cuid2=r=>e.check(nb(nE,r)),e.ulid=r=>e.check(sb(sE,r)),e.base64=r=>e.check(pb(pE,r)),e.base64url=r=>e.check(mb(mE,r)),e.xid=r=>e.check(ib(iE,r)),e.ksuid=r=>e.check(ab(aE,r)),e.ipv4=r=>e.check(cb(cE,r)),e.ipv6=r=>e.check(ub(uE,r)),e.cidrv4=r=>e.check(lb(lE,r)),e.cidrv6=r=>e.check(db(dE,r)),e.e164=r=>e.check(fb(fE,r)),e.datetime=r=>e.check(Vp(r)),e.date=r=>e.check(Jp(r)),e.time=r=>e.check(Hp(r)),e.duration=r=>e.check(Bp(r))});function P(e){return WS(eE,e)}var De=Z("ZodStringFormat",(e,t)=>{Ae.init(e,t),mz.init(e,t)}),fz=Z("ZodEmail",(e,t)=>{tS.init(e,t),De.init(e,t)});function hz(e){return ap(fz,e)}var cz=Z("ZodGUID",(e,t)=>{Qy.init(e,t),De.init(e,t)});var gu=Z("ZodUUID",(e,t)=>{eS.init(e,t),De.init(e,t)});var gz=Z("ZodURL",(e,t)=>{rS.init(e,t),De.init(e,t)});function _z(e){return up(gz,e)}var tE=Z("ZodEmoji",(e,t)=>{oS.init(e,t),De.init(e,t)});var rE=Z("ZodNanoID",(e,t)=>{nS.init(e,t),De.init(e,t)});var oE=Z("ZodCUID",(e,t)=>{sS.init(e,t),De.init(e,t)});var nE=Z("ZodCUID2",(e,t)=>{iS.init(e,t),De.init(e,t)});var sE=Z("ZodULID",(e,t)=>{aS.init(e,t),De.init(e,t)});var iE=Z("ZodXID",(e,t)=>{cS.init(e,t),De.init(e,t)});var aE=Z("ZodKSUID",(e,t)=>{uS.init(e,t),De.init(e,t)});var cE=Z("ZodIPv4",(e,t)=>{fS.init(e,t),De.init(e,t)});var uE=Z("ZodIPv6",(e,t)=>{hS.init(e,t),De.init(e,t)});var lE=Z("ZodCIDRv4",(e,t)=>{gS.init(e,t),De.init(e,t)});var dE=Z("ZodCIDRv6",(e,t)=>{_S.init(e,t),De.init(e,t)});var pE=Z("ZodBase64",(e,t)=>{yS.init(e,t),De.init(e,t)});var mE=Z("ZodBase64URL",(e,t)=>{SS.init(e,t),De.init(e,t)});var fE=Z("ZodE164",(e,t)=>{bS.init(e,t),De.init(e,t)});var hE=Z("ZodJWT",(e,t)=>{zS.init(e,t),De.init(e,t)});var vz=Z("ZodNumber",(e,t)=>{rp.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>zp(e,o,n,s),Js(e,"ZodNumber",{gt(o,n){return this.check(uu(o,n))},gte(o,n){return this.check(Zs(o,n))},min(o,n){return this.check(Zs(o,n))},lt(o,n){return this.check(cu(o,n))},lte(o,n){return this.check(qs(o,n))},max(o,n){return this.check(qs(o,n))},int(o){return this.check(uz(o))},safe(o){return this.check(uz(o))},positive(o){return this.check(uu(0,o))},nonnegative(o){return this.check(Zs(0,o))},negative(o){return this.check(cu(0,o))},nonpositive(o){return this.check(qs(0,o))},multipleOf(o,n){return this.check(lu(o,n))},step(o,n){return this.check(lu(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function X(e){return Sb(vz,e)}var gE=Z("ZodNumberFormat",(e,t)=>{$S.init(e,t),vz.init(e,t)});function uz(e){return bb(gE,e)}var _E=Z("ZodBoolean",(e,t)=>{wS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$p(e,r,o,n)});function _e(e){return zb(_E,e)}var vE=Z("ZodNull",(e,t)=>{RS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wp(e,r,o,n)});function _u(e){return $b(vE,e)}var yE=Z("ZodUnknown",(e,t)=>{PS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n)});function ge(){return wb(yE)}var SE=Z("ZodNever",(e,t)=>{ES.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n)});function bE(e){return Rb(SE,e)}var zE=Z("ZodArray",(e,t)=>{kS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n),e.element=t.element,Js(e,"ZodArray",{min(r,o){return this.check(rn(r,o))},nonempty(r){return this.check(rn(1,r))},max(r,o){return this.check(du(r,o))},length(r,o){return this.check(pu(r,o))},unwrap(){return this.element}})});function W(e,t){return Pb(zE,e,t)}var yz=Z("ZodObject",(e,t)=>{IS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),Pe.defineLazy(e,"shape",()=>t.shape),Js(e,"ZodObject",{keyof(){return we(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ge()})},loose(){return this.clone({...this._zod.def,catchall:ge()})},strict(){return this.clone({...this._zod.def,catchall:bE()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Pe.extend(this,r)},safeExtend(r){return Pe.safeExtend(this,r)},merge(r){return Pe.merge(this,r)},pick(r){return Pe.pick(this,r)},omit(r){return Pe.omit(this,r)},partial(...r){return Pe.partial(zz,this,r[0])},required(...r){return Pe.required($z,this,r[0])}})});function j(e,t){let r={type:"object",shape:e??{},...Pe.normalizeParams(t)};return new yz(r)}function ze(e,t){return new yz({type:"object",shape:e,catchall:ge(),...Pe.normalizeParams(t)})}var Sz=Z("ZodUnion",(e,t)=>{op.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cp(e,r,o,n),e.options=t.options});function le(e,t){return new Sz({type:"union",options:e,...Pe.normalizeParams(t)})}var $E=Z("ZodDiscriminatedUnion",(e,t)=>{Sz.init(e,t),OS.init(e,t)});function Gp(e,t,r){return new $E({type:"union",options:t,discriminator:e,...Pe.normalizeParams(r)})}var wE=Z("ZodIntersection",(e,t)=>{CS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n)});function on(e,t){return new wE({type:"intersection",left:e,right:t})}var lz=Z("ZodRecord",(e,t)=>{NS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ie(e,t,r){return!t||!t._zod?new lz({type:"record",keyType:P(),valueType:e,...Pe.normalizeParams(t)}):new lz({type:"record",keyType:e,valueType:t,...Pe.normalizeParams(r)})}var Kp=Z("ZodEnum",(e,t)=>{jS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Ep(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Kp({...t,checks:[],...Pe.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Kp({...t,checks:[],...Pe.normalizeParams(n),entries:s})}});function we(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Kp({type:"enum",entries:r,...Pe.normalizeParams(t)})}var RE=Z("ZodLiteral",(e,t)=>{AS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new RE({type:"literal",values:Array.isArray(e)?e:[e],...Pe.normalizeParams(t)})}var PE=Z("ZodTransform",(e,t)=>{MS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Yo(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Pe.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Pe.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function bz(e){return new PE({type:"transform",transform:e})}var zz=Z("ZodOptional",(e,t)=>{np.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ve(e){return new zz({type:"optional",innerType:e})}var EE=Z("ZodExactOptional",(e,t)=>{qS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kE(e){return new EE({type:"optional",innerType:e})}var xE=Z("ZodNullable",(e,t)=>{ZS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function dz(e){return new xE({type:"nullable",innerType:e})}var TE=Z("ZodDefault",(e,t)=>{LS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function IE(e,t){return new TE({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Pe.shallowClone(t)}})}var OE=Z("ZodPrefault",(e,t)=>{DS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function CE(e,t){return new OE({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Pe.shallowClone(t)}})}var $z=Z("ZodNonOptional",(e,t)=>{US.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function NE(e,t){return new $z({type:"nonoptional",innerType:e,...Pe.normalizeParams(t)})}var jE=Z("ZodCatch",(e,t)=>{FS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function AE(e,t){return new jE({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var wz=Z("ZodPipe",(e,t)=>{sp.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dp(e,r,o,n),e.in=t.in,e.out=t.out});function pz(e,t){return new wz({type:"pipe",in:e,out:t})}var ME=Z("ZodPreprocess",(e,t)=>{wz.init(e,t),VS.init(e,t)}),qE=Z("ZodReadonly",(e,t)=>{JS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Up(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ZE(e){return new qE({type:"readonly",innerType:e})}var LE=Z("ZodLazy",(e,t)=>{HS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fp(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Wp(e){return new LE({type:"lazy",getter:e})}var DE=Z("ZodCustom",(e,t)=>{BS.init(e,t),Me.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xp(e,r,o,n)});function UE(e,t={}){return Eb(DE,e,t)}function FE(e,t){return kb(e,t)}function vu(e,t){return new ME({type:"pipe",in:bz(e),out:t})}Rt(KS());var tm=Symbol.for("mcp.sdk.errorBrands");function sm(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,tm,{value:r,enumerable:!1,configurable:!0})}function cn(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,tm)){let r=t[tm];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var VE=class Zz extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return cn(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",sm(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new Zz(t.error,t.error_description??t.error,t.error_uri)}},me=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),ue=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return cn(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",sm(this,new.target)}},JE=class extends ue{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var Rz={};function Lz(e){return Object.hasOwn(Rz,e)?Rz[e]:void 0}function Pz(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function HE(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Dz(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function Ys(e,t){let r={};for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let s=t===void 0?void 0:t[o];if(s===void 0){r[o]=n;continue}if(Pz(n)&&Pz(s)){let i={};for(let[a,c]of Object.entries(n))c!==void 0&&s[a]===void 0&&!HE(o,a,s)&&(i[a]=c);Object.keys(i).length>0&&(r[o]=i)}}return Object.keys(r).length>0?r:void 0}var Uz="2026-07-28",Ct=[Uz];function dr(e){return e>=Uz}function Fz(e){return e.filter(t=>!dr(t))}function im(e){return e.filter(t=>dr(t))}function Vz(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Jz=["task","inputRequests","requestState"];function am(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Jz.some(t=>t in e)?e:{...e,content:[]}}function BE(){let e=Wp(()=>le([P(),X(),_e(),_u(),ie(P(),e),W(e)])),t=ie(P(),e),r=le([P(),X().int()]),o=P(),n=j({ttl:X().optional()}),s=j({taskId:P()}),i=ze({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=j({_meta:i.optional()}),c=a.extend({task:n.optional()}),u=j({method:P(),params:a.loose().optional()}),l=j({_meta:i.optional()}),d=j({method:P(),params:l.loose().optional()}),p=ze({_meta:i.optional()}),g=le([P(),X().int()]),f=p.strict(),_=l.extend({requestId:g.optional(),reason:P().optional()}),m=d.extend({method:J("notifications/cancelled"),params:_}),h=j({src:P(),mimeType:P().optional(),sizes:W(P()).optional(),theme:we(["light","dark"]).optional()}),z=j({icons:W(h).optional()}),v=j({name:P(),title:P().optional()}),S=v.extend({...v.shape,...z.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),R=on(j({applyDefaults:_e().optional()}),t),b=vu(lt=>lt&&typeof lt=="object"&&!Array.isArray(lt)&&Object.keys(lt).length===0?{form:{}}:lt,on(j({form:R.optional(),url:t.optional()}),t.optional())),y=ze({list:t.optional(),cancel:t.optional(),requests:ze({sampling:ze({createMessage:t.optional()}).optional(),elicitation:ze({create:t.optional()}).optional()}).optional()}),$=ze({list:t.optional(),cancel:t.optional(),requests:ze({tools:ze({call:t.optional()}).optional()}).optional()}),T=j({experimental:ie(P(),t).optional(),sampling:j({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:j({listChanged:_e().optional()}).optional(),tasks:y.optional(),extensions:ie(P(),t).optional()}),C=a.extend({protocolVersion:P(),capabilities:T,clientInfo:S}),O=u.extend({method:J("initialize"),params:C}),L=j({experimental:ie(P(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:j({listChanged:_e().optional()}).optional(),resources:j({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:j({listChanged:_e().optional()}).optional(),tasks:$.optional(),extensions:ie(P(),t).optional()}),H=p.extend({protocolVersion:P(),capabilities:L,serverInfo:S,instructions:P().optional()}),G=d.extend({method:J("notifications/initialized"),params:l.optional()}),he=u.extend({method:J("ping"),params:a.optional()}),qe=j({progress:X(),total:ve(X()),message:ve(P())}),Ie=j({...l.shape,...qe.shape,progressToken:r}),Ye=d.extend({method:J("notifications/progress"),params:Ie}),ye=a.extend({cursor:o.optional()}),I=u.extend({params:ye.optional()}),A=p.extend({nextCursor:o.optional()}),F=j({uri:P(),mimeType:ve(P()),_meta:ie(P(),ge()).optional()}),w=F.extend({text:P()}),x=P().refine(lt=>{try{return atob(lt),!0}catch{return!1}},{message:"Invalid Base64 string"}),N=F.extend({blob:x}),B=we(["user","assistant"]),te=j({audience:W(B).optional(),priority:X().min(0).max(1).optional(),lastModified:Mr.datetime({offset:!0}).optional()}),fe=j({...v.shape,...z.shape,uri:P(),description:ve(P()),mimeType:ve(P()),size:ve(X()),annotations:te.optional(),_meta:ve(ze({}))}),se=j({...v.shape,...z.shape,uriTemplate:P(),description:ve(P()),mimeType:ve(P()),annotations:te.optional(),_meta:ve(ze({}))}),Oe=I.extend({method:J("resources/list")}),mt=A.extend({resources:W(fe)}),E=I.extend({method:J("resources/templates/list")}),M=A.extend({resourceTemplates:W(se)}),D=a.extend({uri:P()}),oe=D,ne=u.extend({method:J("resources/read"),params:oe}),pe=p.extend({contents:W(le([w,N]))}),Ge=d.extend({method:J("notifications/resources/list_changed"),params:l.optional()}),et=D,ct=u.extend({method:J("resources/subscribe"),params:et}),Xe=D,Ue=u.extend({method:J("resources/unsubscribe"),params:Xe}),Et=l.extend({uri:P()}),rt=d.extend({method:J("notifications/resources/updated"),params:Et}),Xt=j({name:P(),description:ve(P()),required:ve(_e())}),Nt=j({...v.shape,...z.shape,description:ve(P()),arguments:ve(W(Xt)),_meta:ve(ze({}))}),Qt=I.extend({method:J("prompts/list")}),mr=A.extend({prompts:W(Nt)}),fr=a.extend({name:P(),arguments:ie(P(),P()).optional()}),Ur=u.extend({method:J("prompts/get"),params:fr}),Fr=j({type:J("text"),text:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),Vr=j({type:J("image"),data:x,mimeType:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),Jr=j({type:J("audio"),data:x,mimeType:P(),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),fn=j({type:J("tool_use"),name:P(),id:P(),input:ie(P(),ge()),_meta:ie(P(),ge()).optional()}),hr=j({type:J("resource"),resource:le([w,N]),annotations:te.optional(),_meta:ie(P(),ge()).optional()}),hn=fe.extend({type:J("resource_link")}),kt=le([Fr,Vr,Jr,hn,hr]),fo=j({role:B,content:kt}),ho=p.extend({description:P().optional(),messages:W(fo)}),Hr=d.extend({method:J("notifications/prompts/list_changed"),params:l.optional()}),gn=j({title:P().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),go=j({taskSupport:we(["required","optional","forbidden"]).optional()}),Br=j({...v.shape,...z.shape,description:P().optional(),inputSchema:j({type:J("object"),properties:ie(P(),e).optional(),required:W(P()).optional()}).catchall(ge()),outputSchema:j({type:J("object"),properties:ie(P(),e).optional(),required:W(P()).optional()}).catchall(ge()).optional(),annotations:gn.optional(),execution:go.optional(),_meta:ie(P(),ge()).optional()}),_o=I.extend({method:J("tools/list")}),vo=A.extend({tools:W(Br)}),yo=p.extend({content:W(kt),structuredContent:ie(P(),ge()).optional(),isError:_e().optional()}),ut=c.extend({name:P(),arguments:ie(P(),ge()).optional()}),_n=u.extend({method:J("tools/call"),params:ut}),si=d.extend({method:J("notifications/tools/list_changed"),params:l.optional()}),So=we(["debug","info","notice","warning","error","critical","alert","emergency"]),vn=a.extend({level:So}),yn=u.extend({method:J("logging/setLevel"),params:vn}),Sn=l.extend({level:So,logger:P().optional(),data:ge()}),bn=d.extend({method:J("notifications/message"),params:Sn}),zn=j({name:P().optional()}),$n=j({hints:W(zn).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),wn=j({mode:we(["auto","required","none"]).optional()}),ii=j({type:J("tool_result"),toolUseId:P().describe("The unique identifier for the corresponding tool call."),content:W(kt),structuredContent:j({}).loose().optional(),isError:_e().optional(),_meta:ie(P(),ge()).optional()}),Rn=Gp("type",[Fr,Vr,Jr]),gr=Gp("type",[Fr,Vr,Jr,fn,ii]),Pn=j({role:B,content:le([gr,W(gr)]),_meta:ie(P(),ge()).optional()}),En=c.extend({messages:W(Pn),modelPreferences:$n.optional(),systemPrompt:P().optional(),includeContext:we(["none","thisServer","allServers"]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:W(P()).optional(),metadata:t.optional(),tools:W(Br).optional(),toolChoice:wn.optional()}),kn=u.extend({method:J("sampling/createMessage"),params:En}),xn=p.extend({model:P(),stopReason:ve(we(["endTurn","stopSequence","maxTokens"]).or(P())),role:B,content:Rn}),Tn=p.extend({model:P(),stopReason:ve(we(["endTurn","stopSequence","maxTokens","toolUse"]).or(P())),role:B,content:le([gr,W(gr)])}),In=j({type:J("boolean"),title:P().optional(),description:P().optional(),default:_e().optional()}),On=j({type:J("string"),title:P().optional(),description:P().optional(),minLength:X().optional(),maxLength:X().optional(),format:we(["email","uri","date","date-time"]).optional(),default:P().optional()}),Cn=j({type:we(["number","integer"]),title:P().optional(),description:P().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Nn=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),default:P().optional()}),jn=j({type:J("string"),title:P().optional(),description:P().optional(),oneOf:W(j({const:P(),title:P()})),default:P().optional()}),An=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),enumNames:W(P()).optional(),default:P().optional()}),Mn=le([Nn,jn]),Kr=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({type:J("string"),enum:W(P())}),default:W(P()).optional()}),Gr=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({anyOf:W(j({const:P(),title:P()}))}),default:W(P()).optional()}),ai=le([Kr,Gr]),ci=le([An,Mn,ai]),bt=le([ci,In,On,Cn]),zt=c.extend({mode:J("form").optional(),message:P(),requestedSchema:j({type:J("object"),properties:ie(P(),bt),required:W(P()).optional()}).catchall(ge())}),qn=c.extend({mode:J("url"),message:P(),elicitationId:P(),url:P().url()}),jt=le([zt,qn]),ui=u.extend({method:J("elicitation/create"),params:jt}),li=l.extend({elicitationId:P()}),di=d.extend({method:J("notifications/elicitation/complete"),params:li}),pi=p.extend({action:we(["accept","decline","cancel"]),content:vu(lt=>lt===null?void 0:lt,ie(P(),le([P(),X(),_e(),W(P())])).optional())}),mi=j({type:J("ref/resource"),uri:P()}),fi=j({type:J("ref/prompt"),name:P()}),hi=a.extend({ref:le([fi,mi]),argument:j({name:P(),value:P()}),context:j({arguments:ie(P(),P()).optional()}).optional()}),Zn=u.extend({method:J("completion/complete"),params:hi}),gi=p.extend({completion:ze({values:W(P()).max(100),total:ve(X().int()),hasMore:ve(_e())})}),_i=j({uri:P().startsWith("file://"),name:P().optional(),_meta:ie(P(),ge()).optional()}),bo=u.extend({method:J("roots/list"),params:a.optional()}),Ln=p.extend({roots:W(_i)}),vi=d.extend({method:J("notifications/roots/list_changed"),params:l.optional()}),yi=ze({ttl:X().optional(),pollInterval:X().optional()}),Si=we(["working","input_required","completed","failed","cancelled"]),_r=j({taskId:P(),status:Si,ttl:le([X(),_u()]),createdAt:P(),lastUpdatedAt:P(),pollInterval:ve(X()),statusMessage:ve(P())}),gt=p.extend({task:_r}),bi=l.merge(_r),Wr=d.extend({method:J("notifications/tasks/status"),params:bi}),zo=u.extend({method:J("tasks/get"),params:a.extend({taskId:P()})}),$o=p.merge(_r),wo=u.extend({method:J("tasks/result"),params:a.extend({taskId:P()})}),Gu=p.loose(),_t=I.extend({method:J("tasks/list")}),We=A.extend({tasks:W(_r)}),Yr=u.extend({method:J("tasks/cancel"),params:a.extend({taskId:P()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:d,ResultSchema:p,RequestIdSchema:g,EmptyResultSchema:f,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:m,IconSchema:h,IconsSchema:z,BaseMetadataSchema:v,ImplementationSchema:S,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:T,InitializeRequestParamsSchema:C,InitializeRequestSchema:O,ServerCapabilitiesSchema:L,InitializeResultSchema:H,InitializedNotificationSchema:G,PingRequestSchema:he,ProgressSchema:qe,ProgressNotificationParamsSchema:Ie,ProgressNotificationSchema:Ye,PaginatedRequestParamsSchema:ye,PaginatedRequestSchema:I,PaginatedResultSchema:A,ResourceContentsSchema:F,TextResourceContentsSchema:w,BlobResourceContentsSchema:N,RoleSchema:B,AnnotationsSchema:te,ResourceSchema:fe,ResourceTemplateSchema:se,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:mt,ListResourceTemplatesRequestSchema:E,ListResourceTemplatesResultSchema:M,ResourceRequestParamsSchema:D,ReadResourceRequestParamsSchema:oe,ReadResourceRequestSchema:ne,ReadResourceResultSchema:pe,ResourceListChangedNotificationSchema:Ge,SubscribeRequestParamsSchema:et,SubscribeRequestSchema:ct,UnsubscribeRequestParamsSchema:Xe,UnsubscribeRequestSchema:Ue,ResourceUpdatedNotificationParamsSchema:Et,ResourceUpdatedNotificationSchema:rt,PromptArgumentSchema:Xt,PromptSchema:Nt,ListPromptsRequestSchema:Qt,ListPromptsResultSchema:mr,GetPromptRequestParamsSchema:fr,GetPromptRequestSchema:Ur,TextContentSchema:Fr,ImageContentSchema:Vr,AudioContentSchema:Jr,ToolUseContentSchema:fn,EmbeddedResourceSchema:hr,ResourceLinkSchema:hn,ContentBlockSchema:kt,PromptMessageSchema:fo,GetPromptResultSchema:ho,PromptListChangedNotificationSchema:Hr,ToolAnnotationsSchema:gn,ToolExecutionSchema:go,ToolSchema:Br,ListToolsRequestSchema:_o,ListToolsResultSchema:vo,CallToolResultSchema:yo,CallToolRequestParamsSchema:ut,CallToolRequestSchema:_n,ToolListChangedNotificationSchema:si,LoggingLevelSchema:So,SetLevelRequestParamsSchema:vn,SetLevelRequestSchema:yn,LoggingMessageNotificationParamsSchema:Sn,LoggingMessageNotificationSchema:bn,ModelHintSchema:zn,ModelPreferencesSchema:$n,ToolChoiceSchema:wn,ToolResultContentSchema:ii,SamplingContentSchema:Rn,SamplingMessageContentBlockSchema:gr,SamplingMessageSchema:Pn,CreateMessageRequestParamsSchema:En,CreateMessageRequestSchema:kn,CreateMessageResultSchema:xn,CreateMessageResultWithToolsSchema:Tn,BooleanSchemaSchema:In,StringSchemaSchema:On,NumberSchemaSchema:Cn,UntitledSingleSelectEnumSchemaSchema:Nn,TitledSingleSelectEnumSchemaSchema:jn,LegacyTitledEnumSchemaSchema:An,SingleSelectEnumSchemaSchema:Mn,UntitledMultiSelectEnumSchemaSchema:Kr,TitledMultiSelectEnumSchemaSchema:Gr,MultiSelectEnumSchemaSchema:ai,EnumSchemaSchema:ci,PrimitiveSchemaDefinitionSchema:bt,ElicitRequestFormParamsSchema:zt,ElicitRequestURLParamsSchema:qn,ElicitRequestParamsSchema:jt,ElicitRequestSchema:ui,ElicitationCompleteNotificationParamsSchema:li,ElicitationCompleteNotificationSchema:di,ElicitResultSchema:pi,ResourceTemplateReferenceSchema:mi,PromptReferenceSchema:fi,CompleteRequestParamsSchema:hi,CompleteRequestSchema:Zn,CompleteResultSchema:gi,RootSchema:_i,ListRootsRequestSchema:bo,ListRootsResultSchema:Ln,RootsListChangedNotificationSchema:vi,TaskCreationParamsSchema:yi,TaskStatusSchema:Si,TaskSchema:_r,CreateTaskResultSchema:gt,TaskStatusNotificationParamsSchema:bi,TaskStatusNotificationSchema:Wr,GetTaskRequestSchema:zo,GetTaskResultSchema:$o,GetTaskPayloadRequestSchema:wo,GetTaskPayloadResultSchema:Gu,ListTasksRequestSchema:_t,ListTasksResultSchema:We,CancelTaskRequestSchema:Yr,CancelTaskResultSchema:p.merge(_r),ClientRequestSchema:le([he,O,Zn,yn,Ur,Qt,Oe,E,ne,ct,Ue,_n,_o,zo,wo,_t,Yr]),ClientNotificationSchema:le([m,Ye,G,vi,Wr]),ClientResultSchema:le([f,xn,Tn,pi,Ln,$o,We,gt]),ServerRequestSchema:le([he,kn,ui,bo,zo,wo,_t,Yr]),ServerNotificationSchema:le([m,Ye,bn,rt,Ge,si,Hr,Wr,di]),ServerResultSchema:le([f,H,gi,ho,mr,mt,M,pe,yo,vo,$o,We,gt]),CallToolResultWireSchema:ge().superRefine((lt,S0)=>{if(!(typeof lt!="object"||lt===null||Array.isArray(lt)||lt.content!==void 0)){for(let Mm of Jz)if(Mm in lt){S0.addIssue({code:"custom",message:`content is required when the body carries '${Mm}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(am).pipe(yo)}}var KE;function Hz(){return KE??=BE()}function Bz(e){return e.type!=="object"}var GE=new Set(["const","enum","default","examples"]),WE=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Ez(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function YE(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(Ez(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Dm(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(c=>o(c,!1));if(n===null||typeof n!="object"||!s&&Ez(n.$id))return n;let i={},a=!1;for(let[c,u]of Object.entries(n))s?i[c]=o(u,!1):(c==="$ref"||c==="$dynamicRef")&&typeof u=="string"?i[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:c==="$recursiveRef"&&u==="#"&&r?a=!0:GE.has(c)?i[c]=u:WE.has(c)?i[c]=o(u,!0):i[c]=o(u,!1);return a&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var Kz={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Gz={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},XE={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},yu;function cm(){if(yu)return yu;let e=Hz();return yu={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},yu}function Wz(e){return Object.prototype.hasOwnProperty.call(Kz,e)}function Yz(e){return Object.prototype.hasOwnProperty.call(Gz,e)}function QE(e){return Object.prototype.hasOwnProperty.call(XE,e)}function ek(e){return QE(e)?cm().resultSchemas[e]:void 0}function tk(e){return Wz(e)?cm().requestSchemas[e]:void 0}function rk(e){return Yz(e)?cm().notificationSchemas[e]:void 0}var Uj=Object.keys(Kz),Fj=Object.keys(Gz);function rm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Su(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var kz={ok:!1,reason:"not-in-era"};function xz(e){return rm(e)&&rm(e.outputSchema)&&Bz(e.outputSchema)}var um={era:"2025-11-25",hasRequestMethod:Wz,hasNotificationMethod:Yz,validateRequest:(e,t)=>Su(tk(e),t),validateResult:(e,t)=>Su(ek(e),t),validateNotification:(e,t)=>Su(rk(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>kz,validateInputResponse:()=>kz,samplingResultVariant:(e,t)=>{let r=Hz();return Su(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Vz(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&Bz(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(rm(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>xz(o))?t:{...t,tools:r.map(o=>xz(o)?{...o,outputSchema:YE(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function ok(){let e=Wp(()=>le([P(),X(),_e(),_u(),ie(P(),e),W(e)])),t=ie(P(),e),r=le([P(),X().int()]),o=P(),n=le([P(),X().int()]),s=we(["user","assistant"]),i=we(["debug","info","notice","warning","error","critical","alert","emergency"]),a=P().refine(We=>{try{return atob(We),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=j({ttl:X().optional()}),u=j({taskId:P()}),l=ze({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=j({_meta:l.optional()}),p=d.extend({task:c.optional()}),g=j({_meta:l.optional()}),f=j({method:P(),params:g.loose().optional()}),_=j({src:P(),mimeType:P().optional(),sizes:W(P()).optional(),theme:we(["light","dark"]).optional()}),m=j({icons:W(_).optional()}),h=j({name:P(),title:P().optional()}),z=h.extend({...h.shape,...m.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),v=on(j({applyDefaults:_e().optional()}),t),S=vu(We=>We&&typeof We=="object"&&!Array.isArray(We)&&Object.keys(We).length===0?{form:{}}:We,on(j({form:v.optional(),url:t.optional()}),t.optional())),R=ze({list:t.optional(),cancel:t.optional(),requests:ze({sampling:ze({createMessage:t.optional()}).optional(),elicitation:ze({create:t.optional()}).optional()}).optional()}),b=ze({list:t.optional(),cancel:t.optional(),requests:ze({tools:ze({call:t.optional()}).optional()}).optional()}),y=j({experimental:ie(P(),t).optional(),sampling:j({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:j({listChanged:_e().optional()}).optional(),tasks:R.optional(),extensions:ie(P(),t).optional()}),$=j({experimental:ie(P(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:j({listChanged:_e().optional()}).optional(),resources:j({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:j({listChanged:_e().optional()}).optional(),tasks:b.optional(),extensions:ie(P(),t).optional()}),T=j({progress:X(),total:ve(X()),message:ve(P())}),C=j({...g.shape,...T.shape,progressToken:r}),O=f.extend({method:J("notifications/progress"),params:C}),L=g.extend({level:i,logger:P().optional(),data:ge()}),H=f.extend({method:J("notifications/message"),params:L}),G=j({uri:P(),mimeType:ve(P()),_meta:ie(P(),ge()).optional()}),he=G.extend({text:P()}),qe=G.extend({blob:a}),Ie=j({audience:W(s).optional(),priority:X().min(0).max(1).optional(),lastModified:Mr.datetime({offset:!0}).optional()}),Ye=j({...h.shape,...m.shape,uri:P(),description:ve(P()),mimeType:ve(P()),size:ve(X()),annotations:Ie.optional(),_meta:ve(ze({}))}),ye=j({...h.shape,...m.shape,uriTemplate:P(),description:ve(P()),mimeType:ve(P()),annotations:Ie.optional(),_meta:ve(ze({}))}),I=f.extend({method:J("notifications/resources/list_changed"),params:g.optional()}),A=g.extend({uri:P()}),F=f.extend({method:J("notifications/resources/updated"),params:A}),w=j({name:P(),description:ve(P()),required:ve(_e())}),x=j({...h.shape,...m.shape,description:ve(P()),arguments:ve(W(w)),_meta:ve(ze({}))}),N=f.extend({method:J("notifications/prompts/list_changed"),params:g.optional()}),B=j({type:J("text"),text:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),te=j({type:J("image"),data:a,mimeType:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),fe=j({type:J("audio"),data:a,mimeType:P(),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),se=j({type:J("tool_use"),name:P(),id:P(),input:ie(P(),ge()),_meta:ie(P(),ge()).optional()}),Oe=j({type:J("resource"),resource:le([he,qe]),annotations:Ie.optional(),_meta:ie(P(),ge()).optional()}),mt=Ye.extend({type:J("resource_link")}),E=le([B,te,fe,mt,Oe]),M=j({role:s,content:E}),D=j({title:P().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),oe=f.extend({method:J("notifications/tools/list_changed"),params:g.optional()}),ne=j({name:P().optional()}),pe=j({hints:W(ne).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),Ge=j({mode:we(["auto","required","none"]).optional()}),et=j({type:J("boolean"),title:P().optional(),description:P().optional(),default:_e().optional()}),ct=j({type:J("string"),title:P().optional(),description:P().optional(),minLength:X().optional(),maxLength:X().optional(),format:we(["email","uri","date","date-time"]).optional(),default:P().optional()}),Xe=j({type:we(["number","integer"]),title:P().optional(),description:P().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Ue=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),default:P().optional()}),Et=j({type:J("string"),title:P().optional(),description:P().optional(),oneOf:W(j({const:P(),title:P()})),default:P().optional()}),rt=j({type:J("string"),title:P().optional(),description:P().optional(),enum:W(P()),enumNames:W(P()).optional(),default:P().optional()}),Xt=le([Ue,Et]),Nt=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({type:J("string"),enum:W(P())}),default:W(P()).optional()}),Qt=j({type:J("array"),title:P().optional(),description:P().optional(),minItems:X().optional(),maxItems:X().optional(),items:j({anyOf:W(j({const:P(),title:P()}))}),default:W(P()).optional()}),mr=le([Nt,Qt]),fr=le([rt,Xt,mr]),Ur=le([fr,et,ct,Xe]),Fr=p.extend({mode:J("form").optional(),message:P(),requestedSchema:j({type:J("object"),properties:ie(P(),Ur),required:W(P()).optional()}).catchall(ge())}),Vr=j({type:J("ref/resource"),uri:P()}),Jr=j({type:J("ref/prompt"),name:P()}),fn=j({uri:P().startsWith("file://"),name:P().optional(),_meta:ie(P(),ge()).optional()}),hr=y.shape,hn=j({experimental:hr.experimental,sampling:hr.sampling,elicitation:hr.elicitation,roots:hr.roots,extensions:hr.extensions}),kt=$.shape,fo=j({experimental:kt.experimental,logging:kt.logging,completions:kt.completions,prompts:kt.prompts,resources:kt.resources,tools:kt.tools,extensions:kt.extensions}),ho=ze({progressToken:r.optional(),[Tt]:P(),[ro]:z.optional(),[Kt]:hn,[Rr]:i.optional()}),Hr=j({...h.shape,...m.shape,description:P().optional(),inputSchema:ze({$schema:P().optional(),type:J("object")}),outputSchema:ze({$schema:P().optional()}).optional(),annotations:D.optional(),_meta:ie(P(),ge()).optional()}),gn=j({type:J("tool_result"),toolUseId:P(),content:W(E),structuredContent:ge().optional(),isError:_e().optional(),_meta:ie(P(),ge()).optional()}),go=le([B,te,fe,se,gn]),Br=j({role:s,content:le([go,W(go)]),_meta:ie(P(),ge()).optional()}),_o=P(),vo=ze({[Lt]:z.optional().catch(void 0)}),yo=vo.optional();function ut(We){return ze({_meta:yo,resultType:_o.default("complete"),...We})}let _n=ut({}),si=ut({nextCursor:o.optional()}),So=ut({content:W(E),structuredContent:ge().optional(),isError:_e().optional()}),vn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),tools:W(Hr),nextCursor:o.optional()}),yn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),prompts:W(x),nextCursor:o.optional()}),Sn=ut({description:P().optional(),messages:W(M)}),bn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resources:W(Ye),nextCursor:o.optional()}),zn=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resourceTemplates:W(ye),nextCursor:o.optional()}),$n=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),contents:W(le([he,qe]))}),wn=ut({completion:j({values:W(P()).max(100),total:X().int().optional(),hasMore:_e().optional()}).loose()}),ii=ut({ttlMs:X().int().min(0),cacheScope:we(["public","private"])}),Rn=ut({ttlMs:X().int().min(0).catch(0),cacheScope:we(["public","private"]).catch("private"),supportedVersions:W(P()),capabilities:fo,instructions:P().optional()}),gr=j({messages:W(Br),modelPreferences:pe.optional(),systemPrompt:P().optional(),includeContext:we(["none","thisServer","allServers"]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:W(P()).optional(),metadata:t.optional(),tools:W(Hr).optional(),toolChoice:Ge.optional()}),Pn=j({method:J("sampling/createMessage"),params:gr}),En=j({method:J("roots/list"),params:j({_meta:ie(P(),ge()).optional()}).optional()}),kn=j({...Br.shape,model:P(),stopReason:P().optional()}),xn=j({roots:W(fn)}),Tn=j({action:we(["accept","decline","cancel"]),content:ie(P(),le([P(),X(),_e(),W(P())])).optional()}),In=j({mode:J("url"),message:P(),url:P().url()}),On=le([Fr,In]),Cn=j({method:J("elicitation/create"),params:On}),Nn=le([Pn,En,Cn]),jn=le([kn,xn,Tn]),An=ie(P(),Nn),Mn=ie(P(),jn),Kr=ut({inputRequests:An.optional(),requestState:P().optional()}),Gr={inputResponses:Mn.optional(),requestState:P().optional()},ai=j({_meta:ho,...Gr}),ci=ze({progressToken:r.optional()});function bt(We,Yr){return j({method:J(We),params:j({_meta:ho,...Yr})})}function zt(We,Yr){return j({method:J(We),params:j({_meta:ci.optional(),...Yr}).optional()})}let qn={name:P(),arguments:ie(P(),ge()).optional(),...Gr},jt={cursor:o.optional()},ui=bt("tools/call",qn),li=bt("tools/list",jt),di=bt("prompts/list",jt),pi=bt("prompts/get",{name:P(),arguments:ie(P(),P()).optional(),...Gr}),mi=bt("resources/list",jt),fi=bt("resources/templates/list",jt),hi=bt("resources/read",{uri:P(),...Gr}),Zn={ref:le([Jr,Vr]),argument:j({name:P(),value:P()}),context:j({arguments:ie(P(),P()).optional()}).optional()},gi=bt("completion/complete",Zn),_i=bt("server/discover",{}),bo=j({toolsListChanged:_e().optional(),promptsListChanged:_e().optional(),resourcesListChanged:_e().optional(),resourceSubscriptions:W(P()).optional()}),Ln={notifications:bo},vi=bt("subscriptions/listen",Ln),yi=vo.extend({"io.modelcontextprotocol/subscriptionId":n}),Si=ze({_meta:yi,resultType:_o.default("complete")}),_r={"tools/call":zt("tools/call",qn),"tools/list":zt("tools/list",jt),"prompts/get":zt("prompts/get",{name:P(),arguments:ie(P(),P()).optional()}),"prompts/list":zt("prompts/list",jt),"resources/list":zt("resources/list",jt),"resources/templates/list":zt("resources/templates/list",jt),"resources/read":zt("resources/read",{uri:P()}),"completion/complete":zt("completion/complete",Zn),"server/discover":zt("server/discover",{}),"subscriptions/listen":zt("subscriptions/listen",Ln)};function gt(We){return ze({_meta:yo,...We})}let bi={"tools/call":gt({content:W(E),structuredContent:ge().optional(),isError:_e().optional()}),"tools/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),tools:W(Hr),nextCursor:o.optional()}),"prompts/get":gt({description:P().optional(),messages:W(M)}),"prompts/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),prompts:W(x),nextCursor:o.optional()}),"resources/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resources:W(Ye),nextCursor:o.optional()}),"resources/templates/list":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),resourceTemplates:W(ye),nextCursor:o.optional()}),"resources/read":gt({ttlMs:X().int().min(0),cacheScope:we(["public","private"]),contents:W(le([he,qe]))}),"completion/complete":gt({completion:j({values:W(P()).max(100),total:X().int().optional(),hasMore:_e().optional()}).loose()}),"server/discover":gt({ttlMs:X().int().min(0).catch(0),cacheScope:we(["public","private"]).catch("private"),supportedVersions:W(P()),capabilities:fo,instructions:P().optional()}),"subscriptions/listen":gt({})},Wr=ze({"io.modelcontextprotocol/subscriptionId":n.optional()}),zo=j({method:J("notifications/subscriptions/acknowledged"),params:j({_meta:Wr.optional(),notifications:bo})}),$o=j({_meta:Wr.optional(),requestId:n,reason:P().optional()}),wo=j({method:J("notifications/cancelled"),params:$o}),Gu={"notifications/cancelled":wo,"notifications/progress":O,"notifications/message":H,"notifications/resources/updated":F,"notifications/resources/list_changed":I,"notifications/tools/list_changed":oe,"notifications/prompts/list_changed":N,"notifications/subscriptions/acknowledged":zo},_t=We=>j({jsonrpc:J("2.0"),id:le([P(),X().int()]),result:We}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:g,NotificationSchema:f,IconSchema:_,IconsSchema:m,BaseMetadataSchema:h,ImplementationSchema:z,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:$,ProgressSchema:T,ProgressNotificationParamsSchema:C,ProgressNotificationSchema:O,LoggingMessageNotificationParamsSchema:L,LoggingMessageNotificationSchema:H,ResourceContentsSchema:G,TextResourceContentsSchema:he,BlobResourceContentsSchema:qe,AnnotationsSchema:Ie,ResourceSchema:Ye,ResourceTemplateSchema:ye,ResourceListChangedNotificationSchema:I,ResourceUpdatedNotificationParamsSchema:A,ResourceUpdatedNotificationSchema:F,PromptArgumentSchema:w,PromptSchema:x,PromptListChangedNotificationSchema:N,TextContentSchema:B,ImageContentSchema:te,AudioContentSchema:fe,ToolUseContentSchema:se,EmbeddedResourceSchema:Oe,ResourceLinkSchema:mt,ContentBlockSchema:E,PromptMessageSchema:M,ToolAnnotationsSchema:D,ToolListChangedNotificationSchema:oe,ModelHintSchema:ne,ModelPreferencesSchema:pe,ToolChoiceSchema:Ge,BooleanSchemaSchema:et,StringSchemaSchema:ct,NumberSchemaSchema:Xe,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:Et,LegacyTitledEnumSchemaSchema:rt,SingleSelectEnumSchemaSchema:Xt,UntitledMultiSelectEnumSchemaSchema:Nt,TitledMultiSelectEnumSchemaSchema:Qt,MultiSelectEnumSchemaSchema:mr,EnumSchemaSchema:fr,PrimitiveSchemaDefinitionSchema:Ur,ElicitRequestFormParamsSchema:Fr,ResourceTemplateReferenceSchema:Vr,PromptReferenceSchema:Jr,RootSchema:fn,ClientCapabilities2026Schema:hn,ServerCapabilities2026Schema:fo,RequestMetaEnvelopeSchema:ho,ToolSchema:Hr,ToolResultContentSchema:gn,SamplingMessageContentBlockSchema:go,SamplingMessageSchema:Br,ResultTypeSchema:_o,ResultMetaSchema:vo,ResultSchema:_n,PaginatedResultSchema:si,CallToolResultSchema:So,ListToolsResultSchema:vn,ListPromptsResultSchema:yn,GetPromptResultSchema:Sn,ListResourcesResultSchema:bn,ListResourceTemplatesResultSchema:zn,ReadResourceResultSchema:$n,CompleteResultSchema:wn,CacheableResultSchema:ii,DiscoverResultSchema:Rn,CreateMessageRequestParamsSchema:gr,CreateMessageRequestSchema:Pn,ListRootsRequestSchema:En,CreateMessageResultSchema:kn,ListRootsResultSchema:xn,ElicitResultSchema:Tn,ElicitRequestURLParamsSchema:In,ElicitRequestParamsSchema:On,ElicitRequestSchema:Cn,InputRequestSchema:Nn,InputResponseSchema:jn,InputRequestsSchema:An,InputResponsesSchema:Mn,InputRequiredResultSchema:Kr,InputResponseRequestParamsSchema:ai,CallToolRequestSchema:ui,ListToolsRequestSchema:li,ListPromptsRequestSchema:di,GetPromptRequestSchema:pi,ListResourcesRequestSchema:mi,ListResourceTemplatesRequestSchema:fi,ReadResourceRequestSchema:hi,CompleteRequestSchema:gi,DiscoverRequestSchema:_i,SubscriptionFilterSchema:bo,SubscriptionsListenRequestSchema:vi,SubscriptionsListenResultMetaSchema:yi,SubscriptionsListenResultSchema:Si,dispatchRequestSchemas:_r,dispatchResultSchemas:bi,NotificationMetaSchema:Wr,SubscriptionsAcknowledgedNotificationSchema:zo,CancelledNotificationParamsSchema:$o,CancelledNotificationSchema:wo,notificationSchemas2026:Gu,JSONRPCResultResponseSchema:_t(_n),CallToolResultResponseSchema:_t(le([So,Kr])),ListToolsResultResponseSchema:_t(vn),ListPromptsResultResponseSchema:_t(yn),GetPromptResultResponseSchema:_t(le([Sn,Kr])),ListResourcesResultResponseSchema:_t(bn),ListResourceTemplatesResultResponseSchema:_t(zn),ReadResourceResultResponseSchema:_t(le([$n,Kr])),CompleteResultResponseSchema:_t(wn),DiscoverResultResponseSchema:_t(Rn)}}var nk;function uo(){return nk??=ok()}var sk=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function ik(e){return sk.includes(e)}var sn=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ru(e,t){if(t===void 0)return e;let r=e[sn];if(r===void 0)return{...e,[sn]:t};let o={},n=r.ttlMs??t.ttlMs;n!==void 0&&(o.ttlMs=n);let s=r.cacheScope??t.cacheScope;return s!==void 0&&(o.cacheScope=s),{...e,[sn]:o}}function ak(e){return e[sn]}function lm(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function dm(e){return e==="public"||e==="private"}function pm(e,t){if(e.ttlMs!==void 0&&!lm(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!dm(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var V=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),Q=class Xz extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return cn(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cn(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",sm(this,new.target)}static fromError(t,r,o){if(t===V.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Qz(n.elicitations,r)}if(t===V.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new po({supported:n.supported,requested:n.requested},r)}if(t===V.InvalidParams||t===V.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===V.ResourceNotFound||Object.keys(n).length===1))return new Pu(n.uri,r)}if(t===V.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new Xs({requiredCapabilities:n.requiredCapabilities},r)}return new Xz(t,r,o)}},Pu=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(V.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Qz=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(V.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},po=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(V.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Xs=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(V.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ck=0,uk="private",lk=["tools/call","prompts/get","resources/read"];function dk(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||lk.includes(e))return t;throw new Q(V.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function pk(e,t){let r=ak(t);if(t.resultType!=="complete"||!ik(e))return r===void 0?t:_k(t);let o=t,n=lm(o.ttlMs)?o.ttlMs:hk(r),s=dm(o.cacheScope)?o.cacheScope:gk(r),i={...o,ttlMs:n,cacheScope:s};return delete i[sn],i}function mk(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function fk(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Lt]:t}}:!mk(r)||r[Lt]!==void 0?e:{...e,_meta:{...r,[Lt]:t}}}function hk(e){return e!==void 0&&lm(e.ttlMs)?e.ttlMs:ck}function gk(e){return e!==void 0&&dm(e.cacheScope)?e.cacheScope:uk}function _k(e){let t={...e};return delete t[sn],t}var vk=["elicitation/create","sampling/createMessage","roots/list"],bu;function e$(){if(bu)return bu;let e=uo();return bu={request:{"elicitation/create":j({method:J("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":j({method:J("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":j({method:J("roots/list"),params:ze({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},bu}function t$(e){return vk.includes(e)}function Yp(e){return t$(e)?e$().request[e]:void 0}function yk(e){return t$(e)?e$().response[e]:void 0}var mm={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},r$={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function o$(e){return Object.prototype.hasOwnProperty.call(mm,e)}function n$(e){return Object.prototype.hasOwnProperty.call(r$,e)}function Sk(e){return Object.prototype.hasOwnProperty.call(mm,e)}function bk(e){return o$(e)?uo().dispatchRequestSchemas[e]:void 0}function zk(e){return Sk(e)?uo().dispatchResultSchemas[e]:void 0}function $k(e){return n$(e)?uo().notificationSchemas2026[e]:void 0}var Vj=Object.keys(mm),Jj=Object.keys(r$);function Ks(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Hs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var wk={ok:!1,reason:"not-in-era"},Rk=[Tt,Kt];function Pk(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(a=>Ks(a)&&"execution"in a)&&(n().tools=s.map(a=>{if(!Ks(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c}));let i=t.capabilities;if(Ks(i)&&"tasks"in i){let a={...i};delete a.tasks,n().capabilities=a}return r}var fm={era:"2026-07-28",hasRequestMethod:o$,hasNotificationMethod:n$,hasInputRequestMethod:e=>Yp(e)!==void 0,validateRequest:(e,t)=>Hs(bk(e),t),validateResult:(e,t)=>Hs(zk(e),t),validateNotification:(e,t)=>Hs($k(e),t),validateInputRequest:(e,t)=>Hs(Yp(e),t),validateInputResponse:(e,t)=>Hs(yk(e),t),samplingResultVariant:()=>wk,outboundEnvelope(e){return{[Tt]:e.protocolVersion,[ro]:e.clientInfo,[Kt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Rr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of Rk)o in e||t.push({key:o,problem:"missing"});let r=uo().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>Vz(e),inputRequestSchema:Yp,decodeResult(e,t){if(!Ks(t))return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=Ks(i)?i:{},c=t.requestState;return Object.keys(a).length===0&&typeof c!="string"?{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,...typeof c=="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new ue(me.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Ek(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return fk(pk(e,dk(e,Pk(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=uo().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},zu;function Ek(){if(zu)return zu;let e=uo();return zu={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},zu}var Qs="2026-07-28";function qr(e){return e!==void 0&&dr(e)?fm:um}function Tz(e){return e.revision!==void 0?qr(e.revision).era:e.era==="modern"?fm.era:um.era}function Xp(e){return s$.some(t=>t.hasRequestMethod(e))}function Qp(e){return s$.some(t=>t.hasNotificationMethod(e))}var s$=[um,fm];function Iz(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ut(e){if(!Iz(e))return;let t=e._meta;return Iz(t)?t:void 0}function mo(e){let t=Ut(e);return t!==void 0&&Tt in t}function ln(e){let t=Ut(e)?.[Tt];return typeof t=="string"?t:void 0}function lo(e){return qr(Qs).validateEnvelopeMeta(e)}var kk=Zm({AnnotationsSchema:()=>ar,AudioContentSchema:()=>Ho,BaseMetadataSchema:()=>ir,BaseRequestParamsSchema:()=>nt,BlobResourceContentsSchema:()=>vs,BooleanSchemaSchema:()=>$s,CallToolRequestParamsSchema:()=>uc,CallToolRequestSchema:()=>lc,CallToolResultSchema:()=>zs,CancelTaskRequestSchema:()=>$d,CancelTaskResultSchema:()=>wd,CancelledNotificationParamsSchema:()=>ma,CancelledNotificationSchema:()=>ds,ClientCapabilitiesSchema:()=>_a,ClientNotificationSchema:()=>Pd,ClientRequestSchema:()=>Rd,ClientResultSchema:()=>Ed,ClientTasksCapabilitySchema:()=>ha,CompatibilityCallToolResultSchema:()=>pd,CompleteRequestParamsSchema:()=>Mc,CompleteRequestSchema:()=>qc,CompleteResultSchema:()=>Zc,ContentBlockSchema:()=>Bo,CreateMessageRequestParamsSchema:()=>zc,CreateMessageRequestSchema:()=>$c,CreateMessageResultSchema:()=>wc,CreateMessageResultWithToolsSchema:()=>Rc,CreateTaskResultSchema:()=>hd,CursorSchema:()=>ss,DiscoverRequestSchema:()=>ba,DiscoverResultSchema:()=>za,ElicitRequestFormParamsSchema:()=>Wo,ElicitRequestParamsSchema:()=>Tc,ElicitRequestSchema:()=>Ic,ElicitRequestURLParamsSchema:()=>xc,ElicitResultSchema:()=>Nc,ElicitationCompleteNotificationParamsSchema:()=>Oc,ElicitationCompleteNotificationSchema:()=>Cc,EmbeddedResourceSchema:()=>ec,EmptyResultSchema:()=>ls,EnumSchemaSchema:()=>kc,GetPromptRequestParamsSchema:()=>Ya,GetPromptRequestSchema:()=>Xa,GetPromptResultSchema:()=>oc,GetTaskPayloadRequestSchema:()=>yd,GetTaskPayloadResultSchema:()=>Sd,GetTaskRequestSchema:()=>_d,GetTaskResultSchema:()=>vd,IconSchema:()=>fa,IconsSchema:()=>Er,ImageContentSchema:()=>Jo,ImplementationSchema:()=>Uo,InitializeRequestParamsSchema:()=>va,InitializeRequestSchema:()=>ps,InitializeResultSchema:()=>ya,InitializedNotificationSchema:()=>Sa,JSONArraySchema:()=>ud,JSONObjectSchema:()=>He,JSONRPCErrorResponseSchema:()=>Do,JSONRPCMessageSchema:()=>so,JSONRPCNotificationSchema:()=>us,JSONRPCRequestSchema:()=>cs,JSONRPCResponseSchema:()=>ld,JSONRPCResultResponseSchema:()=>Lo,JSONValueSchema:()=>$r,LegacyTitledEnumSchemaSchema:()=>Ps,ListChangedOptionsBaseSchema:()=>md,ListPromptsRequestSchema:()=>Ga,ListPromptsResultSchema:()=>Wa,ListResourceTemplatesRequestSchema:()=>xa,ListResourceTemplatesResultSchema:()=>Ta,ListResourcesRequestSchema:()=>Ea,ListResourcesResultSchema:()=>ka,ListRootsRequestSchema:()=>Dc,ListRootsResultSchema:()=>Uc,ListTasksRequestSchema:()=>bd,ListTasksResultSchema:()=>zd,ListToolsRequestSchema:()=>ac,ListToolsResultSchema:()=>cc,LoggingLevelSchema:()=>Ir,LoggingMessageNotificationParamsSchema:()=>fc,LoggingMessageNotificationSchema:()=>hc,ModelHintSchema:()=>gc,ModelPreferencesSchema:()=>_c,MultiSelectEnumSchemaSchema:()=>Ec,NotificationSchema:()=>pt,NotificationsParamsSchema:()=>dt,NumberSchemaSchema:()=>Go,PaginatedRequestParamsSchema:()=>Ra,PaginatedRequestSchema:()=>kr,PaginatedResultSchema:()=>xr,PingRequestSchema:()=>fs,PrimitiveSchemaDefinitionSchema:()=>xs,ProgressNotificationParamsSchema:()=>wa,ProgressNotificationSchema:()=>hs,ProgressSchema:()=>$a,ProgressTokenSchema:()=>ns,PromptArgumentSchema:()=>Ba,PromptListChangedNotificationSchema:()=>nc,PromptMessageSchema:()=>rc,PromptReferenceSchema:()=>Ac,PromptSchema:()=>Ka,ReadResourceRequestParamsSchema:()=>Ia,ReadResourceRequestSchema:()=>Oa,ReadResourceResultSchema:()=>Ca,RelatedTaskMetadataSchema:()=>pa,RequestIdSchema:()=>Pr,RequestMetaSchema:()=>is,RequestSchema:()=>Be,ResourceContentsSchema:()=>gs,ResourceLinkSchema:()=>tc,ResourceListChangedNotificationSchema:()=>Na,ResourceRequestParamsSchema:()=>Fo,ResourceSchema:()=>ys,ResourceTemplateReferenceSchema:()=>jc,ResourceTemplateSchema:()=>Pa,ResourceUpdatedNotificationParamsSchema:()=>Ja,ResourceUpdatedNotificationSchema:()=>Ha,ResultMetaObjectSchema:()=>as,ResultSchema:()=>Ke,RoleSchema:()=>Tr,RootSchema:()=>Lc,RootsListChangedNotificationSchema:()=>Fc,SamplingContentSchema:()=>Sc,SamplingMessageContentBlockSchema:()=>eo,SamplingMessageSchema:()=>bc,ServerCapabilitiesSchema:()=>ms,ServerNotificationSchema:()=>xd,ServerRequestSchema:()=>kd,ServerResultSchema:()=>Td,ServerTasksCapabilitySchema:()=>ga,SetLevelRequestParamsSchema:()=>pc,SetLevelRequestSchema:()=>mc,SingleSelectEnumSchemaSchema:()=>Pc,StringSchemaSchema:()=>Ko,SubscribeRequestParamsSchema:()=>ja,SubscribeRequestSchema:()=>Aa,SubscriptionFilterSchema:()=>Ss,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Da,SubscriptionsAcknowledgedNotificationSchema:()=>Ua,SubscriptionsListenRequestParamsSchema:()=>Za,SubscriptionsListenRequestSchema:()=>La,SubscriptionsListenResultMetaSchema:()=>Fa,SubscriptionsListenResultSchema:()=>Va,TaskAugmentedRequestParamsSchema:()=>no,TaskCreationParamsSchema:()=>fd,TaskMetadataSchema:()=>da,TaskSchema:()=>Or,TaskStatusNotificationParamsSchema:()=>Jc,TaskStatusNotificationSchema:()=>gd,TaskStatusSchema:()=>Vc,TextContentSchema:()=>Vo,TextResourceContentsSchema:()=>_s,TitledMultiSelectEnumSchemaSchema:()=>ks,TitledSingleSelectEnumSchemaSchema:()=>Rs,ToolAnnotationsSchema:()=>sc,ToolChoiceSchema:()=>vc,ToolExecutionSchema:()=>ic,ToolListChangedNotificationSchema:()=>dc,ToolResultContentSchema:()=>yc,ToolSchema:()=>bs,ToolUseContentSchema:()=>Qa,UnsubscribeRequestParamsSchema:()=>Ma,UnsubscribeRequestSchema:()=>qa,UntitledMultiSelectEnumSchemaSchema:()=>Es,UntitledSingleSelectEnumSchemaSchema:()=>ws});var tt=e=>cs.safeParse(e).success,Yt=e=>us.safeParse(e).success,Ft=e=>Lo.safeParse(e).success,Vt=e=>Do.safeParse(e).success;var pr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var hm=e=>ps.safeParse(e).success;function gm(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function _m(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var xk="Mcp-Param-",Oz="x-mcp-header",Tk=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ik=new Set(["string","integer","boolean","number"]);function Eu(e){let t=[],r=new Map,o=(s,i,a)=>{if(s===null||typeof s!="object")return;let c=s;if(Oz in c){if(!a||i.length===0)return`${nn(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let l=c[Oz];if(typeof l!="string"||l.length===0)return`${nn(i)}: x-mcp-header MUST be a non-empty string`;if(!Tk.test(l))return`${nn(i)}: x-mcp-header '${l}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!Ik.has(d))return`${nn(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;let p=l.toLowerCase(),g=r.get(p);if(g!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${g}')`;r.set(p,l),t.push({path:i,headerName:l,type:d})}let u=c.properties;if(u!==null&&typeof u=="object")for(let[l,d]of Object.entries(u)){let p=o(d,[...i,l],a);if(p!==void 0)return p}for(let l of Ok){let d=c[l];if(d===void 0)continue;let p=Array.isArray(d)?d:d!==null&&typeof d=="object"&&Ck.has(l)?Object.values(d):[d];for(let g of p){let f=o(g,[...i,`<${l}>`],!1);if(f!==void 0)return f}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var Ok=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Ck=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function nn(e){return e.length===0?"<root>":e.join(".")}var Nk="=?base64?",jk="?=",Ak=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Mk=/^-?\d+(\.\d+)?$/;function qk(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function Zk(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.codePointAt(o);return new TextDecoder("utf-8",{fatal:!0}).decode(r)}function i$(e){if(!(e.startsWith(Nk)&&e.endsWith(jk)))return e;let t=e.slice(9,e.length-2);if(Ak.test(t))try{return Zk(t)}catch{return}}function Lk(e,t){let r=e;for(let o of t){if(r===null||typeof r!="object")return;r=r[o]}return r}function a$(e,t,r){for(let o of e){let n=`${xk}${o.headerName}`,s=r.get(n),i=Lk(t,o.path);if(i==null)continue;let a=qk(i);if(a===void 0)continue;if(s===null)return em("param-header-missing",n,`the body carries ${nn(o.path)}=${JSON.stringify(i)} but the ${n} header is absent`);let c=i$(s);if(c===void 0)return em("param-header-invalid-encoding",n,`the ${n} header carries an invalid Base64 sentinel value`);if(!((o.type==="integer"||o.type==="number")&&Mk.test(c)&&typeof i=="number"?Number(c)===i:c===a))return em("param-header-mismatch",n,`the ${n} header decodes to ${JSON.stringify(c)} but the body carries ${nn(o.path)}=${JSON.stringify(i)}`)}}function em(e,t,r){return{kind:"reject",rung:"param-header-validation",cell:e,httpStatus:400,code:an,message:`Bad Request: the request headers and body disagree: ${r}`,data:{mismatch:{header:t,body:r}},settled:!0}}var an=-32020,Hj=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[V.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[an,V.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[V.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[V.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[V.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[an],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[V.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[an],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],vm={[V.ParseError]:400,[V.InvalidRequest]:400,[V.MethodNotFound]:404,[V.UnsupportedProtocolVersion]:400,[V.MissingRequiredClientCapability]:400,[an]:400};function c$(e,t){return t==="in-band"?e===V.MissingRequiredClientCapability?400:200:vm[e]??400}function Ot(e,t,r,o,n){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:o.code,message:o.message,...o.data!==void 0&&{data:o.data},settled:n}}function Wt(e,t,r,o="era-classification"){return Ot(o,e,400,new Q(an,`Bad Request: the request headers and body disagree: ${r}`,{mismatch:{header:t,body:r}}),!0)}var Cz={"tools/call":"name","prompts/get":"name","resources/read":"uri"};function $u(e){let t=0;for(;t<e.length;){let o=e.codePointAt(t);if(o!==9&&o!==32)break;t+=1}let r=e.length;for(;r>t;){let o=e.codePointAt(r-1);if(o!==9&&o!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}function u$(e,t){if(t.messageKind!=="request")return;let r=t.message.method;if(e.mcpMethodHeader===void 0)return Wt("method-header-missing","(missing)",`the body names method ${r} but the required Mcp-Method header is absent`,"standard-header-validation");let o=Object.hasOwn(Cz,r)?Cz[r]:void 0;if(o===void 0)return;let n=t.message.params?.[o],s=typeof n=="string"?n:void 0;if(e.mcpNameHeader===void 0)return s===void 0?void 0:Wt("name-header-missing","(missing)",`the body carries params.${o}="${s}" but the required Mcp-Name header is absent`,"standard-header-validation");let i=$u(e.mcpNameHeader),a=i$(i);if(a===void 0)return Wt("name-header-invalid-encoding",i,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation");if(s!==void 0&&a!==s)return Wt("name-header-mismatch",i,`the body carries params.${o}="${s}" but the Mcp-Name header names "${a}"`,"standard-header-validation")}function wu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function l$(e){return e===void 0?{era:"modern"}:{era:dr(e)?"modern":"legacy",revision:e}}function ku(e){if(!mo(e))return!1;let t=ln(e);if(t===void 0||!dr(t))return!1;let r=Ut(e);return r!==void 0&&lo(r).length===0}function Dk(e){if(e.length===0)return Ot("jsonrpc-shape","empty-batch",400,new Q(V.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let t of e){if(mo(wu(t)?t.params:void 0))return Ot("jsonrpc-shape","batch-with-modern-element",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(tt(t)||Yt(t)||Ft(t)||Vt(t)))return Ot("jsonrpc-shape","batch-with-invalid-element",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}function Uk(e,t){let r=t.params,o=t.method,n=e.protocolVersionHeader,s=n!==void 0&&dr(n);if(o==="initialize"&&!ku(r)){if(s)return Wt("initialize-with-modern-header",n,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let i=wu(r)&&typeof r.protocolVersion=="string"?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...i!==void 0&&{requestedVersion:i}}}if(mo(r)){let i=Ut(r),a=(i===void 0?[]:lo(i))[0];if(a!==void 0)return Ot("envelope","envelope-invalid",400,new Q(V.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${a.key}: ${a.problem}`,{envelope:a}),!0);let c=ln(r);return n!==void 0&&c!==void 0&&n!==c?Wt("header-body-version-mismatch",n,`the body envelope names protocol version ${c} but the MCP-Protocol-Version header names ${n}`):e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("method-header-mismatch",e.mcpMethodHeader,`the body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:t,classification:l$(c)}}if(s){let i=Ut(r),a=lo(i??{}).filter(u=>u.problem==="missing").map(u=>u.key),c=i===void 0?["_meta"]:a.length>0?a:[Tt];return Ot("envelope","modern-header-without-claim",400,new Q(V.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${n}, but the request is missing the required per-request envelope key(s): ${c.join(", ")}`,{envelope:{missing:c}}),!0)}return{kind:"legacy",reason:"no-claim",...n!==void 0&&{requestedVersion:n}}}function Fk(e,t){let r=t.params,o=t.method,n=e.protocolVersionHeader,s=n!==void 0&&dr(n);if(mo(r)){let i=ln(r);if(i===void 0){let c=Ut(r),u=(c===void 0?[]:lo(c)).find(l=>l.key===Tt)??{key:Tt,problem:"expected a protocol version string"};return Ot("envelope","notification-envelope-invalid",400,new Q(V.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${u.key}: ${u.problem}`,{envelope:u}),!0)}if(n!==void 0&&n!==i)return Wt("notification-header-body-version-mismatch",n,`the notification envelope names protocol version ${i} but the MCP-Protocol-Version header names ${n}`);let a=l$(i);return a.era==="modern"&&e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:a}}return s?e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==o?Wt("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${o} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:{era:"modern",revision:n}}:{kind:"legacy",reason:"notification",...n!==void 0&&{requestedVersion:n}}}function d$(e){if(e={...e,...e.protocolVersionHeader!==void 0&&{protocolVersionHeader:$u(e.protocolVersionHeader)},...e.mcpMethodHeader!==void 0&&{mcpMethodHeader:$u(e.mcpMethodHeader)},...e.mcpNameHeader!==void 0&&{mcpNameHeader:$u(e.mcpNameHeader)}},e.httpMethod.toUpperCase()!=="POST")return{kind:"legacy",reason:"http-method"};let t=e.body;return Array.isArray(t)?Dk(t):Ft(t)||Vt(t)?{kind:"legacy",reason:"response"}:wu(t)&&tt(t)?Uk(e,t):wu(t)&&Yt(t)?Fk(e,t):Ot("jsonrpc-shape","invalid-json-rpc-body",400,new Q(V.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}function xu(e,t){switch(e.reason){case"http-method":return Ot("http-method","modern-only-method-not-allowed",405,new Q(-32e3,"Method not allowed."),!0);case"batch":return Ot("jsonrpc-shape","modern-only-batch-not-supported",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return Ot("jsonrpc-shape","modern-only-response-post",400,new Q(V.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return Ot("era-classification","modern-only-missing-envelope",400,r===void 0?new Q(V.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new po({supported:[...t],requested:r}),!0)}}}function Tu(e,t){return hu(e,t)}function Bs(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function un(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var Nz=!1,om="draft-2020-12";function Zr(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:om});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");Nz||(Nz=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),o=fu(e,{target:om,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:p$(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function p$(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(o=>o!==null&&typeof o=="object"&&(o.type==="object"||p$(o)))}return!1}function Vk(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function co(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>Vk(o)).join(", ")}:{success:!0,data:r.value}}function Jk(e){let t=fu(e,{target:om,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var Hk=/\\\.\\d\{(\d+)\}/;function Bk(e){let t=Hk.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>Mr.datetime({local:o,offset:n,precision:s}))))}function Kk(e,t){let r;switch(e){case"email":r=[hz()];break;case"uri":r=[_z()];break;case"date":r=[Mr.date()];break;case"date-time":r=Bk(t);break}return new Set(r.map(o=>Jk(o)).filter(o=>o!==void 0))}function Gk(e,t,r){return r!=="zod"?!0:Kk(e,t).has(t)}function m$(e){let t=Zr(e,"input"),r=t.properties||{},o=t.required||[];return Object.entries(r).map(([n,s])=>({name:n,description:s?.description,required:o.includes(n)}))}function Ws(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wk(e){try{return Zr(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new Q(V.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Yk=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ym(e){return Yk.has(e)||e.startsWith("x-")}var Xk=new Set(["$schema",...Object.keys(Wo.shape.requestedSchema.shape)]),jz={string:Bs([Ko,ws,Rs,Ps]),number:Bs([Go]),integer:Bs([Go]),boolean:Bs([$s]),array:Bs([Es,ks])},Qk=new Set(Ko.shape.format.unwrap().options);function ex(e,t,r,o){if(!Ws(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(jz,e.type)?jz[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,a]of Object.entries(e))n.has(i)||ym(i)?s[i]=a:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?Qk.has(e.format)?(typeof a!="string"||!Gk(e.format,a,r))&&o.push(`${t}.${i}`):s[i]=a:o.push(`${t}.${i}`);return s}function tx(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&Ws(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,ex(a,`properties.${i}`,t,o)])):Xk.has(n)?r[n]=s:ym(n)||o.push(n);if(o.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function rx(e,t){if(!Ws(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Tu(xs,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function nm(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>nm(o,t[n],`${r}[${n}]`)):!Ws(e)||!Ws(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?nm(n,t[o],s):ym(o)?[]:[s]})}function ox(e){if(!un(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=tx(Wk(e.requestedSchema),t),o=Tu(Wo.shape.requestedSchema,r);if(!o.success)throw new Q(V.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${rx(r,o.error.message)}`);let n=nm(r,o.data);if(n.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new Q(V.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function nx(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var sx=Object.assign(nx,{elicit(e){try{return{method:"elicitation/create",params:ox(e)}}catch(t){throw t instanceof Q?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var f$=250;function h$(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function g$(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function _$(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}var ix=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],ax={IdJagTokenExchangeResponseSchema:Nd,OAuthClientInformationFullSchema:Ad,OAuthClientInformationSchema:Gc,OAuthClientMetadataSchema:Kc,OAuthClientRegistrationErrorSchema:Md,OAuthErrorResponseSchema:jd,OAuthMetadataSchema:Hc,OAuthProtectedResourceMetadataSchema:Id,OAuthTokenRevocationRequestSchema:qd,OAuthTokensSchema:Cd,OpenIdProviderDiscoveryMetadataSchema:Od,OpenIdProviderMetadataSchema:Bc},v$={},y$={};function S$(e,t){let r=e.slice(0,-6);v$[r]=t,y$[r]=o=>t.safeParse(o).success}for(let e of ix)S$(e,kk[e]);for(let[e,t]of Object.entries(ax))S$(e,t);var cx=Object.freeze(v$),ux=Object.freeze(y$);function lx(e){switch(e){case"initialize":case"notifications/initialized":return qr(void 0);case"server/discover":return qr(Qs);default:return}}var b$=6e4,dx=[Tt,ro,Kt,Rr],px=["inputResponses","requestState"];function Az(e,t){let r=e.params;if(!Gs(r))return{message:e,lifted:{}};let o=r._meta,n=Gs(o)?dx.filter(c=>c in o):[],s=t==="request"?px.filter(c=>c in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(n.length>0&&Gs(o)){let c={},u={...o};for(let l of n)c[l]=o[l],delete u[l];i.envelope=c,Object.keys(u).length>0?a._meta=u:delete a._meta}for(let c of s)c==="inputResponses"&&(i.inputResponses=a[c]),c==="requestState"&&(i.requestState=a[c]),delete a[c];return{message:{...e,params:a},lifted:i}}function Mz(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function ei(e){return()=>e}var mx=ei(void 0);function Sm(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:ei(t)}}}var z$;function Iu(e,t){z$(e,t)}var bm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{z$=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??os,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ue(me.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ue(me.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),Ft(n)||Vt(n)?this._onresponse(n):tt(n)?this._onrequest(n,s):Yt(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new ue(me.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=Az(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=Tz(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Qp(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=Az(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(_,m,h)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:_,message:m,...h!==void 0&&{data:h}}};s?.send(z).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let _=Tz(t.classification);if(_!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${n.era}`));let m=t.classification.revision??_;i(V.UnsupportedProtocolVersion,`Unsupported protocol version: ${m}`,{supported:this._supportedProtocolVersions,requested:m});return}}if(Xp(r.method)&&!n.hasRequestMethod(r.method)){i(V.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(V.MethodNotFound,"Method not found");return}let c=n.checkInboundEnvelope(o);if(c!==void 0){i(V.InvalidParams,c);return}let u=(_,m)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...m,relatedRequestId:r.id}),l=(_,m,h)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,m,{...h,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let p=o.inputResponses===void 0?void 0:fx(o.inputResponses),g={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...p!==void 0&&{inputResponses:p.accepted},...p!==void 0&&p.droppedKeys.length>0&&{droppedInputResponseKeys:p.droppedKeys},requestState:o.requestState===void 0?mx:ei(o.requestState),signal:d.signal,send:(_,m,h)=>{let z=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(z,_.method),un(m))return l(_,m,h);let v=Mz(z,_.method);if(v===void 0)throw new TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(_,v,m)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(g,t);Promise.resolve().then(()=>a(r,f)).then(async _=>{if(d.signal.aborted)return;let m;try{m=n.encodeResult(r.method,_,this._outboundServerInfo())}catch(z){this._onerror(new Error(`Failed to encode result for ${r.method}: ${z}`)),i(V.InternalError,"Internal error");return}let h={result:m,jsonrpc:"2.0",id:r.id};await s?.send(h)},async _=>{if(d.signal.aborted)return;let m=Number.isSafeInteger(_.code)?_.code:V.InternalError,h={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(m),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await s?.send(h)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===d&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ft(e)?r(e):r(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),un(t))return this._requestWithSchemaViaCodec(o,e,t,r);let n=Mz(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return qr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=lx(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Xp(t)&&!e.hasRequestMethod(t))throw new ue(me.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),u,l;return new Promise((d,p)=>{let g=b=>{p(b)};if(!this._transport){g(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(b){g(b);return}if(o?.signal?.aborted){let b=o.signal.reason;throw b instanceof ue?b:new ue(me.RequestTimeout,String(b))}let f=e.era===Qs&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;l=_;let m={...t,jsonrpc:"2.0",id:_};o?.onprogress&&(this._progressHandlers.set(_,o.onprogress),m.params={...t.params,_meta:{...t.params?._meta,progressToken:_}});let h=this._envelopeOutbound(m),z=!1,v=b=>{z||(this._progressHandlers.delete(_),f===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(b)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(y=>this._onerror(new Error(`Failed to send cancellation: ${y}`))):f.abort(),p(b instanceof ue?b:new ue(me.RequestTimeout,String(b))))};this._responseHandlers.set(_,b=>{if(o?.signal?.aborted)return;if(z=!0,b instanceof Error)return p(b);let y;try{y=e.decodeResult(t.method,b.result)}catch(T){return p(T instanceof Error?T:new Error(String(T)))}if(y.kind==="invalid")return p(y.error);if(y.kind==="input_required"){if(o?.allowInputRequired===!0)return d(hx(y));let T={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(C,O)=>this._requestWithSchemaViaCodec(e,C===void 0?{method:t.method}:{method:t.method,params:C},r,O)};return d(this._resolveNonCompleteResult(y,T))}let $=y.result;co(r,$).then(T=>{T.success?d(T.data):p(new ue(me.InvalidResult,`Invalid result for ${t.method}: ${T.error}`))},p)}),u=()=>v(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let S=o?.timeout??b$,R=()=>v(new ue(me.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(_,S,o?.maxTotalTimeout,R,o?.resetTimeoutOnProgress??!1),this._transport.send(h,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:f?.signal}).catch(b=>{this._progressHandlers.delete(_),p(b)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),l!==void 0&&(this._responseHandlers.delete(l),this._cleanupTimeout(l))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new ue(me.NotConnected,"Not connected");if(Qp(t.method)&&!e.hasNotificationMethod(t.method))throw new ue(me.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!Xp(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason==="not-in-era"&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason==="not-in-era"?new Q(V.InternalError,`No wire schema for ${e} in the resolved era`):new Error(a.message);return Promise.resolve(t(a.value,s))}}else if(r)o=async(n,s)=>{let i=await co(t.params,{...n.params});if(!i.success)throw new Q(V.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!Qp(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new Q(V.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await co(t.params,{...o.params});if(!n.success)throw new Q(V.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Gs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function zm(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Gs(i)&&Gs(s)?{...i,...s}:s}return r}function qz(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fx(e){let t={},r=[];if(!qz(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!qz(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function hx(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var gx=U(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw new TypeError("argument string is required");var c=typeof a=="object"?s(a):a;if(typeof c!="string")throw new TypeError("argument string is required to be a string");var u=c.indexOf(";"),l=u!==-1?c.slice(0,u).trim():c.trim();if(!o.test(l))throw new TypeError("invalid media type");var d=new i(l.toLowerCase());if(u!==-1){var p,g,f;for(t.lastIndex=u;g=t.exec(c);){if(g.index!==u)throw new TypeError("invalid parameter format");u+=g[0].length,p=g[1].toLowerCase(),f=g[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf("\\")!==-1&&(f=f.replace(r,"$1"))),d.parameters[p]=f}if(u!==c.length)throw new TypeError("invalid parameter format")}return d}function s(a){var c;if(typeof a.getHeader=="function"?c=a.getHeader("content-type"):typeof a.headers=="object"&&(c=a.headers&&a.headers["content-type"]),typeof c!="string")throw new TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),_x=wi(gx(),1);function $m(e){if(e)try{return _x.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function wm(e){return e==="application/json"?!0:$m(e)==="application/json"}var $$=10*1024*1024,Rm=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??$$}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
121
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return w$(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function w$(e){return so.parse(JSON.parse(e))}function Pm(e){return JSON.stringify(e)+`
122
+ `}var vx=/^[A-Za-z0-9._-]{1,128}$/;function yx(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!vx.test(e)){let r=[...e].filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Sx(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Em(e){let t=yx(e);return Sx(e,t.warnings),t.isValid}function bx(e){return typeof e=="object"&&e!==null&&"_zod"in e}function zx(e){return typeof e=="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName=="string"}function $x(e){if(typeof e!="object"||e===null||un(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(r=>bx(r))}function Ou(e){if(e!==void 0){if($x(e))return j(e);if(typeof e=="object"&&e!==null&&!un(e)&&Object.values(e).some(t=>zx(t)))throw new TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!un(e))throw new TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var Nu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(h){if(super(),!e.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let h=this._items[0];return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.reduce((z,v)=>`${z}${v}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((z,v)=>(v instanceof r&&(z[v.str]=(z[v.str]||0)+1),z),{})}};e._Code=o,e.nil=new o("");function n(h,...z){let v=[h[0]],S=0;for(;S<z.length;)a(v,z[S]),v.push(h[++S]);return new o(v)}e._=n;let s=new o("+");function i(h,...z){let v=[g(h[0])],S=0;for(;S<z.length;)v.push(s),a(v,z[S]),v.push(s,g(h[++S]));return c(v),new o(v)}e.str=i;function a(h,z){z instanceof o?h.push(...z._items):z instanceof r?h.push(z):h.push(d(z))}e.addCodeArg=a;function c(h){let z=1;for(;z<h.length-1;){if(h[z]===s){let v=u(h[z-1],h[z+1]);if(v!==void 0){h.splice(z-1,3,v);continue}h[z++]="+"}z++}}function u(h,z){if(z==='""')return h;if(h==='""')return z;if(typeof h=="string")return z instanceof r||h[h.length-1]!=='"'?void 0:typeof z!="string"?`${h.slice(0,-1)}${z}"`:z[0]==='"'?h.slice(0,-1)+z.slice(1):void 0;if(typeof z=="string"&&z[0]==='"'&&!(h instanceof r))return`"${h}${z.slice(1)}`}function l(h,z){return z.emptyStr()?h:h.emptyStr()?z:i`${h}${z}`}e.strConcat=l;function d(h){return typeof h=="number"||typeof h=="boolean"||h===null?h:g(Array.isArray(h)?h.join(","):h)}function p(h){return new o(g(h))}e.stringify=p;function g(h){return JSON.stringify(h).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=g;function f(h){return typeof h=="string"&&e.IDENTIFIER.test(h)?new o(`.${h}`):n`[${h}]`}e.getProperty=f;function _(h){if(typeof h=="string"&&e.IDENTIFIER.test(h))return new o(`${h}`);throw new Error(`CodeGen: invalid export name: ${h}, use explicit $id name mapping`)}e.getEsmExportName=_;function m(h){return new o(h.toString())}e.regexpCode=m}),R$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Nu();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}},o;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,l;if(!((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0)&&l.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:l}){this.value=c,this.scopePath=(0,t._)`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var a=class extends n{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:t.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var l;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let d=this.toName(c),{prefix:p}=d,g=(l=u.key)!==null&&l!==void 0?l:u.ref,f=this._values[p];if(f){let h=f.get(g);if(h)return h}else f=this._values[p]=new Map;f.set(g,d);let _=this._scope[p]||(this._scope[p]=[]),m=_.length;return _[m]=u.ref,d.setValue(u,{property:p,itemIndex:m}),d}getValue(c,u){let l=this._values[c];if(l)return l.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${c}${l.scopePath}`})}scopeCode(c=this._values,u,l){return this._reduceValues(c,d=>{if(d.value===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return d.value.code},u,l)}_reduceValues(c,u,l={},d){let p=t.nil;for(let g in c){let f=c[g];if(!f)continue;let _=l[g]=l[g]||new Map;f.forEach(m=>{if(_.has(m))return;_.set(m,o.Started);let h=u(m);if(h){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;p=(0,t._)`${p}${z} ${m} = ${h};${this.opts._n}`}else if(h=d?.(m))p=(0,t._)`${p}${h}${this.opts._n}`;else throw new r(m);_.set(m,o.Completed)})}return p}};e.ValueScope=a}),de=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=Nu(),r=R$();var o=Nu();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=R$();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(w,x){return this}},i=class extends s{constructor(w,x,N){super(),this.varKind=w,this.name=x,this.rhs=N}render({es5:w,_n:x}){let N=w?r.varKinds.var:this.varKind,B=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${B};`+x}optimizeNames(w,x){if(w[this.name.str])return this.rhs&&(this.rhs=G(this.rhs,w,x)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(w,x,N){super(),this.lhs=w,this.rhs=x,this.sideEffects=N}render({_n:w}){return`${this.lhs} = ${this.rhs};`+w}optimizeNames(w,x){if(!(this.lhs instanceof t.Name&&!w[this.lhs.str]&&!this.sideEffects))return this.rhs=G(this.rhs,w,x),this}get names(){return H(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(w,x,N,B){super(w,N,B),this.op=x}render({_n:w}){return`${this.lhs} ${this.op}= ${this.rhs};`+w}},u=class extends s{constructor(w){super(),this.label=w,this.names={}}render({_n:w}){return`${this.label}:`+w}},l=class extends s{constructor(w){super(),this.label=w,this.names={}}render({_n:w}){return`break${this.label?` ${this.label}`:""};`+w}},d=class extends s{constructor(w){super(),this.error=w}render({_n:w}){return`throw ${this.error};`+w}get names(){return this.error.names}},p=class extends s{constructor(w){super(),this.code=w}render({_n:w}){return`${this.code};`+w}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(w,x){return this.code=G(this.code,w,x),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},g=class extends s{constructor(w=[]){super(),this.nodes=w}render(w){return this.nodes.reduce((x,N)=>x+N.render(w),"")}optimizeNodes(){let{nodes:w}=this,x=w.length;for(;x--;){let N=w[x].optimizeNodes();Array.isArray(N)?w.splice(x,1,...N):N?w[x]=N:w.splice(x,1)}return w.length>0?this:void 0}optimizeNames(w,x){let{nodes:N}=this,B=N.length;for(;B--;){let te=N[B];te.optimizeNames(w,x)||(he(w,te.names),N.splice(B,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((w,x)=>L(w,x.names),{})}},f=class extends g{render(w){return"{"+w._n+super.render(w)+"}"+w._n}},_=class extends g{},m=class extends f{};m.kind="else";var h=class Cu extends f{constructor(x,N){super(N),this.condition=x}render(x){let N=`if(${this.condition})`+super.render(x);return this.else&&(N+="else "+this.else.render(x)),N}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let N=this.else;if(N){let B=N.optimizeNodes();N=this.else=Array.isArray(B)?new m(B):B}if(N)return x===!1?N instanceof Cu?N:N.nodes:this.nodes.length?this:new Cu(qe(x),N instanceof Cu?[N]:N.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,N){var B;if(this.else=(B=this.else)===null||B===void 0?void 0:B.optimizeNames(x,N),!!(super.optimizeNames(x,N)||this.else))return this.condition=G(this.condition,x,N),this}get names(){let x=super.names;return H(x,this.condition),this.else&&L(x,this.else.names),x}};h.kind="if";var z=class extends f{};z.kind="for";var v=class extends z{constructor(w){super(),this.iteration=w}render(w){return`for(${this.iteration})`+super.render(w)}optimizeNames(w,x){if(super.optimizeNames(w,x))return this.iteration=G(this.iteration,w,x),this}get names(){return L(super.names,this.iteration.names)}},S=class extends z{constructor(w,x,N,B){super(),this.varKind=w,this.name=x,this.from=N,this.to=B}render(w){let x=w.es5?r.varKinds.var:this.varKind,{name:N,from:B,to:te}=this;return`for(${x} ${N}=${B}; ${N}<${te}; ${N}++)`+super.render(w)}get names(){return H(H(super.names,this.from),this.to)}},R=class extends z{constructor(w,x,N,B){super(),this.loop=w,this.varKind=x,this.name=N,this.iterable=B}render(w){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(w)}optimizeNames(w,x){if(super.optimizeNames(w,x))return this.iterable=G(this.iterable,w,x),this}get names(){return L(super.names,this.iterable.names)}},b=class extends f{constructor(w,x,N){super(),this.name=w,this.args=x,this.async=N}render(w){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(w)}};b.kind="func";var y=class extends g{render(w){return"return "+super.render(w)}};y.kind="return";var $=class extends f{render(w){let x="try"+super.render(w);return this.catch&&(x+=this.catch.render(w)),this.finally&&(x+=this.finally.render(w)),x}optimizeNodes(){var w,x;return super.optimizeNodes(),(w=this.catch)===null||w===void 0||w.optimizeNodes(),(x=this.finally)===null||x===void 0||x.optimizeNodes(),this}optimizeNames(w,x){var N,B;return super.optimizeNames(w,x),(N=this.catch)===null||N===void 0||N.optimizeNames(w,x),(B=this.finally)===null||B===void 0||B.optimizeNames(w,x),this}get names(){let w=super.names;return this.catch&&L(w,this.catch.names),this.finally&&L(w,this.finally.names),w}},T=class extends f{constructor(w){super(),this.error=w}render(w){return`catch(${this.error})`+super.render(w)}};T.kind="catch";var C=class extends f{render(w){return"finally"+super.render(w)}};C.kind="finally";var O=class{constructor(w,x={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...x,_n:x.lines?`
123
+ `:""},this._extScope=w,this._scope=new r.Scope({parent:w}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name(w){return this._scope.name(w)}scopeName(w){return this._extScope.name(w)}scopeValue(w,x){let N=this._extScope.value(w,x);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(w,x){return this._extScope.getValue(w,x)}scopeRefs(w){return this._extScope.scopeRefs(w,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(w,x,N,B){let te=this._scope.toName(x);return N!==void 0&&B&&(this._constants[te.str]=N),this._leafNode(new i(w,te,N)),te}const(w,x,N){return this._def(r.varKinds.const,w,x,N)}let(w,x,N){return this._def(r.varKinds.let,w,x,N)}var(w,x,N){return this._def(r.varKinds.var,w,x,N)}assign(w,x,N){return this._leafNode(new a(w,x,N))}add(w,x){return this._leafNode(new c(w,e.operators.ADD,x))}code(w){return typeof w=="function"?w():w!==t.nil&&this._leafNode(new p(w)),this}object(...w){let x=["{"];for(let[N,B]of w)x.length>1&&x.push(","),x.push(N),(N!==B||this.opts.es5)&&(x.push(":"),(0,t.addCodeArg)(x,B));return x.push("}"),new t._Code(x)}if(w,x,N){if(this._blockNode(new h(w)),x&&N)this.code(x).else().code(N).endIf();else if(x)this.code(x).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(w){return this._elseNode(new h(w))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(h,m)}_for(w,x){return this._blockNode(w),x&&this.code(x).endFor(),this}for(w,x){return this._for(new v(w),x)}forRange(w,x,N,B,te=this.opts.es5?r.varKinds.var:r.varKinds.let){let fe=this._scope.toName(w);return this._for(new S(te,fe,x,N),()=>B(fe))}forOf(w,x,N,B=r.varKinds.const){let te=this._scope.toName(w);if(this.opts.es5){let fe=x instanceof t.Name?x:this.var("_arr",x);return this.forRange("_i",0,(0,t._)`${fe}.length`,se=>{this.var(te,(0,t._)`${fe}[${se}]`),N(te)})}return this._for(new R("of",B,te,x),()=>N(te))}forIn(w,x,N,B=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(w,(0,t._)`Object.keys(${x})`,N);let te=this._scope.toName(w);return this._for(new R("in",B,te,x),()=>N(te))}endFor(){return this._endBlockNode(z)}label(w){return this._leafNode(new u(w))}break(w){return this._leafNode(new l(w))}return(w){let x=new y;if(this._blockNode(x),this.code(w),x.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try(w,x,N){if(!x&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');let B=new $;if(this._blockNode(B),this.code(w),x){let te=this.name("e");this._currNode=B.catch=new T(te),x(te)}return N&&(this._currNode=B.finally=new C,this.code(N)),this._endBlockNode(T,C)}throw(w){return this._leafNode(new d(w))}block(w,x){return this._blockStarts.push(this._nodes.length),w&&this.code(w).endBlock(x),this}endBlock(w){let x=this._blockStarts.pop();if(x===void 0)throw new Error("CodeGen: not in self-balancing block");let N=this._nodes.length-x;if(N<0||w!==void 0&&N!==w)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${w} expected`);return this._nodes.length=x,this}func(w,x=t.nil,N,B){return this._blockNode(new b(w,x,N)),B&&this.code(B).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(w=1){for(;w-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(w){return this._currNode.nodes.push(w),this}_blockNode(w){this._currNode.nodes.push(w),this._nodes.push(w)}_endBlockNode(w,x){let N=this._currNode;if(N instanceof w||x&&N instanceof x)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${x?`${w.kind}/${x.kind}`:w.kind}"`)}_elseNode(w){let x=this._currNode;if(!(x instanceof h))throw new Error('CodeGen: "else" without "if"');return this._currNode=x.else=w,this}get _root(){return this._nodes[0]}get _currNode(){let w=this._nodes;return w[w.length-1]}set _currNode(w){let x=this._nodes;x[x.length-1]=w}};e.CodeGen=O;function L(w,x){for(let N in x)w[N]=(w[N]||0)+(x[N]||0);return w}function H(w,x){return x instanceof t._CodeOrName?L(w,x.names):w}function G(w,x,N){if(w instanceof t.Name)return B(w);if(!te(w))return w;return new t._Code(w._items.reduce((fe,se)=>(se instanceof t.Name&&(se=B(se)),se instanceof t._Code?fe.push(...se._items):fe.push(se),fe),[]));function B(fe){let se=N[fe.str];return se===void 0||x[fe.str]!==1?fe:(delete x[fe.str],se)}function te(fe){return fe instanceof t._Code&&fe._items.some(se=>se instanceof t.Name&&x[se.str]===1&&N[se.str]!==void 0)}}function he(w,x){for(let N in x)w[N]=(w[N]||0)-(x[N]||0)}function qe(w){return typeof w=="boolean"||typeof w=="number"||w===null?!w:(0,t._)`!${F(w)}`}e.not=qe;let Ie=A(e.operators.AND);function Ye(...w){return w.reduce(Ie)}e.and=Ye;let ye=A(e.operators.OR);function I(...w){return w.reduce(ye)}e.or=I;function A(w){return(x,N)=>x===t.nil?N:N===t.nil?x:(0,t._)`${F(x)} ${w} ${F(N)}`}function F(w){return w instanceof t.Name?w:(0,t._)`(${w})`}}),be=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=de(),r=Nu();function o(b){let y={};for(let $ of b)y[$]=!0;return y}e.toHash=o;function n(b,y){return typeof y=="boolean"?y:Object.keys(y).length===0?!0:(s(b,y),!i(y,b.self.RULES.all))}e.alwaysValidSchema=n;function s(b,y=b.schema){let{opts:$,self:T}=b;if(!$.strictSchema||typeof y=="boolean")return;let C=T.RULES.keywords;for(let O in y)C[O]||R(b,`unknown keyword: "${O}"`)}e.checkUnknownRules=s;function i(b,y){if(typeof b=="boolean")return!b;for(let $ in b)if(y[$])return!0;return!1}e.schemaHasRules=i;function a(b,y){if(typeof b=="boolean")return!b;for(let $ in b)if($!=="$ref"&&y.all[$])return!0;return!1}e.schemaHasRulesButRef=a;function c({topSchemaRef:b,schemaPath:y},$,T,C){if(!C){if(typeof $=="number"||typeof $=="boolean")return $;if(typeof $=="string")return(0,t._)`${$}`}return(0,t._)`${b}${y}${(0,t.getProperty)(T)}`}e.schemaRefOrVal=c;function u(b){return p(decodeURIComponent(b))}e.unescapeFragment=u;function l(b){return encodeURIComponent(d(b))}e.escapeFragment=l;function d(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function p(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function g(b,y){if(Array.isArray(b))for(let $ of b)y($);else y(b)}e.eachItem=g;function f({mergeNames:b,mergeToName:y,mergeValues:$,resultToName:T}){return(C,O,L,H)=>{let G=L===void 0?O:L instanceof t.Name?(O instanceof t.Name?b(C,O,L):y(C,O,L),L):O instanceof t.Name?(y(C,L,O),O):$(O,L);return H===t.Name&&!(G instanceof t.Name)?T(C,G):G}}e.mergeEvaluated={props:f({mergeNames:(b,y,$)=>b.if((0,t._)`${$} !== true && ${y} !== undefined`,()=>{b.if((0,t._)`${y} === true`,()=>b.assign($,!0),()=>b.assign($,(0,t._)`${$} || {}`).code((0,t._)`Object.assign(${$}, ${y})`))}),mergeToName:(b,y,$)=>b.if((0,t._)`${$} !== true`,()=>{y===!0?b.assign($,!0):(b.assign($,(0,t._)`${$} || {}`),m(b,$,y))}),mergeValues:(b,y)=>b===!0?!0:{...b,...y},resultToName:_}),items:f({mergeNames:(b,y,$)=>b.if((0,t._)`${$} !== true && ${y} !== undefined`,()=>b.assign($,(0,t._)`${y} === true ? true : ${$} > ${y} ? ${$} : ${y}`)),mergeToName:(b,y,$)=>b.if((0,t._)`${$} !== true`,()=>b.assign($,y===!0?!0:(0,t._)`${$} > ${y} ? ${$} : ${y}`)),mergeValues:(b,y)=>b===!0?!0:Math.max(b,y),resultToName:(b,y)=>b.var("items",y)})};function _(b,y){if(y===!0)return b.var("props",!0);let $=b.var("props",(0,t._)`{}`);return y!==void 0&&m(b,$,y),$}e.evaluatedPropsToName=_;function m(b,y,$){Object.keys($).forEach(T=>b.assign((0,t._)`${y}${(0,t.getProperty)(T)}`,!0))}e.setEvaluated=m;let h={};function z(b,y){return b.scopeValue("func",{ref:y,code:h[y.code]||(h[y.code]=new r._Code(y.code))})}e.useFunc=z;var v;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(v||(e.Type=v={}));function S(b,y,$){if(b instanceof t.Name){let T=y===v.Num;return $?T?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:T?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return $?(0,t.getProperty)(b).toString():"/"+d(b)}e.getErrorPath=S;function R(b,y,$=b.opts.strictSchema){if($){if(y=`strict mode: ${y}`,$===!0)throw new Error(y);b.self.logger.warn(y)}}e.checkStrictMode=R}),Jt=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Au=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=de(),r=be(),o=Jt();e.keywordError={message:({keyword:m})=>(0,t.str)`must pass "${m}" keyword validation`},e.keyword$DataError={message:({keyword:m,schemaType:h})=>h?(0,t.str)`"${m}" keyword must be ${h} ($data)`:(0,t.str)`"${m}" keyword is invalid ($data)`};function n(m,h=e.keywordError,z,v){let{it:S}=m,{gen:R,compositeRule:b,allErrors:y}=S,$=d(m,h,z);v??(b||y)?c(R,$):u(S,(0,t._)`[${$}]`)}e.reportError=n;function s(m,h=e.keywordError,z){let{it:v}=m,{gen:S,compositeRule:R,allErrors:b}=v;c(S,d(m,h,z)),R||b||u(v,o.default.vErrors)}e.reportExtraError=s;function i(m,h){m.assign(o.default.errors,h),m.if((0,t._)`${o.default.vErrors} !== null`,()=>m.if(h,()=>m.assign((0,t._)`${o.default.vErrors}.length`,h),()=>m.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:m,keyword:h,schemaValue:z,data:v,errsCount:S,it:R}){if(S===void 0)throw new Error("ajv implementation error");let b=m.name("err");m.forRange("i",S,o.default.errors,y=>{m.const(b,(0,t._)`${o.default.vErrors}[${y}]`),m.if((0,t._)`${b}.instancePath === undefined`,()=>m.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(o.default.instancePath,R.errorPath))),m.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${R.errSchemaPath}/${h}`),R.opts.verbose&&(m.assign((0,t._)`${b}.schema`,z),m.assign((0,t._)`${b}.data`,v))})}e.extendErrors=a;function c(m,h){let z=m.const("err",h);m.if((0,t._)`${o.default.vErrors} === null`,()=>m.assign(o.default.vErrors,(0,t._)`[${z}]`),(0,t._)`${o.default.vErrors}.push(${z})`),m.code((0,t._)`${o.default.errors}++`)}function u(m,h){let{gen:z,validateName:v,schemaEnv:S}=m;S.$async?z.throw((0,t._)`new ${m.ValidationError}(${h})`):(z.assign((0,t._)`${v}.errors`,h),z.return(!1))}let l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(m,h,z){let{createErrors:v}=m.it;return v===!1?(0,t._)`{}`:p(m,h,z)}function p(m,h,z={}){let{gen:v,it:S}=m,R=[g(S,z),f(m,z)];return _(m,h,R),v.object(...R)}function g({errorPath:m},{instancePath:h}){let z=h?(0,t.str)`${m}${(0,r.getErrorPath)(h,r.Type.Str)}`:m;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,z)]}function f({keyword:m,it:{errSchemaPath:h}},{schemaPath:z,parentSchema:v}){let S=v?h:(0,t.str)`${h}/${m}`;return z&&(S=(0,t.str)`${S}${(0,r.getErrorPath)(z,r.Type.Str)}`),[l.schemaPath,S]}function _(m,{params:h,message:z},v){let{keyword:S,data:R,schemaValue:b,it:y}=m,{opts:$,propertyName:T,topSchemaRef:C,schemaPath:O}=y;v.push([l.keyword,S],[l.params,typeof h=="function"?h(m):h||(0,t._)`{}`]),$.messages&&v.push([l.message,typeof z=="function"?z(m):z]),$.verbose&&v.push([l.schema,b],[l.parentSchema,(0,t._)`${C}${O}`],[o.default.data,R]),T&&v.push([l.propertyName,T])}}),wx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Au(),r=de(),o=Jt(),n={message:"boolean schema is false"};function s(c){let{gen:u,schema:l,validateName:d}=c;l===!1?a(c,!1):typeof l=="object"&&l.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${d}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(c,u){let{gen:l,schema:d}=c;d===!1?(l.var(u,!1),a(c)):l.var(u,!0)}e.boolOrEmptySchema=i;function a(c,u){let{gen:l,data:d}=c,p={gen:l,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(p,n,void 0,u)}}),P$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o}),E$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let a=s.RULES.types[i];return a&&a!==!0&&r(n,a)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(a=>n[a]!==void 0))}e.shouldUseRule=o}),ju=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=P$(),r=E$(),o=Au(),n=de(),s=be();var i;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function a(v){let S=c(v.type);if(S.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!S.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&S.push("null")}return S}e.getSchemaTypes=a;function c(v){let S=Array.isArray(v)?v:v?[v]:[];if(S.every(t.isJSONType))return S;throw new Error("type must be JSONType or JSONType[]: "+S.join(","))}e.getJSONTypes=c;function u(v,S){let{gen:R,data:b,opts:y}=v,$=d(S,y.coerceTypes),T=S.length>0&&!($.length===0&&S.length===1&&(0,r.schemaHasRulesForType)(v,S[0]));if(T){let C=_(S,b,y.strictNumbers,i.Wrong);R.if(C,()=>{$.length?p(v,S,$):h(v)})}return T}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function d(v,S){return S?v.filter(R=>l.has(R)||S==="array"&&R==="array"):[]}function p(v,S,R){let{gen:b,data:y,opts:$}=v,T=b.let("dataType",(0,n._)`typeof ${y}`),C=b.let("coerced",(0,n._)`undefined`);$.coerceTypes==="array"&&b.if((0,n._)`${T} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>b.assign(y,(0,n._)`${y}[0]`).assign(T,(0,n._)`typeof ${y}`).if(_(S,y,$.strictNumbers),()=>b.assign(C,y))),b.if((0,n._)`${C} !== undefined`);for(let L of R)(l.has(L)||L==="array"&&$.coerceTypes==="array")&&O(L);b.else(),h(v),b.endIf(),b.if((0,n._)`${C} !== undefined`,()=>{b.assign(y,C),g(v,C)});function O(L){switch(L){case"string":b.elseIf((0,n._)`${T} == "number" || ${T} == "boolean"`).assign(C,(0,n._)`"" + ${y}`).elseIf((0,n._)`${y} === null`).assign(C,(0,n._)`""`);return;case"number":b.elseIf((0,n._)`${T} == "boolean" || ${y} === null
124
124
  || (${T} == "string" && ${y} && ${y} == +${y})`).assign(C,(0,n._)`+${y}`);return;case"integer":b.elseIf((0,n._)`${T} === "boolean" || ${y} === null
125
125
  || (${T} === "string" && ${y} && ${y} == +${y} && !(${y} % 1))`).assign(C,(0,n._)`+${y}`);return;case"boolean":b.elseIf((0,n._)`${y} === "false" || ${y} === 0 || ${y} === null`).assign(C,!1).elseIf((0,n._)`${y} === "true" || ${y} === 1`).assign(C,!0);return;case"null":b.elseIf((0,n._)`${y} === "" || ${y} === 0 || ${y} === false`),b.assign(C,null);return;case"array":b.elseIf((0,n._)`${T} === "string" || ${T} === "number"
126
- || ${T} === "boolean" || ${y} === null`).assign(C,(0,n._)`[${y}]`)}}}function g({gen:v,parentData:S,parentDataProperty:R},b){v.if((0,n._)`${S} !== undefined`,()=>v.assign((0,n._)`${S}[${R}]`,b))}function f(v,S,R,b=i.Correct){let y=b===i.Correct?n.operators.EQ:n.operators.NEQ,$;switch(v){case"null":return(0,n._)`${S} ${y} null`;case"array":$=(0,n._)`Array.isArray(${S})`;break;case"object":$=(0,n._)`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":$=T((0,n._)`!(${S} % 1) && !isNaN(${S})`);break;case"number":$=T();break;default:return(0,n._)`typeof ${S} ${y} ${v}`}return b===i.Correct?$:(0,n.not)($);function T(C=n.nil){return(0,n.and)((0,n._)`typeof ${S} == "number"`,C,R?(0,n._)`isFinite(${S})`:n.nil)}}e.checkDataType=f;function _(v,S,R,b){if(v.length===1)return f(v[0],S,R,b);let y,$=(0,s.toHash)(v);if($.array&&$.object){let T=(0,n._)`typeof ${S} != "object"`;y=$.null?T:(0,n._)`!${S} || ${T}`,delete $.null,delete $.array,delete $.object}else y=n.nil;$.number&&delete $.integer;for(let T in $)y=(0,n.and)(y,f(T,S,R,b));return y}e.checkDataTypes=_;let m={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:S})=>typeof v=="string"?(0,n._)`{type: ${v}}`:(0,n._)`{type: ${S}}`};function h(v){let S=z(v);(0,o.reportError)(S,m)}e.reportTypeError=h;function z(v){let{gen:S,data:R,schema:b}=v,y=(0,s.schemaRefOrVal)(v,b,"type");return{gen:S,keyword:"type",data:R,schema:b.type,schemaCode:y,schemaValue:y,parentSchema:b,params:{},it:v}}}),wx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=de(),r=be();function o(s,i){let{properties:a,items:c}=s.schema;if(i==="object"&&a)for(let u in a)n(s,u,a[u].default);else i==="array"&&Array.isArray(c)&&c.forEach((u,l)=>n(s,l,u.default))}e.assignDefaults=o;function n(s,i,a){let{gen:c,compositeRule:u,data:l,opts:d}=s;if(a===void 0)return;let p=(0,t._)`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${p}`);return}let g=(0,t._)`${p} === undefined`;d.useDefaults==="empty"&&(g=(0,t._)`${g} || ${p} === null || ${p} === ""`),c.if(g,(0,t._)`${p} = ${(0,t.stringify)(a)}`)}}),Ht=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=de(),r=be(),o=Jt(),n=be();function s(v,S){let{gen:R,data:b,it:y}=v;R.if(d(R,b,S,y.opts.ownProperties),()=>{v.setParams({missingProperty:(0,t._)`${S}`},!0),v.error()})}e.checkReportMissingProp=s;function i({gen:v,data:S,it:{opts:R}},b,y){return(0,t.or)(...b.map($=>(0,t.and)(d(v,S,$,R.ownProperties),(0,t._)`${y} = ${$}`)))}e.checkMissingProp=i;function a(v,S){v.setParams({missingProperty:S},!0),v.error()}e.reportMissingProp=a;function c(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(v,S,R){return(0,t._)`${c(v)}.call(${S}, ${R})`}e.isOwnProperty=u;function l(v,S,R,b){let y=(0,t._)`${S}${(0,t.getProperty)(R)} !== undefined`;return b?(0,t._)`${y} && ${u(v,S,R)}`:y}e.propertyInData=l;function d(v,S,R,b){let y=(0,t._)`${S}${(0,t.getProperty)(R)} === undefined`;return b?(0,t.or)(y,(0,t.not)(u(v,S,R))):y}e.noPropertyInData=d;function p(v){return v?Object.keys(v).filter(S=>S!=="__proto__"):[]}e.allSchemaProperties=p;function g(v,S){return p(S).filter(R=>!(0,r.alwaysValidSchema)(v,S[R]))}e.schemaProperties=g;function f({schemaCode:v,data:S,it:{gen:R,topSchemaRef:b,schemaPath:y,errorPath:$},it:T},C,O,L){let H=L?(0,t._)`${v}, ${S}, ${b}${y}`:S,G=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,$)],[o.default.parentData,T.parentData],[o.default.parentDataProperty,T.parentDataProperty],[o.default.rootData,o.default.rootData]];T.opts.dynamicRef&&G.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let he=(0,t._)`${H}, ${R.object(...G)}`;return O!==t.nil?(0,t._)`${C}.call(${O}, ${he})`:(0,t._)`${C}(${he})`}e.callValidateCode=f;let _=(0,t._)`new RegExp`;function m({gen:v,it:{opts:S}},R){let b=S.unicodeRegExp?"u":"",{regExp:y}=S.code,$=y(R,b);return v.scopeValue("pattern",{key:$.toString(),ref:$,code:(0,t._)`${y.code==="new RegExp"?_:(0,n.useFunc)(v,y)}(${R}, ${b})`})}e.usePattern=m;function h(v){let{gen:S,data:R,keyword:b,it:y}=v,$=S.name("valid");if(y.allErrors){let C=S.let("valid",!0);return T(()=>S.assign(C,!1)),C}return S.var($,!0),T(()=>S.break()),$;function T(C){let O=S.const("len",(0,t._)`${R}.length`);S.forRange("i",0,O,L=>{v.subschema({keyword:b,dataProp:L,dataPropType:r.Type.Num},$),S.if((0,t.not)($),C)})}}e.validateArray=h;function z(v){let{gen:S,schema:R,keyword:b,it:y}=v;if(!Array.isArray(R))throw new Error("ajv implementation error");if(R.some(C=>(0,r.alwaysValidSchema)(y,C))&&!y.opts.unevaluated)return;let $=S.let("valid",!1),T=S.name("_valid");S.block(()=>R.forEach((C,O)=>{let L=v.subschema({keyword:b,schemaProp:O,compositeRule:!0},T);S.assign($,(0,t._)`${$} || ${T}`),v.mergeValidEvaluated(L,T)||S.if((0,t.not)($))})),v.result($,()=>v.reset(),()=>v.error(!0))}e.validateUnion=z}),Rx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=de(),r=Jt(),o=Ht(),n=Au();function s(g,f){let{gen:_,keyword:m,schema:h,parentSchema:z,it:v}=g,S=f.macro.call(v.self,h,z,v),R=l(_,m,S);v.opts.validateSchema!==!1&&v.self.validateSchema(S,!0);let b=_.name("valid");g.subschema({schema:S,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${m}`,topSchemaRef:R,compositeRule:!0},b),g.pass(b,()=>g.error(!0))}e.macroKeywordCode=s;function i(g,f){var _;let{gen:m,keyword:h,schema:z,parentSchema:v,$data:S,it:R}=g;u(R,f);let b=l(m,h,!S&&f.compile?f.compile.call(R.self,z,v,R):f.validate),y=m.let("valid");g.block$data(y,$),g.ok((_=f.valid)!==null&&_!==void 0?_:y);function $(){if(f.errors===!1)O(),f.modifying&&a(g),L(()=>g.error());else{let H=f.async?T():C();f.modifying&&a(g),L(()=>c(g,H))}}function T(){let H=m.let("ruleErrs",null);return m.try(()=>O((0,t._)`await `),G=>m.assign(y,!1).if((0,t._)`${G} instanceof ${R.ValidationError}`,()=>m.assign(H,(0,t._)`${G}.errors`),()=>m.throw(G))),H}function C(){let H=(0,t._)`${b}.errors`;return m.assign(H,null),O(t.nil),H}function O(H=f.async?(0,t._)`await `:t.nil){let G=R.opts.passContext?r.default.this:r.default.self,he=!("compile"in f&&!S||f.schema===!1);m.assign(y,(0,t._)`${H}${(0,o.callValidateCode)(g,b,G,he)}`,f.modifying)}function L(H){var G;m.if((0,t.not)((G=f.valid)!==null&&G!==void 0?G:y),H)}}e.funcKeywordCode=i;function a(g){let{gen:f,data:_,it:m}=g;f.if(m.parentData,()=>f.assign(_,(0,t._)`${m.parentData}[${m.parentDataProperty}]`))}function c(g,f){let{gen:_}=g;_.if((0,t._)`Array.isArray(${f})`,()=>{_.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${f} : ${r.default.vErrors}.concat(${f})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},f){if(f.async&&!g.$async)throw new Error("async keyword in sync schema")}function l(g,f,_){if(_===void 0)throw new Error(`keyword "${f}" failed to compile`);return g.scopeValue("keyword",typeof _=="function"?{ref:_}:{ref:_,code:(0,t.stringify)(_)})}function d(g,f,_=!1){return!f.length||f.some(m=>m==="array"?Array.isArray(g):m==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==m||_&&typeof g>"u")}e.validSchemaType=d;function p({schema:g,opts:f,self:_,errSchemaPath:m},h,z){if(Array.isArray(h.keyword)?!h.keyword.includes(z):h.keyword!==z)throw new Error("ajv implementation error");let v=h.dependencies;if(v?.some(S=>!Object.prototype.hasOwnProperty.call(g,S)))throw new Error(`parent schema must have dependencies of ${z}: ${v.join(",")}`);if(h.validateSchema&&!h.validateSchema(g[z])){let S=`keyword "${z}" value is invalid at path "${m}": `+_.errorsText(h.validateSchema.errors);if(f.validateSchema==="log")_.logger.error(S);else throw new Error(S)}}e.validateKeywordUsage=p}),Px=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=de(),r=be();function o(i,{keyword:a,schemaProp:c,schema:u,schemaPath:l,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let g=i.schema[a];return c===void 0?{schema:g,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:g[c],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${a}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(l===void 0||d===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:p,errSchemaPath:d}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,a,{dataProp:c,dataPropType:u,data:l,dataTypes:d,propertyName:p}){if(l!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:g}=a;if(c!==void 0){let{errorPath:_,dataPathArr:m,opts:h}=a;f(g.let("data",(0,t._)`${a.data}${(0,t.getProperty)(c)}`,!0)),i.errorPath=(0,t.str)`${_}${(0,r.getErrorPath)(c,u,h.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${c}`,i.dataPathArr=[...m,i.parentDataProperty]}l!==void 0&&(f(l instanceof t.Name?l:g.let("data",l,!0)),p!==void 0&&(i.propertyName=p)),d&&(i.dataTypes=d);function f(_){i.data=_,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,_]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:a,jtdMetadata:c,compositeRule:u,createErrors:l,allErrors:d}){u!==void 0&&(i.compositeRule=u),l!==void 0&&(i.createErrors=l),d!==void 0&&(i.allErrors=d),i.jtdDiscriminator=a,i.jtdMetadata=c}e.extendSubschemaMode=s}),E$=U((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,a;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(a=Object.keys(o),s=a.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=s;i--!==0;){var c=a[i];if(!r(o[c],n[c]))return!1}return!0}return o!==o&&n!==n}}),Ex=U((e,t)=>{var r=t.exports=function(s,i,a){typeof i=="function"&&(a=i,i={}),a=i.cb||a;var c=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};o(i,c,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function o(s,i,a,c,u,l,d,p,g,f){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,u,l,d,p,g,f);for(var _ in c){var m=c[_];if(Array.isArray(m)){if(_ in r.arrayKeywords)for(var h=0;h<m.length;h++)o(s,i,a,m[h],u+"/"+_+"/"+h,l,u,_,c,h)}else if(_ in r.propsKeywords){if(m&&typeof m=="object")for(var z in m)o(s,i,a,m[z],u+"/"+_+"/"+n(z),l,u,_,c,z)}else(_ in r.keywords||s.allKeys&&!(_ in r.skipKeywords))&&o(s,i,a,m,u+"/"+_,l,u,_,c)}a(c,u,l,d,p,g,f)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),Mu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=be(),r=E$(),o=Ex(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(m,h=!0){return typeof m=="boolean"?!0:h===!0?!a(m):h?c(m)<=h:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(m){for(let h in m){if(i.has(h))return!0;let z=m[h];if(Array.isArray(z)&&z.some(a)||typeof z=="object"&&a(z))return!0}return!1}function c(m){let h=0;for(let z in m){if(z==="$ref")return 1/0;if(h++,!n.has(z)&&(typeof m[z]=="object"&&(0,t.eachItem)(m[z],v=>h+=c(v)),h===1/0))return 1/0}return h}function u(m,h="",z){return z!==!1&&(h=p(h)),l(m,m.parse(h))}e.getFullPath=u;function l(m,h){return m.serialize(h).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function p(m){return m?m.replace(d,""):""}e.normalizeId=p;function g(m,h,z){return z=p(z),m.resolve(h,z)}e.resolveUrl=g;let f=/^[a-z_][-a-z0-9._]*$/i;function _(m,h){if(typeof m=="boolean")return{};let{schemaId:z,uriResolver:v}=this.opts,S=p(m[z]||h),R={"":S},b=u(v,S,!1),y={},$=new Set;return o(m,{allKeys:!0},(O,L,H,G)=>{if(G===void 0)return;let he=b+L,qe=R[G];typeof O[z]=="string"&&(qe=Ie.call(this,O[z])),Ye.call(this,O.$anchor),Ye.call(this,O.$dynamicAnchor),R[L]=qe;function Ie(ye){let I=this.opts.uriResolver.resolve;if(ye=p(qe?I(qe,ye):ye),$.has(ye))throw C(ye);$.add(ye);let A=this.refs[ye];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?T(O,A.schema,ye):ye!==p(he)&&(ye[0]==="#"?(T(O,y[ye],ye),y[ye]=O):this.refs[ye]=he),ye}function Ye(ye){if(typeof ye=="string"){if(!f.test(ye))throw new Error(`invalid anchor "${ye}"`);Ie.call(this,`#${ye}`)}}}),y;function T(O,L,H){if(L!==void 0&&!r(O,L))throw C(H)}function C(O){return new Error(`reference "${O}" resolves to more than one schema`)}}e.getSchemaRefs=_}),dn=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=$x(),r=ju(),o=P$(),n=ju(),s=wx(),i=Rx(),a=Px(),c=de(),u=Jt(),l=Mu(),d=be(),p=Au();function g(E){if(b(E)&&($(E),R(E))){h(E);return}f(E,()=>(0,t.topBoolOrEmptySchema)(E))}e.validateFunctionCode=g;function f({gen:E,validateName:M,schema:D,schemaEnv:oe,opts:ne},pe){ne.code.es5?E.func(M,(0,c._)`${u.default.data}, ${u.default.valCxt}`,oe.$async,()=>{E.code((0,c._)`"use strict"; ${v(D,ne)}`),m(E,ne),E.code(pe)}):E.func(M,(0,c._)`${u.default.data}, ${_(ne)}`,oe.$async,()=>E.code(v(D,ne)).code(pe))}function _(E){return(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${E.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function m(E,M){E.if(u.default.valCxt,()=>{E.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),E.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),E.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),E.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),M.dynamicRef&&E.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{E.var(u.default.instancePath,(0,c._)`""`),E.var(u.default.parentData,(0,c._)`undefined`),E.var(u.default.parentDataProperty,(0,c._)`undefined`),E.var(u.default.rootData,u.default.data),M.dynamicRef&&E.var(u.default.dynamicAnchors,(0,c._)`{}`)})}function h(E){let{schema:M,opts:D,gen:oe}=E;f(E,()=>{D.$comment&&M.$comment&&G(E),O(E),oe.let(u.default.vErrors,null),oe.let(u.default.errors,0),D.unevaluated&&z(E),T(E),he(E)})}function z(E){let{gen:M,validateName:D}=E;E.evaluated=M.const("evaluated",(0,c._)`${D}.evaluated`),M.if((0,c._)`${E.evaluated}.dynamicProps`,()=>M.assign((0,c._)`${E.evaluated}.props`,(0,c._)`undefined`)),M.if((0,c._)`${E.evaluated}.dynamicItems`,()=>M.assign((0,c._)`${E.evaluated}.items`,(0,c._)`undefined`))}function v(E,M){let D=typeof E=="object"&&E[M.schemaId];return D&&(M.code.source||M.code.process)?(0,c._)`/*# sourceURL=${D} */`:c.nil}function S(E,M){if(b(E)&&($(E),R(E))){y(E,M);return}(0,t.boolOrEmptySchema)(E,M)}function R({schema:E,self:M}){if(typeof E=="boolean")return!E;for(let D in E)if(M.RULES.all[D])return!0;return!1}function b(E){return typeof E.schema!="boolean"}function y(E,M){let{schema:D,gen:oe,opts:ne}=E;ne.$comment&&D.$comment&&G(E),L(E),H(E);let pe=oe.const("_errs",u.default.errors);T(E,pe),oe.var(M,(0,c._)`${pe} === ${u.default.errors}`)}function $(E){(0,d.checkUnknownRules)(E),C(E)}function T(E,M){if(E.opts.jtd)return Ie(E,[],!1,M);let D=(0,r.getSchemaTypes)(E.schema);Ie(E,D,!(0,r.coerceAndCheckDataType)(E,D),M)}function C(E){let{schema:M,errSchemaPath:D,opts:oe,self:ne}=E;M.$ref&&oe.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(M,ne.RULES)&&ne.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function O(E){let{schema:M,opts:D}=E;M.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,d.checkStrictMode)(E,"default is ignored in the schema root")}function L(E){let M=E.schema[E.opts.schemaId];M&&(E.baseId=(0,l.resolveUrl)(E.opts.uriResolver,E.baseId,M))}function H(E){if(E.schema.$async&&!E.schemaEnv.$async)throw new Error("async schema in sync schema")}function G({gen:E,schemaEnv:M,schema:D,errSchemaPath:oe,opts:ne}){let pe=D.$comment;if(ne.$comment===!0)E.code((0,c._)`${u.default.self}.logger.log(${pe})`);else if(typeof ne.$comment=="function"){let Ge=(0,c.str)`${oe}/$comment`,et=E.scopeValue("root",{ref:M.root});E.code((0,c._)`${u.default.self}.opts.$comment(${pe}, ${Ge}, ${et}.schema)`)}}function he(E){let{gen:M,schemaEnv:D,validateName:oe,ValidationError:ne,opts:pe}=E;D.$async?M.if((0,c._)`${u.default.errors} === 0`,()=>M.return(u.default.data),()=>M.throw((0,c._)`new ${ne}(${u.default.vErrors})`)):(M.assign((0,c._)`${oe}.errors`,u.default.vErrors),pe.unevaluated&&qe(E),M.return((0,c._)`${u.default.errors} === 0`))}function qe({gen:E,evaluated:M,props:D,items:oe}){D instanceof c.Name&&E.assign((0,c._)`${M}.props`,D),oe instanceof c.Name&&E.assign((0,c._)`${M}.items`,oe)}function Ie(E,M,D,oe){let{gen:ne,schema:pe,data:Ge,allErrors:et,opts:ct,self:Xe}=E,{RULES:Ue}=Xe;if(pe.$ref&&(ct.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(pe,Ue))){ne.block(()=>fe(E,"$ref",Ue.all.$ref.definition));return}ct.jtd||ye(E,M),ne.block(()=>{for(let rt of Ue.rules)Et(rt);Et(Ue.post)});function Et(rt){(0,o.shouldUseGroup)(pe,rt)&&(rt.type?(ne.if((0,n.checkDataType)(rt.type,Ge,ct.strictNumbers)),Ye(E,rt),M.length===1&&M[0]===rt.type&&D&&(ne.else(),(0,n.reportTypeError)(E)),ne.endIf()):Ye(E,rt),et||ne.if((0,c._)`${u.default.errors} === ${oe||0}`))}}function Ye(E,M){let{gen:D,schema:oe,opts:{useDefaults:ne}}=E;ne&&(0,s.assignDefaults)(E,M.type),D.block(()=>{for(let pe of M.rules)(0,o.shouldUseRule)(oe,pe)&&fe(E,pe.keyword,pe.definition,M.type)})}function ye(E,M){E.schemaEnv.meta||!E.opts.strictTypes||(I(E,M),E.opts.allowUnionTypes||A(E,M),F(E,E.dataTypes))}function I(E,M){if(M.length){if(!E.dataTypes.length){E.dataTypes=M;return}M.forEach(D=>{x(E.dataTypes,D)||B(E,`type "${D}" not allowed by context "${E.dataTypes.join(",")}"`)}),N(E,M)}}function A(E,M){M.length>1&&!(M.length===2&&M.includes("null"))&&B(E,"use allowUnionTypes to allow union type keyword")}function F(E,M){let D=E.self.RULES.all;for(let oe in D){let ne=D[oe];if(typeof ne=="object"&&(0,o.shouldUseRule)(E.schema,ne)){let{type:pe}=ne.definition;pe.length&&!pe.some(Ge=>w(M,Ge))&&B(E,`missing type "${pe.join(",")}" for keyword "${oe}"`)}}}function w(E,M){return E.includes(M)||M==="number"&&E.includes("integer")}function x(E,M){return E.includes(M)||M==="integer"&&E.includes("number")}function N(E,M){let D=[];for(let oe of E.dataTypes)x(M,oe)?D.push(oe):M.includes("integer")&&oe==="number"&&D.push("integer");E.dataTypes=D}function B(E,M){let D=E.schemaEnv.baseId+E.errSchemaPath;M+=` at "${D}" (strictTypes)`,(0,d.checkStrictMode)(E,M,E.opts.strictTypes)}var te=class{constructor(E,M,D){if((0,i.validateKeywordUsage)(E,M,D),this.gen=E.gen,this.allErrors=E.allErrors,this.keyword=D,this.data=E.data,this.schema=E.schema[D],this.$data=M.$data&&E.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(E,this.schema,D,this.$data),this.schemaType=M.schemaType,this.parentSchema=E.schema,this.params={},this.it=E,this.def=M,this.$data)this.schemaCode=E.gen.const("vSchema",mt(this.$data,E));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${D} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=E.gen.const("_errs",u.default.errors))}result(E,M,D){this.failResult((0,c.not)(E),M,D)}failResult(E,M,D){this.gen.if(E),D?D():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(E,M){this.failResult((0,c.not)(E),void 0,M)}fail(E){if(E===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(E),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(E){if(!this.$data)return this.fail(E);let{schemaCode:M}=this;this.fail((0,c._)`${M} !== undefined && (${(0,c.or)(this.invalid$data(),E)})`)}error(E,M,D){if(M){this.setParams(M),this._error(E,D),this.setParams({});return}this._error(E,D)}_error(E,M){(E?p.reportExtraError:p.reportError)(this,this.def.error,M)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(E){this.allErrors||this.gen.if(E)}setParams(E,M){M?Object.assign(this.params,E):this.params=E}block$data(E,M,D=c.nil){this.gen.block(()=>{this.check$data(E,D),M()})}check$data(E=c.nil,M=c.nil){if(!this.$data)return;let{gen:D,schemaCode:oe,schemaType:ne,def:pe}=this;D.if((0,c.or)((0,c._)`${oe} === undefined`,M)),E!==c.nil&&D.assign(E,!0),(ne.length||pe.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),E!==c.nil&&D.assign(E,!1)),D.else()}invalid$data(){let{gen:E,schemaCode:M,schemaType:D,def:oe,it:ne}=this;return(0,c.or)(pe(),Ge());function pe(){if(D.length){if(!(M instanceof c.Name))throw new Error("ajv implementation error");let et=Array.isArray(D)?D:[D];return(0,c._)`${(0,n.checkDataTypes)(et,M,ne.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}function Ge(){if(oe.validateSchema){let et=E.scopeValue("validate$data",{ref:oe.validateSchema});return(0,c._)`!${et}(${M})`}return c.nil}}subschema(E,M){let D=(0,a.getSubschema)(this.it,E);(0,a.extendSubschemaData)(D,this.it,E),(0,a.extendSubschemaMode)(D,E);let oe={...this.it,...D,items:void 0,props:void 0};return S(oe,M),oe}mergeEvaluated(E,M){let{it:D,gen:oe}=this;D.opts.unevaluated&&(D.props!==!0&&E.props!==void 0&&(D.props=d.mergeEvaluated.props(oe,E.props,D.props,M)),D.items!==!0&&E.items!==void 0&&(D.items=d.mergeEvaluated.items(oe,E.items,D.items,M)))}mergeValidEvaluated(E,M){let{it:D,gen:oe}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return oe.if(M,()=>this.mergeEvaluated(E,c.Name)),!0}};e.KeywordCxt=te;function fe(E,M,D,oe){let ne=new te(E,D,M);"code"in D?D.code(ne,oe):ne.$data&&D.validate?(0,i.funcKeywordCode)(ne,D):"macro"in D?(0,i.macroKeywordCode)(ne,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(ne,D)}let se=/^\/(?:[^~]|~0|~1)*$/,Oe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mt(E,{dataLevel:M,dataNames:D,dataPathArr:oe}){let ne,pe;if(E==="")return u.default.rootData;if(E[0]==="/"){if(!se.test(E))throw new Error(`Invalid JSON-pointer: ${E}`);ne=E,pe=u.default.rootData}else{let Xe=Oe.exec(E);if(!Xe)throw new Error(`Invalid JSON-pointer: ${E}`);let Ue=+Xe[1];if(ne=Xe[2],ne==="#"){if(Ue>=M)throw new Error(ct("property/index",Ue));return oe[M-Ue]}if(Ue>M)throw new Error(ct("data",Ue));if(pe=D[M-Ue],!ne)return pe}let Ge=pe,et=ne.split("/");for(let Xe of et)Xe&&(pe=(0,c._)`${pe}${(0,c.getProperty)((0,d.unescapeJsonPointer)(Xe))}`,Ge=(0,c._)`${Ge} && ${pe}`);return Ge;function ct(Xe,Ue){return`Cannot access ${Xe} ${Ue} levels up, current level is ${M}`}}e.getData=mt}),ti=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t}),pn=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Mu();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r}),qu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=de(),r=ti(),o=Jt(),n=Mu(),s=be(),i=dn();var a=class{constructor(h){var z;this.refs={},this.dynamicAnchors={};let v;typeof h.schema=="object"&&(v=h.schema),this.schema=h.schema,this.schemaId=h.schemaId,this.root=h.root||this,this.baseId=(z=h.baseId)!==null&&z!==void 0?z:(0,n.normalizeId)(v?.[h.schemaId||"$id"]),this.schemaPath=h.schemaPath,this.localRefs=h.localRefs,this.meta=h.meta,this.$async=v?.$async,this.refs={}}};e.SchemaEnv=a;function c(h){let z=d.call(this,h);if(z)return z;let v=(0,n.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:S,lines:R}=this.opts.code,{ownProperties:b}=this.opts,y=new t.CodeGen(this.scope,{es5:S,lines:R,ownProperties:b}),$;h.$async&&($=y.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let T=y.scopeName("validate");h.validateName=T;let C={gen:y,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,t.stringify)(h.schema)}:{ref:h.schema}),validateName:T,ValidationError:$,schema:h.schema,schemaEnv:h,rootId:v,baseId:h.baseId||v,schemaPath:t.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},O;try{this._compilations.add(h),(0,i.validateFunctionCode)(C),y.optimize(this.opts.code.optimize);let L=y.toString();O=`${y.scopeRefs(o.default.scope)}return ${L}`,this.opts.code.process&&(O=this.opts.code.process(O,h));let H=new Function(`${o.default.self}`,`${o.default.scope}`,O)(this,this.scope.get());if(this.scope.value(T,{ref:H}),H.errors=null,H.schema=h.schema,H.schemaEnv=h,h.$async&&(H.$async=!0),this.opts.code.source===!0&&(H.source={validateName:T,validateCode:L,scopeValues:y._values}),this.opts.unevaluated){let{props:G,items:he}=C;H.evaluated={props:G instanceof t.Name?void 0:G,items:he instanceof t.Name?void 0:he,dynamicProps:G instanceof t.Name,dynamicItems:he instanceof t.Name},H.source&&(H.source.evaluated=(0,t.stringify)(H.evaluated))}return h.validate=H,h}catch(L){throw delete h.validate,delete h.validateName,O&&this.logger.error("Error compiling schema, function code:",O),L}finally{this._compilations.delete(h)}}e.compileSchema=c;function u(h,z,v){var S;v=(0,n.resolveUrl)(this.opts.uriResolver,z,v);let R=h.refs[v];if(R)return R;let b=g.call(this,h,v);if(b===void 0){let y=(S=h.localRefs)===null||S===void 0?void 0:S[v],{schemaId:$}=this.opts;y&&(b=new a({schema:y,schemaId:$,root:h,baseId:z}))}if(b!==void 0)return h.refs[v]=l.call(this,b)}e.resolveRef=u;function l(h){return(0,n.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:c.call(this,h)}function d(h){for(let z of this._compilations)if(p(z,h))return z}e.getCompilingSchema=d;function p(h,z){return h.schema===z.schema&&h.root===z.root&&h.baseId===z.baseId}function g(h,z){let v;for(;typeof(v=this.refs[z])=="string";)z=v;return v||this.schemas[z]||f.call(this,h,z)}function f(h,z){let v=this.opts.uriResolver.parse(z),S=(0,n._getFullPath)(this.opts.uriResolver,v),R=(0,n.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&S===R)return m.call(this,v,h);let b=(0,n.normalizeId)(S),y=this.refs[b]||this.schemas[b];if(typeof y=="string"){let $=f.call(this,h,y);return typeof $?.schema!="object"?void 0:m.call(this,v,$)}if(typeof y?.schema=="object"){if(y.validate||c.call(this,y),b===(0,n.normalizeId)(z)){let{schema:$}=y,{schemaId:T}=this.opts,C=$[T];return C&&(R=(0,n.resolveUrl)(this.opts.uriResolver,R,C)),new a({schema:$,schemaId:T,root:h,baseId:R})}return m.call(this,v,y)}}e.resolveSchema=f;let _=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(h,{baseId:z,schema:v,root:S}){var R;if(((R=h.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let $ of h.fragment.slice(1).split("/")){if(typeof v=="boolean")return;let T=v[(0,s.unescapeFragment)($)];if(T===void 0)return;v=T;let C=typeof v=="object"&&v[this.opts.schemaId];!_.has($)&&C&&(z=(0,n.resolveUrl)(this.opts.uriResolver,z,C))}let b;if(typeof v!="boolean"&&v.$ref&&!(0,s.schemaHasRulesButRef)(v,this.RULES)){let $=(0,n.resolveUrl)(this.opts.uriResolver,z,v.$ref);b=f.call(this,S,$)}let{schemaId:y}=this.opts;if(b=b||new a({schema:v,schemaId:y,root:S,baseId:z}),b.schema!==b.root.schema)return b}}),kx=U((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),k$=U((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(f){let _="",m=0,h=0;for(h=0;h<f.length;h++)if(m=f[h].charCodeAt(0),m!==48){if(!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";_+=f[h];break}for(h+=1;h<f.length;h++){if(m=f[h].charCodeAt(0),!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";_+=f[h]}return _}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(f){return f.length=0,!0}function a(f,_,m){if(f.length){let h=n(f);if(h!=="")_.push(h);else return m.error=!0,!1;f.length=0}return!0}function c(f){let _=0,m={error:!1,address:"",zone:""},h=[],z=[],v=!1,S=!1,R=a;for(let b=0;b<f.length;b++){let y=f[b];if(!(y==="["||y==="]"))if(y===":"){if(v===!0&&(S=!0),!R(z,h,m))break;if(++_>7){m.error=!0;break}b>0&&f[b-1]===":"&&(v=!0),h.push(":");continue}else if(y==="%"){if(!R(z,h,m))break;R=i}else{z.push(y);continue}}return z.length&&(R===i?m.zone=z.join(""):S?h.push(z.join("")):h.push(n(z))),m.address=h.join(""),m}function u(f){if(l(f,":")<2)return{host:f,isIPV6:!1};let _=c(f);if(_.error)return{host:f,isIPV6:!1};{let m=_.address,h=_.address;return _.zone&&(m+="%"+_.zone,h+="%25"+_.zone),{host:m,isIPV6:!0,escapedHost:h}}}function l(f,_){let m=0;for(let h=0;h<f.length;h++)f[h]===_&&m++;return m}function d(f){let _=f,m=[],h=-1,z=0;for(;z=_.length;){if(z===1){if(_===".")break;if(_==="/"){m.push("/");break}else{m.push(_);break}}else if(z===2){if(_[0]==="."){if(_[1]===".")break;if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&(_[1]==="."||_[1]==="/")){m.push("/");break}}else if(z===3&&_==="/.."){m.length!==0&&m.pop(),m.push("/");break}if(_[0]==="."){if(_[1]==="."){if(_[2]==="/"){_=_.slice(3);continue}}else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&_[1]==="."){if(_[2]==="/"){_=_.slice(2);continue}else if(_[2]==="."&&_[3]==="/"){_=_.slice(3),m.length!==0&&m.pop();continue}}if((h=_.indexOf("/",1))===-1){m.push(_);break}else m.push(_.slice(0,h)),_=_.slice(h)}return m.join("")}function p(f,_){let m=_!==!0?escape:unescape;return f.scheme!==void 0&&(f.scheme=m(f.scheme)),f.userinfo!==void 0&&(f.userinfo=m(f.userinfo)),f.host!==void 0&&(f.host=m(f.host)),f.path!==void 0&&(f.path=m(f.path)),f.query!==void 0&&(f.query=m(f.query)),f.fragment!==void 0&&(f.fragment=m(f.fragment)),f}function g(f){let _=[];if(f.userinfo!==void 0&&(_.push(f.userinfo),_.push("@")),f.host!==void 0){let m=unescape(f.host);if(!o(m)){let h=u(m);h.isIPV6===!0?m=`[${h.escapedHost}]`:m=f.host}_.push(m)}return(typeof f.port=="number"||typeof f.port=="string")&&(_.push(":"),_.push(String(f.port))),_.length?_.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:g,normalizeComponentEncoding:p,removeDotSegments:d,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}}),xx=U((e,t)=>{let{isUUID:r}=k$(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(y){return n.indexOf(y)!==-1}function i(y){return y.secure===!0?!0:y.secure===!1?!1:y.scheme?y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S"):!1}function a(y){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y}function c(y){let $=String(y.scheme).toLowerCase()==="https";return(y.port===($?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}function u(y){return y.secure=i(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function l(y){if((y.port===(i(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){let[$,T]=y.resourceName.split("?");y.path=$&&$!=="/"?$:void 0,y.query=T,y.resourceName=void 0}return y.fragment=void 0,y}function d(y,$){if(!y.path)return y.error="URN can not be parsed",y;let T=y.path.match(o);if(T){let C=$.scheme||y.scheme||"urn";y.nid=T[1].toLowerCase(),y.nss=T[2];let O=b(`${C}:${$.nid||y.nid}`);y.path=void 0,O&&(y=O.parse(y,$))}else y.error=y.error||"URN can not be parsed.";return y}function p(y,$){if(y.nid===void 0)throw new Error("URN without nid cannot be serialized");let T=$.scheme||y.scheme||"urn",C=y.nid.toLowerCase(),O=b(`${T}:${$.nid||C}`);O&&(y=O.serialize(y,$));let L=y,H=y.nss;return L.path=`${C||$.nid}:${H}`,$.skipEscape=!0,L}function g(y,$){let T=y;return T.uuid=T.nss,T.nss=void 0,!$.tolerant&&(!T.uuid||!r(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function f(y){let $=y;return $.nss=(y.uuid||"").toLowerCase(),$}let _={scheme:"http",domainHost:!0,parse:a,serialize:c},m={scheme:"https",domainHost:_.domainHost,parse:a,serialize:c},h={scheme:"ws",domainHost:!0,parse:u,serialize:l},z={scheme:"wss",domainHost:h.domainHost,parse:h.parse,serialize:h.serialize},R={http:_,https:m,ws:h,wss:z,urn:{scheme:"urn",parse:d,serialize:p,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:g,serialize:f,skipNormalize:!0}};Object.setPrototypeOf(R,null);function b(y){return y&&(R[y]||R[y.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:R,isValidSchemeName:s,getSchemeHandler:b}}),Tx=U((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=k$(),{SCHEMES:c,getSchemeHandler:u}=xx();function l(z,v){return typeof z=="string"?z=f(m(z,v),v):typeof z=="object"&&(z=m(f(z,v),v)),z}function d(z,v,S){let R=S?Object.assign({scheme:"null"},S):{scheme:"null"},b=p(m(z,R),m(v,R),R,!0);return R.skipEscape=!0,f(b,R)}function p(z,v,S,R){let b={};return R||(z=m(f(z,S),S),v=m(f(v,S),S)),S=S||{},!S.tolerant&&v.scheme?(b.scheme=v.scheme,b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.path?(v.path[0]==="/"?b.path=o(v.path):((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path?b.path="/"+v.path:z.path?b.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+v.path:b.path=v.path,b.path=o(b.path)),b.query=v.query):(b.path=z.path,v.query!==void 0?b.query=v.query:b.query=z.query),b.userinfo=z.userinfo,b.host=z.host,b.port=z.port),b.scheme=z.scheme),b.fragment=v.fragment,b}function g(z,v,S){return typeof z=="string"?(z=unescape(z),z=f(s(m(z,S),!0),{...S,skipEscape:!0})):typeof z=="object"&&(z=f(s(z,!0),{...S,skipEscape:!0})),typeof v=="string"?(v=unescape(v),v=f(s(m(v,S),!0),{...S,skipEscape:!0})):typeof v=="object"&&(v=f(s(v,!0),{...S,skipEscape:!0})),z.toLowerCase()===v.toLowerCase()}function f(z,v){let S={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},R=Object.assign({},v),b=[],y=u(R.scheme||S.scheme);y&&y.serialize&&y.serialize(S,R),S.path!==void 0&&(R.skipEscape?S.path=unescape(S.path):(S.path=escape(S.path),S.scheme!==void 0&&(S.path=S.path.split("%3A").join(":")))),R.reference!=="suffix"&&S.scheme&&b.push(S.scheme,":");let $=n(S);if($!==void 0&&(R.reference!=="suffix"&&b.push("//"),b.push($),S.path&&S.path[0]!=="/"&&b.push("/")),S.path!==void 0){let T=S.path;!R.absolutePath&&(!y||!y.absolutePath)&&(T=o(T)),$===void 0&&T[0]==="/"&&T[1]==="/"&&(T="/%2F"+T.slice(2)),b.push(T)}return S.query!==void 0&&b.push("?",S.query),S.fragment!==void 0&&b.push("#",S.fragment),b.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(z,v){let S=Object.assign({},v),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},b=!1;S.reference==="suffix"&&(S.scheme?z=S.scheme+":"+z:z="//"+z);let y=z.match(_);if(y){if(R.scheme=y[1],R.userinfo=y[3],R.host=y[4],R.port=parseInt(y[5],10),R.path=y[6]||"",R.query=y[7],R.fragment=y[8],isNaN(R.port)&&(R.port=y[5]),R.host)if(i(R.host)===!1){let T=r(R.host);R.host=T.host.toLowerCase(),b=T.isIPV6}else b=!0;R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",S.reference&&S.reference!=="suffix"&&S.reference!==R.reference&&(R.error=R.error||"URI is not a "+S.reference+" reference.");let $=u(S.scheme||R.scheme);if(!S.unicodeSupport&&(!$||!$.unicodeSupport)&&R.host&&(S.domainHost||$&&$.domainHost)&&b===!1&&a(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(T){R.error=R.error||"Host's domain name can not be converted to ASCII: "+T}(!$||$&&!$.skipNormalize)&&(z.indexOf("%")!==-1&&(R.scheme!==void 0&&(R.scheme=unescape(R.scheme)),R.host!==void 0&&(R.host=unescape(R.host))),R.path&&(R.path=escape(unescape(R.path))),R.fragment&&(R.fragment=encodeURI(decodeURIComponent(R.fragment)))),$&&$.parse&&$.parse(R,S)}else R.error=R.error||"URI can not be parsed.";return R}let h={SCHEMES:c,normalize:l,resolve:d,resolveComponent:p,equal:g,serialize:f,parse:m};t.exports=h,t.exports.default=h,t.exports.fastUri=h}),Ix=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Tx();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),xm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=ti(),n=pn(),s=R$(),i=qu(),a=de(),c=Mu(),u=ju(),l=be(),d=kx(),p=Ix(),g=(I,A)=>new RegExp(I,A);g.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function v(I){var A,F,w,x,N,B,te,fe,se,Oe,mt,E,M,D,oe,ne,pe,Ge,et,ct,Xe,Ue,Et,rt,Xt;let Nt=I.strict,Qt=(A=I.code)===null||A===void 0?void 0:A.optimize,mr=Qt===!0||Qt===void 0?1:Qt||0,fr=(w=(F=I.code)===null||F===void 0?void 0:F.regExp)!==null&&w!==void 0?w:g,Ur=(x=I.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(B=(N=I.strictSchema)!==null&&N!==void 0?N:Nt)!==null&&B!==void 0?B:!0,strictNumbers:(fe=(te=I.strictNumbers)!==null&&te!==void 0?te:Nt)!==null&&fe!==void 0?fe:!0,strictTypes:(Oe=(se=I.strictTypes)!==null&&se!==void 0?se:Nt)!==null&&Oe!==void 0?Oe:"log",strictTuples:(E=(mt=I.strictTuples)!==null&&mt!==void 0?mt:Nt)!==null&&E!==void 0?E:"log",strictRequired:(D=(M=I.strictRequired)!==null&&M!==void 0?M:Nt)!==null&&D!==void 0?D:!1,code:I.code?{...I.code,optimize:mr,regExp:fr}:{optimize:mr,regExp:fr},loopRequired:(oe=I.loopRequired)!==null&&oe!==void 0?oe:z,loopEnum:(ne=I.loopEnum)!==null&&ne!==void 0?ne:z,meta:(pe=I.meta)!==null&&pe!==void 0?pe:!0,messages:(Ge=I.messages)!==null&&Ge!==void 0?Ge:!0,inlineRefs:(et=I.inlineRefs)!==null&&et!==void 0?et:!0,schemaId:(ct=I.schemaId)!==null&&ct!==void 0?ct:"$id",addUsedSchema:(Xe=I.addUsedSchema)!==null&&Xe!==void 0?Xe:!0,validateSchema:(Ue=I.validateSchema)!==null&&Ue!==void 0?Ue:!0,validateFormats:(Et=I.validateFormats)!==null&&Et!==void 0?Et:!0,unicodeRegExp:(rt=I.unicodeRegExp)!==null&&rt!==void 0?rt:!0,int32range:(Xt=I.int32range)!==null&&Xt!==void 0?Xt:!0,uriResolver:Ur}}var S=class{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...v(I)};let{es5:A,lines:F}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:_,es5:A,lines:F}),this.logger=L(I.logger);let w=I.validateFormats;I.validateFormats=!1,this.RULES=(0,s.getRules)(),R.call(this,m,I,"NOT SUPPORTED"),R.call(this,h,I,"DEPRECATED","warn"),this._metaOpts=C.call(this),I.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&T.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),y.call(this),I.validateFormats=w}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:I,meta:A,schemaId:F}=this.opts,w=d;F==="id"&&(w={...d},w.id=w.$id,delete w.$id),A&&I&&this.addMetaSchema(w,w[F],!1)}defaultMeta(){let{meta:I,schemaId:A}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[A]||I:void 0}validate(I,A){let F;if(typeof I=="string"){if(F=this.getSchema(I),!F)throw new Error(`no schema with key or ref "${I}"`)}else F=this.compile(I);let w=F(A);return"$async"in F||(this.errors=F.errors),w}compile(I,A){let F=this._addSchema(I,A);return F.validate||this._compileSchemaEnv(F)}compileAsync(I,A){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:F}=this.opts;return w.call(this,I,A);async function w(se,Oe){await x.call(this,se.$schema);let mt=this._addSchema(se,Oe);return mt.validate||N.call(this,mt)}async function x(se){se&&!this.getSchema(se)&&await w.call(this,{$ref:se},!0)}async function N(se){try{return this._compileSchemaEnv(se)}catch(Oe){if(!(Oe instanceof n.default))throw Oe;return B.call(this,Oe),await te.call(this,Oe.missingSchema),N.call(this,se)}}function B({missingSchema:se,missingRef:Oe}){if(this.refs[se])throw new Error(`AnySchema ${se} is loaded but ${Oe} cannot be resolved`)}async function te(se){let Oe=await fe.call(this,se);this.refs[se]||await x.call(this,Oe.$schema),this.refs[se]||this.addSchema(Oe,se,A)}async function fe(se){let Oe=this._loading[se];if(Oe)return Oe;try{return await(this._loading[se]=F(se))}finally{delete this._loading[se]}}}addSchema(I,A,F,w=this.opts.validateSchema){if(Array.isArray(I)){for(let N of I)this.addSchema(N,void 0,F,w);return this}let x;if(typeof I=="object"){let{schemaId:N}=this.opts;if(x=I[N],x!==void 0&&typeof x!="string")throw new Error(`schema ${N} must be string`)}return A=(0,c.normalizeId)(A||x),this._checkUnique(A),this.schemas[A]=this._addSchema(I,F,A,w,!0),this}addMetaSchema(I,A,F=this.opts.validateSchema){return this.addSchema(I,A,!0,F),this}validateSchema(I,A){if(typeof I=="boolean")return!0;let F;if(F=I.$schema,F!==void 0&&typeof F!="string")throw new Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let w=this.validate(F,I);if(!w&&A){let x="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(x);else throw new Error(x)}return w}getSchema(I){let A;for(;typeof(A=b.call(this,I))=="string";)I=A;if(A===void 0){let{schemaId:F}=this.opts,w=new i.SchemaEnv({schema:{},schemaId:F});if(A=i.resolveSchema.call(this,w,I),!A)return;this.refs[I]=A}return A.validate||this._compileSchemaEnv(A)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let A=b.call(this,I);return typeof A=="object"&&this._cache.delete(A.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{let A=I;this._cache.delete(A);let F=I[this.opts.schemaId];return F&&(F=(0,c.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(let A of I)this.addKeyword(A);return this}addKeyword(I,A){let F;if(typeof I=="string")F=I,typeof A=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),A.keyword=F);else if(typeof I=="object"&&A===void 0){if(A=I,F=A.keyword,Array.isArray(F)&&!F.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(G.call(this,F,A),!A)return(0,l.eachItem)(F,x=>he.call(this,x)),this;Ie.call(this,A);let w={...A,type:(0,u.getJSONTypes)(A.type),schemaType:(0,u.getJSONTypes)(A.schemaType)};return(0,l.eachItem)(F,w.type.length===0?x=>he.call(this,x,w):x=>w.type.forEach(N=>he.call(this,x,w,N))),this}getKeyword(I){let A=this.RULES.all[I];return typeof A=="object"?A.definition:!!A}removeKeyword(I){let{RULES:A}=this;delete A.keywords[I],delete A.all[I];for(let F of A.rules){let w=F.rules.findIndex(x=>x.keyword===I);w>=0&&F.rules.splice(w,1)}return this}addFormat(I,A){return typeof A=="string"&&(A=new RegExp(A)),this.formats[I]=A,this}errorsText(I=this.errors,{separator:A=", ",dataVar:F="data"}={}){return!I||I.length===0?"No errors":I.map(w=>`${F}${w.instancePath} ${w.message}`).reduce((w,x)=>w+A+x)}$dataMetaSchema(I,A){let F=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(let w of A){let x=w.split("/").slice(1),N=I;for(let B of x)N=N[B];for(let B in F){let te=F[B];if(typeof te!="object")continue;let{$data:fe}=te.definition,se=N[B];fe&&se&&(N[B]=ye(se))}}return I}_removeAllSchemas(I,A){for(let F in I){let w=I[F];(!A||A.test(F))&&(typeof w=="string"?delete I[F]:w&&!w.meta&&(this._cache.delete(w.schema),delete I[F]))}}_addSchema(I,A,F,w=this.opts.validateSchema,x=this.opts.addUsedSchema){let N,{schemaId:B}=this.opts;if(typeof I=="object")N=I[B];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(I);if(te!==void 0)return te;F=(0,c.normalizeId)(N||F);let fe=c.getSchemaRefs.call(this,I,F);return te=new i.SchemaEnv({schema:I,schemaId:B,meta:A,baseId:F,localRefs:fe}),this._cache.set(te.schema,te),x&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=te),w&&this.validateSchema(I,!0),te}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){let A=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=A}}};S.ValidationError=o.default,S.MissingRefError=n.default,e.default=S;function R(I,A,F,w="error"){for(let x in I){let N=x;N in A&&this.logger[w](`${F}: option ${x}. ${I[N]}`)}}function b(I){return I=(0,c.normalizeId)(I),this.schemas[I]||this.refs[I]}function y(){let I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(let A in I)this.addSchema(I[A],A)}function $(){for(let I in this.opts.formats){let A=this.opts.formats[I];A&&this.addFormat(I,A)}}function T(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let A in I){let F=I[A];F.keyword||(F.keyword=A),this.addKeyword(F)}}function C(){let I={...this.opts};for(let A of f)delete I[A];return I}let O={log(){},warn(){},error(){}};function L(I){if(I===!1)return O;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}let H=/^[a-z_$][a-z0-9_$:-]*$/i;function G(I,A){let{RULES:F}=this;if((0,l.eachItem)(I,w=>{if(F.keywords[w])throw new Error(`Keyword ${w} is already defined`);if(!H.test(w))throw new Error(`Keyword ${w} has invalid name`)}),!!A&&A.$data&&!("code"in A||"validate"in A))throw new Error('$data keyword must have "code" or "validate" function')}function he(I,A,F){var w;let x=A?.post;if(F&&x)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:N}=this,B=x?N.post:N.rules.find(({type:fe})=>fe===F);if(B||(B={type:F,rules:[]},N.rules.push(B)),N.keywords[I]=!0,!A)return;let te={keyword:I,definition:{...A,type:(0,u.getJSONTypes)(A.type),schemaType:(0,u.getJSONTypes)(A.schemaType)}};A.before?qe.call(this,B,te,A.before):B.rules.push(te),N.all[I]=te,(w=A.implements)===null||w===void 0||w.forEach(fe=>this.addKeyword(fe))}function qe(I,A,F){let w=I.rules.findIndex(x=>x.keyword===F);w>=0?I.rules.splice(w,0,A):(I.rules.push(A),this.logger.warn(`rule ${F} is not defined`))}function Ie(I){let{metaSchema:A}=I;A!==void 0&&(I.$data&&this.opts.$data&&(A=ye(A)),I.validateSchema=this.compile(A,!0))}let Ye={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ye(I){return{anyOf:[I,Ye]}}}),Ox=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Tm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=pn(),r=Ht(),o=de(),n=Jt(),s=qu(),i=be(),a={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:p,it:g}=l,{baseId:f,schemaEnv:_,validateName:m,opts:h,self:z}=g,{root:v}=_;if((p==="#"||p==="#/")&&f===v.baseId)return R();let S=s.resolveRef.call(z,v,f,p);if(S===void 0)throw new t.default(g.opts.uriResolver,f,p);if(S instanceof s.SchemaEnv)return b(S);return y(S);function R(){if(_===v)return u(l,m,_,_.$async);let $=d.scopeValue("root",{ref:v});return u(l,(0,o._)`${$}.validate`,v,v.$async)}function b($){u(l,c(l,$),$,$.$async)}function y($){let T=d.scopeValue("schema",h.code.source===!0?{ref:$,code:(0,o.stringify)($)}:{ref:$}),C=d.name("valid"),O=l.subschema({schema:$,dataTypes:[],schemaPath:o.nil,topSchemaRef:T,errSchemaPath:p},C);l.mergeEvaluated(O),l.ok(C)}}};function c(l,d){let{gen:p}=l;return d.validate?p.scopeValue("validate",{ref:d.validate}):(0,o._)`${p.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=c;function u(l,d,p,g){let{gen:f,it:_}=l,{allErrors:m,schemaEnv:h,opts:z}=_,v=z.passContext?n.default.this:o.nil;g?S():R();function S(){if(!h.$async)throw new Error("async schema referenced by sync schema");let $=f.let("valid");f.try(()=>{f.code((0,o._)`await ${(0,r.callValidateCode)(l,d,v)}`),y(d),m||f.assign($,!0)},T=>{f.if((0,o._)`!(${T} instanceof ${_.ValidationError})`,()=>f.throw(T)),b(T),m||f.assign($,!1)}),l.ok($)}function R(){l.result((0,r.callValidateCode)(l,d,v),()=>y(d),()=>b(d))}function b($){let T=(0,o._)`${$}.errors`;f.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${T} : ${n.default.vErrors}.concat(${T})`),f.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function y($){var T;if(!_.opts.unevaluated)return;let C=(T=p?.validate)===null||T===void 0?void 0:T.evaluated;if(_.props!==!0)if(C&&!C.dynamicProps)C.props!==void 0&&(_.props=i.mergeEvaluated.props(f,C.props,_.props));else{let O=f.var("props",(0,o._)`${$}.evaluated.props`);_.props=i.mergeEvaluated.props(f,O,_.props,o.Name)}if(_.items!==!0)if(C&&!C.dynamicItems)C.items!==void 0&&(_.items=i.mergeEvaluated.items(f,C.items,_.items));else{let O=f.var("items",(0,o._)`${$}.evaluated.items`);_.items=i.mergeEvaluated.items(f,O,_.items,o.Name)}}}e.callRef=u,e.default=a}),x$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ox(),r=Tm(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o}),Cx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:a,schemaCode:c}=s;s.fail$data((0,t._)`${a} ${o[i].fail} ${c} || isNaN(${a})`)}};e.default=n}),Nx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:a}=o,c=a.opts.multipleOfPrecision,u=n.let("res"),l=c?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r}),jx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),Ax=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=jx(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let a=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${a} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:a,schemaCode:c,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,d=u.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${a})`;s.fail$data((0,t._)`${d} ${l} ${c}`)}};e.default=n}),Mx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=be(),o=de(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s,p=d.opts.unicodeRegExp?"u":"";if(c){let{regExp:g}=d.opts.code,f=g.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,g),_=i.let("valid");i.try(()=>i.assign(_,(0,o._)`${f}(${l}, ${p}).test(${a})`),()=>i.assign(_,!1)),s.fail$data((0,o._)`!${_}`)}else{let g=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${g}.test(${a})`)}}};e.default=n}),qx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${a} ${i}`)}};e.default=r}),Zx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=be(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:a,schemaCode:c,data:u,$data:l,it:d}=s,{opts:p}=d;if(!l&&a.length===0)return;let g=a.length>=p.loopRequired;if(d.allErrors?f():_(),p.strictRequired){let z=s.parentSchema.properties,{definedProperties:v}=s.it;for(let S of a)if(z?.[S]===void 0&&!v.has(S)){let R=`required property "${S}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(d,R,d.opts.strictRequired)}}function f(){if(g||l)s.block$data(r.nil,m);else for(let z of a)(0,t.checkReportMissingProp)(s,z)}function _(){let z=i.let("missing");if(g||l){let v=i.let("valid",!0);s.block$data(v,()=>h(z,v)),s.ok(v)}else i.if((0,t.checkMissingProp)(s,a,z)),(0,t.reportMissingProp)(s,z),i.else()}function m(){i.forOf("prop",c,z=>{s.setParams({missingProperty:z}),i.if((0,t.noPropertyInData)(i,u,z,p.ownProperties),()=>s.error())})}function h(z,v){s.setParams({missingProperty:z}),i.forOf(z,c,()=>{i.assign(v,(0,t.propertyInData)(i,u,z,p.ownProperties)),i.if((0,r.not)(v),()=>{s.error(),i.break()})},r.nil)}}};e.default=n}),Lx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${a} ${i}`)}};e.default=r}),Im=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=E$();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),Dx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ju(),r=de(),o=be(),n=Im(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:a}})=>(0,r.str)`must NOT have duplicate items (items ## ${a} and ${i} are identical)`,params:({params:{i,j:a}})=>(0,r._)`{i: ${i}, j: ${a}}`},code(i){let{gen:a,data:c,$data:u,schema:l,parentSchema:d,schemaCode:p,it:g}=i;if(!u&&!l)return;let f=a.let("valid"),_=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(f,m,(0,r._)`${p} === false`),i.ok(f);function m(){let S=a.let("i",(0,r._)`${c}.length`),R=a.let("j");i.setParams({i:S,j:R}),a.assign(f,!0),a.if((0,r._)`${S} > 1`,()=>(h()?z:v)(S,R))}function h(){return _.length>0&&!_.some(S=>S==="object"||S==="array")}function z(S,R){let b=a.name("item"),y=(0,t.checkDataTypes)(_,b,g.opts.strictNumbers,t.DataType.Wrong),$=a.const("indices",(0,r._)`{}`);a.for((0,r._)`;${S}--;`,()=>{a.let(b,(0,r._)`${c}[${S}]`),a.if(y,(0,r._)`continue`),_.length>1&&a.if((0,r._)`typeof ${b} == "string"`,(0,r._)`${b} += "_"`),a.if((0,r._)`typeof ${$}[${b}] == "number"`,()=>{a.assign(R,(0,r._)`${$}[${b}]`),i.error(),a.assign(f,!1).break()}).code((0,r._)`${$}[${b}] = ${S}`)})}function v(S,R){let b=(0,o.useFunc)(a,n.default),y=a.name("outer");a.label(y).for((0,r._)`;${S}--;`,()=>a.for((0,r._)`${R} = ${S}; ${R}--;`,()=>a.if((0,r._)`${b}(${c}[${S}], ${c}[${R}])`,()=>{i.error(),a.assign(f,!1).break(y)})))}}};e.default=s}),Ux=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Im(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:a,$data:c,schemaCode:u,schema:l}=s;c||l&&typeof l=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${a}, ${u})`):s.fail((0,t._)`${l} !== ${a}`)}};e.default=n}),Fx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Im(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s;if(!c&&u.length===0)throw new Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,g,f=()=>g??(g=(0,r.useFunc)(i,o.default)),_;if(p||c)_=i.let("valid"),s.block$data(_,m);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let z=i.const("vSchema",l);_=(0,t.or)(...u.map((v,S)=>h(z,S)))}s.pass(_);function m(){i.assign(_,!1),i.forOf("v",l,z=>i.if((0,t._)`${f()}(${a}, ${z})`,()=>i.assign(_,!0).break()))}function h(z,v){let S=u[v];return typeof S=="object"&&S!==null?(0,t._)`${f()}(${a}, ${z}[${v}])`:(0,t._)`${a} === ${S}`}}};e.default=n}),T$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Cx(),r=Nx(),o=Ax(),n=Mx(),s=qx(),i=Zx(),a=Lx(),c=Dx(),u=Ux(),l=Fx(),d=[t.default,r.default,o.default,n.default,s.default,i.default,a.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d}),I$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=de(),r=be(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:a}=s,{items:c}=i;if(!Array.isArray(c)){(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,c)}};function n(s,i){let{gen:a,schema:c,data:u,keyword:l,it:d}=s;d.items=!0;let p=a.const("len",(0,t._)`${u}.length`);if(c===!1)s.setParams({len:i.length}),s.pass((0,t._)`${p} <= ${i.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(d,c)){let f=a.var("valid",(0,t._)`${p} <= ${i.length}`);a.if((0,t.not)(f),()=>g(f)),s.ok(f)}function g(f){a.forRange("i",i.length,p,_=>{s.subschema({keyword:l,dataProp:_,dataPropType:r.Type.Num},f),d.allErrors||a.if((0,t.not)(f),()=>a.break())})}}e.validateAdditionalItems=n,e.default=o}),O$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=de(),r=be(),o=Ht(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:a,it:c}=i;if(Array.isArray(a))return s(i,"additionalItems",a);c.items=!0,!(0,r.alwaysValidSchema)(c,a)&&i.ok((0,o.validateArray)(i))}};function s(i,a,c=i.schema){let{gen:u,parentSchema:l,data:d,keyword:p,it:g}=i;m(l),g.opts.unevaluated&&c.length&&g.items!==!0&&(g.items=r.mergeEvaluated.items(u,c.length,g.items));let f=u.name("valid"),_=u.const("len",(0,t._)`${d}.length`);c.forEach((h,z)=>{(0,r.alwaysValidSchema)(g,h)||(u.if((0,t._)`${_} > ${z}`,()=>i.subschema({keyword:p,schemaProp:z,dataProp:z},f)),i.ok(f))});function m(h){let{opts:z,errSchemaPath:v}=g,S=c.length,R=S===h.minItems&&(S===h.maxItems||h[a]===!1);if(z.strictTuples&&!R){let b=`"${p}" is ${S}-tuple, but minItems or maxItems/${a} are not specified or different at path "${v}"`;(0,r.checkStrictMode)(g,b,z.strictTuples)}}}e.validateTuple=s,e.default=n}),Vx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=O$(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r}),Jx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Ht(),n=I$(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:a,parentSchema:c,it:u}=i,{prefixItems:l}=c;u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&(l?(0,n.validateAdditionalItems)(i,l):i.ok((0,o.validateArray)(i)))}};e.default=s}),Hx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:a,data:c,it:u}=n,l,d,{minContains:p,maxContains:g}=a;u.opts.next?(l=p===void 0?1:p,d=g):l=1;let f=s.const("len",(0,t._)`${c}.length`);if(n.setParams({min:l,max:d}),d===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&l>d){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let v=(0,t._)`${f} >= ${l}`;d!==void 0&&(v=(0,t._)`${v} && ${f} <= ${d}`),n.pass(v);return}u.items=!0;let _=s.name("valid");d===void 0&&l===1?h(_,()=>s.if(_,()=>s.break())):l===0?(s.let(_,!0),d!==void 0&&s.if((0,t._)`${c}.length > 0`,m)):(s.let(_,!1),m()),n.result(_,()=>n.reset());function m(){let v=s.name("_valid"),S=s.let("count",0);h(v,()=>s.if(v,()=>z(S)))}function h(v,S){s.forRange("i",0,f,R=>{n.subschema({keyword:"contains",dataProp:R,dataPropType:r.Type.Num,compositeRule:!0},v),S()})}function z(v){s.code((0,t._)`${v}++`),d===void 0?s.if((0,t._)`${v} >= ${l}`,()=>s.assign(_,!0).break()):(s.if((0,t._)`${v} > ${d}`,()=>s.assign(_,!1).break()),l===1?s.assign(_,!0):s.if((0,t._)`${v} >= ${l}`,()=>s.assign(_,!0)))}}};e.default=o}),Om=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=de(),r=be(),o=Ht();e.error={message:({params:{property:c,depsCount:u,deps:l}})=>{let d=u===1?"property":"properties";return(0,t.str)`must have ${d} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:d}})=>(0,t._)`{property: ${c},
126
+ || ${T} === "boolean" || ${y} === null`).assign(C,(0,n._)`[${y}]`)}}}function g({gen:v,parentData:S,parentDataProperty:R},b){v.if((0,n._)`${S} !== undefined`,()=>v.assign((0,n._)`${S}[${R}]`,b))}function f(v,S,R,b=i.Correct){let y=b===i.Correct?n.operators.EQ:n.operators.NEQ,$;switch(v){case"null":return(0,n._)`${S} ${y} null`;case"array":$=(0,n._)`Array.isArray(${S})`;break;case"object":$=(0,n._)`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":$=T((0,n._)`!(${S} % 1) && !isNaN(${S})`);break;case"number":$=T();break;default:return(0,n._)`typeof ${S} ${y} ${v}`}return b===i.Correct?$:(0,n.not)($);function T(C=n.nil){return(0,n.and)((0,n._)`typeof ${S} == "number"`,C,R?(0,n._)`isFinite(${S})`:n.nil)}}e.checkDataType=f;function _(v,S,R,b){if(v.length===1)return f(v[0],S,R,b);let y,$=(0,s.toHash)(v);if($.array&&$.object){let T=(0,n._)`typeof ${S} != "object"`;y=$.null?T:(0,n._)`!${S} || ${T}`,delete $.null,delete $.array,delete $.object}else y=n.nil;$.number&&delete $.integer;for(let T in $)y=(0,n.and)(y,f(T,S,R,b));return y}e.checkDataTypes=_;let m={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:S})=>typeof v=="string"?(0,n._)`{type: ${v}}`:(0,n._)`{type: ${S}}`};function h(v){let S=z(v);(0,o.reportError)(S,m)}e.reportTypeError=h;function z(v){let{gen:S,data:R,schema:b}=v,y=(0,s.schemaRefOrVal)(v,b,"type");return{gen:S,keyword:"type",data:R,schema:b.type,schemaCode:y,schemaValue:y,parentSchema:b,params:{},it:v}}}),Rx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=de(),r=be();function o(s,i){let{properties:a,items:c}=s.schema;if(i==="object"&&a)for(let u in a)n(s,u,a[u].default);else i==="array"&&Array.isArray(c)&&c.forEach((u,l)=>n(s,l,u.default))}e.assignDefaults=o;function n(s,i,a){let{gen:c,compositeRule:u,data:l,opts:d}=s;if(a===void 0)return;let p=(0,t._)`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${p}`);return}let g=(0,t._)`${p} === undefined`;d.useDefaults==="empty"&&(g=(0,t._)`${g} || ${p} === null || ${p} === ""`),c.if(g,(0,t._)`${p} = ${(0,t.stringify)(a)}`)}}),Ht=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=de(),r=be(),o=Jt(),n=be();function s(v,S){let{gen:R,data:b,it:y}=v;R.if(d(R,b,S,y.opts.ownProperties),()=>{v.setParams({missingProperty:(0,t._)`${S}`},!0),v.error()})}e.checkReportMissingProp=s;function i({gen:v,data:S,it:{opts:R}},b,y){return(0,t.or)(...b.map($=>(0,t.and)(d(v,S,$,R.ownProperties),(0,t._)`${y} = ${$}`)))}e.checkMissingProp=i;function a(v,S){v.setParams({missingProperty:S},!0),v.error()}e.reportMissingProp=a;function c(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(v,S,R){return(0,t._)`${c(v)}.call(${S}, ${R})`}e.isOwnProperty=u;function l(v,S,R,b){let y=(0,t._)`${S}${(0,t.getProperty)(R)} !== undefined`;return b?(0,t._)`${y} && ${u(v,S,R)}`:y}e.propertyInData=l;function d(v,S,R,b){let y=(0,t._)`${S}${(0,t.getProperty)(R)} === undefined`;return b?(0,t.or)(y,(0,t.not)(u(v,S,R))):y}e.noPropertyInData=d;function p(v){return v?Object.keys(v).filter(S=>S!=="__proto__"):[]}e.allSchemaProperties=p;function g(v,S){return p(S).filter(R=>!(0,r.alwaysValidSchema)(v,S[R]))}e.schemaProperties=g;function f({schemaCode:v,data:S,it:{gen:R,topSchemaRef:b,schemaPath:y,errorPath:$},it:T},C,O,L){let H=L?(0,t._)`${v}, ${S}, ${b}${y}`:S,G=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,$)],[o.default.parentData,T.parentData],[o.default.parentDataProperty,T.parentDataProperty],[o.default.rootData,o.default.rootData]];T.opts.dynamicRef&&G.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let he=(0,t._)`${H}, ${R.object(...G)}`;return O!==t.nil?(0,t._)`${C}.call(${O}, ${he})`:(0,t._)`${C}(${he})`}e.callValidateCode=f;let _=(0,t._)`new RegExp`;function m({gen:v,it:{opts:S}},R){let b=S.unicodeRegExp?"u":"",{regExp:y}=S.code,$=y(R,b);return v.scopeValue("pattern",{key:$.toString(),ref:$,code:(0,t._)`${y.code==="new RegExp"?_:(0,n.useFunc)(v,y)}(${R}, ${b})`})}e.usePattern=m;function h(v){let{gen:S,data:R,keyword:b,it:y}=v,$=S.name("valid");if(y.allErrors){let C=S.let("valid",!0);return T(()=>S.assign(C,!1)),C}return S.var($,!0),T(()=>S.break()),$;function T(C){let O=S.const("len",(0,t._)`${R}.length`);S.forRange("i",0,O,L=>{v.subschema({keyword:b,dataProp:L,dataPropType:r.Type.Num},$),S.if((0,t.not)($),C)})}}e.validateArray=h;function z(v){let{gen:S,schema:R,keyword:b,it:y}=v;if(!Array.isArray(R))throw new Error("ajv implementation error");if(R.some(C=>(0,r.alwaysValidSchema)(y,C))&&!y.opts.unevaluated)return;let $=S.let("valid",!1),T=S.name("_valid");S.block(()=>R.forEach((C,O)=>{let L=v.subschema({keyword:b,schemaProp:O,compositeRule:!0},T);S.assign($,(0,t._)`${$} || ${T}`),v.mergeValidEvaluated(L,T)||S.if((0,t.not)($))})),v.result($,()=>v.reset(),()=>v.error(!0))}e.validateUnion=z}),Px=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=de(),r=Jt(),o=Ht(),n=Au();function s(g,f){let{gen:_,keyword:m,schema:h,parentSchema:z,it:v}=g,S=f.macro.call(v.self,h,z,v),R=l(_,m,S);v.opts.validateSchema!==!1&&v.self.validateSchema(S,!0);let b=_.name("valid");g.subschema({schema:S,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${m}`,topSchemaRef:R,compositeRule:!0},b),g.pass(b,()=>g.error(!0))}e.macroKeywordCode=s;function i(g,f){var _;let{gen:m,keyword:h,schema:z,parentSchema:v,$data:S,it:R}=g;u(R,f);let b=l(m,h,!S&&f.compile?f.compile.call(R.self,z,v,R):f.validate),y=m.let("valid");g.block$data(y,$),g.ok((_=f.valid)!==null&&_!==void 0?_:y);function $(){if(f.errors===!1)O(),f.modifying&&a(g),L(()=>g.error());else{let H=f.async?T():C();f.modifying&&a(g),L(()=>c(g,H))}}function T(){let H=m.let("ruleErrs",null);return m.try(()=>O((0,t._)`await `),G=>m.assign(y,!1).if((0,t._)`${G} instanceof ${R.ValidationError}`,()=>m.assign(H,(0,t._)`${G}.errors`),()=>m.throw(G))),H}function C(){let H=(0,t._)`${b}.errors`;return m.assign(H,null),O(t.nil),H}function O(H=f.async?(0,t._)`await `:t.nil){let G=R.opts.passContext?r.default.this:r.default.self,he=!("compile"in f&&!S||f.schema===!1);m.assign(y,(0,t._)`${H}${(0,o.callValidateCode)(g,b,G,he)}`,f.modifying)}function L(H){var G;m.if((0,t.not)((G=f.valid)!==null&&G!==void 0?G:y),H)}}e.funcKeywordCode=i;function a(g){let{gen:f,data:_,it:m}=g;f.if(m.parentData,()=>f.assign(_,(0,t._)`${m.parentData}[${m.parentDataProperty}]`))}function c(g,f){let{gen:_}=g;_.if((0,t._)`Array.isArray(${f})`,()=>{_.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${f} : ${r.default.vErrors}.concat(${f})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},f){if(f.async&&!g.$async)throw new Error("async keyword in sync schema")}function l(g,f,_){if(_===void 0)throw new Error(`keyword "${f}" failed to compile`);return g.scopeValue("keyword",typeof _=="function"?{ref:_}:{ref:_,code:(0,t.stringify)(_)})}function d(g,f,_=!1){return!f.length||f.some(m=>m==="array"?Array.isArray(g):m==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==m||_&&typeof g>"u")}e.validSchemaType=d;function p({schema:g,opts:f,self:_,errSchemaPath:m},h,z){if(Array.isArray(h.keyword)?!h.keyword.includes(z):h.keyword!==z)throw new Error("ajv implementation error");let v=h.dependencies;if(v?.some(S=>!Object.prototype.hasOwnProperty.call(g,S)))throw new Error(`parent schema must have dependencies of ${z}: ${v.join(",")}`);if(h.validateSchema&&!h.validateSchema(g[z])){let S=`keyword "${z}" value is invalid at path "${m}": `+_.errorsText(h.validateSchema.errors);if(f.validateSchema==="log")_.logger.error(S);else throw new Error(S)}}e.validateKeywordUsage=p}),Ex=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=de(),r=be();function o(i,{keyword:a,schemaProp:c,schema:u,schemaPath:l,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let g=i.schema[a];return c===void 0?{schema:g,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:g[c],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${a}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(l===void 0||d===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:p,errSchemaPath:d}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,a,{dataProp:c,dataPropType:u,data:l,dataTypes:d,propertyName:p}){if(l!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:g}=a;if(c!==void 0){let{errorPath:_,dataPathArr:m,opts:h}=a;f(g.let("data",(0,t._)`${a.data}${(0,t.getProperty)(c)}`,!0)),i.errorPath=(0,t.str)`${_}${(0,r.getErrorPath)(c,u,h.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${c}`,i.dataPathArr=[...m,i.parentDataProperty]}l!==void 0&&(f(l instanceof t.Name?l:g.let("data",l,!0)),p!==void 0&&(i.propertyName=p)),d&&(i.dataTypes=d);function f(_){i.data=_,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,_]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:a,jtdMetadata:c,compositeRule:u,createErrors:l,allErrors:d}){u!==void 0&&(i.compositeRule=u),l!==void 0&&(i.createErrors=l),d!==void 0&&(i.allErrors=d),i.jtdDiscriminator=a,i.jtdMetadata=c}e.extendSubschemaMode=s}),k$=U((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,a;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(a=Object.keys(o),s=a.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=s;i--!==0;){var c=a[i];if(!r(o[c],n[c]))return!1}return!0}return o!==o&&n!==n}}),kx=U((e,t)=>{var r=t.exports=function(s,i,a){typeof i=="function"&&(a=i,i={}),a=i.cb||a;var c=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};o(i,c,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function o(s,i,a,c,u,l,d,p,g,f){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,u,l,d,p,g,f);for(var _ in c){var m=c[_];if(Array.isArray(m)){if(_ in r.arrayKeywords)for(var h=0;h<m.length;h++)o(s,i,a,m[h],u+"/"+_+"/"+h,l,u,_,c,h)}else if(_ in r.propsKeywords){if(m&&typeof m=="object")for(var z in m)o(s,i,a,m[z],u+"/"+_+"/"+n(z),l,u,_,c,z)}else(_ in r.keywords||s.allKeys&&!(_ in r.skipKeywords))&&o(s,i,a,m,u+"/"+_,l,u,_,c)}a(c,u,l,d,p,g,f)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),Mu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=be(),r=k$(),o=kx(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(m,h=!0){return typeof m=="boolean"?!0:h===!0?!a(m):h?c(m)<=h:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(m){for(let h in m){if(i.has(h))return!0;let z=m[h];if(Array.isArray(z)&&z.some(a)||typeof z=="object"&&a(z))return!0}return!1}function c(m){let h=0;for(let z in m){if(z==="$ref")return 1/0;if(h++,!n.has(z)&&(typeof m[z]=="object"&&(0,t.eachItem)(m[z],v=>h+=c(v)),h===1/0))return 1/0}return h}function u(m,h="",z){return z!==!1&&(h=p(h)),l(m,m.parse(h))}e.getFullPath=u;function l(m,h){return m.serialize(h).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function p(m){return m?m.replace(d,""):""}e.normalizeId=p;function g(m,h,z){return z=p(z),m.resolve(h,z)}e.resolveUrl=g;let f=/^[a-z_][-a-z0-9._]*$/i;function _(m,h){if(typeof m=="boolean")return{};let{schemaId:z,uriResolver:v}=this.opts,S=p(m[z]||h),R={"":S},b=u(v,S,!1),y={},$=new Set;return o(m,{allKeys:!0},(O,L,H,G)=>{if(G===void 0)return;let he=b+L,qe=R[G];typeof O[z]=="string"&&(qe=Ie.call(this,O[z])),Ye.call(this,O.$anchor),Ye.call(this,O.$dynamicAnchor),R[L]=qe;function Ie(ye){let I=this.opts.uriResolver.resolve;if(ye=p(qe?I(qe,ye):ye),$.has(ye))throw C(ye);$.add(ye);let A=this.refs[ye];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?T(O,A.schema,ye):ye!==p(he)&&(ye[0]==="#"?(T(O,y[ye],ye),y[ye]=O):this.refs[ye]=he),ye}function Ye(ye){if(typeof ye=="string"){if(!f.test(ye))throw new Error(`invalid anchor "${ye}"`);Ie.call(this,`#${ye}`)}}}),y;function T(O,L,H){if(L!==void 0&&!r(O,L))throw C(H)}function C(O){return new Error(`reference "${O}" resolves to more than one schema`)}}e.getSchemaRefs=_}),dn=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=wx(),r=ju(),o=E$(),n=ju(),s=Rx(),i=Px(),a=Ex(),c=de(),u=Jt(),l=Mu(),d=be(),p=Au();function g(E){if(b(E)&&($(E),R(E))){h(E);return}f(E,()=>(0,t.topBoolOrEmptySchema)(E))}e.validateFunctionCode=g;function f({gen:E,validateName:M,schema:D,schemaEnv:oe,opts:ne},pe){ne.code.es5?E.func(M,(0,c._)`${u.default.data}, ${u.default.valCxt}`,oe.$async,()=>{E.code((0,c._)`"use strict"; ${v(D,ne)}`),m(E,ne),E.code(pe)}):E.func(M,(0,c._)`${u.default.data}, ${_(ne)}`,oe.$async,()=>E.code(v(D,ne)).code(pe))}function _(E){return(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${E.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function m(E,M){E.if(u.default.valCxt,()=>{E.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),E.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),E.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),E.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),M.dynamicRef&&E.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{E.var(u.default.instancePath,(0,c._)`""`),E.var(u.default.parentData,(0,c._)`undefined`),E.var(u.default.parentDataProperty,(0,c._)`undefined`),E.var(u.default.rootData,u.default.data),M.dynamicRef&&E.var(u.default.dynamicAnchors,(0,c._)`{}`)})}function h(E){let{schema:M,opts:D,gen:oe}=E;f(E,()=>{D.$comment&&M.$comment&&G(E),O(E),oe.let(u.default.vErrors,null),oe.let(u.default.errors,0),D.unevaluated&&z(E),T(E),he(E)})}function z(E){let{gen:M,validateName:D}=E;E.evaluated=M.const("evaluated",(0,c._)`${D}.evaluated`),M.if((0,c._)`${E.evaluated}.dynamicProps`,()=>M.assign((0,c._)`${E.evaluated}.props`,(0,c._)`undefined`)),M.if((0,c._)`${E.evaluated}.dynamicItems`,()=>M.assign((0,c._)`${E.evaluated}.items`,(0,c._)`undefined`))}function v(E,M){let D=typeof E=="object"&&E[M.schemaId];return D&&(M.code.source||M.code.process)?(0,c._)`/*# sourceURL=${D} */`:c.nil}function S(E,M){if(b(E)&&($(E),R(E))){y(E,M);return}(0,t.boolOrEmptySchema)(E,M)}function R({schema:E,self:M}){if(typeof E=="boolean")return!E;for(let D in E)if(M.RULES.all[D])return!0;return!1}function b(E){return typeof E.schema!="boolean"}function y(E,M){let{schema:D,gen:oe,opts:ne}=E;ne.$comment&&D.$comment&&G(E),L(E),H(E);let pe=oe.const("_errs",u.default.errors);T(E,pe),oe.var(M,(0,c._)`${pe} === ${u.default.errors}`)}function $(E){(0,d.checkUnknownRules)(E),C(E)}function T(E,M){if(E.opts.jtd)return Ie(E,[],!1,M);let D=(0,r.getSchemaTypes)(E.schema);Ie(E,D,!(0,r.coerceAndCheckDataType)(E,D),M)}function C(E){let{schema:M,errSchemaPath:D,opts:oe,self:ne}=E;M.$ref&&oe.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(M,ne.RULES)&&ne.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function O(E){let{schema:M,opts:D}=E;M.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,d.checkStrictMode)(E,"default is ignored in the schema root")}function L(E){let M=E.schema[E.opts.schemaId];M&&(E.baseId=(0,l.resolveUrl)(E.opts.uriResolver,E.baseId,M))}function H(E){if(E.schema.$async&&!E.schemaEnv.$async)throw new Error("async schema in sync schema")}function G({gen:E,schemaEnv:M,schema:D,errSchemaPath:oe,opts:ne}){let pe=D.$comment;if(ne.$comment===!0)E.code((0,c._)`${u.default.self}.logger.log(${pe})`);else if(typeof ne.$comment=="function"){let Ge=(0,c.str)`${oe}/$comment`,et=E.scopeValue("root",{ref:M.root});E.code((0,c._)`${u.default.self}.opts.$comment(${pe}, ${Ge}, ${et}.schema)`)}}function he(E){let{gen:M,schemaEnv:D,validateName:oe,ValidationError:ne,opts:pe}=E;D.$async?M.if((0,c._)`${u.default.errors} === 0`,()=>M.return(u.default.data),()=>M.throw((0,c._)`new ${ne}(${u.default.vErrors})`)):(M.assign((0,c._)`${oe}.errors`,u.default.vErrors),pe.unevaluated&&qe(E),M.return((0,c._)`${u.default.errors} === 0`))}function qe({gen:E,evaluated:M,props:D,items:oe}){D instanceof c.Name&&E.assign((0,c._)`${M}.props`,D),oe instanceof c.Name&&E.assign((0,c._)`${M}.items`,oe)}function Ie(E,M,D,oe){let{gen:ne,schema:pe,data:Ge,allErrors:et,opts:ct,self:Xe}=E,{RULES:Ue}=Xe;if(pe.$ref&&(ct.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(pe,Ue))){ne.block(()=>fe(E,"$ref",Ue.all.$ref.definition));return}ct.jtd||ye(E,M),ne.block(()=>{for(let rt of Ue.rules)Et(rt);Et(Ue.post)});function Et(rt){(0,o.shouldUseGroup)(pe,rt)&&(rt.type?(ne.if((0,n.checkDataType)(rt.type,Ge,ct.strictNumbers)),Ye(E,rt),M.length===1&&M[0]===rt.type&&D&&(ne.else(),(0,n.reportTypeError)(E)),ne.endIf()):Ye(E,rt),et||ne.if((0,c._)`${u.default.errors} === ${oe||0}`))}}function Ye(E,M){let{gen:D,schema:oe,opts:{useDefaults:ne}}=E;ne&&(0,s.assignDefaults)(E,M.type),D.block(()=>{for(let pe of M.rules)(0,o.shouldUseRule)(oe,pe)&&fe(E,pe.keyword,pe.definition,M.type)})}function ye(E,M){E.schemaEnv.meta||!E.opts.strictTypes||(I(E,M),E.opts.allowUnionTypes||A(E,M),F(E,E.dataTypes))}function I(E,M){if(M.length){if(!E.dataTypes.length){E.dataTypes=M;return}M.forEach(D=>{x(E.dataTypes,D)||B(E,`type "${D}" not allowed by context "${E.dataTypes.join(",")}"`)}),N(E,M)}}function A(E,M){M.length>1&&!(M.length===2&&M.includes("null"))&&B(E,"use allowUnionTypes to allow union type keyword")}function F(E,M){let D=E.self.RULES.all;for(let oe in D){let ne=D[oe];if(typeof ne=="object"&&(0,o.shouldUseRule)(E.schema,ne)){let{type:pe}=ne.definition;pe.length&&!pe.some(Ge=>w(M,Ge))&&B(E,`missing type "${pe.join(",")}" for keyword "${oe}"`)}}}function w(E,M){return E.includes(M)||M==="number"&&E.includes("integer")}function x(E,M){return E.includes(M)||M==="integer"&&E.includes("number")}function N(E,M){let D=[];for(let oe of E.dataTypes)x(M,oe)?D.push(oe):M.includes("integer")&&oe==="number"&&D.push("integer");E.dataTypes=D}function B(E,M){let D=E.schemaEnv.baseId+E.errSchemaPath;M+=` at "${D}" (strictTypes)`,(0,d.checkStrictMode)(E,M,E.opts.strictTypes)}var te=class{constructor(E,M,D){if((0,i.validateKeywordUsage)(E,M,D),this.gen=E.gen,this.allErrors=E.allErrors,this.keyword=D,this.data=E.data,this.schema=E.schema[D],this.$data=M.$data&&E.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(E,this.schema,D,this.$data),this.schemaType=M.schemaType,this.parentSchema=E.schema,this.params={},this.it=E,this.def=M,this.$data)this.schemaCode=E.gen.const("vSchema",mt(this.$data,E));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${D} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=E.gen.const("_errs",u.default.errors))}result(E,M,D){this.failResult((0,c.not)(E),M,D)}failResult(E,M,D){this.gen.if(E),D?D():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(E,M){this.failResult((0,c.not)(E),void 0,M)}fail(E){if(E===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(E),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(E){if(!this.$data)return this.fail(E);let{schemaCode:M}=this;this.fail((0,c._)`${M} !== undefined && (${(0,c.or)(this.invalid$data(),E)})`)}error(E,M,D){if(M){this.setParams(M),this._error(E,D),this.setParams({});return}this._error(E,D)}_error(E,M){(E?p.reportExtraError:p.reportError)(this,this.def.error,M)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(E){this.allErrors||this.gen.if(E)}setParams(E,M){M?Object.assign(this.params,E):this.params=E}block$data(E,M,D=c.nil){this.gen.block(()=>{this.check$data(E,D),M()})}check$data(E=c.nil,M=c.nil){if(!this.$data)return;let{gen:D,schemaCode:oe,schemaType:ne,def:pe}=this;D.if((0,c.or)((0,c._)`${oe} === undefined`,M)),E!==c.nil&&D.assign(E,!0),(ne.length||pe.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),E!==c.nil&&D.assign(E,!1)),D.else()}invalid$data(){let{gen:E,schemaCode:M,schemaType:D,def:oe,it:ne}=this;return(0,c.or)(pe(),Ge());function pe(){if(D.length){if(!(M instanceof c.Name))throw new Error("ajv implementation error");let et=Array.isArray(D)?D:[D];return(0,c._)`${(0,n.checkDataTypes)(et,M,ne.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}function Ge(){if(oe.validateSchema){let et=E.scopeValue("validate$data",{ref:oe.validateSchema});return(0,c._)`!${et}(${M})`}return c.nil}}subschema(E,M){let D=(0,a.getSubschema)(this.it,E);(0,a.extendSubschemaData)(D,this.it,E),(0,a.extendSubschemaMode)(D,E);let oe={...this.it,...D,items:void 0,props:void 0};return S(oe,M),oe}mergeEvaluated(E,M){let{it:D,gen:oe}=this;D.opts.unevaluated&&(D.props!==!0&&E.props!==void 0&&(D.props=d.mergeEvaluated.props(oe,E.props,D.props,M)),D.items!==!0&&E.items!==void 0&&(D.items=d.mergeEvaluated.items(oe,E.items,D.items,M)))}mergeValidEvaluated(E,M){let{it:D,gen:oe}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return oe.if(M,()=>this.mergeEvaluated(E,c.Name)),!0}};e.KeywordCxt=te;function fe(E,M,D,oe){let ne=new te(E,D,M);"code"in D?D.code(ne,oe):ne.$data&&D.validate?(0,i.funcKeywordCode)(ne,D):"macro"in D?(0,i.macroKeywordCode)(ne,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(ne,D)}let se=/^\/(?:[^~]|~0|~1)*$/,Oe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mt(E,{dataLevel:M,dataNames:D,dataPathArr:oe}){let ne,pe;if(E==="")return u.default.rootData;if(E[0]==="/"){if(!se.test(E))throw new Error(`Invalid JSON-pointer: ${E}`);ne=E,pe=u.default.rootData}else{let Xe=Oe.exec(E);if(!Xe)throw new Error(`Invalid JSON-pointer: ${E}`);let Ue=+Xe[1];if(ne=Xe[2],ne==="#"){if(Ue>=M)throw new Error(ct("property/index",Ue));return oe[M-Ue]}if(Ue>M)throw new Error(ct("data",Ue));if(pe=D[M-Ue],!ne)return pe}let Ge=pe,et=ne.split("/");for(let Xe of et)Xe&&(pe=(0,c._)`${pe}${(0,c.getProperty)((0,d.unescapeJsonPointer)(Xe))}`,Ge=(0,c._)`${Ge} && ${pe}`);return Ge;function ct(Xe,Ue){return`Cannot access ${Xe} ${Ue} levels up, current level is ${M}`}}e.getData=mt}),ti=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t}),pn=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Mu();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r}),qu=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=de(),r=ti(),o=Jt(),n=Mu(),s=be(),i=dn();var a=class{constructor(h){var z;this.refs={},this.dynamicAnchors={};let v;typeof h.schema=="object"&&(v=h.schema),this.schema=h.schema,this.schemaId=h.schemaId,this.root=h.root||this,this.baseId=(z=h.baseId)!==null&&z!==void 0?z:(0,n.normalizeId)(v?.[h.schemaId||"$id"]),this.schemaPath=h.schemaPath,this.localRefs=h.localRefs,this.meta=h.meta,this.$async=v?.$async,this.refs={}}};e.SchemaEnv=a;function c(h){let z=d.call(this,h);if(z)return z;let v=(0,n.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:S,lines:R}=this.opts.code,{ownProperties:b}=this.opts,y=new t.CodeGen(this.scope,{es5:S,lines:R,ownProperties:b}),$;h.$async&&($=y.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let T=y.scopeName("validate");h.validateName=T;let C={gen:y,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,t.stringify)(h.schema)}:{ref:h.schema}),validateName:T,ValidationError:$,schema:h.schema,schemaEnv:h,rootId:v,baseId:h.baseId||v,schemaPath:t.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},O;try{this._compilations.add(h),(0,i.validateFunctionCode)(C),y.optimize(this.opts.code.optimize);let L=y.toString();O=`${y.scopeRefs(o.default.scope)}return ${L}`,this.opts.code.process&&(O=this.opts.code.process(O,h));let H=new Function(`${o.default.self}`,`${o.default.scope}`,O)(this,this.scope.get());if(this.scope.value(T,{ref:H}),H.errors=null,H.schema=h.schema,H.schemaEnv=h,h.$async&&(H.$async=!0),this.opts.code.source===!0&&(H.source={validateName:T,validateCode:L,scopeValues:y._values}),this.opts.unevaluated){let{props:G,items:he}=C;H.evaluated={props:G instanceof t.Name?void 0:G,items:he instanceof t.Name?void 0:he,dynamicProps:G instanceof t.Name,dynamicItems:he instanceof t.Name},H.source&&(H.source.evaluated=(0,t.stringify)(H.evaluated))}return h.validate=H,h}catch(L){throw delete h.validate,delete h.validateName,O&&this.logger.error("Error compiling schema, function code:",O),L}finally{this._compilations.delete(h)}}e.compileSchema=c;function u(h,z,v){var S;v=(0,n.resolveUrl)(this.opts.uriResolver,z,v);let R=h.refs[v];if(R)return R;let b=g.call(this,h,v);if(b===void 0){let y=(S=h.localRefs)===null||S===void 0?void 0:S[v],{schemaId:$}=this.opts;y&&(b=new a({schema:y,schemaId:$,root:h,baseId:z}))}if(b!==void 0)return h.refs[v]=l.call(this,b)}e.resolveRef=u;function l(h){return(0,n.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:c.call(this,h)}function d(h){for(let z of this._compilations)if(p(z,h))return z}e.getCompilingSchema=d;function p(h,z){return h.schema===z.schema&&h.root===z.root&&h.baseId===z.baseId}function g(h,z){let v;for(;typeof(v=this.refs[z])=="string";)z=v;return v||this.schemas[z]||f.call(this,h,z)}function f(h,z){let v=this.opts.uriResolver.parse(z),S=(0,n._getFullPath)(this.opts.uriResolver,v),R=(0,n.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&S===R)return m.call(this,v,h);let b=(0,n.normalizeId)(S),y=this.refs[b]||this.schemas[b];if(typeof y=="string"){let $=f.call(this,h,y);return typeof $?.schema!="object"?void 0:m.call(this,v,$)}if(typeof y?.schema=="object"){if(y.validate||c.call(this,y),b===(0,n.normalizeId)(z)){let{schema:$}=y,{schemaId:T}=this.opts,C=$[T];return C&&(R=(0,n.resolveUrl)(this.opts.uriResolver,R,C)),new a({schema:$,schemaId:T,root:h,baseId:R})}return m.call(this,v,y)}}e.resolveSchema=f;let _=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(h,{baseId:z,schema:v,root:S}){var R;if(((R=h.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let $ of h.fragment.slice(1).split("/")){if(typeof v=="boolean")return;let T=v[(0,s.unescapeFragment)($)];if(T===void 0)return;v=T;let C=typeof v=="object"&&v[this.opts.schemaId];!_.has($)&&C&&(z=(0,n.resolveUrl)(this.opts.uriResolver,z,C))}let b;if(typeof v!="boolean"&&v.$ref&&!(0,s.schemaHasRulesButRef)(v,this.RULES)){let $=(0,n.resolveUrl)(this.opts.uriResolver,z,v.$ref);b=f.call(this,S,$)}let{schemaId:y}=this.opts;if(b=b||new a({schema:v,schemaId:y,root:S,baseId:z}),b.schema!==b.root.schema)return b}}),xx=U((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),x$=U((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(f){let _="",m=0,h=0;for(h=0;h<f.length;h++)if(m=f[h].charCodeAt(0),m!==48){if(!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";_+=f[h];break}for(h+=1;h<f.length;h++){if(m=f[h].charCodeAt(0),!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";_+=f[h]}return _}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(f){return f.length=0,!0}function a(f,_,m){if(f.length){let h=n(f);if(h!=="")_.push(h);else return m.error=!0,!1;f.length=0}return!0}function c(f){let _=0,m={error:!1,address:"",zone:""},h=[],z=[],v=!1,S=!1,R=a;for(let b=0;b<f.length;b++){let y=f[b];if(!(y==="["||y==="]"))if(y===":"){if(v===!0&&(S=!0),!R(z,h,m))break;if(++_>7){m.error=!0;break}b>0&&f[b-1]===":"&&(v=!0),h.push(":");continue}else if(y==="%"){if(!R(z,h,m))break;R=i}else{z.push(y);continue}}return z.length&&(R===i?m.zone=z.join(""):S?h.push(z.join("")):h.push(n(z))),m.address=h.join(""),m}function u(f){if(l(f,":")<2)return{host:f,isIPV6:!1};let _=c(f);if(_.error)return{host:f,isIPV6:!1};{let m=_.address,h=_.address;return _.zone&&(m+="%"+_.zone,h+="%25"+_.zone),{host:m,isIPV6:!0,escapedHost:h}}}function l(f,_){let m=0;for(let h=0;h<f.length;h++)f[h]===_&&m++;return m}function d(f){let _=f,m=[],h=-1,z=0;for(;z=_.length;){if(z===1){if(_===".")break;if(_==="/"){m.push("/");break}else{m.push(_);break}}else if(z===2){if(_[0]==="."){if(_[1]===".")break;if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&(_[1]==="."||_[1]==="/")){m.push("/");break}}else if(z===3&&_==="/.."){m.length!==0&&m.pop(),m.push("/");break}if(_[0]==="."){if(_[1]==="."){if(_[2]==="/"){_=_.slice(3);continue}}else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&_[1]==="."){if(_[2]==="/"){_=_.slice(2);continue}else if(_[2]==="."&&_[3]==="/"){_=_.slice(3),m.length!==0&&m.pop();continue}}if((h=_.indexOf("/",1))===-1){m.push(_);break}else m.push(_.slice(0,h)),_=_.slice(h)}return m.join("")}function p(f,_){let m=_!==!0?escape:unescape;return f.scheme!==void 0&&(f.scheme=m(f.scheme)),f.userinfo!==void 0&&(f.userinfo=m(f.userinfo)),f.host!==void 0&&(f.host=m(f.host)),f.path!==void 0&&(f.path=m(f.path)),f.query!==void 0&&(f.query=m(f.query)),f.fragment!==void 0&&(f.fragment=m(f.fragment)),f}function g(f){let _=[];if(f.userinfo!==void 0&&(_.push(f.userinfo),_.push("@")),f.host!==void 0){let m=unescape(f.host);if(!o(m)){let h=u(m);h.isIPV6===!0?m=`[${h.escapedHost}]`:m=f.host}_.push(m)}return(typeof f.port=="number"||typeof f.port=="string")&&(_.push(":"),_.push(String(f.port))),_.length?_.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:g,normalizeComponentEncoding:p,removeDotSegments:d,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}}),Tx=U((e,t)=>{let{isUUID:r}=x$(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(y){return n.indexOf(y)!==-1}function i(y){return y.secure===!0?!0:y.secure===!1?!1:y.scheme?y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S"):!1}function a(y){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y}function c(y){let $=String(y.scheme).toLowerCase()==="https";return(y.port===($?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}function u(y){return y.secure=i(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function l(y){if((y.port===(i(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){let[$,T]=y.resourceName.split("?");y.path=$&&$!=="/"?$:void 0,y.query=T,y.resourceName=void 0}return y.fragment=void 0,y}function d(y,$){if(!y.path)return y.error="URN can not be parsed",y;let T=y.path.match(o);if(T){let C=$.scheme||y.scheme||"urn";y.nid=T[1].toLowerCase(),y.nss=T[2];let O=b(`${C}:${$.nid||y.nid}`);y.path=void 0,O&&(y=O.parse(y,$))}else y.error=y.error||"URN can not be parsed.";return y}function p(y,$){if(y.nid===void 0)throw new Error("URN without nid cannot be serialized");let T=$.scheme||y.scheme||"urn",C=y.nid.toLowerCase(),O=b(`${T}:${$.nid||C}`);O&&(y=O.serialize(y,$));let L=y,H=y.nss;return L.path=`${C||$.nid}:${H}`,$.skipEscape=!0,L}function g(y,$){let T=y;return T.uuid=T.nss,T.nss=void 0,!$.tolerant&&(!T.uuid||!r(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function f(y){let $=y;return $.nss=(y.uuid||"").toLowerCase(),$}let _={scheme:"http",domainHost:!0,parse:a,serialize:c},m={scheme:"https",domainHost:_.domainHost,parse:a,serialize:c},h={scheme:"ws",domainHost:!0,parse:u,serialize:l},z={scheme:"wss",domainHost:h.domainHost,parse:h.parse,serialize:h.serialize},R={http:_,https:m,ws:h,wss:z,urn:{scheme:"urn",parse:d,serialize:p,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:g,serialize:f,skipNormalize:!0}};Object.setPrototypeOf(R,null);function b(y){return y&&(R[y]||R[y.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:R,isValidSchemeName:s,getSchemeHandler:b}}),Ix=U((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=x$(),{SCHEMES:c,getSchemeHandler:u}=Tx();function l(z,v){return typeof z=="string"?z=f(m(z,v),v):typeof z=="object"&&(z=m(f(z,v),v)),z}function d(z,v,S){let R=S?Object.assign({scheme:"null"},S):{scheme:"null"},b=p(m(z,R),m(v,R),R,!0);return R.skipEscape=!0,f(b,R)}function p(z,v,S,R){let b={};return R||(z=m(f(z,S),S),v=m(f(v,S),S)),S=S||{},!S.tolerant&&v.scheme?(b.scheme=v.scheme,b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.path?(v.path[0]==="/"?b.path=o(v.path):((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path?b.path="/"+v.path:z.path?b.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+v.path:b.path=v.path,b.path=o(b.path)),b.query=v.query):(b.path=z.path,v.query!==void 0?b.query=v.query:b.query=z.query),b.userinfo=z.userinfo,b.host=z.host,b.port=z.port),b.scheme=z.scheme),b.fragment=v.fragment,b}function g(z,v,S){return typeof z=="string"?(z=unescape(z),z=f(s(m(z,S),!0),{...S,skipEscape:!0})):typeof z=="object"&&(z=f(s(z,!0),{...S,skipEscape:!0})),typeof v=="string"?(v=unescape(v),v=f(s(m(v,S),!0),{...S,skipEscape:!0})):typeof v=="object"&&(v=f(s(v,!0),{...S,skipEscape:!0})),z.toLowerCase()===v.toLowerCase()}function f(z,v){let S={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},R=Object.assign({},v),b=[],y=u(R.scheme||S.scheme);y&&y.serialize&&y.serialize(S,R),S.path!==void 0&&(R.skipEscape?S.path=unescape(S.path):(S.path=escape(S.path),S.scheme!==void 0&&(S.path=S.path.split("%3A").join(":")))),R.reference!=="suffix"&&S.scheme&&b.push(S.scheme,":");let $=n(S);if($!==void 0&&(R.reference!=="suffix"&&b.push("//"),b.push($),S.path&&S.path[0]!=="/"&&b.push("/")),S.path!==void 0){let T=S.path;!R.absolutePath&&(!y||!y.absolutePath)&&(T=o(T)),$===void 0&&T[0]==="/"&&T[1]==="/"&&(T="/%2F"+T.slice(2)),b.push(T)}return S.query!==void 0&&b.push("?",S.query),S.fragment!==void 0&&b.push("#",S.fragment),b.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(z,v){let S=Object.assign({},v),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},b=!1;S.reference==="suffix"&&(S.scheme?z=S.scheme+":"+z:z="//"+z);let y=z.match(_);if(y){if(R.scheme=y[1],R.userinfo=y[3],R.host=y[4],R.port=parseInt(y[5],10),R.path=y[6]||"",R.query=y[7],R.fragment=y[8],isNaN(R.port)&&(R.port=y[5]),R.host)if(i(R.host)===!1){let T=r(R.host);R.host=T.host.toLowerCase(),b=T.isIPV6}else b=!0;R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",S.reference&&S.reference!=="suffix"&&S.reference!==R.reference&&(R.error=R.error||"URI is not a "+S.reference+" reference.");let $=u(S.scheme||R.scheme);if(!S.unicodeSupport&&(!$||!$.unicodeSupport)&&R.host&&(S.domainHost||$&&$.domainHost)&&b===!1&&a(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(T){R.error=R.error||"Host's domain name can not be converted to ASCII: "+T}(!$||$&&!$.skipNormalize)&&(z.indexOf("%")!==-1&&(R.scheme!==void 0&&(R.scheme=unescape(R.scheme)),R.host!==void 0&&(R.host=unescape(R.host))),R.path&&(R.path=escape(unescape(R.path))),R.fragment&&(R.fragment=encodeURI(decodeURIComponent(R.fragment)))),$&&$.parse&&$.parse(R,S)}else R.error=R.error||"URI can not be parsed.";return R}let h={SCHEMES:c,normalize:l,resolve:d,resolveComponent:p,equal:g,serialize:f,parse:m};t.exports=h,t.exports.default=h,t.exports.fastUri=h}),Ox=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ix();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),xm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=ti(),n=pn(),s=P$(),i=qu(),a=de(),c=Mu(),u=ju(),l=be(),d=xx(),p=Ox(),g=(I,A)=>new RegExp(I,A);g.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function v(I){var A,F,w,x,N,B,te,fe,se,Oe,mt,E,M,D,oe,ne,pe,Ge,et,ct,Xe,Ue,Et,rt,Xt;let Nt=I.strict,Qt=(A=I.code)===null||A===void 0?void 0:A.optimize,mr=Qt===!0||Qt===void 0?1:Qt||0,fr=(w=(F=I.code)===null||F===void 0?void 0:F.regExp)!==null&&w!==void 0?w:g,Ur=(x=I.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(B=(N=I.strictSchema)!==null&&N!==void 0?N:Nt)!==null&&B!==void 0?B:!0,strictNumbers:(fe=(te=I.strictNumbers)!==null&&te!==void 0?te:Nt)!==null&&fe!==void 0?fe:!0,strictTypes:(Oe=(se=I.strictTypes)!==null&&se!==void 0?se:Nt)!==null&&Oe!==void 0?Oe:"log",strictTuples:(E=(mt=I.strictTuples)!==null&&mt!==void 0?mt:Nt)!==null&&E!==void 0?E:"log",strictRequired:(D=(M=I.strictRequired)!==null&&M!==void 0?M:Nt)!==null&&D!==void 0?D:!1,code:I.code?{...I.code,optimize:mr,regExp:fr}:{optimize:mr,regExp:fr},loopRequired:(oe=I.loopRequired)!==null&&oe!==void 0?oe:z,loopEnum:(ne=I.loopEnum)!==null&&ne!==void 0?ne:z,meta:(pe=I.meta)!==null&&pe!==void 0?pe:!0,messages:(Ge=I.messages)!==null&&Ge!==void 0?Ge:!0,inlineRefs:(et=I.inlineRefs)!==null&&et!==void 0?et:!0,schemaId:(ct=I.schemaId)!==null&&ct!==void 0?ct:"$id",addUsedSchema:(Xe=I.addUsedSchema)!==null&&Xe!==void 0?Xe:!0,validateSchema:(Ue=I.validateSchema)!==null&&Ue!==void 0?Ue:!0,validateFormats:(Et=I.validateFormats)!==null&&Et!==void 0?Et:!0,unicodeRegExp:(rt=I.unicodeRegExp)!==null&&rt!==void 0?rt:!0,int32range:(Xt=I.int32range)!==null&&Xt!==void 0?Xt:!0,uriResolver:Ur}}var S=class{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...v(I)};let{es5:A,lines:F}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:_,es5:A,lines:F}),this.logger=L(I.logger);let w=I.validateFormats;I.validateFormats=!1,this.RULES=(0,s.getRules)(),R.call(this,m,I,"NOT SUPPORTED"),R.call(this,h,I,"DEPRECATED","warn"),this._metaOpts=C.call(this),I.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&T.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),y.call(this),I.validateFormats=w}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:I,meta:A,schemaId:F}=this.opts,w=d;F==="id"&&(w={...d},w.id=w.$id,delete w.$id),A&&I&&this.addMetaSchema(w,w[F],!1)}defaultMeta(){let{meta:I,schemaId:A}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[A]||I:void 0}validate(I,A){let F;if(typeof I=="string"){if(F=this.getSchema(I),!F)throw new Error(`no schema with key or ref "${I}"`)}else F=this.compile(I);let w=F(A);return"$async"in F||(this.errors=F.errors),w}compile(I,A){let F=this._addSchema(I,A);return F.validate||this._compileSchemaEnv(F)}compileAsync(I,A){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:F}=this.opts;return w.call(this,I,A);async function w(se,Oe){await x.call(this,se.$schema);let mt=this._addSchema(se,Oe);return mt.validate||N.call(this,mt)}async function x(se){se&&!this.getSchema(se)&&await w.call(this,{$ref:se},!0)}async function N(se){try{return this._compileSchemaEnv(se)}catch(Oe){if(!(Oe instanceof n.default))throw Oe;return B.call(this,Oe),await te.call(this,Oe.missingSchema),N.call(this,se)}}function B({missingSchema:se,missingRef:Oe}){if(this.refs[se])throw new Error(`AnySchema ${se} is loaded but ${Oe} cannot be resolved`)}async function te(se){let Oe=await fe.call(this,se);this.refs[se]||await x.call(this,Oe.$schema),this.refs[se]||this.addSchema(Oe,se,A)}async function fe(se){let Oe=this._loading[se];if(Oe)return Oe;try{return await(this._loading[se]=F(se))}finally{delete this._loading[se]}}}addSchema(I,A,F,w=this.opts.validateSchema){if(Array.isArray(I)){for(let N of I)this.addSchema(N,void 0,F,w);return this}let x;if(typeof I=="object"){let{schemaId:N}=this.opts;if(x=I[N],x!==void 0&&typeof x!="string")throw new Error(`schema ${N} must be string`)}return A=(0,c.normalizeId)(A||x),this._checkUnique(A),this.schemas[A]=this._addSchema(I,F,A,w,!0),this}addMetaSchema(I,A,F=this.opts.validateSchema){return this.addSchema(I,A,!0,F),this}validateSchema(I,A){if(typeof I=="boolean")return!0;let F;if(F=I.$schema,F!==void 0&&typeof F!="string")throw new Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let w=this.validate(F,I);if(!w&&A){let x="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(x);else throw new Error(x)}return w}getSchema(I){let A;for(;typeof(A=b.call(this,I))=="string";)I=A;if(A===void 0){let{schemaId:F}=this.opts,w=new i.SchemaEnv({schema:{},schemaId:F});if(A=i.resolveSchema.call(this,w,I),!A)return;this.refs[I]=A}return A.validate||this._compileSchemaEnv(A)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let A=b.call(this,I);return typeof A=="object"&&this._cache.delete(A.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{let A=I;this._cache.delete(A);let F=I[this.opts.schemaId];return F&&(F=(0,c.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(let A of I)this.addKeyword(A);return this}addKeyword(I,A){let F;if(typeof I=="string")F=I,typeof A=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),A.keyword=F);else if(typeof I=="object"&&A===void 0){if(A=I,F=A.keyword,Array.isArray(F)&&!F.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(G.call(this,F,A),!A)return(0,l.eachItem)(F,x=>he.call(this,x)),this;Ie.call(this,A);let w={...A,type:(0,u.getJSONTypes)(A.type),schemaType:(0,u.getJSONTypes)(A.schemaType)};return(0,l.eachItem)(F,w.type.length===0?x=>he.call(this,x,w):x=>w.type.forEach(N=>he.call(this,x,w,N))),this}getKeyword(I){let A=this.RULES.all[I];return typeof A=="object"?A.definition:!!A}removeKeyword(I){let{RULES:A}=this;delete A.keywords[I],delete A.all[I];for(let F of A.rules){let w=F.rules.findIndex(x=>x.keyword===I);w>=0&&F.rules.splice(w,1)}return this}addFormat(I,A){return typeof A=="string"&&(A=new RegExp(A)),this.formats[I]=A,this}errorsText(I=this.errors,{separator:A=", ",dataVar:F="data"}={}){return!I||I.length===0?"No errors":I.map(w=>`${F}${w.instancePath} ${w.message}`).reduce((w,x)=>w+A+x)}$dataMetaSchema(I,A){let F=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(let w of A){let x=w.split("/").slice(1),N=I;for(let B of x)N=N[B];for(let B in F){let te=F[B];if(typeof te!="object")continue;let{$data:fe}=te.definition,se=N[B];fe&&se&&(N[B]=ye(se))}}return I}_removeAllSchemas(I,A){for(let F in I){let w=I[F];(!A||A.test(F))&&(typeof w=="string"?delete I[F]:w&&!w.meta&&(this._cache.delete(w.schema),delete I[F]))}}_addSchema(I,A,F,w=this.opts.validateSchema,x=this.opts.addUsedSchema){let N,{schemaId:B}=this.opts;if(typeof I=="object")N=I[B];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(I);if(te!==void 0)return te;F=(0,c.normalizeId)(N||F);let fe=c.getSchemaRefs.call(this,I,F);return te=new i.SchemaEnv({schema:I,schemaId:B,meta:A,baseId:F,localRefs:fe}),this._cache.set(te.schema,te),x&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=te),w&&this.validateSchema(I,!0),te}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){let A=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=A}}};S.ValidationError=o.default,S.MissingRefError=n.default,e.default=S;function R(I,A,F,w="error"){for(let x in I){let N=x;N in A&&this.logger[w](`${F}: option ${x}. ${I[N]}`)}}function b(I){return I=(0,c.normalizeId)(I),this.schemas[I]||this.refs[I]}function y(){let I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(let A in I)this.addSchema(I[A],A)}function $(){for(let I in this.opts.formats){let A=this.opts.formats[I];A&&this.addFormat(I,A)}}function T(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let A in I){let F=I[A];F.keyword||(F.keyword=A),this.addKeyword(F)}}function C(){let I={...this.opts};for(let A of f)delete I[A];return I}let O={log(){},warn(){},error(){}};function L(I){if(I===!1)return O;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}let H=/^[a-z_$][a-z0-9_$:-]*$/i;function G(I,A){let{RULES:F}=this;if((0,l.eachItem)(I,w=>{if(F.keywords[w])throw new Error(`Keyword ${w} is already defined`);if(!H.test(w))throw new Error(`Keyword ${w} has invalid name`)}),!!A&&A.$data&&!("code"in A||"validate"in A))throw new Error('$data keyword must have "code" or "validate" function')}function he(I,A,F){var w;let x=A?.post;if(F&&x)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:N}=this,B=x?N.post:N.rules.find(({type:fe})=>fe===F);if(B||(B={type:F,rules:[]},N.rules.push(B)),N.keywords[I]=!0,!A)return;let te={keyword:I,definition:{...A,type:(0,u.getJSONTypes)(A.type),schemaType:(0,u.getJSONTypes)(A.schemaType)}};A.before?qe.call(this,B,te,A.before):B.rules.push(te),N.all[I]=te,(w=A.implements)===null||w===void 0||w.forEach(fe=>this.addKeyword(fe))}function qe(I,A,F){let w=I.rules.findIndex(x=>x.keyword===F);w>=0?I.rules.splice(w,0,A):(I.rules.push(A),this.logger.warn(`rule ${F} is not defined`))}function Ie(I){let{metaSchema:A}=I;A!==void 0&&(I.$data&&this.opts.$data&&(A=ye(A)),I.validateSchema=this.compile(A,!0))}let Ye={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ye(I){return{anyOf:[I,Ye]}}}),Cx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Tm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=pn(),r=Ht(),o=de(),n=Jt(),s=qu(),i=be(),a={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:p,it:g}=l,{baseId:f,schemaEnv:_,validateName:m,opts:h,self:z}=g,{root:v}=_;if((p==="#"||p==="#/")&&f===v.baseId)return R();let S=s.resolveRef.call(z,v,f,p);if(S===void 0)throw new t.default(g.opts.uriResolver,f,p);if(S instanceof s.SchemaEnv)return b(S);return y(S);function R(){if(_===v)return u(l,m,_,_.$async);let $=d.scopeValue("root",{ref:v});return u(l,(0,o._)`${$}.validate`,v,v.$async)}function b($){u(l,c(l,$),$,$.$async)}function y($){let T=d.scopeValue("schema",h.code.source===!0?{ref:$,code:(0,o.stringify)($)}:{ref:$}),C=d.name("valid"),O=l.subschema({schema:$,dataTypes:[],schemaPath:o.nil,topSchemaRef:T,errSchemaPath:p},C);l.mergeEvaluated(O),l.ok(C)}}};function c(l,d){let{gen:p}=l;return d.validate?p.scopeValue("validate",{ref:d.validate}):(0,o._)`${p.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=c;function u(l,d,p,g){let{gen:f,it:_}=l,{allErrors:m,schemaEnv:h,opts:z}=_,v=z.passContext?n.default.this:o.nil;g?S():R();function S(){if(!h.$async)throw new Error("async schema referenced by sync schema");let $=f.let("valid");f.try(()=>{f.code((0,o._)`await ${(0,r.callValidateCode)(l,d,v)}`),y(d),m||f.assign($,!0)},T=>{f.if((0,o._)`!(${T} instanceof ${_.ValidationError})`,()=>f.throw(T)),b(T),m||f.assign($,!1)}),l.ok($)}function R(){l.result((0,r.callValidateCode)(l,d,v),()=>y(d),()=>b(d))}function b($){let T=(0,o._)`${$}.errors`;f.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${T} : ${n.default.vErrors}.concat(${T})`),f.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function y($){var T;if(!_.opts.unevaluated)return;let C=(T=p?.validate)===null||T===void 0?void 0:T.evaluated;if(_.props!==!0)if(C&&!C.dynamicProps)C.props!==void 0&&(_.props=i.mergeEvaluated.props(f,C.props,_.props));else{let O=f.var("props",(0,o._)`${$}.evaluated.props`);_.props=i.mergeEvaluated.props(f,O,_.props,o.Name)}if(_.items!==!0)if(C&&!C.dynamicItems)C.items!==void 0&&(_.items=i.mergeEvaluated.items(f,C.items,_.items));else{let O=f.var("items",(0,o._)`${$}.evaluated.items`);_.items=i.mergeEvaluated.items(f,O,_.items,o.Name)}}}e.callRef=u,e.default=a}),T$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Cx(),r=Tm(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o}),Nx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:a,schemaCode:c}=s;s.fail$data((0,t._)`${a} ${o[i].fail} ${c} || isNaN(${a})`)}};e.default=n}),jx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:a}=o,c=a.opts.multipleOfPrecision,u=n.let("res"),l=c?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r}),Ax=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),Mx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Ax(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let a=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${a} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:a,schemaCode:c,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,d=u.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${a})`;s.fail$data((0,t._)`${d} ${l} ${c}`)}};e.default=n}),qx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=be(),o=de(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s,p=d.opts.unicodeRegExp?"u":"";if(c){let{regExp:g}=d.opts.code,f=g.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,g),_=i.let("valid");i.try(()=>i.assign(_,(0,o._)`${f}(${l}, ${p}).test(${a})`),()=>i.assign(_,!1)),s.fail$data((0,o._)`!${_}`)}else{let g=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${g}.test(${a})`)}}};e.default=n}),Zx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${a} ${i}`)}};e.default=r}),Lx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=be(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:a,schemaCode:c,data:u,$data:l,it:d}=s,{opts:p}=d;if(!l&&a.length===0)return;let g=a.length>=p.loopRequired;if(d.allErrors?f():_(),p.strictRequired){let z=s.parentSchema.properties,{definedProperties:v}=s.it;for(let S of a)if(z?.[S]===void 0&&!v.has(S)){let R=`required property "${S}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(d,R,d.opts.strictRequired)}}function f(){if(g||l)s.block$data(r.nil,m);else for(let z of a)(0,t.checkReportMissingProp)(s,z)}function _(){let z=i.let("missing");if(g||l){let v=i.let("valid",!0);s.block$data(v,()=>h(z,v)),s.ok(v)}else i.if((0,t.checkMissingProp)(s,a,z)),(0,t.reportMissingProp)(s,z),i.else()}function m(){i.forOf("prop",c,z=>{s.setParams({missingProperty:z}),i.if((0,t.noPropertyInData)(i,u,z,p.ownProperties),()=>s.error())})}function h(z,v){s.setParams({missingProperty:z}),i.forOf(z,c,()=>{i.assign(v,(0,t.propertyInData)(i,u,z,p.ownProperties)),i.if((0,r.not)(v),()=>{s.error(),i.break()})},r.nil)}}};e.default=n}),Dx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${a} ${i}`)}};e.default=r}),Im=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=k$();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),Ux=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ju(),r=de(),o=be(),n=Im(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:a}})=>(0,r.str)`must NOT have duplicate items (items ## ${a} and ${i} are identical)`,params:({params:{i,j:a}})=>(0,r._)`{i: ${i}, j: ${a}}`},code(i){let{gen:a,data:c,$data:u,schema:l,parentSchema:d,schemaCode:p,it:g}=i;if(!u&&!l)return;let f=a.let("valid"),_=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(f,m,(0,r._)`${p} === false`),i.ok(f);function m(){let S=a.let("i",(0,r._)`${c}.length`),R=a.let("j");i.setParams({i:S,j:R}),a.assign(f,!0),a.if((0,r._)`${S} > 1`,()=>(h()?z:v)(S,R))}function h(){return _.length>0&&!_.some(S=>S==="object"||S==="array")}function z(S,R){let b=a.name("item"),y=(0,t.checkDataTypes)(_,b,g.opts.strictNumbers,t.DataType.Wrong),$=a.const("indices",(0,r._)`{}`);a.for((0,r._)`;${S}--;`,()=>{a.let(b,(0,r._)`${c}[${S}]`),a.if(y,(0,r._)`continue`),_.length>1&&a.if((0,r._)`typeof ${b} == "string"`,(0,r._)`${b} += "_"`),a.if((0,r._)`typeof ${$}[${b}] == "number"`,()=>{a.assign(R,(0,r._)`${$}[${b}]`),i.error(),a.assign(f,!1).break()}).code((0,r._)`${$}[${b}] = ${S}`)})}function v(S,R){let b=(0,o.useFunc)(a,n.default),y=a.name("outer");a.label(y).for((0,r._)`;${S}--;`,()=>a.for((0,r._)`${R} = ${S}; ${R}--;`,()=>a.if((0,r._)`${b}(${c}[${S}], ${c}[${R}])`,()=>{i.error(),a.assign(f,!1).break(y)})))}}};e.default=s}),Fx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Im(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:a,$data:c,schemaCode:u,schema:l}=s;c||l&&typeof l=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${a}, ${u})`):s.fail((0,t._)`${l} !== ${a}`)}};e.default=n}),Vx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Im(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s;if(!c&&u.length===0)throw new Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,g,f=()=>g??(g=(0,r.useFunc)(i,o.default)),_;if(p||c)_=i.let("valid"),s.block$data(_,m);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let z=i.const("vSchema",l);_=(0,t.or)(...u.map((v,S)=>h(z,S)))}s.pass(_);function m(){i.assign(_,!1),i.forOf("v",l,z=>i.if((0,t._)`${f()}(${a}, ${z})`,()=>i.assign(_,!0).break()))}function h(z,v){let S=u[v];return typeof S=="object"&&S!==null?(0,t._)`${f()}(${a}, ${z}[${v}])`:(0,t._)`${a} === ${S}`}}};e.default=n}),I$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nx(),r=jx(),o=Mx(),n=qx(),s=Zx(),i=Lx(),a=Dx(),c=Ux(),u=Fx(),l=Vx(),d=[t.default,r.default,o.default,n.default,s.default,i.default,a.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d}),O$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=de(),r=be(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:a}=s,{items:c}=i;if(!Array.isArray(c)){(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,c)}};function n(s,i){let{gen:a,schema:c,data:u,keyword:l,it:d}=s;d.items=!0;let p=a.const("len",(0,t._)`${u}.length`);if(c===!1)s.setParams({len:i.length}),s.pass((0,t._)`${p} <= ${i.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(d,c)){let f=a.var("valid",(0,t._)`${p} <= ${i.length}`);a.if((0,t.not)(f),()=>g(f)),s.ok(f)}function g(f){a.forRange("i",i.length,p,_=>{s.subschema({keyword:l,dataProp:_,dataPropType:r.Type.Num},f),d.allErrors||a.if((0,t.not)(f),()=>a.break())})}}e.validateAdditionalItems=n,e.default=o}),C$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=de(),r=be(),o=Ht(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:a,it:c}=i;if(Array.isArray(a))return s(i,"additionalItems",a);c.items=!0,!(0,r.alwaysValidSchema)(c,a)&&i.ok((0,o.validateArray)(i))}};function s(i,a,c=i.schema){let{gen:u,parentSchema:l,data:d,keyword:p,it:g}=i;m(l),g.opts.unevaluated&&c.length&&g.items!==!0&&(g.items=r.mergeEvaluated.items(u,c.length,g.items));let f=u.name("valid"),_=u.const("len",(0,t._)`${d}.length`);c.forEach((h,z)=>{(0,r.alwaysValidSchema)(g,h)||(u.if((0,t._)`${_} > ${z}`,()=>i.subschema({keyword:p,schemaProp:z,dataProp:z},f)),i.ok(f))});function m(h){let{opts:z,errSchemaPath:v}=g,S=c.length,R=S===h.minItems&&(S===h.maxItems||h[a]===!1);if(z.strictTuples&&!R){let b=`"${p}" is ${S}-tuple, but minItems or maxItems/${a} are not specified or different at path "${v}"`;(0,r.checkStrictMode)(g,b,z.strictTuples)}}}e.validateTuple=s,e.default=n}),Jx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=C$(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r}),Hx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Ht(),n=O$(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:a,parentSchema:c,it:u}=i,{prefixItems:l}=c;u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&(l?(0,n.validateAdditionalItems)(i,l):i.ok((0,o.validateArray)(i)))}};e.default=s}),Bx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:a,data:c,it:u}=n,l,d,{minContains:p,maxContains:g}=a;u.opts.next?(l=p===void 0?1:p,d=g):l=1;let f=s.const("len",(0,t._)`${c}.length`);if(n.setParams({min:l,max:d}),d===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&l>d){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let v=(0,t._)`${f} >= ${l}`;d!==void 0&&(v=(0,t._)`${v} && ${f} <= ${d}`),n.pass(v);return}u.items=!0;let _=s.name("valid");d===void 0&&l===1?h(_,()=>s.if(_,()=>s.break())):l===0?(s.let(_,!0),d!==void 0&&s.if((0,t._)`${c}.length > 0`,m)):(s.let(_,!1),m()),n.result(_,()=>n.reset());function m(){let v=s.name("_valid"),S=s.let("count",0);h(v,()=>s.if(v,()=>z(S)))}function h(v,S){s.forRange("i",0,f,R=>{n.subschema({keyword:"contains",dataProp:R,dataPropType:r.Type.Num,compositeRule:!0},v),S()})}function z(v){s.code((0,t._)`${v}++`),d===void 0?s.if((0,t._)`${v} >= ${l}`,()=>s.assign(_,!0).break()):(s.if((0,t._)`${v} > ${d}`,()=>s.assign(_,!1).break()),l===1?s.assign(_,!0):s.if((0,t._)`${v} >= ${l}`,()=>s.assign(_,!0)))}}};e.default=o}),Om=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=de(),r=be(),o=Ht();e.error={message:({params:{property:c,depsCount:u,deps:l}})=>{let d=u===1?"property":"properties";return(0,t.str)`must have ${d} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:d}})=>(0,t._)`{property: ${c},
127
127
  missingProperty: ${d},
128
128
  depsCount: ${u},
129
- deps: ${l}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,l]=s(c);i(c,u),a(c,l)}};function s({schema:c}){let u={},l={};for(let d in c){if(d==="__proto__")continue;let p=Array.isArray(c[d])?u:l;p[d]=c[d]}return[u,l]}function i(c,u=c.schema){let{gen:l,data:d,it:p}=c;if(Object.keys(u).length===0)return;let g=l.let("missing");for(let f in u){let _=u[f];if(_.length===0)continue;let m=(0,o.propertyInData)(l,d,f,p.opts.ownProperties);c.setParams({property:f,depsCount:_.length,deps:_.join(", ")}),p.allErrors?l.if(m,()=>{for(let h of _)(0,o.checkReportMissingProp)(c,h)}):(l.if((0,t._)`${m} && (${(0,o.checkMissingProp)(c,_,g)})`),(0,o.reportMissingProp)(c,g),l.else())}}e.validatePropertyDeps=i;function a(c,u=c.schema){let{gen:l,data:d,keyword:p,it:g}=c,f=l.name("valid");for(let _ in u)(0,r.alwaysValidSchema)(g,u[_])||(l.if((0,o.propertyInData)(l,d,_,g.opts.ownProperties),()=>{let m=c.subschema({keyword:p,schemaProp:_},f);c.mergeValidEvaluated(m,f)},()=>l.var(f,!0)),c.ok(f))}e.validateSchemaDeps=a,e.default=n}),Bx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n;if((0,r.alwaysValidSchema)(c,i))return;let u=s.name("valid");s.forIn("key",a,l=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),c.allErrors||s.break()})}),n.ok(u)}};e.default=o}),C$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=Jt(),n=be(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:a,schema:c,parentSchema:u,data:l,errsCount:d,it:p}=i;if(!d)throw new Error("ajv implementation error");let{allErrors:g,opts:f}=p;if(p.props=!0,f.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(p,c))return;let _=(0,t.allSchemaProperties)(u.properties),m=(0,t.allSchemaProperties)(u.patternProperties);h(),i.ok((0,r._)`${d} === ${o.default.errors}`);function h(){a.forIn("key",l,b=>{!_.length&&!m.length?S(b):a.if(z(b),()=>S(b))})}function z(b){let y;if(_.length>8){let $=(0,n.schemaRefOrVal)(p,u.properties,"properties");y=(0,t.isOwnProperty)(a,$,b)}else _.length?y=(0,r.or)(..._.map($=>(0,r._)`${b} === ${$}`)):y=r.nil;return m.length&&(y=(0,r.or)(y,...m.map($=>(0,r._)`${(0,t.usePattern)(i,$)}.test(${b})`))),(0,r.not)(y)}function v(b){a.code((0,r._)`delete ${l}[${b}]`)}function S(b){if(f.removeAdditional==="all"||f.removeAdditional&&c===!1){v(b);return}if(c===!1){i.setParams({additionalProperty:b}),i.error(),g||a.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(p,c)){let y=a.name("valid");f.removeAdditional==="failing"?(R(b,y,!1),a.if((0,r.not)(y),()=>{i.reset(),v(b)})):(R(b,y),g||a.if((0,r.not)(y),()=>a.break()))}}function R(b,y,$){let T={keyword:"additionalProperties",dataProp:b,dataPropType:n.Type.Str};$===!1&&Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(T,y)}}};e.default=s}),Kx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dn(),r=Ht(),o=be(),n=C$(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,parentSchema:u,data:l,it:d}=i;d.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(d,n.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(c);for(let h of p)d.definedProperties.add(h);d.opts.unevaluated&&p.length&&d.props!==!0&&(d.props=o.mergeEvaluated.props(a,(0,o.toHash)(p),d.props));let g=p.filter(h=>!(0,o.alwaysValidSchema)(d,c[h]));if(g.length===0)return;let f=a.name("valid");for(let h of g)_(h)?m(h):(a.if((0,r.propertyInData)(a,l,h,d.opts.ownProperties)),m(h),d.allErrors||a.else().var(f,!0),a.endIf()),i.it.definedProperties.add(h),i.ok(f);function _(h){return d.opts.useDefaults&&!d.compositeRule&&c[h].default!==void 0}function m(h){i.subschema({keyword:"properties",schemaProp:h,dataProp:h},f)}}};e.default=s}),Gx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=be(),n=be(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,data:u,parentSchema:l,it:d}=i,{opts:p}=d,g=(0,t.allSchemaProperties)(c),f=g.filter(R=>(0,o.alwaysValidSchema)(d,c[R]));if(g.length===0||f.length===g.length&&(!d.opts.unevaluated||d.props===!0))return;let _=p.strictSchema&&!p.allowMatchingProperties&&l.properties,m=a.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,n.evaluatedPropsToName)(a,d.props));let{props:h}=d;z();function z(){for(let R of g)_&&v(R),d.allErrors?S(R):(a.var(m,!0),S(R),a.if(m))}function v(R){for(let b in _)new RegExp(R).test(b)&&(0,o.checkStrictMode)(d,`property ${b} matches pattern ${R} (use allowMatchingProperties)`)}function S(R){a.forIn("key",u,b=>{a.if((0,r._)`${(0,t.usePattern)(i,R)}.test(${b})`,()=>{let y=f.includes(R);y||i.subschema({keyword:"patternProperties",schemaProp:R,dataProp:b,dataPropType:n.Type.Str},m),d.opts.unevaluated&&h!==!0?a.assign((0,r._)`${h}[${b}]`,!0):!y&&!d.allErrors&&a.if((0,r.not)(m),()=>a.break())})})}}};e.default=s}),Wx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let a=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),o.failResult(a,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r}),Yx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ht().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),Xx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:a,it:c}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(c.opts.discriminator&&a.discriminator)return;let u=i,l=s.let("valid",!1),d=s.let("passing",null),p=s.name("_valid");n.setParams({passing:d}),s.block(g),n.result(l,()=>n.reset(),()=>n.error(!0));function g(){u.forEach((f,_)=>{let m;(0,r.alwaysValidSchema)(c,f)?s.var(p,!0):m=n.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},p),_>0&&s.if((0,t._)`${p} && ${l}`).assign(l,!1).assign(d,(0,t._)`[${d}, ${_}]`).else(),s.if(p,()=>{s.assign(l,!0),s.assign(d,_),m&&n.mergeEvaluated(m,t.Name)})})}}};e.default=o}),Qx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let a=n.name("valid");s.forEach((c,u)=>{if((0,t.alwaysValidSchema)(i,c))return;let l=o.subschema({keyword:"allOf",schemaProp:u},a);o.ok(a),o.mergeEvaluated(l)})}};e.default=r}),eT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:a,it:c}=s;a.then===void 0&&a.else===void 0&&(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=n(c,"then"),l=n(c,"else");if(!u&&!l)return;let d=i.let("valid",!0),p=i.name("_valid");if(g(),s.reset(),u&&l){let _=i.let("ifClause");s.setParams({ifClause:_}),i.if(p,f("then",_),f("else",_))}else u?i.if(p,f("then")):i.if((0,t.not)(p),f("else"));s.pass(d,()=>s.error(!0));function g(){let _=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p);s.mergeEvaluated(_)}function f(_,m){return()=>{let h=s.subschema({keyword:_},p);i.assign(d,p),s.mergeValidEvaluated(h,d),m?i.assign(m,(0,t._)`${_}`):s.setParams({ifClause:_})}}}};function n(s,i){let a=s.schema[i];return a!==void 0&&!(0,r.alwaysValidSchema)(s,a)}e.default=o}),tT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r}),N$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=I$(),r=Vx(),o=O$(),n=Jx(),s=Hx(),i=Om(),a=Bx(),c=C$(),u=Kx(),l=Gx(),d=Wx(),p=Yx(),g=Xx(),f=Qx(),_=eT(),m=tT();function h(z=!1){let v=[d.default,p.default,g.default,f.default,_.default,m.default,a.default,c.default,i.default,u.default,l.default];return z?v.push(r.default,n.default):v.push(t.default,o.default),v.push(s.default),v}e.default=h}),rT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:a,schema:c,schemaCode:u,it:l}=o,{opts:d,errSchemaPath:p,schemaEnv:g,self:f}=l;if(!d.validateFormats)return;a?_():m();function _(){let h=s.scopeValue("formats",{ref:f.formats,code:d.code.formats}),z=s.const("fDef",(0,t._)`${h}[${u}]`),v=s.let("fType"),S=s.let("format");s.if((0,t._)`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>s.assign(v,(0,t._)`${z}.type || "string"`).assign(S,(0,t._)`${z}.validate`),()=>s.assign(v,(0,t._)`"string"`).assign(S,z)),o.fail$data((0,t.or)(R(),b()));function R(){return d.strictSchema===!1?t.nil:(0,t._)`${u} && !${S}`}function b(){let y=g.$async?(0,t._)`(${z}.async ? await ${S}(${i}) : ${S}(${i}))`:(0,t._)`${S}(${i})`,$=(0,t._)`(typeof ${S} == "function" ? ${y} : ${S}.test(${i}))`;return(0,t._)`${S} && ${S} !== true && ${v} === ${n} && !${$}`}}function m(){let h=f.formats[c];if(!h){R();return}if(h===!0)return;let[z,v,S]=b(h);z===n&&o.pass(y());function R(){if(d.strictSchema===!1){f.logger.warn($());return}throw new Error($());function $(){return`unknown format "${c}" ignored in schema at path "${p}"`}}function b($){let T=$ instanceof RegExp?(0,t.regexpCode)($):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(c)}`:void 0,C=s.scopeValue("formats",{key:c,ref:$,code:T});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,t._)`${C}.validate`]:["string",$,C]}function y(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!g.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${i})`}return typeof v=="function"?(0,t._)`${S}(${i})`:(0,t._)`${S}.test(${i})`}}}};e.default=r}),j$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[rT().default];e.default=t}),A$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),M$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=x$(),r=T$(),o=N$(),n=j$(),s=A$(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),oT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Cm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=oT(),o=qu(),n=pn(),s=be(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:a,tagName:c}})=>a===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:a,tag:c,tagName:u}})=>(0,t._)`{error: ${a}, tag: ${u}, tagValue: ${c}}`},code(a){let{gen:c,data:u,schema:l,parentSchema:d,it:p}=a,{oneOf:g}=d;if(!p.opts.discriminator)throw new Error("discriminator: requires discriminator option");let f=l.propertyName;if(typeof f!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!g)throw new Error("discriminator: requires oneOf keyword");let _=c.let("valid",!1),m=c.const("tag",(0,t._)`${u}${(0,t.getProperty)(f)}`);c.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>a.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:f})),a.ok(_);function h(){let S=v();c.if(!1);for(let R in S)c.elseIf((0,t._)`${m} === ${R}`),c.assign(_,z(S[R]));c.else(),a.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:f}),c.endIf()}function z(S){let R=c.name("valid"),b=a.subschema({keyword:"oneOf",schemaProp:S},R);return a.mergeEvaluated(b,t.Name),R}function v(){var S;let R={},b=$(d),y=!0;for(let O=0;O<g.length;O++){let L=g[O];if(L?.$ref&&!(0,s.schemaHasRulesButRef)(L,p.self.RULES)){let G=L.$ref;if(L=o.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,G),L instanceof o.SchemaEnv&&(L=L.schema),L===void 0)throw new n.default(p.opts.uriResolver,p.baseId,G)}let H=(S=L?.properties)===null||S===void 0?void 0:S[f];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);y=y&&(b||$(L)),T(H,O)}if(!y)throw new Error(`discriminator: "${f}" must be required`);return R;function $({required:O}){return Array.isArray(O)&&O.includes(f)}function T(O,L){if(O.const)C(O.const,L);else if(O.enum)for(let H of O.enum)C(H,L);else throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function C(O,L){if(typeof O!="string"||O in R)throw new Error(`discriminator: "${f}" values must be unique strings`);R[O]=L}}}};e.default=i}),nT=U((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),q$=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=xm(),o=M$(),n=Cm(),s=nT(),i=["/properties"],a="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(g=>this.addVocabulary(g)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let g=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(g,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),Z$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=de(),r=Jt(),o=qu(),n=Tm(),s={keyword:"$dynamicAnchor",schemaType:"string",code:c=>i(c,c.schema)};function i(c,u){let{gen:l,it:d}=c;d.schemaEnv.root.dynamicAnchors[u]=!0;let p=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,g=d.errSchemaPath==="#"?d.validateName:a(c);l.if((0,t._)`!${p}`,()=>l.assign(p,g))}e.dynamicAnchor=i;function a(c){let{schemaEnv:u,schema:l,self:d}=c.it,{root:p,baseId:g,localRefs:f,meta:_}=u.root,{schemaId:m}=d.opts,h=new o.SchemaEnv({schema:l,schemaId:m,root:p,baseId:g,localRefs:f,meta:_});return o.compileSchema.call(d,h),(0,n.getValidate)(c,h)}e.default=s}),L$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=de(),r=Jt(),o=Tm(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,a){let{gen:c,keyword:u,it:l}=i;if(a[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let d=a.slice(1);if(l.allErrors)p();else{let f=c.let("valid",!1);p(f),i.ok(f)}function p(f){if(l.schemaEnv.root.dynamicAnchors[d]){let _=c.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);c.if(_,g(_,f),g(l.validateName,f))}else g(l.validateName,f)()}function g(f,_){return _?()=>c.block(()=>{(0,o.callRef)(i,f),c.let(_,!0)}):()=>(0,o.callRef)(i,f)}}e.dynamicRef=s,e.default=n}),sT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Z$(),r=be(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o}),iT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=L$(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r}),D$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Z$(),r=L$(),o=sT(),n=iT(),s=[t.default,r.default,o.default,n.default];e.default=s}),aT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Om(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r}),cT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Om(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r}),uT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r}),U$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aT(),r=cT(),o=uT(),n=[t.default,r.default,o.default];e.default=n}),lT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Jt(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:a,data:c,errsCount:u,it:l}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:d,props:p}=l;p instanceof t.Name?i.if((0,t._)`${p} !== true`,()=>i.forIn("key",c,m=>i.if(f(p,m),()=>g(m)))):p!==!0&&i.forIn("key",c,m=>p===void 0?g(m):i.if(_(p,m),()=>g(m))),l.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function g(m){if(a===!1){s.setParams({unevaluatedProperty:m}),s.error(),d||i.break();return}if(!(0,r.alwaysValidSchema)(l,a)){let h=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:r.Type.Str},h),d||i.if((0,t.not)(h),()=>i.break())}}function f(m,h){return(0,t._)`!${m} || !${m}[${h}]`}function _(m,h){let z=[];for(let v in m)m[v]===!0&&z.push((0,t._)`${h} !== ${v}`);return(0,t.and)(...z)}}};e.default=n}),dT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n,u=c.items||0;if(u===!0)return;let l=s.const("len",(0,t._)`${a}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(c,i)){let p=s.var("valid",(0,t._)`${l} <= ${u}`);s.if((0,t.not)(p),()=>d(p,u)),n.ok(p)}c.items=!0;function d(p,g){s.forRange("i",g,l,f=>{n.subschema({keyword:"unevaluatedItems",dataProp:f,dataPropType:r.Type.Num},p),c.allErrors||s.if((0,t.not)(p),()=>s.break())})}}};e.default=o}),F$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lT(),r=dT(),o=[t.default,r.default];e.default=o}),pT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),mT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),fT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),hT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),gT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),_T=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),vT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),yT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=pT(),r=mT(),o=fT(),n=hT(),s=gT(),i=_T(),a=vT(),c=["/properties"];function u(l){return[t,r,o,n,d(this,s),i,d(this,a)].forEach(p=>this.addMetaSchema(p,void 0,!1)),this;function d(p,g){return l?p.$dataMetaSchema(g,c):g}}e.default=u}),ST=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=xm(),o=M$(),n=D$(),s=U$(),i=F$(),a=Cm(),c=yT(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(_=>this.addVocabulary(_)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:m}=this.opts;m&&(c.default.call(this,_),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var d=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var g=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return g.default}});var f=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),bT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=x$(),r=T$(),o=N$(),n=D$(),s=U$(),i=F$(),a=j$(),c=A$(),u=[n.default,t.default,r.default,(0,o.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),zT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),$T=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),wT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),RT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),PT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),ET=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),kT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),xT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),TT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zT(),r=$T(),o=wT(),n=RT(),s=PT(),i=ET(),a=kT(),c=xT(),u=["/properties"];function l(d){return[t,r,o,n,s,p(this,i),a,p(this,c)].forEach(g=>this.addMetaSchema(g,void 0,!1)),this;function p(g,f){return d?g.$dataMetaSchema(f,u):f}}e.default=l}),IT=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=xm(),o=bT(),n=Cm(),s=TT(),i="https://json-schema.org/draft/2020-12/schema";var a=class extends r.default{constructor(p={}){super({...p,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(p=>this.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:p,meta:g}=this.opts;g&&(s.default.call(this,p),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=a,t.exports=e=a,t.exports.Ajv2020=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var c=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),OT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(O,L){return{validate:O,compare:L}}e.fullFormats={date:t(s,i),time:t(c(!0),u),"date-time":t(p(!0),g),"iso-time":t(c(),l),"iso-date-time":t(p(),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:C,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:"number",validate:b},int64:{type:"number",validate:y},float:{type:"number",validate:$},double:{type:"number",validate:$},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,g),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(O){return O%4===0&&(O%100!==0||O%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(O){let L=o.exec(O);if(!L)return!1;let H=+L[1],G=+L[2],he=+L[3];return G>=1&&G<=12&&he>=1&&he<=(G===2&&r(H)?29:n[G])}function i(O,L){if(O&&L)return O>L?1:O<L?-1:0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(O){return function(H){let G=a.exec(H);if(!G)return!1;let he=+G[1],qe=+G[2],Ie=+G[3],Ye=G[4],ye=G[5]==="-"?-1:1,I=+(G[6]||0),A=+(G[7]||0);if(I>23||A>59||O&&!Ye)return!1;if(he<=23&&qe<=59&&Ie<60)return!0;let F=qe-A*ye,w=he-I*ye-(F<0?1:0);return(w===23||w===-1)&&(F===59||F===-1)&&Ie<61}}function u(O,L){if(!(O&&L))return;let H=new Date("2020-01-01T"+O).valueOf(),G=new Date("2020-01-01T"+L).valueOf();if(H&&G)return H-G}function l(O,L){if(!(O&&L))return;let H=a.exec(O),G=a.exec(L);if(H&&G)return O=H[1]+H[2]+H[3],L=G[1]+G[2]+G[3],O>L?1:O<L?-1:0}let d=/t|\s/i;function p(O){let L=c(O);return function(G){let he=G.split(d);return he.length===2&&s(he[0])&&L(he[1])}}function g(O,L){if(!(O&&L))return;let H=new Date(O).valueOf(),G=new Date(L).valueOf();if(H&&G)return H-G}function f(O,L){if(!(O&&L))return;let[H,G]=O.split(d),[he,qe]=L.split(d),Ie=i(H,he);if(Ie!==void 0)return Ie||u(G,qe)}let _=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(O){return _.test(O)&&m.test(O)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(O){return z.lastIndex=0,z.test(O)}let S=-(2**31),R=2**31-1;function b(O){return Number.isInteger(O)&&O<=R&&O>=S}function y(O){return Number.isInteger(O)}function $(){return!0}let T=/[^\\]\\Z/;function C(O){if(T.test(O))return!1;try{return new RegExp(O),!0}catch{return!1}}}),CT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=q$(),r=de(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:a,schemaCode:c})=>(0,r.str)`should be ${n[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${n[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:c,data:u,schemaCode:l,keyword:d,it:p}=a,{opts:g,self:f}=p;if(!g.validateFormats)return;let _=new t.KeywordCxt(p,f.RULES.all.format.definition,"format");_.$data?m():h();function m(){let v=c.scopeValue("formats",{ref:f.formats,code:g.code.formats}),S=c.const("fmt",(0,r._)`${v}[${_.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,z(S)))}function h(){let v=_.schema,S=f.formats[v];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${d}": format "${v}" does not define "compare" function`);let R=c.scopeValue("formats",{key:v,ref:S,code:g.code.formats?(0,r._)`${g.code.formats}${(0,r.getProperty)(v)}`:void 0});a.fail$data(z(R))}function z(v){return(0,r._)`${v}.compare(${u}, ${l}) ${n[d].fail} 0`}},dependencies:["format"]};let i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i}),NT=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=OT(),o=CT(),n=de(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,s),u;let[d,p]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return c(u,l.formats||r.formatNames,d,p),l.keywords&&(0,o.default)(u),u};a.get=(u,l="full")=>{let d=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!d)throw new Error(`Unknown format "${u}"`);return d};function c(u,l,d,p){var g,f;(g=(f=u.opts.code).formats)!==null&&g!==void 0||(f.formats=(0,n._)`require("ajv-formats/dist/formats").${p}`);for(let _ of l)u.addFormat(_,d[_])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),V$=q$(),jT=ST(),AT=IT(),MT=wi(NT(),1),qT=MT.default;function km(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return qT(t),t}var Zu=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=km(AT.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Dm(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=km(jT.Ajv2019):this._ajvDraft7??=km(V$.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},nA=V$.Ajv;var Lu=R0(require("node:process"),1);var Q$=Symbol.for("mcp.completable");function jm(e){return!!e&&typeof e=="object"&&Q$ in e}function LT(e){return e[Q$]?.complete}var oi=15e3,DT=2**31-1;function Uu(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,DT));return r.unref?.(),r}var e0=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(r){this.onerror?.(r instanceof Error?r:new Error(String(r)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function t0(e){return{toolsChanged:()=>e.publish({kind:"tools_list_changed"}),promptsChanged:()=>e.publish({kind:"prompts_list_changed"}),resourcesChanged:()=>e.publish({kind:"resources_list_changed"}),resourceUpdated:t=>e.publish({kind:"resource_updated",uri:t})}}function r0(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function o0(e,t){let r={},o=n=>t===void 0||n===!0;return e.toolsListChanged===!0&&o(t?.tools?.listChanged)&&(r.toolsListChanged=!0),e.promptsListChanged===!0&&o(t?.prompts?.listChanged)&&(r.promptsListChanged=!0),e.resourcesListChanged===!0&&o(t?.resources?.listChanged)&&(r.resourcesListChanged=!0),e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&o(t?.resources?.subscribe)&&(r.resourceSubscriptions=[...e.resourceSubscriptions]),r}function UT(e){switch(e.kind){case"tools_list_changed":return{method:"notifications/tools/list_changed"};case"prompts_list_changed":return{method:"notifications/prompts/list_changed"};case"resources_list_changed":return{method:"notifications/resources/list_changed"};case"resource_updated":return{method:"notifications/resources/updated",params:{uri:e.uri}}}}var mn=1024;function J$(e,t,r){return Response.json({jsonrpc:"2.0",error:{code:t,message:r},id:e},{status:200})}function Du(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[wr]:t}}}}function n0(e){let t=qr(Qs).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}function s0(e){let{bus:t,onerror:r}=e,o=e.maxSubscriptions??mn,n=e.keepAliveMs??oi,s=new Set;function i(a,c,u,l){if(s.size>=o)return r?.(new Error(`subscriptions/listen refused: subscription limit reached (${o})`)),J$(a.id,-32603,"Subscription limit reached");let d=n0(a);if(d===void 0)return J$(a.id,-32602,"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");let p=o0(d,u),g=a.id,f=new TextEncoder,_,m=!1,h,z,v,S=$=>{if(!m)try{_.enqueue(f.encode($))}catch(T){r?.(T instanceof Error?T:new Error(String(T)))}},R=($,T)=>{S(`event: message
129
+ deps: ${l}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,l]=s(c);i(c,u),a(c,l)}};function s({schema:c}){let u={},l={};for(let d in c){if(d==="__proto__")continue;let p=Array.isArray(c[d])?u:l;p[d]=c[d]}return[u,l]}function i(c,u=c.schema){let{gen:l,data:d,it:p}=c;if(Object.keys(u).length===0)return;let g=l.let("missing");for(let f in u){let _=u[f];if(_.length===0)continue;let m=(0,o.propertyInData)(l,d,f,p.opts.ownProperties);c.setParams({property:f,depsCount:_.length,deps:_.join(", ")}),p.allErrors?l.if(m,()=>{for(let h of _)(0,o.checkReportMissingProp)(c,h)}):(l.if((0,t._)`${m} && (${(0,o.checkMissingProp)(c,_,g)})`),(0,o.reportMissingProp)(c,g),l.else())}}e.validatePropertyDeps=i;function a(c,u=c.schema){let{gen:l,data:d,keyword:p,it:g}=c,f=l.name("valid");for(let _ in u)(0,r.alwaysValidSchema)(g,u[_])||(l.if((0,o.propertyInData)(l,d,_,g.opts.ownProperties),()=>{let m=c.subschema({keyword:p,schemaProp:_},f);c.mergeValidEvaluated(m,f)},()=>l.var(f,!0)),c.ok(f))}e.validateSchemaDeps=a,e.default=n}),Kx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n;if((0,r.alwaysValidSchema)(c,i))return;let u=s.name("valid");s.forIn("key",a,l=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),c.allErrors||s.break()})}),n.ok(u)}};e.default=o}),N$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=Jt(),n=be(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:a,schema:c,parentSchema:u,data:l,errsCount:d,it:p}=i;if(!d)throw new Error("ajv implementation error");let{allErrors:g,opts:f}=p;if(p.props=!0,f.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(p,c))return;let _=(0,t.allSchemaProperties)(u.properties),m=(0,t.allSchemaProperties)(u.patternProperties);h(),i.ok((0,r._)`${d} === ${o.default.errors}`);function h(){a.forIn("key",l,b=>{!_.length&&!m.length?S(b):a.if(z(b),()=>S(b))})}function z(b){let y;if(_.length>8){let $=(0,n.schemaRefOrVal)(p,u.properties,"properties");y=(0,t.isOwnProperty)(a,$,b)}else _.length?y=(0,r.or)(..._.map($=>(0,r._)`${b} === ${$}`)):y=r.nil;return m.length&&(y=(0,r.or)(y,...m.map($=>(0,r._)`${(0,t.usePattern)(i,$)}.test(${b})`))),(0,r.not)(y)}function v(b){a.code((0,r._)`delete ${l}[${b}]`)}function S(b){if(f.removeAdditional==="all"||f.removeAdditional&&c===!1){v(b);return}if(c===!1){i.setParams({additionalProperty:b}),i.error(),g||a.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(p,c)){let y=a.name("valid");f.removeAdditional==="failing"?(R(b,y,!1),a.if((0,r.not)(y),()=>{i.reset(),v(b)})):(R(b,y),g||a.if((0,r.not)(y),()=>a.break()))}}function R(b,y,$){let T={keyword:"additionalProperties",dataProp:b,dataPropType:n.Type.Str};$===!1&&Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(T,y)}}};e.default=s}),Gx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dn(),r=Ht(),o=be(),n=N$(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,parentSchema:u,data:l,it:d}=i;d.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(d,n.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(c);for(let h of p)d.definedProperties.add(h);d.opts.unevaluated&&p.length&&d.props!==!0&&(d.props=o.mergeEvaluated.props(a,(0,o.toHash)(p),d.props));let g=p.filter(h=>!(0,o.alwaysValidSchema)(d,c[h]));if(g.length===0)return;let f=a.name("valid");for(let h of g)_(h)?m(h):(a.if((0,r.propertyInData)(a,l,h,d.opts.ownProperties)),m(h),d.allErrors||a.else().var(f,!0),a.endIf()),i.it.definedProperties.add(h),i.ok(f);function _(h){return d.opts.useDefaults&&!d.compositeRule&&c[h].default!==void 0}function m(h){i.subschema({keyword:"properties",schemaProp:h,dataProp:h},f)}}};e.default=s}),Wx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ht(),r=de(),o=be(),n=be(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,data:u,parentSchema:l,it:d}=i,{opts:p}=d,g=(0,t.allSchemaProperties)(c),f=g.filter(R=>(0,o.alwaysValidSchema)(d,c[R]));if(g.length===0||f.length===g.length&&(!d.opts.unevaluated||d.props===!0))return;let _=p.strictSchema&&!p.allowMatchingProperties&&l.properties,m=a.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,n.evaluatedPropsToName)(a,d.props));let{props:h}=d;z();function z(){for(let R of g)_&&v(R),d.allErrors?S(R):(a.var(m,!0),S(R),a.if(m))}function v(R){for(let b in _)new RegExp(R).test(b)&&(0,o.checkStrictMode)(d,`property ${b} matches pattern ${R} (use allowMatchingProperties)`)}function S(R){a.forIn("key",u,b=>{a.if((0,r._)`${(0,t.usePattern)(i,R)}.test(${b})`,()=>{let y=f.includes(R);y||i.subschema({keyword:"patternProperties",schemaProp:R,dataProp:b,dataPropType:n.Type.Str},m),d.opts.unevaluated&&h!==!0?a.assign((0,r._)`${h}[${b}]`,!0):!y&&!d.allErrors&&a.if((0,r.not)(m),()=>a.break())})})}}};e.default=s}),Yx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let a=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),o.failResult(a,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r}),Xx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ht().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),Qx=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:a,it:c}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(c.opts.discriminator&&a.discriminator)return;let u=i,l=s.let("valid",!1),d=s.let("passing",null),p=s.name("_valid");n.setParams({passing:d}),s.block(g),n.result(l,()=>n.reset(),()=>n.error(!0));function g(){u.forEach((f,_)=>{let m;(0,r.alwaysValidSchema)(c,f)?s.var(p,!0):m=n.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},p),_>0&&s.if((0,t._)`${p} && ${l}`).assign(l,!1).assign(d,(0,t._)`[${d}, ${_}]`).else(),s.if(p,()=>{s.assign(l,!0),s.assign(d,_),m&&n.mergeEvaluated(m,t.Name)})})}}};e.default=o}),eT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let a=n.name("valid");s.forEach((c,u)=>{if((0,t.alwaysValidSchema)(i,c))return;let l=o.subschema({keyword:"allOf",schemaProp:u},a);o.ok(a),o.mergeEvaluated(l)})}};e.default=r}),tT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:a,it:c}=s;a.then===void 0&&a.else===void 0&&(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=n(c,"then"),l=n(c,"else");if(!u&&!l)return;let d=i.let("valid",!0),p=i.name("_valid");if(g(),s.reset(),u&&l){let _=i.let("ifClause");s.setParams({ifClause:_}),i.if(p,f("then",_),f("else",_))}else u?i.if(p,f("then")):i.if((0,t.not)(p),f("else"));s.pass(d,()=>s.error(!0));function g(){let _=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p);s.mergeEvaluated(_)}function f(_,m){return()=>{let h=s.subschema({keyword:_},p);i.assign(d,p),s.mergeValidEvaluated(h,d),m?i.assign(m,(0,t._)`${_}`):s.setParams({ifClause:_})}}}};function n(s,i){let a=s.schema[i];return a!==void 0&&!(0,r.alwaysValidSchema)(s,a)}e.default=o}),rT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r}),j$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=O$(),r=Jx(),o=C$(),n=Hx(),s=Bx(),i=Om(),a=Kx(),c=N$(),u=Gx(),l=Wx(),d=Yx(),p=Xx(),g=Qx(),f=eT(),_=tT(),m=rT();function h(z=!1){let v=[d.default,p.default,g.default,f.default,_.default,m.default,a.default,c.default,i.default,u.default,l.default];return z?v.push(r.default,n.default):v.push(t.default,o.default),v.push(s.default),v}e.default=h}),oT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:a,schema:c,schemaCode:u,it:l}=o,{opts:d,errSchemaPath:p,schemaEnv:g,self:f}=l;if(!d.validateFormats)return;a?_():m();function _(){let h=s.scopeValue("formats",{ref:f.formats,code:d.code.formats}),z=s.const("fDef",(0,t._)`${h}[${u}]`),v=s.let("fType"),S=s.let("format");s.if((0,t._)`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>s.assign(v,(0,t._)`${z}.type || "string"`).assign(S,(0,t._)`${z}.validate`),()=>s.assign(v,(0,t._)`"string"`).assign(S,z)),o.fail$data((0,t.or)(R(),b()));function R(){return d.strictSchema===!1?t.nil:(0,t._)`${u} && !${S}`}function b(){let y=g.$async?(0,t._)`(${z}.async ? await ${S}(${i}) : ${S}(${i}))`:(0,t._)`${S}(${i})`,$=(0,t._)`(typeof ${S} == "function" ? ${y} : ${S}.test(${i}))`;return(0,t._)`${S} && ${S} !== true && ${v} === ${n} && !${$}`}}function m(){let h=f.formats[c];if(!h){R();return}if(h===!0)return;let[z,v,S]=b(h);z===n&&o.pass(y());function R(){if(d.strictSchema===!1){f.logger.warn($());return}throw new Error($());function $(){return`unknown format "${c}" ignored in schema at path "${p}"`}}function b($){let T=$ instanceof RegExp?(0,t.regexpCode)($):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(c)}`:void 0,C=s.scopeValue("formats",{key:c,ref:$,code:T});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,t._)`${C}.validate`]:["string",$,C]}function y(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!g.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${i})`}return typeof v=="function"?(0,t._)`${S}(${i})`:(0,t._)`${S}.test(${i})`}}}};e.default=r}),A$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[oT().default];e.default=t}),M$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),q$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=T$(),r=I$(),o=j$(),n=A$(),s=M$(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),nT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Cm=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=nT(),o=qu(),n=pn(),s=be(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:a,tagName:c}})=>a===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:a,tag:c,tagName:u}})=>(0,t._)`{error: ${a}, tag: ${u}, tagValue: ${c}}`},code(a){let{gen:c,data:u,schema:l,parentSchema:d,it:p}=a,{oneOf:g}=d;if(!p.opts.discriminator)throw new Error("discriminator: requires discriminator option");let f=l.propertyName;if(typeof f!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!g)throw new Error("discriminator: requires oneOf keyword");let _=c.let("valid",!1),m=c.const("tag",(0,t._)`${u}${(0,t.getProperty)(f)}`);c.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>a.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:f})),a.ok(_);function h(){let S=v();c.if(!1);for(let R in S)c.elseIf((0,t._)`${m} === ${R}`),c.assign(_,z(S[R]));c.else(),a.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:f}),c.endIf()}function z(S){let R=c.name("valid"),b=a.subschema({keyword:"oneOf",schemaProp:S},R);return a.mergeEvaluated(b,t.Name),R}function v(){var S;let R={},b=$(d),y=!0;for(let O=0;O<g.length;O++){let L=g[O];if(L?.$ref&&!(0,s.schemaHasRulesButRef)(L,p.self.RULES)){let G=L.$ref;if(L=o.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,G),L instanceof o.SchemaEnv&&(L=L.schema),L===void 0)throw new n.default(p.opts.uriResolver,p.baseId,G)}let H=(S=L?.properties)===null||S===void 0?void 0:S[f];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);y=y&&(b||$(L)),T(H,O)}if(!y)throw new Error(`discriminator: "${f}" must be required`);return R;function $({required:O}){return Array.isArray(O)&&O.includes(f)}function T(O,L){if(O.const)C(O.const,L);else if(O.enum)for(let H of O.enum)C(H,L);else throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function C(O,L){if(typeof O!="string"||O in R)throw new Error(`discriminator: "${f}" values must be unique strings`);R[O]=L}}}};e.default=i}),sT=U((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),Z$=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=xm(),o=q$(),n=Cm(),s=sT(),i=["/properties"],a="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(g=>this.addVocabulary(g)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let g=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(g,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),L$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=de(),r=Jt(),o=qu(),n=Tm(),s={keyword:"$dynamicAnchor",schemaType:"string",code:c=>i(c,c.schema)};function i(c,u){let{gen:l,it:d}=c;d.schemaEnv.root.dynamicAnchors[u]=!0;let p=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,g=d.errSchemaPath==="#"?d.validateName:a(c);l.if((0,t._)`!${p}`,()=>l.assign(p,g))}e.dynamicAnchor=i;function a(c){let{schemaEnv:u,schema:l,self:d}=c.it,{root:p,baseId:g,localRefs:f,meta:_}=u.root,{schemaId:m}=d.opts,h=new o.SchemaEnv({schema:l,schemaId:m,root:p,baseId:g,localRefs:f,meta:_});return o.compileSchema.call(d,h),(0,n.getValidate)(c,h)}e.default=s}),D$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=de(),r=Jt(),o=Tm(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,a){let{gen:c,keyword:u,it:l}=i;if(a[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let d=a.slice(1);if(l.allErrors)p();else{let f=c.let("valid",!1);p(f),i.ok(f)}function p(f){if(l.schemaEnv.root.dynamicAnchors[d]){let _=c.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);c.if(_,g(_,f),g(l.validateName,f))}else g(l.validateName,f)()}function g(f,_){return _?()=>c.block(()=>{(0,o.callRef)(i,f),c.let(_,!0)}):()=>(0,o.callRef)(i,f)}}e.dynamicRef=s,e.default=n}),iT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=L$(),r=be(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o}),aT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=D$(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r}),U$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=L$(),r=D$(),o=iT(),n=aT(),s=[t.default,r.default,o.default,n.default];e.default=s}),cT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Om(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r}),uT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Om(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r}),lT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r}),F$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cT(),r=uT(),o=lT(),n=[t.default,r.default,o.default];e.default=n}),dT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o=Jt(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:a,data:c,errsCount:u,it:l}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:d,props:p}=l;p instanceof t.Name?i.if((0,t._)`${p} !== true`,()=>i.forIn("key",c,m=>i.if(f(p,m),()=>g(m)))):p!==!0&&i.forIn("key",c,m=>p===void 0?g(m):i.if(_(p,m),()=>g(m))),l.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function g(m){if(a===!1){s.setParams({unevaluatedProperty:m}),s.error(),d||i.break();return}if(!(0,r.alwaysValidSchema)(l,a)){let h=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:r.Type.Str},h),d||i.if((0,t.not)(h),()=>i.break())}}function f(m,h){return(0,t._)`!${m} || !${m}[${h}]`}function _(m,h){let z=[];for(let v in m)m[v]===!0&&z.push((0,t._)`${h} !== ${v}`);return(0,t.and)(...z)}}};e.default=n}),pT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=be(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n,u=c.items||0;if(u===!0)return;let l=s.const("len",(0,t._)`${a}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(c,i)){let p=s.var("valid",(0,t._)`${l} <= ${u}`);s.if((0,t.not)(p),()=>d(p,u)),n.ok(p)}c.items=!0;function d(p,g){s.forRange("i",g,l,f=>{n.subschema({keyword:"unevaluatedItems",dataProp:f,dataPropType:r.Type.Num},p),c.allErrors||s.if((0,t.not)(p),()=>s.break())})}}};e.default=o}),V$=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dT(),r=pT(),o=[t.default,r.default];e.default=o}),mT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),fT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),hT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),gT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),_T=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),vT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),yT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),ST=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mT(),r=fT(),o=hT(),n=gT(),s=_T(),i=vT(),a=yT(),c=["/properties"];function u(l){return[t,r,o,n,d(this,s),i,d(this,a)].forEach(p=>this.addMetaSchema(p,void 0,!1)),this;function d(p,g){return l?p.$dataMetaSchema(g,c):g}}e.default=u}),bT=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=xm(),o=q$(),n=U$(),s=F$(),i=V$(),a=Cm(),c=ST(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(_=>this.addVocabulary(_)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:m}=this.opts;m&&(c.default.call(this,_),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var d=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var g=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return g.default}});var f=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),zT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=T$(),r=I$(),o=j$(),n=U$(),s=F$(),i=V$(),a=A$(),c=M$(),u=[n.default,t.default,r.default,(0,o.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),$T=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),wT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),RT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),PT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),ET=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),kT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),xT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),TT=U((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),IT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$T(),r=wT(),o=RT(),n=PT(),s=ET(),i=kT(),a=xT(),c=TT(),u=["/properties"];function l(d){return[t,r,o,n,s,p(this,i),a,p(this,c)].forEach(g=>this.addMetaSchema(g,void 0,!1)),this;function p(g,f){return d?g.$dataMetaSchema(f,u):f}}e.default=l}),OT=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=xm(),o=zT(),n=Cm(),s=IT(),i="https://json-schema.org/draft/2020-12/schema";var a=class extends r.default{constructor(p={}){super({...p,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(p=>this.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:p,meta:g}=this.opts;g&&(s.default.call(this,p),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=a,t.exports=e=a,t.exports.Ajv2020=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var c=dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=ti();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=pn();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),CT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(O,L){return{validate:O,compare:L}}e.fullFormats={date:t(s,i),time:t(c(!0),u),"date-time":t(p(!0),g),"iso-time":t(c(),l),"iso-date-time":t(p(),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:C,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:"number",validate:b},int64:{type:"number",validate:y},float:{type:"number",validate:$},double:{type:"number",validate:$},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,g),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(O){return O%4===0&&(O%100!==0||O%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(O){let L=o.exec(O);if(!L)return!1;let H=+L[1],G=+L[2],he=+L[3];return G>=1&&G<=12&&he>=1&&he<=(G===2&&r(H)?29:n[G])}function i(O,L){if(O&&L)return O>L?1:O<L?-1:0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(O){return function(H){let G=a.exec(H);if(!G)return!1;let he=+G[1],qe=+G[2],Ie=+G[3],Ye=G[4],ye=G[5]==="-"?-1:1,I=+(G[6]||0),A=+(G[7]||0);if(I>23||A>59||O&&!Ye)return!1;if(he<=23&&qe<=59&&Ie<60)return!0;let F=qe-A*ye,w=he-I*ye-(F<0?1:0);return(w===23||w===-1)&&(F===59||F===-1)&&Ie<61}}function u(O,L){if(!(O&&L))return;let H=new Date("2020-01-01T"+O).valueOf(),G=new Date("2020-01-01T"+L).valueOf();if(H&&G)return H-G}function l(O,L){if(!(O&&L))return;let H=a.exec(O),G=a.exec(L);if(H&&G)return O=H[1]+H[2]+H[3],L=G[1]+G[2]+G[3],O>L?1:O<L?-1:0}let d=/t|\s/i;function p(O){let L=c(O);return function(G){let he=G.split(d);return he.length===2&&s(he[0])&&L(he[1])}}function g(O,L){if(!(O&&L))return;let H=new Date(O).valueOf(),G=new Date(L).valueOf();if(H&&G)return H-G}function f(O,L){if(!(O&&L))return;let[H,G]=O.split(d),[he,qe]=L.split(d),Ie=i(H,he);if(Ie!==void 0)return Ie||u(G,qe)}let _=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(O){return _.test(O)&&m.test(O)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(O){return z.lastIndex=0,z.test(O)}let S=-(2**31),R=2**31-1;function b(O){return Number.isInteger(O)&&O<=R&&O>=S}function y(O){return Number.isInteger(O)}function $(){return!0}let T=/[^\\]\\Z/;function C(O){if(T.test(O))return!1;try{return new RegExp(O),!0}catch{return!1}}}),NT=U(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=Z$(),r=de(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:a,schemaCode:c})=>(0,r.str)`should be ${n[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${n[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:c,data:u,schemaCode:l,keyword:d,it:p}=a,{opts:g,self:f}=p;if(!g.validateFormats)return;let _=new t.KeywordCxt(p,f.RULES.all.format.definition,"format");_.$data?m():h();function m(){let v=c.scopeValue("formats",{ref:f.formats,code:g.code.formats}),S=c.const("fmt",(0,r._)`${v}[${_.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,z(S)))}function h(){let v=_.schema,S=f.formats[v];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${d}": format "${v}" does not define "compare" function`);let R=c.scopeValue("formats",{key:v,ref:S,code:g.code.formats?(0,r._)`${g.code.formats}${(0,r.getProperty)(v)}`:void 0});a.fail$data(z(R))}function z(v){return(0,r._)`${v}.compare(${u}, ${l}) ${n[d].fail} 0`}},dependencies:["format"]};let i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i}),jT=U((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=CT(),o=NT(),n=de(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,s),u;let[d,p]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return c(u,l.formats||r.formatNames,d,p),l.keywords&&(0,o.default)(u),u};a.get=(u,l="full")=>{let d=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!d)throw new Error(`Unknown format "${u}"`);return d};function c(u,l,d,p){var g,f;(g=(f=u.opts.code).formats)!==null&&g!==void 0||(f.formats=(0,n._)`require("ajv-formats/dist/formats").${p}`);for(let _ of l)u.addFormat(_,d[_])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),J$=Z$(),AT=bT(),MT=OT(),qT=wi(jT(),1),ZT=qT.default;function km(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ZT(t),t}var Zu=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=km(MT.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Um(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=km(AT.Ajv2019):this._ajvDraft7??=km(J$.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},nA=J$.Ajv;var Lu=P0(require("node:process"),1);var e0=Symbol.for("mcp.completable");function jm(e){return!!e&&typeof e=="object"&&e0 in e}function DT(e){return e[e0]?.complete}var oi=15e3,UT=2**31-1;function Uu(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,UT));return r.unref?.(),r}var t0=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(r){this.onerror?.(r instanceof Error?r:new Error(String(r)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function r0(e){return{toolsChanged:()=>e.publish({kind:"tools_list_changed"}),promptsChanged:()=>e.publish({kind:"prompts_list_changed"}),resourcesChanged:()=>e.publish({kind:"resources_list_changed"}),resourceUpdated:t=>e.publish({kind:"resource_updated",uri:t})}}function o0(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function n0(e,t){let r={},o=n=>t===void 0||n===!0;return e.toolsListChanged===!0&&o(t?.tools?.listChanged)&&(r.toolsListChanged=!0),e.promptsListChanged===!0&&o(t?.prompts?.listChanged)&&(r.promptsListChanged=!0),e.resourcesListChanged===!0&&o(t?.resources?.listChanged)&&(r.resourcesListChanged=!0),e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&o(t?.resources?.subscribe)&&(r.resourceSubscriptions=[...e.resourceSubscriptions]),r}function FT(e){switch(e.kind){case"tools_list_changed":return{method:"notifications/tools/list_changed"};case"prompts_list_changed":return{method:"notifications/prompts/list_changed"};case"resources_list_changed":return{method:"notifications/resources/list_changed"};case"resource_updated":return{method:"notifications/resources/updated",params:{uri:e.uri}}}}var mn=1024;function H$(e,t,r){return Response.json({jsonrpc:"2.0",error:{code:t,message:r},id:e},{status:200})}function Du(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[wr]:t}}}}function s0(e){let t=qr(Qs).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}function i0(e){let{bus:t,onerror:r}=e,o=e.maxSubscriptions??mn,n=e.keepAliveMs??oi,s=new Set;function i(a,c,u,l){if(s.size>=o)return r?.(new Error(`subscriptions/listen refused: subscription limit reached (${o})`)),H$(a.id,-32603,"Subscription limit reached");let d=s0(a);if(d===void 0)return H$(a.id,-32602,"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");let p=n0(d,u),g=a.id,f=new TextEncoder,_,m=!1,h,z,v,S=$=>{if(!m)try{_.enqueue(f.encode($))}catch(T){r?.(T instanceof Error?T:new Error(String(T)))}},R=($,T)=>{S(`event: message
130
130
  data: ${JSON.stringify({jsonrpc:"2.0",method:$,params:T})}
131
131
 
132
132
  `)},b=$=>{if(!m){$&&S(`event: message
133
133
  data: ${JSON.stringify({jsonrpc:"2.0",id:g,result:{resultType:"complete",_meta:{[wr]:g,[Lt]:l}}})}
134
134
 
135
- `),m=!0;try{h?.()}catch(T){r?.(T instanceof Error?T:new Error(String(T)))}z!==void 0&&clearInterval(z),v?.(),s.delete(b);try{_.close()}catch{}}},y=new ReadableStream({start($){_=$;let T=Du({method:"notifications/subscriptions/acknowledged",params:{notifications:p}},g);R(T.method,T.params),h=t.subscribe(C=>{if(m||!r0(p,C))return;let O=Du(UT(C),g);R(O.method,O.params)}),z=Uu(n,()=>S(`: keepalive
135
+ `),m=!0;try{h?.()}catch(T){r?.(T instanceof Error?T:new Error(String(T)))}z!==void 0&&clearInterval(z),v?.(),s.delete(b);try{_.close()}catch{}}},y=new ReadableStream({start($){_=$;let T=Du({method:"notifications/subscriptions/acknowledged",params:{notifications:p}},g);R(T.method,T.params),h=t.subscribe(C=>{if(m||!o0(p,C))return;let O=Du(FT(C),g);R(O.method,O.params)}),z=Uu(n,()=>S(`: keepalive
136
136
 
137
- `)),s.add(b)},cancel(){b(!1)}});if(c!==void 0)if(c.aborted)b(!1);else{let $=()=>b(!1);c.addEventListener("abort",$,{once:!0}),v=()=>c.removeEventListener("abort",$)}return new Response(y,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}return{serve:i,closeAll(){for(let a of s)a(!0)},get openCount(){return s.size}}}var FT=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),i0=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=mn,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){this._serverCapabilities=e,t!==void 0&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=n0(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let r=o0(t,this._serverCapabilities);return this._subs.set(e.id,r),Du({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!FT.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t=="string"?t:void 0,o=VT(e.method,r),n=[];for(let[s,i]of this._subs)r0(i,o)&&n.push(Du({method:e.method,params:e.params??{}},s));return n}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[wr]:t,...this._serverInfo!==void 0&&{[Lt]:this._serverInfo}}}});return this._subs.clear(),e}};function VT(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var JT=8,HT=6e5;function BT(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??JT,roundTimeoutMs:e?.roundTimeoutMs??HT,legacyShim:e?.legacyShim??!0}}function a0(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new Q(V.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=r,n=Lz(o);if(n===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:n}}function KT(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Nm(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new Q(V.InternalError,t)}var GT=class{constructor(e){this._host=e}async fulfill(e,t,r,o,n){let{maxRounds:s,roundTimeoutMs:i}=this._host,a=o.mcpReq.signal,c=n,u=0;for(;;){if(u+=1,u>s)return Nm(e,f$(e,s));let l=c.inputRequests,d=l!=null&&Object.keys(l).length>0,p=typeof c.requestState=="string"?c.requestState:void 0;if(!d&&p===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let g;if(d){let m=this._host.resolvedClientCapabilities(o),h=[];for(let[v,S]of Object.entries(l)){let{embedded:R,required:b}=a0(e,v,S);if(R.method!=="roots/list"&&R.params===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${R.method}' without params`);if(Ys(b,m)!==void 0)return Nm(e,`Cannot request input '${v}' (${R.method}): the client on this 2025-era connection did not declare the required capability${m===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);h.push([v,R])}let z=g$(a);try{let v={relatedRequestId:o.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},S=await Promise.all(h.map(async([R,b])=>{try{return[R,await this._dispatchLeg(b,v)]}catch(y){throw z.abort(y),y}}));g=Object.fromEntries(S)}catch(v){if(a.aborted)throw v;return Nm(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{z.dispose()}}else await h$(m$,a);let f={...o,mcpReq:{...o.mcpReq,inputResponses:g,droppedInputResponseKeys:void 0,requestState:ei(p)}};if(p!==void 0){let m=await this._host.verifyRequestState(p,f,e);m!==void 0&&(f=Sm(f,m))}let _=await t(r,f);if(!pr(_))return _;c=_}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:KT()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},WT=new Set(["tools/call","prompts/get","resources/read"]),c0,u0,l0;function d0(e,t){c0(e,t)}function Fu(e,t){u0(e,t)}function Vu(e){return l0(e)}var Ju=class extends bm{_clientCapabilities;_clientVersion;static{c0=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},u0=(e,t)=>{let r=t.filter(o=>!e._supportedProtocolVersions.includes(o));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},l0=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new GT({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Zu,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=BT(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,o]of Object.entries(t.cacheHints))o!==void 0&&pm(o,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),im(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,n=Tu(Ir,o);return n.success&&this._loggingLevels.set(r,n.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,n,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[Rr],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:n,logger:s}})},elicitInput:(o,n)=>this.elicitInput(o,n),requestSampling:(o,n)=>this.createMessage(o,n)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Ir.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new ue(me.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=zm(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],o=WT.has(e);return r===void 0&&!o?async(n,s)=>{let i=await t(n,s);if(pr(i))throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(n,s)=>{let i=o?await this._invokeInputRequiredCapableHandler(e,t,n,s):await t(n,s);if(pr(i)){if(!o)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Ru(i,r)}}return async(r,o)=>{let n=qr(this._negotiatedProtocolVersion),s=n.validateRequest("tools/call",r);if(!s.ok)throw new Q(s.reason==="not-in-era"?V.InternalError:V.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,o);if(pr(i))return i;let a=am(i),c=n.validateResult("tools/call",a);if(!c.ok)throw new Q(c.reason==="not-in-era"?V.InternalError:V.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&dr(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,o){let n=this._servedModernEra(),s=o.mcpReq.requestState();if(s!==void 0&&typeof s!="string")throw new Q(V.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=o;if(typeof s=="string"){let d=await this._verifyRequestState(s,o,e);d!==void 0&&(i=Sm(o,d))}let a;try{a=await t(r,i)}catch(d){throw d instanceof Q&&d.code===V.UrlElicitationRequired&&n?new Q(V.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):d}if(!pr(a))return a;if(!n){if(!this._inputRequiredServing.legacyShim)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??to}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,a)}let c=a.inputRequests,u=c!=null&&Object.keys(c).length>0,l=typeof a.requestState=="string";if(!u&&!l)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let d=this._inputRequestCapabilityView(o);for(let[p,g]of Object.entries(c)){let{embedded:f,required:_}=a0(e,p,g),m=Ys(_,d);if(m!==void 0)throw new Xs({requiredCapabilities:m},`Cannot request input '${p}' (${f.method}): the request's client capabilities do not declare the required capability`)}}return a}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${o instanceof Error?o.message:String(o)}`)),new Q(V.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Kt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new ue(me.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new ue(me.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new ue(me.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new ue(me.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new ue(me.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Uz(this._supportedProtocolVersions),o=r.includes(t)?t:r[0]??to;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:im(this._supportedProtocolVersions),capabilities:YT(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new ue(me.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],a=i.some(d=>d.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(d=>d.type==="tool_use");if(a){if(i.some(d=>d.type!=="tool_result"))throw new Q(V.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new Q(V.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter(g=>g.type==="tool_use").map(g=>g.id)),p=new Set(i.filter(g=>g.type==="tool_result").map(g=>g.toolUseId));if(d.size!==p.size||![...d].every(g=>p.has(g)))throw new Q(V.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),n=this._wireCodec().samplingResultVariant(r,o);if(!n.ok)throw new ue(me.InvalidResult,`Invalid sampling/createMessage result: ${n.reason==="invalid"?n.message:n.reason}`);return n.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new ue(me.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let o=e.mode??"form",n=r?.validateAcceptedContent??!0;switch(o){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(n&&i.action==="accept"&&i.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!a.valid)throw new Q(V.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){throw a instanceof Q?a:new Q(V.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function YT(e){return{...e}}var ni=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return B$;try{let r=Zr(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new Ju(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Zr(t.inputSchema,"input"):B$,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=Zr(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new Q(V.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(r,e.params.arguments,e.params.name),n=await this.executeToolHandler(r,o,t);return await this.validateToolOutput(r,n,e.params.name),pr(n)?n:this.server.projectCallToolResult(n,r.outputSchemaJson)}catch(o){if(o instanceof Q&&o.code===V.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let o=await co(e.inputSchema,t??{});if(!o.success)throw new Q(V.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${o.error}`);return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema||pr(t)||t.isError)return;if(t.structuredContent===void 0)throw new Q(V.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=await co(e.outputSchema,t.structuredContent);if(!o.success)throw new Q(V.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${o.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return gm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return _m(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Q(V.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new Q(V.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return ri;let o=X$(Y$(r.argsSchema)?.[e.params.argument.name]);if(!jm(o))return ri;let n=LT(o);return n?W$(await n(e.params.argument.value,e.params.context)):ri}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(n=>n.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return ri;throw new Q(V.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);return o?W$(await o(e.params.argument.value,e.params.context)):ri}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(t);for(let i of s.resources)o.push({...n.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new Q(V.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new Q(V.InvalidParams,`Resource ${r} disabled`);return Ru(await o.readCallback(r,t),o.cacheHint)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(r.toString());if(s)return Ru(await n.readCallback(r,s,t),n.cacheHint)}throw new Pu(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?p$(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new Q(V.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,o){let n=r.cacheHint,s=r;if(n!==void 0){pm(n,`resource ${e}`);let i={...r};delete i.cacheHint,s=i}if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,r.title,t,s,o);return n!==void 0&&(i.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,r.title,t,s,o);return n!==void 0&&(i.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,r,o,n){let s={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:i=>{i.uri!==void 0&&i.uri!==r&&(delete this._registeredResources[r],i.uri&&(this._registeredResources[i.uri]=s)),i.name!==void 0&&(s.name=i.name),i.title!==void 0&&(s.title=i.title),i.metadata!==void 0&&(s.metadata=i.metadata),i.callback!==void 0&&(s.readCallback=i.callback),i.enabled!==void 0&&(s.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,o,n){let s={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{a.name!==void 0&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=s)),a.title!==void 0&&(s.title=a.title),a.template!==void 0&&(s.resourceTemplate=a.template),a.metadata!==void 0&&(s.metadata=a.metadata),a.callback!==void 0&&(s.readCallback=a.callback),a.enabled!==void 0&&(s.enabled=a.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;return Array.isArray(i)&&i.some(a=>!!r.completeCallback(a))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,t,r,o,n,s,i){let a=o,c=n,u={title:t,description:r,argsSchema:o,icons:s,_meta:i,handler:G$(e,o,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:l=>{l.name!==void 0&&l.name!==e&&(delete this._registeredPrompts[e],l.name&&(this._registeredPrompts[l.name]=u)),l.title!==void 0&&(u.title=l.title),l.description!==void 0&&(u.description=l.description),l.icons!==void 0&&(u.icons=l.icons),l._meta!==void 0&&(u._meta=l._meta);let d=!1;l.argsSchema!==void 0&&(u.argsSchema=l.argsSchema,a=l.argsSchema,d=!0),l.callback!==void 0&&(c=l.callback,d=!0),d&&(u.handler=G$(e,a,c)),l.enabled!==void 0&&(u.enabled=l.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,o){let l=Y$(o);l&&Object.values(l).some(d=>jm(X$(d)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(e,t,r,o,n,s,i,a,c,u){if(Em(e),o!==void 0)try{let p=Zr(o,"input");this._toolInputSchemaJson[e]=p;let g=Eu(p);g.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${g.reason}`)}catch{}let l=u,d={title:t,description:r,inputSchema:o,outputSchema:n,outputSchemaJson:K$(n),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:H$(o,u),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:p=>{p.name!==void 0&&p.name!==e&&(typeof p.name=="string"&&Em(p.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],p.name&&(delete this._toolInputSchemaJson[p.name],this._registeredTools[p.name]=d,e=p.name)),p.title!==void 0&&(d.title=p.title),p.description!==void 0&&(d.description=p.description);let g=!1;p.paramsSchema!==void 0&&(d.inputSchema=p.paramsSchema,delete this._toolInputSchemaJson[e],g=!0),p.callback!==void 0&&(d.handler=p.callback,l=p.callback,g=!0),g&&(d.executor=H$(d.inputSchema,l)),p.outputSchema!==void 0&&(d.outputSchema=p.outputSchema,d.outputSchemaJson=K$(p.outputSchema)),p.annotations!==void 0&&(d.annotations=p.annotations),p.icons!==void 0&&(d.icons=p.icons),p._meta!==void 0&&(d._meta=p._meta),p.enabled!==void 0&&(d.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:s,outputSchema:i,annotations:a,icons:c,_meta:u}=t;return this._createRegisteredTool(e,o,n,Ou(s),Ou(i),a,c,void 0,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:s,icons:i,_meta:a}=t,c=this._createRegisteredPrompt(e,o,n,Ou(s),r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function H$(e,t){if(e){let o=t;return async(n,s)=>o(n,s)}let r=t;return async(o,n)=>r(n)}var B$={type:"object",properties:{}};function K$(e){if(e!==void 0)try{return Zr(e,"output")}catch{return}}function G$(e,t,r){if(t){let o=r;return async(n,s)=>{let i=await co(t,n);if(!i.success)throw new Q(V.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return o(i.data,s)}}else{let o=r;return async(n,s)=>o(s)}}function W$(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ri={completion:{values:[],hasMore:!1}};function Y$(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function XT(e){return e?.type==="optional"}function X$(e){return XT(e)?e.def?.innerType??e:e}var QT=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(e){this._classification=e.classification,this._responseMode=e.responseMode??"auto",this._keepAliveMs=e.keepAliveMs??oi}async start(){if(this._started)throw new Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(e,t){if(this._used)throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||this.onmessage===void 0)throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw new Error("PerRequestHTTPServerTransport is closed");this._used=!0;let r=t?.request?.signal;if(r?.aborted)throw await this.close(),new ue(me.ConnectionClosed,"The request was aborted before it could be handled");let o={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(tt(e)){this._requestId=e.id;let n,s,i=new Promise((a,c)=>{n=a,s=c});if(this._deferredResponse={promise:i,resolve:n,reject:s,settled:!1},r!==void 0){let a=()=>void this.close();r.addEventListener("abort",a,{once:!0}),this._abortCleanup=()=>r.removeEventListener("abort",a)}this._dispatchWindowOpen=!0;try{this.onmessage(e,o)}finally{this._dispatchWindowOpen=!1}return this._responseMode==="sse"&&!this._closed&&!this._deferredResponse.settled&&this.upgradeToSse(),i}return this.onmessage(e,o),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let r=Ft(e)||Vt(e),o=r?e.id:t?.relatedRequestId;if(this._requestId===void 0||o===void 0||o!==this._requestId){r&&this.onerror?.(new Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(r){if(this._terminalDelivered)return;this._terminalDelivered=!0;let n=Vt(e)?e.error.code:void 0,s=n!==void 0&&(this._dispatchWindowOpen||n===V.MissingRequiredClientCapability)?vm[n]:void 0;if(s!==void 0&&this._sse===void 0){this.settleResponse(Response.json(e,{status:s,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(this._sse!==void 0||this._responseMode==="sse"){this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e),this.finalizeStream();return}this.settleResponse(Response.json(e,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}this._responseMode!=="json"&&(this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||this._sse===void 0||this._sse.closed)return;let t=e.split(`
137
+ `)),s.add(b)},cancel(){b(!1)}});if(c!==void 0)if(c.aborted)b(!1);else{let $=()=>b(!1);c.addEventListener("abort",$,{once:!0}),v=()=>c.removeEventListener("abort",$)}return new Response(y,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}return{serve:i,closeAll(){for(let a of s)a(!0)},get openCount(){return s.size}}}var VT=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),a0=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=mn,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){this._serverCapabilities=e,t!==void 0&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw new Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=s0(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let r=n0(t,this._serverCapabilities);return this._subs.set(e.id,r),Du({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!VT.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t=="string"?t:void 0,o=JT(e.method,r),n=[];for(let[s,i]of this._subs)o0(i,o)&&n.push(Du({method:e.method,params:e.params??{}},s));return n}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[wr]:t,...this._serverInfo!==void 0&&{[Lt]:this._serverInfo}}}});return this._subs.clear(),e}};function JT(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var HT=8,BT=6e5;function KT(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??HT,roundTimeoutMs:e?.roundTimeoutMs??BT,legacyShim:e?.legacyShim??!0}}function c0(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new Q(V.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=r,n=Dz(o);if(n===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:n}}function GT(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Nm(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new Q(V.InternalError,t)}var WT=class{constructor(e){this._host=e}async fulfill(e,t,r,o,n){let{maxRounds:s,roundTimeoutMs:i}=this._host,a=o.mcpReq.signal,c=n,u=0;for(;;){if(u+=1,u>s)return Nm(e,h$(e,s));let l=c.inputRequests,d=l!=null&&Object.keys(l).length>0,p=typeof c.requestState=="string"?c.requestState:void 0;if(!d&&p===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let g;if(d){let m=this._host.resolvedClientCapabilities(o),h=[];for(let[v,S]of Object.entries(l)){let{embedded:R,required:b}=c0(e,v,S);if(R.method!=="roots/list"&&R.params===void 0)throw new Q(V.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${R.method}' without params`);if(Ys(b,m)!==void 0)return Nm(e,`Cannot request input '${v}' (${R.method}): the client on this 2025-era connection did not declare the required capability${m===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);h.push([v,R])}let z=_$(a);try{let v={relatedRequestId:o.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},S=await Promise.all(h.map(async([R,b])=>{try{return[R,await this._dispatchLeg(b,v)]}catch(y){throw z.abort(y),y}}));g=Object.fromEntries(S)}catch(v){if(a.aborted)throw v;return Nm(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{z.dispose()}}else await g$(f$,a);let f={...o,mcpReq:{...o.mcpReq,inputResponses:g,droppedInputResponseKeys:void 0,requestState:ei(p)}};if(p!==void 0){let m=await this._host.verifyRequestState(p,f,e);m!==void 0&&(f=Sm(f,m))}let _=await t(r,f);if(!pr(_))return _;c=_}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:GT()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},YT=new Set(["tools/call","prompts/get","resources/read"]),u0,l0,d0;function p0(e,t){u0(e,t)}function Fu(e,t){l0(e,t)}function Vu(e){return d0(e)}var Ju=class extends bm{_clientCapabilities;_clientVersion;static{u0=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},l0=(e,t)=>{let r=t.filter(o=>!e._supportedProtocolVersions.includes(o));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},d0=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new WT({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Zu,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=KT(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,o]of Object.entries(t.cacheHints))o!==void 0&&pm(o,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),im(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,n=Tu(Ir,o);return n.success&&this._loggingLevels.set(r,n.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,n,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[Rr],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:n,logger:s}})},elicitInput:(o,n)=>this.elicitInput(o,n),requestSampling:(o,n)=>this.createMessage(o,n)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Ir.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new ue(me.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=zm(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],o=YT.has(e);return r===void 0&&!o?async(n,s)=>{let i=await t(n,s);if(pr(i))throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(n,s)=>{let i=o?await this._invokeInputRequiredCapableHandler(e,t,n,s):await t(n,s);if(pr(i)){if(!o)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Ru(i,r)}}return async(r,o)=>{let n=qr(this._negotiatedProtocolVersion),s=n.validateRequest("tools/call",r);if(!s.ok)throw new Q(s.reason==="not-in-era"?V.InternalError:V.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,o);if(pr(i))return i;let a=am(i),c=n.validateResult("tools/call",a);if(!c.ok)throw new Q(c.reason==="not-in-era"?V.InternalError:V.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&dr(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,o){let n=this._servedModernEra(),s=o.mcpReq.requestState();if(s!==void 0&&typeof s!="string")throw new Q(V.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=o;if(typeof s=="string"){let d=await this._verifyRequestState(s,o,e);d!==void 0&&(i=Sm(o,d))}let a;try{a=await t(r,i)}catch(d){throw d instanceof Q&&d.code===V.UrlElicitationRequired&&n?new Q(V.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):d}if(!pr(a))return a;if(!n){if(!this._inputRequiredServing.legacyShim)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??to}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,a)}let c=a.inputRequests,u=c!=null&&Object.keys(c).length>0,l=typeof a.requestState=="string";if(!u&&!l)throw new Q(V.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let d=this._inputRequestCapabilityView(o);for(let[p,g]of Object.entries(c)){let{embedded:f,required:_}=c0(e,p,g),m=Ys(_,d);if(m!==void 0)throw new Xs({requiredCapabilities:m},`Cannot request input '${p}' (${f.method}): the request's client capabilities do not declare the required capability`)}}return a}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${o instanceof Error?o.message:String(o)}`)),new Q(V.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Kt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new ue(me.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new ue(me.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new ue(me.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new ue(me.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new ue(me.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Fz(this._supportedProtocolVersions),o=r.includes(t)?t:r[0]??to;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:im(this._supportedProtocolVersions),capabilities:XT(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new ue(me.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],a=i.some(d=>d.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(d=>d.type==="tool_use");if(a){if(i.some(d=>d.type!=="tool_result"))throw new Q(V.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new Q(V.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter(g=>g.type==="tool_use").map(g=>g.id)),p=new Set(i.filter(g=>g.type==="tool_result").map(g=>g.toolUseId));if(d.size!==p.size||![...d].every(g=>p.has(g)))throw new Q(V.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),n=this._wireCodec().samplingResultVariant(r,o);if(!n.ok)throw new ue(me.InvalidResult,`Invalid sampling/createMessage result: ${n.reason==="invalid"?n.message:n.reason}`);return n.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new ue(me.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let o=e.mode??"form",n=r?.validateAcceptedContent??!0;switch(o){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(n&&i.action==="accept"&&i.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!a.valid)throw new Q(V.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){throw a instanceof Q?a:new Q(V.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function XT(e){return{...e}}var ni=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return K$;try{let r=Zr(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new Ju(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Zr(t.inputSchema,"input"):K$,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=Zr(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new Q(V.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(r,e.params.arguments,e.params.name),n=await this.executeToolHandler(r,o,t);return await this.validateToolOutput(r,n,e.params.name),pr(n)?n:this.server.projectCallToolResult(n,r.outputSchemaJson)}catch(o){if(o instanceof Q&&o.code===V.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let o=await co(e.inputSchema,t??{});if(!o.success)throw new Q(V.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${o.error}`);return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema||pr(t)||t.isError)return;if(t.structuredContent===void 0)throw new Q(V.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=await co(e.outputSchema,t.structuredContent);if(!o.success)throw new Q(V.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${o.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return gm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return _m(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Q(V.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new Q(V.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return ri;let o=Q$(X$(r.argsSchema)?.[e.params.argument.name]);if(!jm(o))return ri;let n=DT(o);return n?Y$(await n(e.params.argument.value,e.params.context)):ri}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(n=>n.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return ri;throw new Q(V.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);return o?Y$(await o(e.params.argument.value,e.params.context)):ri}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(t);for(let i of s.resources)o.push({...n.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new Q(V.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new Q(V.InvalidParams,`Resource ${r} disabled`);return Ru(await o.readCallback(r,t),o.cacheHint)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(r.toString());if(s)return Ru(await n.readCallback(r,s,t),n.cacheHint)}throw new Pu(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?m$(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new Q(V.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new Q(V.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,o){let n=r.cacheHint,s=r;if(n!==void 0){pm(n,`resource ${e}`);let i={...r};delete i.cacheHint,s=i}if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,r.title,t,s,o);return n!==void 0&&(i.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,r.title,t,s,o);return n!==void 0&&(i.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,r,o,n){let s={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:i=>{i.uri!==void 0&&i.uri!==r&&(delete this._registeredResources[r],i.uri&&(this._registeredResources[i.uri]=s)),i.name!==void 0&&(s.name=i.name),i.title!==void 0&&(s.title=i.title),i.metadata!==void 0&&(s.metadata=i.metadata),i.callback!==void 0&&(s.readCallback=i.callback),i.enabled!==void 0&&(s.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,o,n){let s={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{a.name!==void 0&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=s)),a.title!==void 0&&(s.title=a.title),a.template!==void 0&&(s.resourceTemplate=a.template),a.metadata!==void 0&&(s.metadata=a.metadata),a.callback!==void 0&&(s.readCallback=a.callback),a.enabled!==void 0&&(s.enabled=a.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;return Array.isArray(i)&&i.some(a=>!!r.completeCallback(a))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,t,r,o,n,s,i){let a=o,c=n,u={title:t,description:r,argsSchema:o,icons:s,_meta:i,handler:W$(e,o,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:l=>{l.name!==void 0&&l.name!==e&&(delete this._registeredPrompts[e],l.name&&(this._registeredPrompts[l.name]=u)),l.title!==void 0&&(u.title=l.title),l.description!==void 0&&(u.description=l.description),l.icons!==void 0&&(u.icons=l.icons),l._meta!==void 0&&(u._meta=l._meta);let d=!1;l.argsSchema!==void 0&&(u.argsSchema=l.argsSchema,a=l.argsSchema,d=!0),l.callback!==void 0&&(c=l.callback,d=!0),d&&(u.handler=W$(e,a,c)),l.enabled!==void 0&&(u.enabled=l.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,o){let l=X$(o);l&&Object.values(l).some(d=>jm(Q$(d)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(e,t,r,o,n,s,i,a,c,u){if(Em(e),o!==void 0)try{let p=Zr(o,"input");this._toolInputSchemaJson[e]=p;let g=Eu(p);g.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${g.reason}`)}catch{}let l=u,d={title:t,description:r,inputSchema:o,outputSchema:n,outputSchemaJson:G$(n),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:B$(o,u),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:p=>{p.name!==void 0&&p.name!==e&&(typeof p.name=="string"&&Em(p.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],p.name&&(delete this._toolInputSchemaJson[p.name],this._registeredTools[p.name]=d,e=p.name)),p.title!==void 0&&(d.title=p.title),p.description!==void 0&&(d.description=p.description);let g=!1;p.paramsSchema!==void 0&&(d.inputSchema=p.paramsSchema,delete this._toolInputSchemaJson[e],g=!0),p.callback!==void 0&&(d.handler=p.callback,l=p.callback,g=!0),g&&(d.executor=B$(d.inputSchema,l)),p.outputSchema!==void 0&&(d.outputSchema=p.outputSchema,d.outputSchemaJson=G$(p.outputSchema)),p.annotations!==void 0&&(d.annotations=p.annotations),p.icons!==void 0&&(d.icons=p.icons),p._meta!==void 0&&(d._meta=p._meta),p.enabled!==void 0&&(d.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:s,outputSchema:i,annotations:a,icons:c,_meta:u}=t;return this._createRegisteredTool(e,o,n,Ou(s),Ou(i),a,c,void 0,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:s,icons:i,_meta:a}=t,c=this._createRegisteredPrompt(e,o,n,Ou(s),r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function B$(e,t){if(e){let o=t;return async(n,s)=>o(n,s)}let r=t;return async(o,n)=>r(n)}var K$={type:"object",properties:{}};function G$(e){if(e!==void 0)try{return Zr(e,"output")}catch{return}}function W$(e,t,r){if(t){let o=r;return async(n,s)=>{let i=await co(t,n);if(!i.success)throw new Q(V.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return o(i.data,s)}}else{let o=r;return async(n,s)=>o(s)}}function Y$(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ri={completion:{values:[],hasMore:!1}};function X$(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function QT(e){return e?.type==="optional"}function Q$(e){return QT(e)?e.def?.innerType??e:e}var eI=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(e){this._classification=e.classification,this._responseMode=e.responseMode??"auto",this._keepAliveMs=e.keepAliveMs??oi}async start(){if(this._started)throw new Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(e,t){if(this._used)throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||this.onmessage===void 0)throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw new Error("PerRequestHTTPServerTransport is closed");this._used=!0;let r=t?.request?.signal;if(r?.aborted)throw await this.close(),new ue(me.ConnectionClosed,"The request was aborted before it could be handled");let o={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(tt(e)){this._requestId=e.id;let n,s,i=new Promise((a,c)=>{n=a,s=c});if(this._deferredResponse={promise:i,resolve:n,reject:s,settled:!1},r!==void 0){let a=()=>void this.close();r.addEventListener("abort",a,{once:!0}),this._abortCleanup=()=>r.removeEventListener("abort",a)}this._dispatchWindowOpen=!0;try{this.onmessage(e,o)}finally{this._dispatchWindowOpen=!1}return this._responseMode==="sse"&&!this._closed&&!this._deferredResponse.settled&&this.upgradeToSse(),i}return this.onmessage(e,o),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let r=Ft(e)||Vt(e),o=r?e.id:t?.relatedRequestId;if(this._requestId===void 0||o===void 0||o!==this._requestId){r&&this.onerror?.(new Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(r){if(this._terminalDelivered)return;this._terminalDelivered=!0;let n=Vt(e)?e.error.code:void 0,s=n!==void 0&&(this._dispatchWindowOpen||n===V.MissingRequiredClientCapability)?vm[n]:void 0;if(s!==void 0&&this._sse===void 0){this.settleResponse(Response.json(e,{status:s,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(this._sse!==void 0||this._responseMode==="sse"){this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e),this.finalizeStream();return}this.settleResponse(Response.json(e,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}this._responseMode!=="json"&&(this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||this._sse===void 0||this._sse.closed)return;let t=e.split(`
138
138
  `).map(r=>`: ${r}`).join(`
139
139
  `);this.writeFrame(`${t}
140
140
 
141
141
  `)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}this._deferredResponse!==void 0&&!this._deferredResponse.settled&&(this._deferredResponse.settled=!0,this._deferredResponse.reject(new ue(me.ConnectionClosed,"Connection closed before a response was produced"))),this.onclose?.()}}settleResponse(e){this._deferredResponse===void 0||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(e))}upgradeToSse(){let e,t=new ReadableStream({start:r=>{e=r},cancel:()=>{this.close()}});this._sse={controller:e,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=Uu(this._keepAliveMs,()=>this.writeCommentFrame("keepalive")),this.settleResponse(new Response(t,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}}))}finalizeStream(){if(this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}queueMicrotask(()=>void this.close())}writeMessageFrame(e){this.writeFrame(`event: message
142
142
  data: ${JSON.stringify(e)}
143
143
 
144
- `)}writeFrame(e){if(!(this._sse===void 0||this._sse.closed))try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(t){this.onerror?.(new Error(`Failed to write to the response stream: ${t}`))}}};async function eI(e,t,r){let o=new QT({classification:r.classification,...r.responseMode!==void 0&&{responseMode:r.responseMode},...r.keepAliveMs!==void 0&&{keepAliveMs:r.keepAliveMs}});return await e.connect(o),o.handleMessage(t,{...r.request!==void 0&&{request:r.request},...r.authInfo!==void 0&&{authInfo:r.authInfo}})}var tI=class{sessionIdGenerator;_started=!1;_closed=!1;_streamMapping=new Map;_requestToStreamMapping=new Map;_requestResponseMap=new Map;_initialized=!1;_enableJsonResponse=!1;_standaloneSseStreamId="_GET_stream";_eventStore;_onsessioninitialized;_onsessionclosed;_allowedHosts;_allowedOrigins;_enableDnsRebindingProtection;_retryInterval;_supportedProtocolVersions;_keepAliveMs;sessionId;onclose;onerror;onmessage;constructor(e={}){this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval,this._supportedProtocolVersions=e.supportedProtocolVersions??os,this._keepAliveMs=e.keepAliveMs??oi}startKeepAlive(e,t){if(this._closed)return;let r=Uu(this._keepAliveMs,()=>{try{e.enqueue(t.encode(`: keepalive
144
+ `)}writeFrame(e){if(!(this._sse===void 0||this._sse.closed))try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(t){this.onerror?.(new Error(`Failed to write to the response stream: ${t}`))}}};async function tI(e,t,r){let o=new eI({classification:r.classification,...r.responseMode!==void 0&&{responseMode:r.responseMode},...r.keepAliveMs!==void 0&&{keepAliveMs:r.keepAliveMs}});return await e.connect(o),o.handleMessage(t,{...r.request!==void 0&&{request:r.request},...r.authInfo!==void 0&&{authInfo:r.authInfo}})}var rI=class{sessionIdGenerator;_started=!1;_closed=!1;_streamMapping=new Map;_requestToStreamMapping=new Map;_requestResponseMap=new Map;_initialized=!1;_enableJsonResponse=!1;_standaloneSseStreamId="_GET_stream";_eventStore;_onsessioninitialized;_onsessionclosed;_allowedHosts;_allowedOrigins;_enableDnsRebindingProtection;_retryInterval;_supportedProtocolVersions;_keepAliveMs;sessionId;onclose;onerror;onmessage;constructor(e={}){this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval,this._supportedProtocolVersions=e.supportedProtocolVersions??os,this._keepAliveMs=e.keepAliveMs??oi}startKeepAlive(e,t){if(this._closed)return;let r=Uu(this._keepAliveMs,()=>{try{e.enqueue(t.encode(`: keepalive
145
145
 
146
146
  `))}catch{r!==void 0&&clearInterval(r)}});return r}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}setSupportedProtocolVersions(e){this._supportedProtocolVersions=e}createJsonErrorResponse(e,t,r,o){let n={code:t,message:r};return o?.data!==void 0&&(n.data=o.data),Response.json({jsonrpc:"2.0",error:n,id:null},{status:e,headers:{"Content-Type":"application/json",...o?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.get("host");if(!t||!this._allowedHosts.includes(t)){let r=`Invalid Host header: ${t}`;return this.onerror?.(new Error(r)),this.createJsonErrorResponse(403,-32e3,r)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.get("origin");if(t&&!this._allowedOrigins.includes(t)){let r=`Invalid Origin header: ${t}`;return this.onerror?.(new Error(r)),this.createJsonErrorResponse(403,-32e3,r)}}}}async handleRequest(e,t){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let r=this.validateRequestHeaders(e);if(r)return r;switch(e.method){case"POST":return this.handlePostRequest(e,t);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}supportsEmptySSEData(e){return this._supportedProtocolVersions.includes(e)&&e>="2025-11-25"}async writePrimingEvent(e,t,r,o){if(!this._eventStore||!this.supportsEmptySSEData(o))return;let n=await this._eventStore.storeEvent(r,{}),s=`id: ${n}
147
147
  data:
@@ -154,5 +154,5 @@ data:
154
154
  `;return o&&(n+=`id: ${o}
155
155
  `),n+=`data: ${JSON.stringify(r)}
156
156
 
157
- `,e.enqueue(t.encode(n)),!0}catch(n){return this.onerror?.(n),!1}}handleUnsupportedRequest(){return this.onerror?.(new Error("Method not allowed.")),Response.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,t){try{let r=e.headers.get("accept");if(!r?.includes("application/json")||!r.includes("text/event-stream"))return this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");if(!wm(e.headers.get("content-type")))return this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let o=e,n;if(t?.parsedBody===void 0)try{n=await e.json()}catch(_){return this.onerror?.(_),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else n=t.parsedBody;let s;try{s=Array.isArray(n)?n.map(_=>so.parse(_)):[so.parse(n)]}catch(_){return this.onerror?.(_),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let i=s.some(_=>hm(_));if(i){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(new Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(s.length>1)return this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!i){let _=this.validateSession(e);if(_)return _;let m=this.validateProtocolVersion(e);if(m)return m}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!s.some(_=>tt(_))){for(let _ of s)this.onmessage?.(_,{authInfo:t?.authInfo,request:o});return new Response(null,{status:202})}let a=crypto.randomUUID(),c=s.find(_=>hm(_)),u=c?c.params.protocolVersion:e.headers.get("mcp-protocol-version")??ua;if(this._enableJsonResponse)return new Promise(_=>{this._streamMapping.set(a,{resolveJson:_,cleanup:()=>{this._streamMapping.delete(a)}});for(let m of s)tt(m)&&this._requestToStreamMapping.set(m.id,a);for(let m of s)this.onmessage?.(m,{authInfo:t?.authInfo,request:o})});let l=new TextEncoder,d,p,g=new ReadableStream({start:_=>{d=_},cancel:()=>{p!==void 0&&clearInterval(p),this._streamMapping.get(a)?.controller===d&&this._streamMapping.delete(a)}}),f={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};this.sessionId!==void 0&&(f["mcp-session-id"]=this.sessionId);for(let _ of s)tt(_)&&(this._streamMapping.set(a,{controller:d,encoder:l,cleanup:()=>{p!==void 0&&clearInterval(p),this._streamMapping.delete(a);try{d.close()}catch{}}}),this._requestToStreamMapping.set(_.id,a));await this.writePrimingEvent(d,l,a,u);for(let _ of s){let m,h;tt(_)&&this._eventStore&&this.supportsEmptySSEData(u)&&(m=()=>{this.closeSSEStream(_.id)},h=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(_,{authInfo:t?.authInfo,request:o,closeSSEStream:m,closeStandaloneSSEStream:h})}return this._streamMapping.get(a)?.controller===d&&(p=this.startKeepAlive(d,l)),new Response(g,{status:200,headers:f})}catch(r){return this.onerror?.(r),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(r)})}}async handleDeleteRequest(e){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(e){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.onerror?.(new Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let t=e.headers.get("mcp-session-id");if(!t)return this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required");if(t!==this.sessionId)return this.onerror?.(new Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")}validateProtocolVersion(e){let t=e.headers.get("mcp-protocol-version");if(t!==null&&!this._supportedProtocolVersions.includes(t)){let r=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(new Error(r)),this.createJsonErrorResponse(400,-32e3,r)}}async close(){if(!this._closed){this._closed=!0;for(let{cleanup:e}of this._streamMapping.values())e();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(e){let t=this._requestToStreamMapping.get(e);if(!t)return;let r=this._streamMapping.get(t);r&&r.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let r=t?.relatedRequestId;if((Ft(e)||Vt(e))&&(r=e.id),r===void 0){if(Ft(e)||Vt(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let s;this._eventStore&&(s=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let i=this._streamMapping.get(this._standaloneSseStreamId);if(i===void 0)return;i.controller&&i.encoder&&(s===void 0||!i.replayedEventIds?.has(s))&&this.writeSSEEvent(i.controller,i.encoder,e,s);return}let o=this._requestToStreamMapping.get(r);if(!o)throw new Error(`No connection established for request ID: ${String(r)}`);let n=this._streamMapping.get(o);if(!this._enableJsonResponse){let s;this._eventStore&&(s=await this._eventStore.storeEvent(o,e),n=this._streamMapping.get(o)),n?.controller&&n?.encoder&&(s===void 0||!n.replayedEventIds?.has(s))&&this.writeSSEEvent(n.controller,n.encoder,e,s)}if(Ft(e)||Vt(e)){this._requestResponseMap.set(r,e);let s=[...this._requestToStreamMapping.entries()].filter(([i,a])=>a===o).map(([i])=>i);if(s.every(i=>this._requestResponseMap.has(i))){if(!n){if(this._enableJsonResponse)throw new Error(`No connection established for request ID: ${String(r)}`);if(!this._eventStore){this.onerror?.(new Error(`Response for request ID ${String(r)} is undeliverable: per-request stream is disconnected and no eventStore is configured`));for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i);return}for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i);return}if(this._enableJsonResponse&&n.resolveJson){let i={"Content-Type":"application/json"};this.sessionId!==void 0&&(i["mcp-session-id"]=this.sessionId);let a=s.map(c=>this._requestResponseMap.get(c));a.length===1?n.resolveJson(Response.json(a[0],{status:200,headers:i})):n.resolveJson(Response.json(a,{status:200,headers:i})),n.cleanup()}else n.cleanup();for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i)}}}};function Lr(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let{method:t,id:r}=e;return typeof t!="string"?null:typeof r=="string"||typeof r=="number"?r:null}function Dr(e,t,r,o,n=null){return Response.json({jsonrpc:"2.0",error:{code:t,message:r,...o!==void 0&&{data:o}},id:n},{status:e})}function Hu(e,t=null){return Dr(e.httpStatus,e.code,e.message,e.data,t)}function Bu(e){return e instanceof Error?e:new Error(String(e))}function Ku(e=null){return Dr(500,-32603,"Internal server error",void 0,e)}function rI(e,t,r){return async(o,n)=>{if(o.method.toUpperCase()!=="POST")return Dr(405,-32e3,"Method not allowed.");try{let s=await e({era:"legacy",...n?.authInfo!==void 0&&{authInfo:n.authInfo},requestInfo:o}),i=new tI({sessionIdGenerator:void 0,...r!==void 0&&{keepAliveMs:r}});await s.connect(i);let a=()=>{i.close().catch(()=>{}),s.close().catch(()=>{})};o.signal?.addEventListener("abort",a,{once:!0});let c=await i.handleRequest(o,{...n?.authInfo!==void 0&&{authInfo:n.authInfo},...n?.parsedBody!==void 0&&{parsedBody:n.parsedBody}});if(c.body===null||$m(c.headers.get("content-type"))!=="text/event-stream")return a(),c;let u=c.body.getReader(),l=!1,d=()=>{l||(l=!0,a())},p=new ReadableStream({pull:async g=>{try{let{done:f,value:_}=await u.read();if(f){d(),g.close();return}_!==void 0&&g.enqueue(_)}catch(f){d(),g.error(f)}},cancel:g=>(d(),u.cancel(g).catch(()=>{}))});return new Response(p,{status:c.status,statusText:c.statusText,headers:c.headers})}catch(s){try{t?.(Bu(s))}catch{}return Ku(Lr(n?.parsedBody))}}}async function oI(e,t,r=!0){let o=e.method.toUpperCase(),n,s=t,i=e,a=!1;if(o==="POST"){if(s===void 0){r&&(i=e.clone());let c;try{c=await e.text()}catch{return{step:"unreadable-body"}}try{n=c.length===0?void 0:JSON.parse(c)}catch{a=!0}!a&&n!==void 0&&(s=n)}else n=s;if(a||n===void 0)return{step:"no-json-body",forwardRequest:i}}return{step:"classified",outcome:l$({httpMethod:o,protocolVersionHeader:e.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:e.headers.get("mcp-method")??void 0,mcpNameHeader:e.headers.get("mcp-name")??void 0,...n!==void 0&&{body:n}}),body:n,parsedBody:s,forwardRequest:i}}function p0(e,t={}){let{legacy:r,onerror:o,responseMode:n}=t;if(typeof r=="function")throw new TypeError("The 'legacy' option only accepts 'stateless' or 'reject', not a handler function. To serve 2025-era traffic with your own handler, route in user land with the exported isLegacyRequest(request) predicate in front of a strict (legacy: 'reject') handler.");let s=new Set,i=!1,a=m=>{try{o?.(m)}catch{}},c=t.bus??new e0(a),u=t0(c),l=s0({bus:c,maxSubscriptions:t.maxSubscriptions??mn,keepAliveMs:t.keepAliveMs??oi,onerror:a});n==="json"&&console.warn("responseMode: 'json' drops mid-call notifications. subscriptions/listen streams are always served over SSE regardless; other notifications emitted before a result are dropped.");let d=r==="reject"?void 0:rI(e,a,t.keepAliveMs);async function p(m,h,z){let v=m.classification.revision;if(v===void 0||!Ct.includes(v)){let C=new po({supported:[...Ct],requested:v??"unknown"});return a(C),Dr(400,C.code,C.message,C.data,Lr(m.message))}let S=c$({httpMethod:h.method,mcpMethodHeader:h.headers.get("mcp-method")??void 0,mcpNameHeader:h.headers.get("mcp-name")??void 0},m);if(S!==void 0)return a(new Error(`Rejected inbound request (${S.cell}): ${S.message}`)),Hu(S,Lr(m.message));let R=m.messageKind==="request"?Ut(m.message.params):void 0,b=R?.[Kt];if(m.messageKind==="request"){let C=Zz(m.message.method);if(C!==void 0){let O=Ys(C,b);if(O!==void 0){let L=new Xs({requiredCapabilities:O});return a(L),Dr(a$(L.code,"ladder"),L.code,L.message,L.data,m.message.id)}}}let y=await e({era:"modern",...z!==void 0&&{authInfo:z},requestInfo:h}),$=y instanceof ni?y.server:y;if(m.messageKind==="request"&&m.message.method==="subscriptions/listen"){let C=$.getCapabilities(),O=Vu($);return y.close().catch(a),l.serve(m.message,h.signal,C,O)}if(m.messageKind==="request"&&m.message.method==="tools/call"&&y instanceof ni){let C=m.message.params,O=typeof C?.name=="string"?C.name:void 0,L=O===void 0?void 0:y.toolInputSchemaJson(O);if(L!==void 0){let H=Eu(L);if(H.valid&&H.declarations.length>0){let G=i$(H.declarations,C?.arguments,h.headers);if(G!==void 0)return y.close().catch(a),a(new Error(`Rejected inbound request (${G.cell}): ${G.message}`)),Hu(G,m.message.id)}}}Iu($,v),Fu($,Ct),R!==void 0&&d0($,{clientInfo:R[ro],clientCapabilities:b});let T=$.onclose;s.add($),$.onclose=()=>{s.delete($),T?.()};try{let C=await eI(y,m.message,{classification:m.classification,request:h,...z!==void 0&&{authInfo:z},...n!==void 0&&{responseMode:n},...t.keepAliveMs!==void 0&&{keepAliveMs:t.keepAliveMs}});return m.messageKind==="notification"&&queueMicrotask(()=>void $.close().catch(()=>{})),C}catch(C){return C instanceof ue&&C.code===me.ConnectionClosed?new Response(null,{status:499}):(await $.close().catch(()=>{}),s.delete($),a(Bu(C)),Ku(Lr(m.message)))}}async function g(m,h,z,v){if(d!==void 0)return d(h,{...z!==void 0&&{authInfo:z},...v!==void 0&&{parsedBody:v}});let S=xu(m,Ct);return S===void 0?new Response(null,{status:202}):(a(new Error(`Rejected 2025-era request on a modern-only endpoint (${S.cell}): ${S.message}`)),Hu(S,Lr(v)))}async function f(m,h){let z=h?.authInfo;if(m.method.toUpperCase()==="POST"&&!wm(m.headers.get("content-type")))return a(new Error("Unsupported Media Type: Content-Type must be application/json")),Dr(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let v=await oI(m,h?.parsedBody);if(v.step==="unreadable-body")return Dr(400,-32700,"Parse error: the request body could not be read");if(v.step==="no-json-body")return d!==void 0?d(v.forwardRequest,{...z!==void 0&&{authInfo:z}}):Dr(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:S,body:R,parsedBody:b,forwardRequest:y}=v;try{switch(S.kind){case"reject":return a(new Error(`Rejected inbound request (${S.cell}): ${S.message}`)),Hu(S,Lr(R));case"modern":return await p(S,m,z);case"legacy":return await g(S,y,z,b)}}catch($){return a(Bu($)),Ku(Lr(R))}}return{fetch:async(m,h)=>{if(i)throw new Error("This MCP handler has been closed");try{return await f(m,h)}catch(z){return a(Bu(z)),Ku(Lr(h?.parsedBody))}},notify:u,bus:c,close:async()=>{i=!0,l.closeAll();let m=[...s].map(h=>h.close().catch(()=>{}));s.clear(),await Promise.all(m)}}}function nI(e,t){if(!e)return{ok:!1,errorCode:"missing_host",message:"Missing Host header"};let r;try{r=new URL(`http://${e}`).hostname}catch{return{ok:!1,errorCode:"invalid_host_header",message:`Invalid Host header: ${e}`,hostHeader:e}}return t.includes(r)?{ok:!0,hostname:r}:{ok:!1,errorCode:"invalid_host",message:`Invalid Host: ${r}`,hostHeader:e,hostname:r}}function m0(){return["localhost","127.0.0.1","[::1]"]}function f0(e,t){let r=nI(e.headers.get("host"),t);if(!r.ok)return Response.json({jsonrpc:"2.0",error:{code:-32e3,message:r.message},id:null},{status:403,headers:{"Content-Type":"application/json"}})}function sI(e,t){if(e==null||e==="")return{ok:!0};let r;try{r=new URL(e).hostname}catch{return{ok:!1,errorCode:"invalid_origin_header",message:`Invalid Origin header: ${e}`,originHeader:e}}return r===""?{ok:!1,errorCode:"invalid_origin_header",message:`Invalid Origin header: ${e}`,originHeader:e}:t.includes(r)?{ok:!0,origin:e,hostname:r}:{ok:!1,errorCode:"invalid_origin",message:`Invalid Origin: ${r}`,originHeader:e,hostname:r}}function h0(){return["localhost","127.0.0.1","[::1]"]}function g0(e,t){let r=sI(e.headers.get("origin"),t);if(!r.ok)return Response.json({jsonrpc:"2.0",error:{code:-32e3,message:r.message},id:null},{status:403,headers:{"Content-Type":"application/json"}})}var iI=class{_readBuffer;_started=!1;_closed=!1;constructor(e=Lu.default.stdin,t=Lu.default.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Rm({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let o=Pm(e),n=!1,s=a=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(a))},i=()=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t())};if(this._stdout.once("error",s),this._stdout.write(o)){if(n)return;n=!0,this._stdout.off("error",s),t()}else n||this._stdout.once("drain",i)})}},_0=3e3,aI=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(Ft(e)||Vt(e)){let{id:r}=e;r!==void 0&&this._settle(r)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if(tt(e))this._pendingRequests.add(e.id);else if(Yt(e)&&e.method==="notifications/cancelled"){let r=e.params?.requestId;r!==void 0&&this._settle(r)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return this._closed||this._pendingRequests.size===0?!0:await new Promise(t=>{let r=()=>{clearTimeout(o),t(!0)},o=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(n=>n!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),this._pendingRequests.size===0&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function cI(e){let t=e.params;if(e.method==="initialize"&&!ku(t)){let s=t!==null&&typeof t=="object"&&typeof t.protocolVersion=="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...s!==void 0&&{requestedVersion:s}}}if(!mo(t))return{kind:"legacy",reason:"no-claim"};let r=Ut(t),o=(r===void 0?[]:lo(r))[0];if(o!==void 0)return{kind:"invalid-envelope",issue:o};let n=ln(t);return n===void 0||!Ct.includes(n)?{kind:"unsupported-revision",requested:n??"unknown"}:{kind:"modern",revision:n,classification:{era:"modern",revision:n}}}function v0(e,t={}){let r=t.legacy??"serve",o=t.transport??new iI,n={phase:"opening"},s,i=!1,a=()=>i||n.phase==="closed",c=$=>{try{t.onerror?.($)}catch{}},u=($,T,C,O)=>o.send({jsonrpc:"2.0",id:$,error:{code:T,message:C,...O!==void 0&&{data:O}}}).catch(L=>c(Bt(L))),l=new i0(t.maxSubscriptions??mn),d=$=>{if(!Yt($))return;let T=l.routeOutbound($);if(T!=="passthrough"){for(let C of T)o.send({jsonrpc:"2.0",...C}).catch(O=>c(Bt(O)));return"handled"}},p=async $=>{if(tt($)&&$.method==="subscriptions/listen"){let T=Ut($.params),C=mo($.params)?(T===void 0?[]:lo(T))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},O=ln($.params),L;if(C!==void 0)L={jsonrpc:"2.0",id:$.id,error:{code:-32602,message:`Invalid _meta envelope: ${C.key}: ${C.problem}`}};else if(O===void 0||!Ct.includes(O)){let H=new po({supported:[...Ct],requested:O??"unknown"});L={jsonrpc:"2.0",id:$.id,error:{code:H.code,message:H.message,data:H.data}}}else L=l.serve($);return await o.send("error"in L?L:{jsonrpc:"2.0",method:L.method,params:L.params}).catch(H=>c(Bt(H))),!0}if(Yt($)&&$.method==="notifications/cancelled"){let T=$.params?.requestId;if(T!==void 0&&l.cancel(T))return!0}return!1},g=($,T,C)=>{let O=xu({kind:"legacy",reason:T,...C!==void 0&&{requestedVersion:C}},Ct);return O===void 0?Promise.resolve():(c(new Error(`Rejected 2025-era request on a modern-only stdio connection (${O.cell}): ${O.message}`)),u($.id,O.code,O.message,O.data))},f=$=>{i||$===s||b()},_=async($,T)=>{let C=await e({era:$}),O=C instanceof ni?C.server:C;$==="modern"&&(Iu(O,T),Fu(O,Ct),l.setServerCapabilities(O.getCapabilities(),Vu(O)));let L=new aI(o,()=>f(L),$==="modern"?d:void 0);return await C.connect(L),{product:C,channel:L}},m=$=>$.product.close().catch(T=>c(Bt(T))),h=async $=>{s=$.channel;try{await $.channel.whenRequestsAnswered(_0)||c(new Error(`Discarded the probe instance with requests still unanswered after ${_0}ms; continuing with the fallback`)),await $.product.close()}catch(T){c(Bt(T))}finally{s=void 0}},z=async $=>{if(n.phase==="closed")return;if(n.phase==="pinned"){if(n.era==="modern"&&tt($)&&$.method==="initialize"&&!ku($.params)){await g($,"initialize",$.params!==null&&typeof $.params=="object"&&typeof $.params.protocolVersion=="string"?$.params.protocolVersion:void 0);return}if(n.era==="modern"&&await p($))return;n.instance.channel.deliver($);return}if(!tt($)&&!Yt($)){c(new Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let T=cI($);switch(T.kind){case"invalid-envelope":{let C=`Invalid _meta envelope for protocol revision 2026-07-28: ${T.issue.key}: ${T.issue.problem}`;tt($)?await u($.id,V.InvalidParams,C,{envelope:T.issue}):c(new Error(`Discarded a notification with a malformed envelope: ${C}`));return}case"unsupported-revision":if(tt($)){let C=new po({supported:[...Ct],requested:T.requested});c(C),await u($.id,C.code,C.message,C.data)}else c(new Error(`Discarded a notification claiming unsupported protocol revision ${T.requested}`));return;case"modern":if(tt($)&&$.method==="server/discover"){if(n.phase==="probe"){n.instance.channel.deliver($,{classification:T.classification});return}let C=await _("modern",T.revision);if(a()){await m(C);return}n={phase:"probe",instance:C},C.channel.deliver($,{classification:T.classification});return}if(n.phase==="probe"){if(Yt($)){n.instance.channel.deliver($,{classification:T.classification});return}n={phase:"pinned",era:"modern",instance:n.instance}}else{let C=await _("modern",T.revision);if(a()){await m(C);return}n={phase:"pinned",era:"modern",instance:C}}if(await p($))return;n.instance.channel.deliver($,{classification:T.classification});return;case"legacy":{if(r==="reject"){tt($)&&await g($,T.reason,T.requestedVersion);return}if(n.phase==="probe"){if(await h(n.instance),a())return;n={phase:"opening"}}let C=await _("legacy");if(a()){await m(C);return}n={phase:"pinned",era:"legacy",instance:C},n.instance.channel.deliver($);return}}},v=[],S=!1,R=async()=>{if(!S){S=!0;try{for(;v.length>0;){let $=v.shift();try{await z($)}catch(T){tt($)&&await u($.id,V.InternalError,"Internal server error"),c(Bt(T))}}}finally{S=!1}}},b=async()=>{if(i||n.phase==="closed")return;i=!0;let $=n;n={phase:"closed"};for(let T of l.teardownAll())await o.send(T).catch(C=>c(Bt(C)));($.phase==="probe"||$.phase==="pinned")&&await $.instance.product.close().catch(T=>c(Bt(T))),await o.close().catch(T=>c(Bt(T)))};o.onmessage=$=>{v.push($),R()},o.onerror=$=>{c($),(n.phase==="probe"||n.phase==="pinned")&&n.instance.channel.onerror?.($)},o.onclose=()=>{if(i||n.phase==="closed")return;i=!0;let $=n;n={phase:"closed"},($.phase==="probe"||$.phase==="pinned")&&$.instance.product.close().catch(T=>c(Bt(T)))};let y=o.start().catch($=>{throw c(Bt($)),$});return y.catch(()=>{}),{close:async()=>{await y.catch(()=>{}),await b()}}}function Bt(e){return e instanceof Error?e:new Error(String(e))}0&&(module.exports={ProtocolError,ProtocolErrorCode,Server,createMcpHandler,hostHeaderValidationResponse,localhostAllowedHostnames,localhostAllowedOrigins,originValidationResponse,serveStdio});
157
+ `,e.enqueue(t.encode(n)),!0}catch(n){return this.onerror?.(n),!1}}handleUnsupportedRequest(){return this.onerror?.(new Error("Method not allowed.")),Response.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,t){try{let r=e.headers.get("accept");if(!r?.includes("application/json")||!r.includes("text/event-stream"))return this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");if(!wm(e.headers.get("content-type")))return this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let o=e,n;if(t?.parsedBody===void 0)try{n=await e.json()}catch(_){return this.onerror?.(_),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else n=t.parsedBody;let s;try{s=Array.isArray(n)?n.map(_=>so.parse(_)):[so.parse(n)]}catch(_){return this.onerror?.(_),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let i=s.some(_=>hm(_));if(i){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(new Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(s.length>1)return this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!i){let _=this.validateSession(e);if(_)return _;let m=this.validateProtocolVersion(e);if(m)return m}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!s.some(_=>tt(_))){for(let _ of s)this.onmessage?.(_,{authInfo:t?.authInfo,request:o});return new Response(null,{status:202})}let a=crypto.randomUUID(),c=s.find(_=>hm(_)),u=c?c.params.protocolVersion:e.headers.get("mcp-protocol-version")??ua;if(this._enableJsonResponse)return new Promise(_=>{this._streamMapping.set(a,{resolveJson:_,cleanup:()=>{this._streamMapping.delete(a)}});for(let m of s)tt(m)&&this._requestToStreamMapping.set(m.id,a);for(let m of s)this.onmessage?.(m,{authInfo:t?.authInfo,request:o})});let l=new TextEncoder,d,p,g=new ReadableStream({start:_=>{d=_},cancel:()=>{p!==void 0&&clearInterval(p),this._streamMapping.get(a)?.controller===d&&this._streamMapping.delete(a)}}),f={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};this.sessionId!==void 0&&(f["mcp-session-id"]=this.sessionId);for(let _ of s)tt(_)&&(this._streamMapping.set(a,{controller:d,encoder:l,cleanup:()=>{p!==void 0&&clearInterval(p),this._streamMapping.delete(a);try{d.close()}catch{}}}),this._requestToStreamMapping.set(_.id,a));await this.writePrimingEvent(d,l,a,u);for(let _ of s){let m,h;tt(_)&&this._eventStore&&this.supportsEmptySSEData(u)&&(m=()=>{this.closeSSEStream(_.id)},h=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(_,{authInfo:t?.authInfo,request:o,closeSSEStream:m,closeStandaloneSSEStream:h})}return this._streamMapping.get(a)?.controller===d&&(p=this.startKeepAlive(d,l)),new Response(g,{status:200,headers:f})}catch(r){return this.onerror?.(r),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(r)})}}async handleDeleteRequest(e){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(e){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.onerror?.(new Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let t=e.headers.get("mcp-session-id");if(!t)return this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required");if(t!==this.sessionId)return this.onerror?.(new Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")}validateProtocolVersion(e){let t=e.headers.get("mcp-protocol-version");if(t!==null&&!this._supportedProtocolVersions.includes(t)){let r=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(new Error(r)),this.createJsonErrorResponse(400,-32e3,r)}}async close(){if(!this._closed){this._closed=!0;for(let{cleanup:e}of this._streamMapping.values())e();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(e){let t=this._requestToStreamMapping.get(e);if(!t)return;let r=this._streamMapping.get(t);r&&r.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let r=t?.relatedRequestId;if((Ft(e)||Vt(e))&&(r=e.id),r===void 0){if(Ft(e)||Vt(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let s;this._eventStore&&(s=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let i=this._streamMapping.get(this._standaloneSseStreamId);if(i===void 0)return;i.controller&&i.encoder&&(s===void 0||!i.replayedEventIds?.has(s))&&this.writeSSEEvent(i.controller,i.encoder,e,s);return}let o=this._requestToStreamMapping.get(r);if(!o)throw new Error(`No connection established for request ID: ${String(r)}`);let n=this._streamMapping.get(o);if(!this._enableJsonResponse){let s;this._eventStore&&(s=await this._eventStore.storeEvent(o,e),n=this._streamMapping.get(o)),n?.controller&&n?.encoder&&(s===void 0||!n.replayedEventIds?.has(s))&&this.writeSSEEvent(n.controller,n.encoder,e,s)}if(Ft(e)||Vt(e)){this._requestResponseMap.set(r,e);let s=[...this._requestToStreamMapping.entries()].filter(([i,a])=>a===o).map(([i])=>i);if(s.every(i=>this._requestResponseMap.has(i))){if(!n){if(this._enableJsonResponse)throw new Error(`No connection established for request ID: ${String(r)}`);if(!this._eventStore){this.onerror?.(new Error(`Response for request ID ${String(r)} is undeliverable: per-request stream is disconnected and no eventStore is configured`));for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i);return}for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i);return}if(this._enableJsonResponse&&n.resolveJson){let i={"Content-Type":"application/json"};this.sessionId!==void 0&&(i["mcp-session-id"]=this.sessionId);let a=s.map(c=>this._requestResponseMap.get(c));a.length===1?n.resolveJson(Response.json(a[0],{status:200,headers:i})):n.resolveJson(Response.json(a,{status:200,headers:i})),n.cleanup()}else n.cleanup();for(let i of s)this._requestResponseMap.delete(i),this._requestToStreamMapping.delete(i)}}}};function Lr(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let{method:t,id:r}=e;return typeof t!="string"?null:typeof r=="string"||typeof r=="number"?r:null}function Dr(e,t,r,o,n=null){return Response.json({jsonrpc:"2.0",error:{code:t,message:r,...o!==void 0&&{data:o}},id:n},{status:e})}function Hu(e,t=null){return Dr(e.httpStatus,e.code,e.message,e.data,t)}function Bu(e){return e instanceof Error?e:new Error(String(e))}function Ku(e=null){return Dr(500,-32603,"Internal server error",void 0,e)}function oI(e,t,r){return async(o,n)=>{if(o.method.toUpperCase()!=="POST")return Dr(405,-32e3,"Method not allowed.");try{let s=await e({era:"legacy",...n?.authInfo!==void 0&&{authInfo:n.authInfo},requestInfo:o}),i=new rI({sessionIdGenerator:void 0,...r!==void 0&&{keepAliveMs:r}});await s.connect(i);let a=()=>{i.close().catch(()=>{}),s.close().catch(()=>{})};o.signal?.addEventListener("abort",a,{once:!0});let c=await i.handleRequest(o,{...n?.authInfo!==void 0&&{authInfo:n.authInfo},...n?.parsedBody!==void 0&&{parsedBody:n.parsedBody}});if(c.body===null||$m(c.headers.get("content-type"))!=="text/event-stream")return a(),c;let u=c.body.getReader(),l=!1,d=()=>{l||(l=!0,a())},p=new ReadableStream({pull:async g=>{try{let{done:f,value:_}=await u.read();if(f){d(),g.close();return}_!==void 0&&g.enqueue(_)}catch(f){d(),g.error(f)}},cancel:g=>(d(),u.cancel(g).catch(()=>{}))});return new Response(p,{status:c.status,statusText:c.statusText,headers:c.headers})}catch(s){try{t?.(Bu(s))}catch{}return Ku(Lr(n?.parsedBody))}}}async function nI(e,t,r=!0){let o=e.method.toUpperCase(),n,s=t,i=e,a=!1;if(o==="POST"){if(s===void 0){r&&(i=e.clone());let c;try{c=await e.text()}catch{return{step:"unreadable-body"}}try{n=c.length===0?void 0:JSON.parse(c)}catch{a=!0}!a&&n!==void 0&&(s=n)}else n=s;if(a||n===void 0)return{step:"no-json-body",forwardRequest:i}}return{step:"classified",outcome:d$({httpMethod:o,protocolVersionHeader:e.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:e.headers.get("mcp-method")??void 0,mcpNameHeader:e.headers.get("mcp-name")??void 0,...n!==void 0&&{body:n}}),body:n,parsedBody:s,forwardRequest:i}}function m0(e,t={}){let{legacy:r,onerror:o,responseMode:n}=t;if(typeof r=="function")throw new TypeError("The 'legacy' option only accepts 'stateless' or 'reject', not a handler function. To serve 2025-era traffic with your own handler, route in user land with the exported isLegacyRequest(request) predicate in front of a strict (legacy: 'reject') handler.");let s=new Set,i=!1,a=m=>{try{o?.(m)}catch{}},c=t.bus??new t0(a),u=r0(c),l=i0({bus:c,maxSubscriptions:t.maxSubscriptions??mn,keepAliveMs:t.keepAliveMs??oi,onerror:a});n==="json"&&console.warn("responseMode: 'json' drops mid-call notifications. subscriptions/listen streams are always served over SSE regardless; other notifications emitted before a result are dropped.");let d=r==="reject"?void 0:oI(e,a,t.keepAliveMs);async function p(m,h,z){let v=m.classification.revision;if(v===void 0||!Ct.includes(v)){let C=new po({supported:[...Ct],requested:v??"unknown"});return a(C),Dr(400,C.code,C.message,C.data,Lr(m.message))}let S=u$({httpMethod:h.method,mcpMethodHeader:h.headers.get("mcp-method")??void 0,mcpNameHeader:h.headers.get("mcp-name")??void 0},m);if(S!==void 0)return a(new Error(`Rejected inbound request (${S.cell}): ${S.message}`)),Hu(S,Lr(m.message));let R=m.messageKind==="request"?Ut(m.message.params):void 0,b=R?.[Kt];if(m.messageKind==="request"){let C=Lz(m.message.method);if(C!==void 0){let O=Ys(C,b);if(O!==void 0){let L=new Xs({requiredCapabilities:O});return a(L),Dr(c$(L.code,"ladder"),L.code,L.message,L.data,m.message.id)}}}let y=await e({era:"modern",...z!==void 0&&{authInfo:z},requestInfo:h}),$=y instanceof ni?y.server:y;if(m.messageKind==="request"&&m.message.method==="subscriptions/listen"){let C=$.getCapabilities(),O=Vu($);return y.close().catch(a),l.serve(m.message,h.signal,C,O)}if(m.messageKind==="request"&&m.message.method==="tools/call"&&y instanceof ni){let C=m.message.params,O=typeof C?.name=="string"?C.name:void 0,L=O===void 0?void 0:y.toolInputSchemaJson(O);if(L!==void 0){let H=Eu(L);if(H.valid&&H.declarations.length>0){let G=a$(H.declarations,C?.arguments,h.headers);if(G!==void 0)return y.close().catch(a),a(new Error(`Rejected inbound request (${G.cell}): ${G.message}`)),Hu(G,m.message.id)}}}Iu($,v),Fu($,Ct),R!==void 0&&p0($,{clientInfo:R[ro],clientCapabilities:b});let T=$.onclose;s.add($),$.onclose=()=>{s.delete($),T?.()};try{let C=await tI(y,m.message,{classification:m.classification,request:h,...z!==void 0&&{authInfo:z},...n!==void 0&&{responseMode:n},...t.keepAliveMs!==void 0&&{keepAliveMs:t.keepAliveMs}});return m.messageKind==="notification"&&queueMicrotask(()=>void $.close().catch(()=>{})),C}catch(C){return C instanceof ue&&C.code===me.ConnectionClosed?new Response(null,{status:499}):(await $.close().catch(()=>{}),s.delete($),a(Bu(C)),Ku(Lr(m.message)))}}async function g(m,h,z,v){if(d!==void 0)return d(h,{...z!==void 0&&{authInfo:z},...v!==void 0&&{parsedBody:v}});let S=xu(m,Ct);return S===void 0?new Response(null,{status:202}):(a(new Error(`Rejected 2025-era request on a modern-only endpoint (${S.cell}): ${S.message}`)),Hu(S,Lr(v)))}async function f(m,h){let z=h?.authInfo;if(m.method.toUpperCase()==="POST"&&!wm(m.headers.get("content-type")))return a(new Error("Unsupported Media Type: Content-Type must be application/json")),Dr(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let v=await nI(m,h?.parsedBody);if(v.step==="unreadable-body")return Dr(400,-32700,"Parse error: the request body could not be read");if(v.step==="no-json-body")return d!==void 0?d(v.forwardRequest,{...z!==void 0&&{authInfo:z}}):Dr(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:S,body:R,parsedBody:b,forwardRequest:y}=v;try{switch(S.kind){case"reject":return a(new Error(`Rejected inbound request (${S.cell}): ${S.message}`)),Hu(S,Lr(R));case"modern":return await p(S,m,z);case"legacy":return await g(S,y,z,b)}}catch($){return a(Bu($)),Ku(Lr(R))}}return{fetch:async(m,h)=>{if(i)throw new Error("This MCP handler has been closed");try{return await f(m,h)}catch(z){return a(Bu(z)),Ku(Lr(h?.parsedBody))}},notify:u,bus:c,close:async()=>{i=!0,l.closeAll();let m=[...s].map(h=>h.close().catch(()=>{}));s.clear(),await Promise.all(m)}}}function sI(e,t){if(!e)return{ok:!1,errorCode:"missing_host",message:"Missing Host header"};let r;try{r=new URL(`http://${e}`).hostname}catch{return{ok:!1,errorCode:"invalid_host_header",message:`Invalid Host header: ${e}`,hostHeader:e}}return t.includes(r)?{ok:!0,hostname:r}:{ok:!1,errorCode:"invalid_host",message:`Invalid Host: ${r}`,hostHeader:e,hostname:r}}function f0(){return["localhost","127.0.0.1","[::1]"]}function h0(e,t){let r=sI(e.headers.get("host"),t);if(!r.ok)return Response.json({jsonrpc:"2.0",error:{code:-32e3,message:r.message},id:null},{status:403,headers:{"Content-Type":"application/json"}})}function iI(e,t){if(e==null||e==="")return{ok:!0};let r;try{r=new URL(e).hostname}catch{return{ok:!1,errorCode:"invalid_origin_header",message:`Invalid Origin header: ${e}`,originHeader:e}}return r===""?{ok:!1,errorCode:"invalid_origin_header",message:`Invalid Origin header: ${e}`,originHeader:e}:t.includes(r)?{ok:!0,origin:e,hostname:r}:{ok:!1,errorCode:"invalid_origin",message:`Invalid Origin: ${r}`,originHeader:e,hostname:r}}function g0(){return["localhost","127.0.0.1","[::1]"]}function _0(e,t){let r=iI(e.headers.get("origin"),t);if(!r.ok)return Response.json({jsonrpc:"2.0",error:{code:-32e3,message:r.message},id:null},{status:403,headers:{"Content-Type":"application/json"}})}var Am=class{_readBuffer;_started=!1;_closed=!1;constructor(e=Lu.default.stdin,t=Lu.default.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Rm({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let o=Pm(e),n=!1,s=a=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(a))},i=()=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t())};if(this._stdout.once("error",s),this._stdout.write(o)){if(n)return;n=!0,this._stdout.off("error",s),t()}else n||this._stdout.once("drain",i)})}},v0=3e3,aI=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(Ft(e)||Vt(e)){let{id:r}=e;r!==void 0&&this._settle(r)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if(tt(e))this._pendingRequests.add(e.id);else if(Yt(e)&&e.method==="notifications/cancelled"){let r=e.params?.requestId;r!==void 0&&this._settle(r)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return this._closed||this._pendingRequests.size===0?!0:await new Promise(t=>{let r=()=>{clearTimeout(o),t(!0)},o=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(n=>n!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),this._pendingRequests.size===0&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function cI(e){let t=e.params;if(e.method==="initialize"&&!ku(t)){let s=t!==null&&typeof t=="object"&&typeof t.protocolVersion=="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...s!==void 0&&{requestedVersion:s}}}if(!mo(t))return{kind:"legacy",reason:"no-claim"};let r=Ut(t),o=(r===void 0?[]:lo(r))[0];if(o!==void 0)return{kind:"invalid-envelope",issue:o};let n=ln(t);return n===void 0||!Ct.includes(n)?{kind:"unsupported-revision",requested:n??"unknown"}:{kind:"modern",revision:n,classification:{era:"modern",revision:n}}}function y0(e,t={}){let r=t.legacy??"serve",o=t.transport??new Am,n={phase:"opening"},s,i=!1,a=()=>i||n.phase==="closed",c=$=>{try{t.onerror?.($)}catch{}},u=($,T,C,O)=>o.send({jsonrpc:"2.0",id:$,error:{code:T,message:C,...O!==void 0&&{data:O}}}).catch(L=>c(Bt(L))),l=new a0(t.maxSubscriptions??mn),d=$=>{if(!Yt($))return;let T=l.routeOutbound($);if(T!=="passthrough"){for(let C of T)o.send({jsonrpc:"2.0",...C}).catch(O=>c(Bt(O)));return"handled"}},p=async $=>{if(tt($)&&$.method==="subscriptions/listen"){let T=Ut($.params),C=mo($.params)?(T===void 0?[]:lo(T))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},O=ln($.params),L;if(C!==void 0)L={jsonrpc:"2.0",id:$.id,error:{code:-32602,message:`Invalid _meta envelope: ${C.key}: ${C.problem}`}};else if(O===void 0||!Ct.includes(O)){let H=new po({supported:[...Ct],requested:O??"unknown"});L={jsonrpc:"2.0",id:$.id,error:{code:H.code,message:H.message,data:H.data}}}else L=l.serve($);return await o.send("error"in L?L:{jsonrpc:"2.0",method:L.method,params:L.params}).catch(H=>c(Bt(H))),!0}if(Yt($)&&$.method==="notifications/cancelled"){let T=$.params?.requestId;if(T!==void 0&&l.cancel(T))return!0}return!1},g=($,T,C)=>{let O=xu({kind:"legacy",reason:T,...C!==void 0&&{requestedVersion:C}},Ct);return O===void 0?Promise.resolve():(c(new Error(`Rejected 2025-era request on a modern-only stdio connection (${O.cell}): ${O.message}`)),u($.id,O.code,O.message,O.data))},f=$=>{i||$===s||b()},_=async($,T)=>{let C=await e({era:$}),O=C instanceof ni?C.server:C;$==="modern"&&(Iu(O,T),Fu(O,Ct),l.setServerCapabilities(O.getCapabilities(),Vu(O)));let L=new aI(o,()=>f(L),$==="modern"?d:void 0);return await C.connect(L),{product:C,channel:L}},m=$=>$.product.close().catch(T=>c(Bt(T))),h=async $=>{s=$.channel;try{await $.channel.whenRequestsAnswered(v0)||c(new Error(`Discarded the probe instance with requests still unanswered after ${v0}ms; continuing with the fallback`)),await $.product.close()}catch(T){c(Bt(T))}finally{s=void 0}},z=async $=>{if(n.phase==="closed")return;if(n.phase==="pinned"){if(n.era==="modern"&&tt($)&&$.method==="initialize"&&!ku($.params)){await g($,"initialize",$.params!==null&&typeof $.params=="object"&&typeof $.params.protocolVersion=="string"?$.params.protocolVersion:void 0);return}if(n.era==="modern"&&await p($))return;n.instance.channel.deliver($);return}if(!tt($)&&!Yt($)){c(new Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let T=cI($);switch(T.kind){case"invalid-envelope":{let C=`Invalid _meta envelope for protocol revision 2026-07-28: ${T.issue.key}: ${T.issue.problem}`;tt($)?await u($.id,V.InvalidParams,C,{envelope:T.issue}):c(new Error(`Discarded a notification with a malformed envelope: ${C}`));return}case"unsupported-revision":if(tt($)){let C=new po({supported:[...Ct],requested:T.requested});c(C),await u($.id,C.code,C.message,C.data)}else c(new Error(`Discarded a notification claiming unsupported protocol revision ${T.requested}`));return;case"modern":if(tt($)&&$.method==="server/discover"){if(n.phase==="probe"){n.instance.channel.deliver($,{classification:T.classification});return}let C=await _("modern",T.revision);if(a()){await m(C);return}n={phase:"probe",instance:C},C.channel.deliver($,{classification:T.classification});return}if(n.phase==="probe"){if(Yt($)){n.instance.channel.deliver($,{classification:T.classification});return}n={phase:"pinned",era:"modern",instance:n.instance}}else{let C=await _("modern",T.revision);if(a()){await m(C);return}n={phase:"pinned",era:"modern",instance:C}}if(await p($))return;n.instance.channel.deliver($,{classification:T.classification});return;case"legacy":{if(r==="reject"){tt($)&&await g($,T.reason,T.requestedVersion);return}if(n.phase==="probe"){if(await h(n.instance),a())return;n={phase:"opening"}}let C=await _("legacy");if(a()){await m(C);return}n={phase:"pinned",era:"legacy",instance:C},n.instance.channel.deliver($);return}}},v=[],S=!1,R=async()=>{if(!S){S=!0;try{for(;v.length>0;){let $=v.shift();try{await z($)}catch(T){tt($)&&await u($.id,V.InternalError,"Internal server error"),c(Bt(T))}}}finally{S=!1}}},b=async()=>{if(i||n.phase==="closed")return;i=!0;let $=n;n={phase:"closed"};for(let T of l.teardownAll())await o.send(T).catch(C=>c(Bt(C)));($.phase==="probe"||$.phase==="pinned")&&await $.instance.product.close().catch(T=>c(Bt(T))),await o.close().catch(T=>c(Bt(T)))};o.onmessage=$=>{v.push($),R()},o.onerror=$=>{c($),(n.phase==="probe"||n.phase==="pinned")&&n.instance.channel.onerror?.($)},o.onclose=()=>{if(i||n.phase==="closed")return;i=!0;let $=n;n={phase:"closed"},($.phase==="probe"||$.phase==="pinned")&&$.instance.product.close().catch(T=>c(Bt(T)))};let y=o.start().catch($=>{throw c(Bt($)),$});return y.catch(()=>{}),{close:async()=>{await y.catch(()=>{}),await b()}}}function Bt(e){return e instanceof Error?e:new Error(String(e))}0&&(module.exports={ProtocolError,ProtocolErrorCode,Server,StdioServerTransport,createMcpHandler,hostHeaderValidationResponse,localhostAllowedHostnames,localhostAllowedOrigins,originValidationResponse,serveStdio});
158
158
  /*! For license information please see mcpSdk.js.LEGAL.txt */