xmcp 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/client.js +42 -44
- package/dist/cloudflare.js +1 -3
- package/dist/config.js +1 -1
- package/dist/host-bridge.js +1 -1
- package/dist/index.js +55 -52
- package/dist/node.js +1 -1
- package/dist/runtime/adapter-express.js +74 -74
- package/dist/runtime/adapter-fastify.js +74 -74
- package/dist/runtime/adapter-fetch-cloudflare.js +69 -69
- package/dist/runtime/adapter-fetch.js +74 -74
- package/dist/runtime/adapter-nestjs.js +70 -70
- package/dist/runtime/adapter-nextjs.js +72 -72
- package/dist/runtime/cloudflare-worker.js +219 -219
- package/dist/runtime/headers.js +1 -1
- package/dist/runtime/http.js +95 -90
- package/dist/runtime/stdio.js +70 -60
- package/dist/runtime/vercel.js +95 -90
- package/package.json +28 -26
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a=r();for(var n in a)("object"==typeof exports?exports:t)[n]=a[n]}}(this,()=>(()=>{"use strict";var t={6982(t){t.exports=require("crypto")},9896(t){t.exports=require("fs")},6928(t){t.exports=require("path")}},r={};function a(n){var i=r[n];if(void 0!==i)return i.exports;var o=r[n]={exports:{}};return t[n](o,o.exports,a),o.exports}a.d=(t,r)=>{for(var n in r)a.o(r,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{let t,r,i,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w;a.r(n),a.d(n,{xmcpHandler:()=>f3,withAuth:()=>f1,resourceMetadataOptions:()=>f9,serverCardHandler:()=>f6,resourceMetadataHandler:()=>f2});let R=require("node:crypto");var k,x,P,E,T,j,O,C,I,N,q,A,M,z,L=Object.create,Z=Object.defineProperty,D=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,V=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,H=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),J=(t,r,a)=>(a=null!=t?L(V(t)):{},((t,r,a,n)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,o=U(r),s=0,l=o.length;s<l;s++)i=o[s],F.call(t,i)||i===a||Z(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(n=D(r,i))||n.enumerable});return t})(!r&&t&&t.__esModule?a:Z(a,"default",{value:t,enumerable:!0}),t));let B=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),K=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),G=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),W=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Y(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function X(t,r="|"){return t.map(t=>eb(t)).join(r)}function Q(t,r){return"bigint"==typeof r?r.toString():r}class ee{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function et(t){return new ee(t)}function er(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let ea=Symbol("evaluating");function en(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function ei(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function eo(t){return ei(t._zod.def)??t._zod.def.shape}function es(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return en(this,r,t),t},enumerable:!0,configurable:!0})}function el(t,r,a){r in t?en(t,r,a):t[r]=a}function ec(t,r,a,n){let i=eo(r);for(let o of a){let a=Object.getOwnPropertyDescriptor(i,o);a.enumerable&&(a.get?es(t,o,()=>{let t=r._zod.def.shape[o];return n?n(t,o):t}):el(t,o,n?n(a.value,o):a.value))}}function eu(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let ed="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ep(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let em=et(()=>{if(eJ.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function eh(t){if(!1===ep(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==ep(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function ef(t){return eh(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let eg=new Set(["string","number","symbol"]);function ey(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ev(t,r,a){let n=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(n._zod.parent=t),n}function e_(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function eb(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},e$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ew(t,r){let a=eo(t),n=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&n.push(t)}return n}function eR(t,r){let a={};ec(a,t,Reflect.ownKeys(eo(t)));for(let t of Reflect.ownKeys(r)){let n=Object.getOwnPropertyDescriptor(r,t);n.enumerable&&(n.get?es(a,t,()=>r[t]):el(a,t,n.value))}return a}function ek(t,r,a,n="partial"){let i=r._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let o=a?new Set(ew(r,a)):void 0,s={};return ec(s,r,Reflect.ownKeys(eo(r)),t&&((r,a)=>o&&!o.has(a)?r:new t({type:"optional",innerType:r}))),ev(r,eu(r._zod.def,{shape:s,checks:[]}))}function ex(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function eP(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eE(t){return"string"==typeof t?t:t?.message}function eT(t,r,a){var n;for(let i=r;i<t.length;i++)(n=t[i]).schema??(n.schema=a)}function ej(t,r,a){let n=t.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let i=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:eE(t.inst?._zod.def?.error?.(t))??eE(i?.(t))??eE(r?.error?.(t))??eE(a.customError?.(t))??eE(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=o,r?.reportInput&&(s.input=t.input),s}let eO=/[\uD800-\uDBFF]/;function eC(t){let r=t.length;if(!eO.test(t))return r;let a=r;for(let n=0;n<r-1;n++)(64512&t.charCodeAt(n))==55296&&(64512&t.charCodeAt(n+1))==56320&&(a--,n++);return a}function eI(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eN(...t){let[r,a,n]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:n}:{...r}}function eq(t,r,a,n=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:n,value:a}),a}function eA(t,r){for(let a in t){let n=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eq(this,a,n(this))},set(t){eq(this,a,t)}})}return r}let eM=!1,ez={configurable:!0,get(){eM=!0}};function eL(r,a,n){let i=Object.getPrototypeOf(r._zod);if(a in i&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(i,a,{configurable:!0,get(){Object.defineProperty(this,a,ez);let t=eM;eM=!1;try{let r=n(this);return eM?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eM=eM||t,r}catch(r){throw delete this[a],eM=eM||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let eZ=Object.freeze({status:"aborted"}),eD={value:void 0,enumerable:!1},eU="captureStackTrace"in Error?Error:null;function eV(t,r,a,n){function i(t){this.def=t,this.constr=u,this.traits=new Set}i.prototype={};let o=a&&new WeakSet;function s(n,s){if(n._zod){if(n._zod.traits.has(t))return}else{eD.value=new i(s);try{Object.defineProperty(n,"_zod",eD)}finally{eD.value=void 0}}if(n._zod.traits.add(t),r(n,s),o){let t=Object.getPrototypeOf(n),r=n._zod.constr.prototype,i=t;for(;i&&i!==r;)i=Object.getPrototypeOf(i);let s=i??t;if(!o.has(s)){o.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eq(this,r,a.bind(this))},set(t){eq(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in n||(n[t]=l[t].bind(n)))}let l=n?.Parent??Object;class c extends l{}function u(t){let r=n?.Parent?function(t){let r=eU;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eU=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!n?.Parent&&r instanceof n.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eF extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eH extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(C=globalThis).__zod_globalConfig??(C.__zod_globalConfig={});let eJ=globalThis.__zod_globalConfig;function eB(t){return t&&Object.assign(eJ,t),eJ}class eK extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eG="~memo",eW=[];function eY(t){return null!==t&&"object"==typeof t}function eX(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eQ=new WeakMap,e0=[],e1={alloc(t,a,n){let i=r;if(!i)return n;r=void 0;let o={value:n,issues:null};return i.set(a.value,o),e0.push(o),n},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var n,i;let o;if("backward"!==a.direction&&(n=a,i=t.value,void 0!==(o=n[eG]?.backEdges)&&eY(i)&&o.has(i)))throw new eK;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let n,i,o,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===n){let r=function t(r,a,n){var i,o;let s=eQ.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let i=t(r,a,n);i>l&&(l=i)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=ei(d);u(r?((r,i)=>{let o=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(i&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,a,n):0;c>o&&(o=c)}return o})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let i=d._cachedInner??(n?r._zod.innerType:void 0);u(i?t(i,a,!1):1);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 t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),i=r,1!==(o=l)&&eQ.set(i,2===o),o}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?n=!0:s=!0}let p=c.value;if(!eY(p))return a(c,u);let m=u[eG];if(m||(m={buckets:new WeakMap,backEdges:void 0},u[eG]=m),i===u)d=o;else{var h;let r;(r=(h=m).buckets.get(t))||(r=new WeakMap,h.buckets.set(t,r)),d=r,i=u,o=d}let f=d.get(p);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...eX(f.issues)):(c.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(f.value)),c;r=d;let g=e0.length,y=a(c,u);r=void 0;let v=e0.length>g?e0.pop():void 0;return y instanceof Promise?y.then(t=>(v&&(v.issues=t.issues.length?eX(t.issues):eW),t)):(v&&(v.issues=y.issues.length?eX(y.issues):eW),y)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},e2=/^[cC][0-9a-z]{6,}$/,e9=/^[0-9a-z]+$/,e4=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e3=/^[0-9a-vA-V]{20}$/,e6=/^[A-Za-z0-9]{27}$/,e5=/^[a-zA-Z0-9_-]{21}$/,e7=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e8=/^([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})$/,te=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,tt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,ta=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ti=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,to=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ts=/^https?$/,tl=/^\+[1-9]\d{6,14}$/,tc="(?:(?:\\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])))",tu=RegExp(`^${tc}$`);function td(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tp=/^[\s\S]{0,}$/,tm=/^-?\d+$/,th=/^-?\d+(?:\.\d+)?$/,tf=/^(?:true|false)$/i,tg=/^null$/i,ty=/^[^A-Z]*$/,tv=/^[^a-z]*$/,t_=eV("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),tb=t=>{let r=t.value;return null!=r&&void 0!==r.length},tS={number:"number",bigint:"bigint",object:"date"},t$=eV("$ZodCheckLessThan",(t,r)=>{t_.init(t,r);let a=tS[typeof r.value];t._zod.check=n=>{(r.inclusive?n.value<=r.value:n.value<r.value)||n.issues.push({origin:tS[typeof n.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:n.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tw=eV("$ZodCheckGreaterThan",(t,r)=>{t_.init(t,r);let a=tS[typeof r.value];t._zod.check=n=>{(r.inclusive?n.value>=r.value:n.value>r.value)||n.issues.push({origin:tS[typeof n.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:n.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tR=eV("$ZodCheckMultipleOf",(t,r)=>{t_.init(t,r),t._zod.check=a=>{let n,i,o;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(i=Math.round(n=a.value/r.value),o=4*Number.EPSILON*Math.max(Math.abs(n),1),Math.abs(n-i)<o?0:n-i))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),tk=eV("$ZodCheckNumberFormat",(t,r)=>{t_.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),n=a?"int":"number",[i,o]=eS[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:n,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!r.abort}))}l<i&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!r.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!r.abort})}}),tx=eV("$ZodCheckMaxLength",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length;if(("string"==typeof n&&i>r.maximum?eC(n):i)<=r.maximum)return;let o=eI(n);a.issues.push({origin:o,code:"too_big",maximum:r.maximum,inclusive:!0,input:n,inst:t,continue:!r.abort})}}),tP=eV("$ZodCheckMinLength",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length;if(("string"==typeof n&&i>=r.minimum&&i<2*r.minimum?eC(n):i)>=r.minimum)return;let o=eI(n);a.issues.push({origin:o,code:"too_small",minimum:r.minimum,inclusive:!0,input:n,inst:t,continue:!r.abort})}}),tE=eV("$ZodCheckLengthEquals",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length,o="string"==typeof n&&i>=r.length&&i<=2*r.length?eC(n):i;if(o===r.length)return;let s=eI(n),l=o>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tT=eV("$ZodCheckStringFormat",(t,r)=>{var a,n;t_.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(n=t._zod).check??(n.check=()=>{})}),tj=eV("$ZodCheckRegex",(t,r)=>{tT.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tO=eV("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=ty),tT.init(t,r)}),tC=eV("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tv),tT.init(t,r)}),tI=eV("$ZodCheckIncludes",(t,r)=>{t_.init(t,r);let a=ey(r.includes),n=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=n,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tN=eV("$ZodCheckStartsWith",(t,r)=>{t_.init(t,r);let a=RegExp(`^${ey(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tq=eV("$ZodCheckEndsWith",(t,r)=>{t_.init(t,r);let a=RegExp(`.*${ey(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tA=eV("$ZodCheckOverwrite",(t,r)=>{t_.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tM{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("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
|
-
${
|
|
3
|
-
};`)(...Object.values(this.closed))}}let tz={major:4,minor:6,patch:5},tL=eV("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tz;let n=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n?.length?[...n]:[];for(let r of i)for(let a of r._zod.onattach)a(t);if(0===i.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,n)=>{let i;if(r.memo)return r;let o=ex(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(o)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&n?.async===!1)throw new eF;if(i||l instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(eT(r.issues,a,t),o||(o=ex(r,a)))});else{if(r.issues.length===a)continue;eT(r.issues,a,t),o||(o=ex(r,a))}}return i?i.then(()=>r):r},a=(a,n,o)=>{if(ex(a))return a.aborted=!0,a;let s=r(n,i,o);if(s instanceof Promise){if(!1===o.async)throw new eF;return s.then(r=>t._zod.parse(r,o))}return t._zod.parse(s,o)};t._zod.run=(n,o)=>{if(o.skipChecks)return t._zod.parse(n,o);if("backward"===o.direction){let r=t._zod.parse({value:n.value,issues:[]},{...o,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,n,o)):a(r,n,o)}let s=t._zod.parse(n,o);if(s instanceof Promise){if(!1===o.async)throw new eF;return s.then(t=>r(t,i,o))}return r(s,i,o)}}},{get"~standard"(){return eq(this,"~standard",tU(this),!1)},set"~standard"(value){eq(this,"~standard",value)}}),tZ=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ej(t,r,eB()))}:{value:t.value};async function tD(t,r){let a={async:!0};return tZ(await t._zod.run({value:r,issues:[]},a),a)}function tU(t){return{validate:r=>{let a={async:!1};try{let n=t._zod.run({value:r,issues:[]},a);if(!(n instanceof Promise))return tZ(n,a)}catch(t){}return tD(t,r)},vendor:"zod",version:1}}let tV=eV("$ZodString",(t,r)=>{tL.init(t,r),t._zod.pattern=r.pattern??tp,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tF=eV("$ZodStringFormat",(t,r)=>{tT.init(t,r),tV.init(t,r)}),tH=eV("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e8),tF.init(t,r)}),tJ=eV("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=te(t))}else r.pattern??(r.pattern=te());tF.init(t,r)}),tB=eV("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=tt),tF.init(t,r)});function tK(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tG=/[\t\n\r]/g;function tW(t){return t.replace(tG,"")}let tY=eV("$ZodURL",(t,r)=>{tF.init(t,r),t._zod.check=a=>{try{var n,i;let o=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===ts.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(o,r):tK(o)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=tW(o);return}r.hostname&&((n=r.hostname).lastIndex=0,!n.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((i=r.protocol).lastIndex=0,!i.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:tW(o);return}catch(n){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),tX=eV("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(tr,"u")),tF.init(t,r)}),tQ=eV("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?e5:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tF.init(t,r)}),t0=eV("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=e2),tF.init(t,r)}),t1=eV("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=e9),tF.init(t,r)}),t2=eV("$ZodULID",(t,r)=>{r.pattern??(r.pattern=e4),tF.init(t,r)}),t9=eV("$ZodXID",(t,r)=>{r.pattern??(r.pattern=e3),tF.init(t,r)}),t4=eV("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=e6),tF.init(t,r)}),t3=eV("$ZodISODateTime",(t,r)=>{let a,n,i;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),n=`${td({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,i=r.local?`${n}|${td({precision:r.precision})}`:n,r.pattern=RegExp(`^${tc}T(?:${i})$`)),tF.init(t,r)}),t6=eV("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tu),tF.init(t,r)}),t5=eV("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${td(r)}$`)),tF.init(t,r)}),t7=eV("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e7),tF.init(t,r)}),t8=eV("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=ta),tF.init(t,r)}),re=/^[0-9a-fA-F:.]+$/;function rt(t){return!!re.test(t)&&tK(`http://[${t}]`)}let rr=eV("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tn),tF.init(t,r),t._zod.check=a=>{rt(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),ra=eV("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=ti),tF.init(t,r)}),rn=eV("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=to),tF.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,n]=r;if(!n)return!1;let i=Number(n);return`${i}`===n&&!(i<0)&&!(i>128)&&rt(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function ri(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let ro=/^[0-9a-zA-Z+/]*={0,2}$/,rs=eV("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=ro),tF.init(t,r),t._zod.check=a=>{ri(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),rl=/^[A-Za-z0-9_-]*$/,rc=eV("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rl),tF.init(t,r),t._zod.check=a=>{!function(t){if(!rl.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return ri(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),ru=eV("$ZodE164",(t,r)=>{r.pattern??(r.pattern=tl),tF.init(t,r)}),rd=eV("$ZodJWT",(t,r)=>{tF.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[n]=a;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||r&&(!("alg"in i)||i.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),rp=eV("$ZodNumber",(t,r)=>{tL.init(t,r),t._zod.pattern=th,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let i=a.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return a;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),a}}),rm=eV("$ZodNumberFormat",(t,r)=>{tk.init(t,r),rp.init(t,r)}),rh=eV("$ZodBoolean",(t,r)=>{tL.init(t,r),t._zod.pattern=tf,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let i=a.value;return"boolean"==typeof i||a.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),a}}),rf=eV("$ZodNull",(t,r)=>{tL.init(t,r),t._zod.pattern=tg,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let n=r.value;return null===n||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),rg=eV("$ZodAny",(t,r)=>{tL.init(t,r),t._zod.parse=t=>t}),ry=eV("$ZodUnknown",(t,r)=>{tL.init(t,r),t._zod.parse=t=>t}),rv=eV("$ZodNever",(t,r)=>{tL.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function r_(t,r,a){t.issues.length&&r.issues.push(...eP(a,t.issues)),r.value[a]=t.value}let rb=eV("$ZodArray",(t,r)=>{tL.init(t,r);let a=eJ.memoizer;a?.attach(t),t._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=a?a.alloc(t,n,Array(o.length),i):Array(o.length);let s=[],l=i?.abortEarly;for(let t=0;t<o.length;t++){let a=o[t],c=r.element._zod.run({value:a,issues:[]},i);if(c instanceof Promise)s.push(c.then(r=>r_(r,n,t)));else if(r_(c,n,t),l&&0!==c.issues.length&&ex(c))break}return s.length?Promise.all(s).then(()=>n):n}});function rS(t,r,a,n,i,o){let s=a in n,l="optional"===o;if(s||!l||"optional"!==i){if(t.issues.length){if(void 0!==i&&l&&!s)return;r.issues.push(...eP(a,t.issues))}if(!s&&void 0===i){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===i&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let r$=[];function rw(t){var r;let a=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),i=n.length?n:r$,o=i.length?[...a,...i]:a;for(let r of o)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:o,symbolKeys:i,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(s)}}function rR(t,r,a,n,i,o,s){let l=[],c=i.keySet,u=i.catchall._zod,d=u.def.type,p=u.optin,m=u.optout,h=0;for(let i in r){if(s&&a.issues.length!==h){if(ex(a,h))break;h=a.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&l.push(i);continue}if("never"===d){l.push(i);continue}let o=u.run({value:r[i],issues:[]},n);o instanceof Promise?t.push(o.then(t=>rS(t,a,i,r,p,m))):rS(o,a,i,r,p,m)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:o,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let rk=eV("$ZodObject",(t,r)=>{let a;tL.init(t,r);let n=Object.getOwnPropertyDescriptor(r,"shape"),i=n?.get?n.get.raw:r.shape??{};if(i){let t=()=>{let a={...i};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=i,Object.defineProperty(r,"shape",{get:t})}let o=et(()=>rw(r));eL(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let n=r[t]._zod;if(n.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||en(a,t,new Set),n.values))a[t].add(r);void 0!==n.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=eJ.memoizer;l?.attach(t),t._zod.parse=(r,n)=>{a??(a=o.value);let i=r.value;if(!ep(i))return r.issues.push({expected:"object",code:"invalid_type",input:i,inst:t}),r;r.value=l?l.alloc(t,r,{},n):{};let c=[],u=a.shape,d=n?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(ex(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:i[t],issues:[]},n);l instanceof Promise?c.push(l.then(a=>rS(a,r,t,i,o,s))):rS(l,r,t,i,o,s)}return s?rR(c,i,r,n,o.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rx=eV("$ZodObjectJIT",(t,r)=>{let a,n;rk.init(t,r);let i=t._zod.parse,o=et(()=>rw(r)),s=eJ.memoizer,l=!eJ.jitless,c=l&&em.value,u=r.catchall;t._zod.parse=(d,p)=>{n??(n=o.value);let m=d.value;return ep(m)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=o.value,n=a.symbolKeys,i=new tM(["payload","ctx"],{shape:r,inst:t,memo:s,syms:n}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
4
|
-
let ${
|
|
5
|
-
for (let i = 0; i < ${
|
|
6
|
-
const iss = ${
|
|
7
|
-
iss.path = iss.path ? [${
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,()=>(()=>{"use strict";var e={6982(e){e.exports=require("crypto")},9896(e){e.exports=require("fs")},6928(e){e.exports=require("path")}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports}r.d=(e,t,a)=>{var i=(t,a)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,[a]:t[i]})};i(t,"get"),i(a,"value")},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{let e,t,i,n,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w;r.r(a),r.d(a,{resourceMetadataHandler:()=>fL,resourceMetadataOptions:()=>fZ,serverCardHandler:()=>fV,withAuth:()=>fM,xmcpHandler:()=>fU});let R=require("node:crypto");var k,x,P,E,T,j,O,C,I,N,q,A,z,M,L=Object.create,Z=Object.defineProperty,D=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,V=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,H=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),J=(e,t,r)=>(r=null!=e?L(V(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,i=U(t),n=0,o=i.length;n<o;n++)a=i[n],F.call(e,a)||void 0===a||Z(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=D(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?r:Z(r,"default",{value:e,enumerable:!0}),e));let B=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),K=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),G=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),W=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Y(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function X(e,t="|"){return e.map(e=>eb(e)).join(t)}function Q(e,t){return"bigint"==typeof t?t.toString():t}class ee{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function et(e){return new ee(e)}function er(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let ea=Symbol("evaluating");function ei(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function en(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function eo(e){return en(e._zod.def)??e._zod.def.shape}function es(e,t,r){Object.defineProperty(e,t,{get(){let e=r();return ei(this,t,e),e},enumerable:!0,configurable:!0})}function el(e,t,r){t in e?ei(e,t,r):e[t]=r}function ec(e,t,r,a){let i=eo(t);for(let n of r){let r=Object.getOwnPropertyDescriptor(i,n);r.enumerable&&(r.get?es(e,n,()=>{let e=t._zod.def.shape[n];return a?a(e,n):e}):el(e,n,a?a(r.value,n):r.value))}}function eu(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}let ed="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ep(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let em=et(()=>{if(eB.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eh(e){if(!1===ep(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==ep(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ef(e){return eh(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let eg=new Set(["string","number","symbol"]);function ey(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ev(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function e_(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function eb(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let eS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},e$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ew(e,t){let r=eo(e),a=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&a.push(e)}return a}function eR(e,t){let r={};ec(r,e,Reflect.ownKeys(eo(e)));for(let e of Reflect.ownKeys(t)){let a=Object.getOwnPropertyDescriptor(t,e);a.enumerable&&(a.get?es(r,e,()=>t[e]):el(r,e,a.value))}return r}function ek(e,t,r,a="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${a}() cannot be used on object schemas containing refinements`);let n=r?new Set(ew(t,r)):void 0,o={};return ec(o,t,Reflect.ownKeys(eo(t)),e&&((t,r)=>n&&!n.has(r)?t:new e({type:"optional",innerType:t}))),ev(t,eu(t._zod.def,{shape:o,checks:[]}))}function ex(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function eP(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eE(e){return"string"==typeof e?e:e?.message}function eT(e){let t=[];for(let r of e??[]){let e=r._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let a=e.maximum??e.length??e.size;a>=0&&t.push([a,r])}return t}function ej(e,t,r){var a;for(let i=t;i<e.length;i++)(a=e[i]).schema??(a.schema=r)}function eO(e,t,r){let a=e.inst?._zod?.traits;a?.has("$ZodType")&&(a.has("$ZodCheck")?e.schema??(e.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,n=e.message?e.message:eE(e.inst?._zod.def?.error?.(e))??eE(i?.(e))??eE(t?.error?.(e))??eE(r.customError?.(e))??eE(r.localeError?.(e))??"Invalid input",o={};for(let t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(o[t]=e[t]);return o.path??(o.path=[]),o.message=n,t?.reportInput&&(o.input=e.input),o}let eC=/[\uD800-\uDBFF]/;function eI(e){let t=e.length;if(!eC.test(e))return t;let r=t;for(let a=0;a<t-1;a++)(64512&e.charCodeAt(a))==55296&&(64512&e.charCodeAt(a+1))==56320&&(r--,a++);return r}function eN(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eq(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}function eA(e,t,r,a=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:a,value:r}),r}function ez(e,t){for(let r in e){let a=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return eA(this,r,a(this))},set(e){eA(this,r,e)}})}return t}let eM=!1,eL={configurable:!0,get(){eM=!0}};function eZ(t,r,a){let i=Object.getPrototypeOf(t._zod);if(r in i&&e!==t._zod){e=void 0;return}e=t._zod,Object.defineProperty(i,r,{configurable:!0,get(){Object.defineProperty(this,r,eL);let e=eM;eM=!1;try{let t=a(this);return eM?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t}),eM=eM||e,t}catch(t){throw delete this[r],eM=eM||e,t}},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:e})}})}let eD=Object.freeze({status:"aborted"}),eU={value:void 0,enumerable:!1},eV="captureStackTrace"in Error?Error:null;function eF(e,t,r,a){function i(e){this.def=e,this.constr=c,this.traits=new Set}i.prototype={};let n=r&&new WeakSet;function o(a,o){if(a._zod){if(a._zod.traits.has(e))return}else{eU.value=new i(o);try{Object.defineProperty(a,"_zod",eU)}finally{eU.value=void 0}}if(a._zod.traits.add(e),t(a,o),n){let e=Object.getPrototypeOf(a),t=a._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let o=i??e;if(!n.has(o)){n.add(o);for(let e in r){let t=Object.getOwnPropertyDescriptor(r,e);t.get?Object.defineProperty(o,e,{...t,enumerable:!1}):function(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:eA(this,t,r.bind(this))},set(e){eA(this,t,e)}})}(o,e,t.value)}}}let s=c.prototype;for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(e in a||(a[e]=s[e].bind(a)))}let s=a?.Parent??Object;class l extends s{}function c(e){let t=a?.Parent?function(e){let t=eV;if(t){let r=t.stackTraceLimit;if("number"==typeof r){try{t.stackTraceLimit=0}catch{return eV=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}(l):this;o(t,e);let r=t._zod.deferred;if(r){for(let e of r)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(l,"name",{value:e}),Object.defineProperty(c,"init",{value:o}),Object.defineProperty(c,Symbol.hasInstance,{value:t=>!!a?.Parent&&t instanceof a.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(c,"name",{value:e}),c}class eH extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eJ extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(C=globalThis).__zod_globalConfig??(C.__zod_globalConfig={});let eB=globalThis.__zod_globalConfig;function eK(e){return e&&Object.assign(eB,e),eB}class eG extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eW="~memo",eY=[];function eX(e){return null!==e&&"object"==typeof e}function eQ(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let e0=new WeakMap,e1=[],e2={alloc(e,r,a){let i=t;if(!i)return a;t=void 0;let n={value:a,issues:null};return i.set(r.value,n),e1.push(n),a},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(e,r)=>{var a,i;let n;if("backward"!==r.direction&&(a=r,i=e.value,void 0!==(n=a[eW]?.backEdges)&&eX(i)&&n.has(i)))throw new eG;return t(e,r)};e._zod.parse=r,e._zod.run===t&&(e._zod.run=r)})},attach(e){var r;let a,i,n,o=!1;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,s=(l,c)=>{let u;if(void 0===a){let t=function e(t,r,a){var i,n;let o=e0.get(t);if(void 0!==o)return 2*!!o;if(r.has(t))return 2;r.add(t);let s=0,l=t=>{if(2!==s&&t?._zod){let i=e(t,r,a);i>s&&(s=i)}},c=e=>{e>s&&(s=e)},u=t._zod.def;switch(u.type){case"object":{let t=en(u);c(t?((t,i)=>{let n=0;for(let o of Reflect.ownKeys(t)){let s=Object.getOwnPropertyDescriptor(t,o);if(i&&!s.enumerable)continue;let l=s.get?1:s.value?._zod?e(s.value,r,a):0;l>n&&(n=l)}return n})(t,!0):1),l(u.catchall);break}case"array":l(u.element);break;case"tuple":for(let e of u.items)l(e);l(u.rest);break;case"record":case"map":l(u.keyType),l(u.valueType);break;case"set":l(u.valueType);break;case"union":for(let e of u.options)l(e);break;case"intersection":l(u.left),l(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":l(u.innerType);break;case"pipe":l(u.in),l(u.out);break;case"function":l(u.input),l(u.output);break;case"lazy":{let i=u._cachedInner??(a?t._zod.innerType:void 0);c(i?e(i,r,!1):1);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 e in u){let t=Object.getOwnPropertyDescriptor(u,e);if(!t||t.get)continue;let r=t.value;if(r&&"object"==typeof r){if(r._zod)l(r);else if(Array.isArray(r))for(let e of r)l(e)}}}return r.delete(t),i=t,1!==(n=s)&&e0.set(i,2===n),n}(e,new Set,!1);if(0===t)return e._zod.parse=r,e._zod.run===s&&(e._zod.run=r),r(l,c);2===t||o?a=!0:o=!0}let d=l.value;if(!eX(d))return r(l,c);let p=c[eW];if(p||(p={buckets:new WeakMap,backEdges:void 0},c[eW]=p),i===c)u=n;else{var m;let t;(t=(m=p).buckets.get(e))||(t=new WeakMap,m.buckets.set(e,t)),u=t,i=c,n=u}let h=u.get(d);if(h)return l.value=h.value,h.issues?h.issues.length&&l.issues.push(...eQ(h.issues)):(l.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value)),l;t=u;let f=e1.length,g=r(l,c);t=void 0;let y=e1.length>f?e1.pop():void 0;return g instanceof Promise?g.then(e=>(y&&(y.issues=e.issues.length?eQ(e.issues):eY),e)):(y&&(y.issues=g.issues.length?eQ(g.issues):eY),g)};e._zod.parse=s,e._zod.run===r&&(e._zod.run=s)})}},e9=/^[cC][0-9a-z]{6,}$/,e4=/^[0-9a-z]+$/,e3=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e5=/^[0-9a-vA-V]{20}$/,e6=/^[A-Za-z0-9]{27}$/,e7=/^[a-zA-Z0-9_-]{21}$/,e8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,te=/^([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})$/,tt=e=>e?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)$/,tr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ta=/^(?:(?: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])$/,ti=/^(([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}|:))$/,tn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,to=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ts=/^https?$/,tl=/^\+[1-9]\d{6,14}$/,tc="(?:(?:\\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])))",tu=RegExp(`^${tc}$`);function td(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tp=/^[\s\S]{0,}$/,tm=/^-?\d+$/,th=/^-?\d+(?:\.\d+)?$/,tf=/^(?:true|false)$/i,tg=/^null$/i,ty=/^[^A-Z]*$/,tv=/^[^a-z]*$/,t_=eF("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tb=e=>{let t=e.value;return null!=t&&void 0!==t.length},tS={number:"number",bigint:"bigint",object:"date"},t$=eF("$ZodCheckLessThan",(e,t)=>{t_.init(e,t);let r=tS[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:tS[typeof a.value]??r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tw=eF("$ZodCheckGreaterThan",(e,t)=>{t_.init(e,t);let r=tS[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:tS[typeof a.value]??r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tR=eF("$ZodCheckMultipleOf",(e,t)=>{t_.init(e,t),e._zod.check=r=>{let a,i,n;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):0==(i=Math.round(a=r.value/t.value),n=4*Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<n?0:a-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),tk=eF("$ZodCheckNumberFormat",(e,t)=>{t_.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,n]=eS[t.format];e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>n&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),tx=eF("$ZodCheckMaxLength",(e,t)=>{var r;t_.init(e,t),(r=e._zod.def).when??(r.when=tb),e._zod.check=r=>{let a=r.value,i=a.length;if(("string"==typeof a&&i>t.maximum?eI(a):i)<=t.maximum)return;let n=eN(a);r.issues.push({origin:n,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),tP=eF("$ZodCheckMinLength",(e,t)=>{var r;t_.init(e,t),(r=e._zod.def).when??(r.when=tb),e._zod.check=r=>{let a=r.value,i=a.length;if(("string"==typeof a&&i>=t.minimum&&i<2*t.minimum?eI(a):i)>=t.minimum)return;let n=eN(a);r.issues.push({origin:n,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),tE=eF("$ZodCheckLengthEquals",(e,t)=>{var r;t_.init(e,t),(r=e._zod.def).when??(r.when=tb),e._zod.check=r=>{let a=r.value,i=a.length,n="string"==typeof a&&i>=t.length&&i<=2*t.length?eI(a):i;if(n===t.length)return;let o=eN(a),s=n>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),tT=eF("$ZodCheckStringFormat",(e,t)=>{var r,a;t_.init(e,t),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),tj=eF("$ZodCheckRegex",(e,t)=>{tT.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})}}),tO=eF("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ty),tT.init(e,t)}),tC=eF("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tv),tT.init(e,t)}),tI=eF("$ZodCheckIncludes",(e,t)=>{t_.init(e,t);let r=ey(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position},}${r}`:r);t.pattern=a,e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),tN=eF("$ZodCheckStartsWith",(e,t)=>{t_.init(e,t);let r=RegExp(`^${ey(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tq=eF("$ZodCheckEndsWith",(e,t)=>{t_.init(e,t);let r=RegExp(`.*${ey(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),tA=eF("$ZodCheckOverwrite",(e,t)=>{t_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class tz{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
|
+
${t.join("\n")}
|
|
3
|
+
};`)(...Object.values(this.closed))}}let tM={major:4,minor:6,patch:7},tL=eF("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tM;let a=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...a??[]]:a?.length?[...a]:[];for(let t of i)for(let r of t._zod.onattach)r(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,r,a)=>{let i;if(t.memo)return t;let n=ex(t);for(let o of r){if(o._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(t)||!o._zod.def.when(t))continue}else if(n)continue;let r=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&a?.async===!1)throw new eH;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,t.issues.length!==r&&(ej(t.issues,r,e),n||(n=ex(t,r)))});else{if(t.issues.length===r)continue;ej(t.issues,r,e),n||(n=ex(t,r))}}return i?i.then(()=>t):t},r=(r,a,n)=>{if(ex(r))return r.aborted=!0,r;let o=t(a,i,n);if(o instanceof Promise){if(!1===n.async)throw new eH;return o.then(t=>e._zod.parse(t,n))}return e._zod.parse(o,n)};e._zod.run=(a,n)=>{if(n.skipChecks)return e._zod.parse(a,n);if("backward"===n.direction){let t=e._zod.parse({value:a.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,n)):r(t,a,n)}let o=e._zod.parse(a,n);if(o instanceof Promise){if(!1===n.async)throw new eH;return o.then(e=>t(e,i,n))}return t(o,i,n)}}},{get"~standard"(){return eA(this,"~standard",tD(this),!1)},set"~standard"(e){eA(this,"~standard",e)}}),tZ=(e,t)=>e.issues.length?{issues:e.issues.map(e=>eO(e,t,eK()))}:{value:e.value};function tD(e){return{validate:t=>{let r={async:!1};try{let a=e._zod.run({value:t,issues:[]},r);if(!(a instanceof Promise))return tZ(a,r)}catch(e){}return async function(e,t){let r={async:!0};return tZ(await e._zod.run({value:t,issues:[]},r),r)}(e,t)},vendor:"zod",version:1}}let tU=eF("$ZodString",(e,t)=>{tL.init(e,t),e._zod.pattern=t.pattern??tp,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),tV=eF("$ZodStringFormat",(e,t)=>{tT.init(e,t),tU.init(e,t)}),tF=eF("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=te),tV.init(e,t)}),tH=eF("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tt(e))}else t.pattern??(t.pattern=tt());tV.init(e,t)}),tJ=eF("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tr),tV.init(e,t)});function tB(e){try{if("u">typeof URL&&"function"==typeof URL.canParse)return URL.canParse(e);return new URL(e),!0}catch{return!1}}let tK=/[\t\n\r]/g;function tG(e){return e.replace(tK,"")}let tW=eF("$ZodURL",(e,t)=>{tV.init(e,t),e._zod.check=r=>{try{var a,i;let n=r.value.trim(),o="normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===ts.source&&!/^https?:\/\//i.test(e))return 1;try{if("u">typeof URL){let t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(n,t):tB(n)||2;if(1===o)return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});if(2===o)return void r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});if(!0===o){r.value=tG(n);return}t.hostname&&((a=t.hostname).lastIndex=0,!a.test(o.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&&((i=t.protocol).lastIndex=0,!i.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:tG(n);return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tY=eF("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),tV.init(e,t)}),tX=eF("$ZodNanoID",(e,t)=>{var r;if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=void 0===t.length?e7:(r=t.length,RegExp(`^[a-zA-Z0-9_-]{${r}}$`))),tV.init(e,t)}),tQ=eF("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=e9),tV.init(e,t)}),t0=eF("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=e4),tV.init(e,t)}),t1=eF("$ZodULID",(e,t)=>{t.pattern??(t.pattern=e3),tV.init(e,t)}),t2=eF("$ZodXID",(e,t)=>{t.pattern??(t.pattern=e5),tV.init(e,t)}),t9=eF("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=e6),tV.init(e,t)}),t4=eF("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=["Z"],t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),a=`${td({precision:t.precision,seconds:!0})}(?:${r.join("|")})`,i=t.local?`${a}|${td({precision:t.precision})}`:a,t.pattern=RegExp(`^${tc}T(?:${i})$`)),tV.init(e,t)}),t3=eF("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tu),tV.init(e,t)}),t5=eF("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${td(t)}$`)),tV.init(e,t)}),t6=eF("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=e8),tV.init(e,t)}),t7=eF("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ta),tV.init(e,t)}),t8=/^[0-9a-fA-F:.]+$/;function re(e){return!!t8.test(e)&&tB(`http://[${e}]`)}let rt=eF("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ti),tV.init(e,t),e._zod.check=r=>{re(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),rr=eF("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tn),tV.init(e,t)}),ra=eF("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=to),tV.init(e,t),e._zod.check=r=>{!function(e){let t=e.split("/");if(2!==t.length)return!1;let[r,a]=t;if(!a)return!1;let i=Number(a);return`${i}`===a&&!(i<0)&&!(i>128)&&re(r)}(r.value)&&r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function ri(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rn=/^[0-9a-zA-Z+/]*={0,2}$/,ro=eF("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rn),tV.init(e,t),e._zod.check=r=>{ri(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rs=/^[A-Za-z0-9_-]*$/,rl=eF("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rs),tV.init(e,t),e._zod.check=r=>{!function(e){if(!rs.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ri(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rc=eF("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tl),tV.init(e,t)}),ru=eF("$ZodJWT",(e,t)=>{tV.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rd=eF("$ZodNumber",(e,t)=>{tL.init(e,t),e._zod.pattern=th,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),r}}),rp=eF("$ZodNumberFormat",(e,t)=>{tk.init(e,t),rd.init(e,t)}),rm=eF("$ZodBoolean",(e,t)=>{tL.init(e,t),e._zod.pattern=tf,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rh=eF("$ZodNull",(e,t)=>{tL.init(e,t),e._zod.pattern=tg,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),rf=eF("$ZodAny",(e,t)=>{tL.init(e,t),e._zod.parse=e=>e}),rg=eF("$ZodUnknown",(e,t)=>{tL.init(e,t),e._zod.parse=e=>e}),ry=eF("$ZodNever",(e,t)=>{tL.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),rv=e=>Array.isArray(e)?e.length:-1;function r_(e,t,r){e.issues.length&&t.issues.push(...eP(r,e.issues)),t.value[r]=e.value}let rb=eF("$ZodArray",(e,t)=>{tL.init(e,t);let r=eB.memoizer;r?.attach(e),e._zod.parse=(a,i)=>{let n=a.value;if(!Array.isArray(n))return a.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),a;a.value=r?r.alloc(e,a,Array(n.length),i):Array(n.length);let o=[],s=i?.abortEarly;for(let e=0;e<n.length;e++){let r=n[e],l=t.element._zod.run({value:r,issues:[]},i);if(l instanceof Promise)o.push(l.then(t=>r_(t,a,e)));else if(r_(l,a,e),s&&0!==l.issues.length&&ex(l))break}return o.length?Promise.all(o).then(()=>a):a},function(e,t){let r=eT(e._zod.def.checks);if(!r.length)return;let a=Math.min(...r.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(r,n)=>{let o=t(r.value);if(o>a&&!n?.skipChecks&&n?.direction!=="backward"){for(let[t,a]of eT(e._zod.def.checks))if(o>t&&a._zod.def.when(r)){let t=r.issues.length;return a._zod.check(r),r.issues[t].continue=!1,ej(r.issues,t,e),r}}return i(r,n)}}(e,rv)});function rS(e,t,r,a,i,n){let o=r in a,s="optional"===n;if(o||!s||"optional"!==i){if(e.issues.length){if(void 0!==i&&s&&!o)return;t.issues.push(...eP(r,e.issues))}if(!o&&void 0===i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?(o||"defaulted"===i&&!s)&&(t.value[r]=void 0):t.value[r]=e.value}}let r$=[];function rw(e){var t;let r=Object.keys(e.shape),a=Object.getOwnPropertySymbols(e.shape),i=a.length?a:r$,n=i.length?[...r,...i]:r;for(let t of n)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let o=Object.keys(t=e.shape).filter(e=>void 0!==t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,allKeys:n,symbolKeys:i,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(o)}}function rR(e,t,r,a,i,n,o){let s=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,d=c.optin,p=c.optout,m=0;for(let i in t){if(o&&r.issues.length!==m){if(ex(r,m))break;m=r.issues.length}if(l.has(i))continue;if("__proto__"===i){"never"===u&&s.push(i);continue}if("never"===u){s.push(i);continue}let n=c.run({value:t[i],issues:[]},a);n instanceof Promise?e.push(n.then(e=>rS(e,r,i,t,d,p))):rS(n,r,i,t,d,p)}return(s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:n,continue:!0}),e.length)?Promise.all(e).then(()=>r):r}let rk=eF("$ZodObject",(e,t)=>{let r;tL.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape"),i=a?.get?a.get.raw:t.shape??{};if(i){let e=()=>{let r={...i};return Object.defineProperty(t,"shape",{value:r}),e.raw=r,r};e.raw=i,Object.defineProperty(t,"shape",{get:e})}let n=et(()=>rw(t));eZ(e,"propValues",e=>{let t=e.def.shape,r={};for(let e in t){let a=t[e]._zod;if(a.values){for(let t of(Object.prototype.hasOwnProperty.call(r,e)||ei(r,e,new Set),a.values))r[e].add(t);void 0!==a.optin&&r[e].add(void 0)}}return r});let o=t.catchall,s=eB.memoizer;s?.attach(e),e._zod.parse=(t,a)=>{r??(r=n.value);let i=t.value;if(!ep(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=s?s.alloc(e,t,{},a):{};let l=[],c=r.shape,u=a?.abortEarly,d=t.issues.length;for(let e of r.allKeys){if(u&&t.issues.length!==d){if(ex(t,d))break;d=t.issues.length}if("__proto__"===e)continue;let r=c[e],n=r._zod.optin,o=r._zod.optout,s=r._zod.run({value:i[e],issues:[]},a);s instanceof Promise?l.push(s.then(r=>rS(r,t,e,i,n,o))):rS(s,t,e,i,n,o)}return o?rR(l,i,t,a,n.value,e,!0===u):l.length?Promise.all(l).then(()=>t):t}}),rx=eF("$ZodObjectJIT",(e,t)=>{let r,a;rk.init(e,t);let i=e._zod.parse,n=et(()=>rw(t)),o=eB.memoizer,s=!eB.jitless,l=s&&em.value,c=t.catchall;e._zod.parse=(u,d)=>{a??(a=n.value);let p=u.value;return ep(p)?s&&l&&d?.async===!1&&!0!==d.jitless?(r||(r=(t=>{let r=n.value,a=r.symbolKeys,i=new tz(["payload","ctx"],{shape:t,inst:e,memo:o,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`
|
|
4
|
+
let ${e}_ab = false;
|
|
5
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
6
|
+
const iss = ${e}.issues[i];
|
|
7
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
8
8
|
payload.issues.push(iss);
|
|
9
|
-
if (iss.continue !== true) ${
|
|
9
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
10
10
|
}
|
|
11
|
-
if (${
|
|
11
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
12
12
|
payload.value = newResult;
|
|
13
13
|
return payload;
|
|
14
|
-
}`;i.write("const input = payload.value;");let
|
|
15
|
-
const ${
|
|
16
|
-
if (!${
|
|
17
|
-
if (${
|
|
14
|
+
}`;i.write("const input = payload.value;");let c=Object.create(null),u=0;for(let e of r.allKeys)c[e]=`key_${u++}`;for(let e of(i.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),r.allKeys)){if("__proto__"===e)continue;let r=c[e],n="symbol"==typeof e?`syms[${a.indexOf(e)}]`:JSON.stringify(e),o=`${n} in input`,u=t[e],d=u?._zod?.optin,p=void 0!==d,m=u?._zod?.optout==="optional";if(i.write(`const ${r} = ${s(n)};`),p&&m){let e="optional"===d?`${r}_present`:`${r}.value !== undefined || ${r}_present`;i.write(`
|
|
15
|
+
const ${r}_present = ${o};
|
|
16
|
+
if (!${r}.issues.length || ${r}_present) {
|
|
17
|
+
if (${r}.issues.length) {${l(r,n)}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (${
|
|
21
|
-
newResult[${
|
|
20
|
+
if (${e}) {
|
|
21
|
+
newResult[${n}] = ${r}.value;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
`)}else
|
|
26
|
-
if (${
|
|
25
|
+
`)}else p?(i.write(`
|
|
26
|
+
if (${r}.issues.length) {${l(r,n)}
|
|
27
27
|
}
|
|
28
|
-
`),"defaulted"===
|
|
29
|
-
if (${
|
|
30
|
-
newResult[${
|
|
28
|
+
`),"defaulted"===d?i.write(`newResult[${n}] = ${r}.value;`):i.write(`
|
|
29
|
+
if (${r}.value !== undefined || ${o}) {
|
|
30
|
+
newResult[${n}] = ${r}.value;
|
|
31
31
|
}
|
|
32
32
|
`)):i.write(`
|
|
33
|
-
const ${
|
|
34
|
-
if (${
|
|
33
|
+
const ${r}_present = ${o};
|
|
34
|
+
if (${r}.issues.length) {${l(r,n)}
|
|
35
35
|
}
|
|
36
|
-
if (!${
|
|
36
|
+
if (!${r}_present && !${r}.issues.length) {
|
|
37
37
|
payload.issues.push({
|
|
38
38
|
code: "invalid_type",
|
|
39
39
|
expected: "nonoptional",
|
|
40
40
|
input: undefined,
|
|
41
|
-
path: [${
|
|
41
|
+
path: [${n}]
|
|
42
42
|
});
|
|
43
43
|
if (ctx && ctx.abortEarly) {
|
|
44
44
|
payload.value = newResult;
|
|
@@ -46,45 +46,51 @@ ${r.join("\n")}
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
if (${
|
|
50
|
-
newResult[${
|
|
49
|
+
if (${r}_present) {
|
|
50
|
+
newResult[${n}] = ${r}.value;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=a(d,p),u)?rR([],m,d,p,n,t,p?.abortEarly===!0):d:i(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function rP(t,r,a,n){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let i=t.filter(t=>!ex(t));return 1===i.length?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>ej(t,n,eB())))}),r)}let rE=eV("$ZodUnion",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),eL(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eL(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),eL(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>er(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(a)return a(n,i);let o=!1,s=[];for(let t of r.options){let r=t._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)s.push(r),o=!0;else{if(0===r.issues.length)return r;s.push(r)}}return o?Promise.all(s).then(r=>rP(r,n,t,i)):rP(s,n,t,i)}}),rT=eV("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rE.init(t,r);let a=t._zod.parse;eL(t,"propValues",t=>{let r={},a=0;for(let n of t.def.options){let i=n._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(n)}"`);for(let[n,o]of(i[t.def.discriminator]?.has(void 0)&&a++,Object.entries(i)))for(let t of(Object.prototype.hasOwnProperty.call(r,n)||en(r,n,new Set),o))r[n].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let n=ei(t._zod.def);if(n&&!Object.prototype.hasOwnProperty.call(n,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let n=et(()=>(function(t){let r=new Map;for(let a of t.options){let n=a._zod.propValues?.[t.discriminator];if(!n||0===n.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of n)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(i,o)=>{let s=i.value;if(!ep(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let l=s?.[r.discriminator],c=n.value.get(l);return c&&(void 0!==l||"backward"!==o.direction)?c._zod.run(i,o):r.unionFallback||"backward"===o.direction?a(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(n.value.keys()).filter(t=>null!==n.value.get(t)),input:s,path:[r.discriminator],inst:t}),i)}}),rj=eV("$ZodIntersection",(t,r)=>{tL.init(t,r),t._zod.parse=(t,a)=>{let n=t.value,i=r.left._zod.run({value:n,issues:[]},a),o=r.right._zod.run({value:n,issues:[]},a);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([r,a])=>rO(t,r,a)):rO(t,i,o)}});function rO(t,r,a){let n,i=new Map,o=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);o.has(r)||o.set(r,t),a=[r]}else n??(n=t),a=t.keys;for(let t of a)i.has(t)||i.set(t,{}),i.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...i].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=n?l.filter(t=>n.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...n,keys:r}),l))!r.includes(a)&&o.has(a)&&t.issues.push(o.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(eh(r)&&eh(a)){let n=Object.keys(a),i=Object.keys(r).filter(t=>-1!==n.indexOf(t)),o={...r,...a};for(let n of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===n)continue;let i=t(r[n],a[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<r.length;i++){let o=t(r[i],a[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(ex(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rC=eV("$ZodRecord",(t,r)=>{tL.init(t,r);let a=eJ.memoizer;a?.attach(t),t._zod.parse=(n,i)=>{let o=n.value;if(!eh(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;n.value=a?a.alloc(t,n,{},i):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},i);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>ej(t,i,eB())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:o[a],issues:[]},i);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&n.issues.push(...eP(a,t.issues)),n.value[c]=t.value})):(d.issues.length&&n.issues.push(...eP(a,d.issues)),n.value[c]=d.value)}for(let t in o)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;n.value[t]=o[t]}else(c=c??[]).push(t);c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}else{let c;for(let u of(n.value=a?a.alloc(t,n,{},i):{},Reflect.ownKeys(o))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},i);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&th.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},i);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?n.value[u]=o[u]:l?(c=c??[]).push(u):n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>ej(t,i,eB())),input:u,path:[u],inst:t});continue}let d=a.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:o[u],issues:[]},i);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&n.issues.push(...eP(u,t.issues)),n.value[d]=t.value})):(p.issues.length&&n.issues.push(...eP(u,p.issues)),n.value[d]=p.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),rI=eV("$ZodEnum",(t,r)=>{tL.init(t,r);let a=Y(r.entries),n=new Set(a);t._zod.values=n,eL(t,"pattern",t=>{let r=Y(t.def.entries).filter(t=>eg.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>ey(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,i)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:a,input:o,inst:t}),r}}),rN=eV("$ZodLiteral",(t,r)=>{tL.init(t,r);let a=new Set(r.values);t._zod.values=a,eL(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?ey(t):t?ey(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(n,i)=>{let o=n.value;return a.has(o)||n.issues.push({code:"invalid_value",values:r.values,input:o,inst:t}),n}}),rq=eV("$ZodTransform",(t,r)=>{tL.init(t,r),t._zod.optin="optional",eJ.memoizer?.guard(t),t._zod.parse=(a,n)=>{if("backward"===n.direction)throw new eH(t.constructor.name);let i=r.transform(a.value,a);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(t=>(a.value=t,a));if(i instanceof Promise)throw new eF;return a.value=i,a}});function rA(t,r){return t.value=r.issues.length?void 0:r.value,t}let rM=eV("$ZodOptional",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eL(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eL(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${er(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let n=r.innerType._zod.run({value:t.value,issues:[]},a);return n instanceof Promise?n.then(r=>rA(t,r)):rA(t,n)}return r.innerType._zod.run(t,a)}}),rz=eV("$ZodExactOptional",(t,r)=>{rM.init(t,r),eL(t,"values",t=>t.def.innerType._zod.values),eL(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rL=eV("$ZodNullable",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>t.def.innerType._zod.optin),eL(t,"optout",t=>t.def.innerType._zod.optout),eL(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${er(r.source)}|null)$`):void 0}),eL(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rZ=eV("$ZodDefault",(t,r)=>{tL.init(t,r),t._zod.optin="defaulted",eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let n=r.innerType._zod.run(t,a);return n instanceof Promise?n.then(t=>rD(t,r)):rD(n,r)}});function rD(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rU=eV("$ZodPrefault",(t,r)=>{tL.init(t,r),t._zod.optin="defaulted",eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rV=eV("$ZodNonOptional",(t,r)=>{tL.init(t,r),eL(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,n)=>{let i=r.innerType._zod.run(a,n);return i instanceof Promise?i.then(r=>rF(r,t)):rF(i,t)}});function rF(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rH(t,r,a,n){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ej(t,n,eB()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rJ=eV("$ZodCatch",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eL(t,"optout",t=>t.def.innerType._zod.optout),eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let n=r.innerType._zod.run({value:t.value,issues:[]},a);return n instanceof Promise?n.then(n=>rH(t,n,r,a)):rH(t,n,r,a)}}),rB=eV("$ZodPipe",(t,r)=>{tL.init(t,r),eL(t,"values",t=>t.def.in._zod.values),eL(t,"optin",t=>t.def.in._zod.optin),eL(t,"optout",t=>t.def.out._zod.optout),eL(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let n=r.out._zod.run(t,a);return n instanceof Promise?n.then(t=>rK(t,r.in,a)):rK(n,r.in,a)}let n=r.in._zod.run(t,a);return n instanceof Promise?n.then(t=>rK(t,r.out,a)):rK(n,r.out,a)}});function rK(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let rG=eV("$ZodPreprocess",(t,r)=>{rB.init(t,r)}),rW=eV("$ZodReadonly",(t,r)=>{tL.init(t,r),eL(t,"propValues",t=>t.def.innerType._zod.propValues),eL(t,"values",t=>t.def.innerType._zod.values),eL(t,"optin",t=>t.def.innerType?._zod?.optin),eL(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let n=r.innerType._zod.run(t,a);return n instanceof Promise?n.then(rY):rY(n)}});function rY(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rX=eV("$ZodLazy",(t,r)=>{var a;let n;tL.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(n!==ea)return void 0===n&&(n=ea,n=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),n},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),eL(t,"pattern",t=>t.innerType?._zod?.pattern),eL(t,"propValues",t=>t.innerType?._zod?.propValues),eL(t,"optin",t=>t.innerType?._zod?.optin??void 0),eL(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),rQ=eV("$ZodCustom",(t,r)=>{t_.init(t,r),tL.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let n=a.value,i=r.fn(n);if(i instanceof Promise)return i.then(r=>r0(r,a,n,t));r0(i,a,n,t)}});function r0(t,r,a,n){if(!t){let t={code:"custom",input:a,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(t.params=n._zod.def.params),r.issues.push(eN(t))}}(I=globalThis).__zod_globalRegistry??(I.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let n={...a,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let r1=globalThis.__zod_globalRegistry;function r2(t){return t.checks&&(t.checks=[...t.checks]),t}function r9(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...e_(r)})}function r4(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...e_(r)})}function r3(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e_(r)})}function r6(t,r){return new t({type:"string",format:"date",check:"string_format",...e_(r)})}function r5(t,r){return new t$({check:"less_than",...e_(r),value:t,inclusive:!1})}function r7(t,r){return new t$({check:"less_than",...e_(r),value:t,inclusive:!0})}function r8(t,r){return new tw({check:"greater_than",...e_(r),value:t,inclusive:!1})}function ae(t,r){return new tw({check:"greater_than",...e_(r),value:t,inclusive:!0})}function at(t,r){return new tR({check:"multiple_of",...e_(r),value:t})}function ar(t,r){return new tx({check:"max_length",...e_(r),maximum:t})}function aa(t,r){return new tP({check:"min_length",...e_(r),minimum:t})}function an(t,r){return new tE({check:"length_equals",...e_(r),length:t})}function ai(t){return new tA({check:"overwrite",tx:t})}function ao(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&en(t,r,a[r]);return t}function as(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??r1,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function al(t,r,a,n,i){let o="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:n.path,message:i}):r.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(i);return Object.assign(a,o),!0}function ac(t,r,a={path:[],schemaPath:[]}){var n;let i=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let n={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,n);else{let a=s.schema,o=r.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(t,r,a,n)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),ac(o,r,n),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&ao(s.schema,c),"input"===r.io&&function t(r,a){let n=a??{seen:new Set};if(n.seen.has(r))return!1;n.seen.add(r);let i=r._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return t(i.element,n);if("set"===i.type)return t(i.valueType,n);if("lazy"===i.type)return t(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return t(i.innerType,n);if("intersection"===i.type)return t(i.left,n)||t(i.right,n);if("record"===i.type||"map"===i.type)return t(i.keyType,n)||t(i.valueType,n);if("pipe"===i.type)return!!r._zod.traits.has("$ZodCodec")||t(i.in,n)||t(i.out,n);if("object"===i.type){for(let r in i.shape)if(t(i.shape[r],n))return!0;return!1}if("union"===i.type){for(let r of i.options)if(t(r,n))return!0;return!1}if("tuple"===i.type){for(let r of i.items)if(t(r,n))return!0;if(i.rest&&t(i.rest,n))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function au(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ad(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let n=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=n.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,r[0])}}let i=r=>{if(r[1].schema.$ref)return;let n=r[1],{ref:i,defId:o}=(r=>{let n="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,i=t.external.uri??(t=>t);if(a)return{ref:i(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${i("__shared")}#/${n}/${au(o)}`}}let i=`#/${n}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:i+au(o)}})(r);n.def={...n.schema},o&&(n.defId=o);let s=n.schema;for(let t in s)delete s[t];s.$ref=i};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
53
|
+
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(t.shape)),u=r(u,d),c)?rR([],p,u,d,a,e,d?.abortEarly===!0):u:i(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u)}});function rP(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!ex(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>eO(e,a,eK())))}),t)}let rE=eF("$ZodUnion",(e,t)=>{tL.init(e,t),eZ(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),eZ(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),eZ(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),eZ(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>er(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(a,i)=>{if(r)return r(a,i);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:a.value,issues:[]},i);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>rP(t,a,e,i)):rP(o,a,e,i)}}),rT=eF("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rE.init(e,t);let r=e._zod.parse;eZ(e,"propValues",e=>{let t={},r=0;for(let a of e.def.options){let i=a._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(a)}"`);for(let[a,n]of(i[e.def.discriminator]?.has(void 0)&&r++,Object.entries(i)))for(let e of(Object.prototype.hasOwnProperty.call(t,a)||ei(t,a,new Set),n))t[a].add(e)}return!e.def.unionFallback&&r>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,r)=>{let a=en(e._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${r}"`)});let a=et(()=>(function(e){let t=new Map;for(let r of e.options){let a=r._zod.propValues?.[e.discriminator];if(!a||0===a.size)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let e of a)if(t.has(e)){if(void 0!==e)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,r)}return t})(t));e._zod.parse=(i,n)=>{let o=i.value;if(!ep(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=o?.[t.discriminator],l=a.value.get(s);return l&&(void 0!==s||"backward"!==n.direction)?l._zod.run(i,n):t.unionFallback||"backward"===n.direction?r(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(a.value.keys()).filter(e=>null!==a.value.get(e)),input:o,path:[t.discriminator],inst:e}),i)}}),rj=eF("$ZodIntersection",(e,t)=>{tL.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,i=t.left._zod.run({value:a,issues:[]},r),n=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([t,r])=>rO(e,t,r)):rO(e,i,n)}});function rO(e,t,r){let a,i=new Map,n=new Map,o=(e,t)=>{let r;if("unrecognized_keys"!==e.code||e.path?.length)if("invalid_key"!==e.code||"record"!==e.origin||e.path?.length!==1)return!1;else{let t=String(e.path[0]);n.has(t)||n.set(t,e),r=[t]}else a??(a=e),r=e.keys;for(let e of r)i.has(e)||i.set(e,{}),i.get(e)[t]=!0;return!0};for(let r of t.issues)o(r,"l")||e.issues.push(r);for(let t of r.issues)o(t,"r")||e.issues.push(t);let s=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=a?s.filter(e=>a.keys.includes(e)):[];for(let r of(t.length&&e.issues.push({...a,keys:t}),s))!t.includes(r)&&n.has(r)&&e.issues.push(n.get(r))}let l=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eh(t)&&eh(r)){let a=Object.keys(r),i=Object.keys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,i)){if("__proto__"===a)continue;let i=e(t[a],r[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};n[a]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};a.push(n.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!l.valid){if(ex(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}let rC=eF("$ZodRecord",(e,t)=>{tL.init(e,t);let r=eB.memoizer;r?.attach(e),e._zod.parse=(a,i)=>{let n=a.value;if(!eh(n))return a.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),a;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){let l;a.value=r?r.alloc(e,a,{},i):{};let c=new Set;for(let r of s)if("string"==typeof r||"number"==typeof r||"symbol"==typeof r){if(c.add("number"==typeof r?r.toString():r),"__proto__"===r)continue;let s=t.keyType._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(s.issues.length){a.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>eO(e,i,eK())),input:r,path:[r],inst:e});continue}let l=s.value;if("__proto__"===l)continue;let u=t.valueType._zod.run({value:n[r],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&a.issues.push(...eP(r,e.issues)),a.value[l]=e.value})):(u.issues.length&&a.issues.push(...eP(r,u.issues)),a.value[l]=u.value)}for(let e in n)if(!c.has(e))if("loose"===t.mode){if("__proto__"===e)continue;a.value[e]=n[e]}else(l=l??[]).push(e);l&&l.length>0&&a.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l,continue:!0})}else{let l;for(let c of(a.value=r?r.alloc(e,a,{},i):{},Reflect.ownKeys(n))){if("__proto__"===c||!Object.prototype.propertyIsEnumerable.call(n,c))continue;let r=t.keyType._zod.run({value:c,issues:[]},i);if(r instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof c&&th.test(c)&&r.issues.length){let e=t.keyType._zod.run({value:Number(c),issues:[]},i);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(r=e)}if(r.issues.length){"loose"===t.mode?a.value[c]=n[c]:s?(l=l??[]).push(c):a.issues.push({code:"invalid_key",origin:"record",issues:r.issues.map(e=>eO(e,i,eK())),input:c,path:[c],inst:e});continue}let u=r.value;if("__proto__"===u)continue;let d=t.valueType._zod.run({value:n[c],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&a.issues.push(...eP(c,e.issues)),a.value[u]=e.value})):(d.issues.length&&a.issues.push(...eP(c,d.issues)),a.value[u]=d.value)}l&&l.length>0&&a.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l,continue:!0})}return o.length?Promise.all(o).then(()=>a):a}}),rI=eF("$ZodEnum",(e,t)=>{tL.init(e,t);let r=Y(t.entries),a=new Set(r);e._zod.values=a,eZ(e,"pattern",e=>{let t=Y(e.def.entries).filter(e=>eg.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>ey(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,i)=>{let n=t.value;return a.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),rN=eF("$ZodLiteral",(e,t)=>{tL.init(e,t);let r=new Set(t.values);e._zod.values=r,eZ(e,"pattern",e=>{let t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?ey(e):e?ey(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(a,i)=>{let n=a.value;return r.has(n)||a.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),a}}),rq=eF("$ZodTransform",(e,t)=>{tL.init(e,t),e._zod.optin="optional",eB.memoizer?.guard(e),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new eJ(e.constructor.name);let i=t.transform(r.value,r);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r));if(i instanceof Promise)throw new eH;return r.value=i,r}});function rA(e,t){return e.value=t.issues.length?void 0:t.value,e}let rz=eF("$ZodOptional",(e,t)=>{tL.init(e,t),eZ(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",eZ(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),eZ(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${er(t.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;let a=t.innerType._zod.run({value:e.value,issues:[]},r);return a instanceof Promise?a.then(t=>rA(e,t)):rA(e,a)}return t.innerType._zod.run(e,r)}}),rM=eF("$ZodExactOptional",(e,t)=>{rz.init(e,t),eZ(e,"values",e=>e.def.innerType._zod.values),eZ(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),rL=eF("$ZodNullable",(e,t)=>{tL.init(e,t),eZ(e,"optin",e=>e.def.innerType._zod.optin),eZ(e,"optout",e=>e.def.innerType._zod.optout),eZ(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${er(t.source)}|null)$`):void 0}),eZ(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),rZ=eF("$ZodDefault",(e,t)=>{tL.init(e,t),e._zod.optin="defaulted",eZ(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>rD(e,t)):rD(a,t)}});function rD(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let rU=eF("$ZodPrefault",(e,t)=>{tL.init(e,t),e._zod.optin="defaulted",eZ(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),rV=eF("$ZodNonOptional",(e,t)=>{tL.init(e,t),eZ(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,a)=>{let i=t.innerType._zod.run(r,a);return i instanceof Promise?i.then(t=>rF(t,e)):rF(i,e)}});function rF(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function rH(e,t,r,a){return t.issues.length?e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>eO(e,a,eK()))},input:e.value}):(e.value=t.value,t.memo&&(e.memo=!0)),e}let rJ=eF("$ZodCatch",(e,t)=>{tL.init(e,t),eZ(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),eZ(e,"optout",e=>e.def.innerType._zod.optout),eZ(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run({value:e.value,issues:[]},r);return a instanceof Promise?a.then(a=>rH(e,a,t,r)):rH(e,a,t,r)}}),rB=eF("$ZodPipe",(e,t)=>{tL.init(e,t),eZ(e,"values",e=>e.def.in._zod.values),eZ(e,"optin",e=>e.def.in._zod.optin),eZ(e,"optout",e=>e.def.out._zod.optout),eZ(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let a=t.out._zod.run(e,r);return a instanceof Promise?a.then(e=>rK(e,t.in,r)):rK(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>rK(e,t.out,r)):rK(a,t.out,r)}});function rK(e,t,r){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let rG=eF("$ZodPreprocess",(e,t)=>{rB.init(e,t)}),rW=eF("$ZodReadonly",(e,t)=>{tL.init(e,t),eZ(e,"propValues",e=>e.def.innerType._zod.propValues),eZ(e,"values",e=>e.def.innerType._zod.values),eZ(e,"optin",e=>e.def.innerType?._zod?.optin),eZ(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(rY):rY(a)}});function rY(e){return e.memo||(e.value=Object.freeze(e.value)),e}let rX=eF("$ZodLazy",(e,t)=>{var r;let a;tL.init(e,t),r=e._zod,Object.defineProperty(r,"innerType",{get(){if(a!==ea)return void 0===a&&(a=ea,a=(()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner))()),a},set(e){Object.defineProperty(r,"innerType",{value:e})},configurable:!0}),eZ(e,"pattern",e=>e.innerType?._zod?.pattern),eZ(e,"propValues",e=>e.innerType?._zod?.propValues),eZ(e,"optin",e=>e.innerType?._zod?.optin??void 0),eZ(e,"optout",e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),rQ=eF("$ZodCustom",(e,t)=>{t_.init(e,t),tL.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,i=t.fn(a);if(i instanceof Promise)return i.then(t=>r0(t,r,a,e));r0(i,r,a,e)}});function r0(e,t,r,a){if(!e){let e={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(eq(e))}}(I=globalThis).__zod_globalRegistry??(I.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let a={...r,...this._map.get(e)};return Object.keys(a).length?a:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let r1=globalThis.__zod_globalRegistry;function r2(e){return e.checks&&(e.checks=[...e.checks]),e}function r9(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...e_(t)})}function r4(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...e_(t)})}function r3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e_(t)})}function r5(e,t){return new e({type:"string",format:"date",check:"string_format",...e_(t)})}function r6(e,t){return new t$({check:"less_than",...e_(t),value:e,inclusive:!1})}function r7(e,t){return new t$({check:"less_than",...e_(t),value:e,inclusive:!0})}function r8(e,t){return new tw({check:"greater_than",...e_(t),value:e,inclusive:!1})}function ae(e,t){return new tw({check:"greater_than",...e_(t),value:e,inclusive:!0})}function at(e,t){return new tR({check:"multiple_of",...e_(t),value:e})}function ar(e,t){return new tx({check:"max_length",...e_(t),maximum:e})}function aa(e,t){return new tP({check:"min_length",...e_(t),minimum:e})}function ai(e,t){return new tE({check:"length_equals",...e_(t),length:e})}function an(e){return new tA({check:"overwrite",tx:e})}function ao(e,...t){for(let r of t)for(let t of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,t)&&ei(e,t,r[t]);return e}function as(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??r1,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 al(e,t,r,a,i){let n="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:a.path,message:i}):t.unrepresentable;if("any"===n)return!1;if(void 0===n||"throw"===n)throw Error(i);return Object.assign(r,n),!0}function ac(e,t,r={path:[],schemaPath:[]}){var a;let i=e._zod.def,n=t.seen.get(e);if(n)return n.count++,r.schemaPath.includes(e)&&(n.cycle=r.path),n.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let a={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,a);else{let r=o.schema,n=t.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(e,t,r,a)}let n=e._zod.parent;n&&(o.ref||(o.ref=n),ac(n,t,a),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&ao(o.schema,l),"input"===t.io&&function e(t,r){let a=r??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,a);if("set"===i.type)return e(i.valueType,a);if("lazy"===i.type)return e(i.getter(),a);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return e(i.innerType,a);if("intersection"===i.type)return e(i.left,a)||e(i.right,a);if("record"===i.type||"map"===i.type)return e(i.keyType,a)||e(i.valueType,a);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,a)||e(i.out,a);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],a))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,a))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,a))return!0;if(i.rest&&e(i.rest,a))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function au(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ad(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let a=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=a.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let a=t[1],{ref:i,defId:n}=(t=>{let a="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${i("__shared")}#/${a}/${au(n)}`}}let i=`#/${a}/`;if(t[1]===r&&!t[1].schema.id)return{ref:"#"};let n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:i+au(n)}})(t);a.def={...a.schema},n&&(a.defId=n);let o=a.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
54
54
|
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let n=a[1];if(r===a[0]){i(a);continue}if(t.external){let n=t.external.registry.get(a[0])?.id;if(r!==a[0]&&n){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id||n.cycle){i(a);continue}n.count>1&&"ref"===t.reused&&i(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let ap=new Set(["type","properties","required","additionalProperties"]),am=["oneOf","anyOf"];function ah(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function af(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!ap.has(t))return null;r.push(a)}let a={},n=new Set;for(let t of r){for(let n in t.properties){if(Object.prototype.hasOwnProperty.call(a,n))continue;let t=[];for(let a of r){let r=a.properties?.[n]??ah(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}en(a,n,1===t.length?t[0]:af(t)??{allOf:t})}for(let r of t.required??[])n.add(r)}let i={type:"object",properties:a};if(n.size&&(i.required=[...n]),r.every(t=>!1===t.additionalProperties))i.additionalProperties=!1;else{let t=[];for(let a of r){let r=ah(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?i.additionalProperties=t[0]:t.length>1&&(i.additionalProperties={allOf:t})}return i}function ag(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let n=r=>{let a=t.seen.get(r);if(null===a.ref)return;let i=a.def??a.schema,o={...i},s=a.ref;if(a.ref=null,s){n(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(i.allOf=i.allOf??[],i.allOf.push(l)):ao(i,l),ao(i,o),r._zod.parent===s)for(let t in i)"$ref"!==t&&"allOf"!==t&&(t in o||delete i[t]);if(l.$ref&&a.def)for(let t in i)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(i[t])===JSON.stringify(a.def[t])&&delete i[t]}let l=r._zod.parent;if(l&&l!==s){n(l);let r=t.seen.get(l);if(r?.schema.$ref&&(i.$ref=r.schema.$ref,r.def))for(let t in i)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(i[t])===JSON.stringify(r.def[t])&&delete i[t]}t.override({zodSchema:r,jsonSchema:i,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())n(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let n=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let i=r.type;for(let t of Array.isArray(i)?i:[i]){if("string"!=typeof t)return;n.includes(t)||n.push(t)}}delete r.anyOf,r.type=1===n.length?n[0]:n}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let n=r.get(a);n?n.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of ap)if(r in t)return;let a=r.filter(t=>am.some(r=>Array.isArray(t[r]))),n=null;if(a.length){let t=a[0],i=am.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let o=r.filter(r=>r!==t),s=t[i].map(t=>af([...o,t]));if(s.some(t=>!t))return;n={[i]:s}}else n=af(r);n&&(delete t.allOf,ao(t,n))}(t)}}let i={};if("draft-2020-12"===t.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}ao(i,a.defId?a.schema:a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&i.id===o&&delete i.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,en(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:ay(r,"input",t.processors),output:ay(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let ay=(t,r,a={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=as({...i??{},target:o,io:r,processors:a});return ac(t,s),ad(s,t),ag(s,t)},av=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},a_=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},ab=(t,r)=>{av(t,"minimum",r),a_(t,"maximum",r)},aS=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},a$=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},aw=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},aR=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},ak=(t,r)=>av(t,"minimum",r.minimum),ax=(t,r)=>a_(t,"maximum",r.maximum),aP=t=>(r,a)=>{aR(r,a.format);let[n,i]=t[a.format];av(r,"minimum",n),a_(r,"maximum",i)},aE={greater_than:(t,r)=>av(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>a_(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>aS(t,r.value),number_format:aP(eS),bigint_format:aP(e$),min_length:ak,max_length:ax,length_equals:(t,r)=>ab(t,r.length),min_size:ak,max_size:ax,size_equals:(t,r)=>ab(t,r.size),string_format:(t,r)=>{aR(t,r.format),r.pattern&&a$(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>aw(t,r.mime)};function aT(t){let r={},a=t._zod.def;for(let n of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])aE[n._zod.def.check]?.(r,n._zod.def);let n=t._zod.bag;for(let t of(void 0!==n.minimum&&av(r,"minimum",n.minimum),void 0!==n.exclusiveMinimum&&av(r,"exclusiveMinimum",n.exclusiveMinimum),void 0!==n.maximum&&a_(r,"maximum",n.maximum),void 0!==n.exclusiveMaximum&&a_(r,"exclusiveMaximum",n.exclusiveMaximum),void 0!==n.multipleOf&&aS(r,n.multipleOf),void 0!==n.format&&(r.format??(r.format=n.format),n.format.includes("int")&&(r.isInt=!0)),n.mime&&aw(r,n.mime),n.patterns??[]))a$(r,t);return r}let aj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aO=new Map([[ro,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rl,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aC=t=>aO.get(t)??t,aI=(t,r,a,n)=>{a.type="string";let{minimum:i,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=aT(t);if("number"==typeof i&&(a.minLength=i),"number"==typeof o&&(a.maxLength=o),s&&(a.format=aj[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aC);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aN=(t,r,a,n)=>{let{minimum:i,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=aT(t);a.type=u?"integer":"number";let d="number"==typeof c&&c>=(i??-1/0),p="number"==typeof l&&l<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;if(d?m?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof i&&(a.minimum=i),p?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof o&&(a.maximum=o),s){let i=new Set;for(let o of s)Number.isFinite(o)&&0!==o?i.add(Math.abs(o)):al(t,r,a,n,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...l]=i;void 0!==o&&(a.multipleOf=o),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aq=(t,r,a,n)=>{a.type="boolean"},aA=(t,r,a,n)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aM=(t,r,a,n)=>{a.not={}},az=(t,r,a,n)=>{},aL=(t,r,a,n)=>{},aZ=(t,r,a,n)=>{let i=Y(t._zod.def.entries);if(0===i.length){a.not={};return}i.every(t=>"number"==typeof t)&&(a.type="number"),i.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=i},aD=(t,r,a,n)=>{let i=t._zod.def;if(0===i.values.length){a.not={};return}let o=[];for(let s of i.values)if(void 0===s){if(al(t,r,a,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(al(t,r,a,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},aU=(t,r,a,n)=>{al(t,r,a,n,"Custom types cannot be represented in JSON Schema")},aV=(t,r,a,n)=>{al(t,r,a,n,"Transforms cannot be represented in JSON Schema")},aF=(t,r,a,n)=>{let i=t._zod.def,{minimum:o,maximum:s}=aT(t);"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=ac(i.element,r,{...n,path:[...n.path,"items"]})};function aH(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aH(r.out):"catch"===r.type?aH(r.innerType):t._zod.optin}let aJ=(t,r,a,n)=>{let i=t._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&al(t,r,a,n,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},o)en(a.properties,t,ac(o[t],r,{...n,path:[...n.path,"properties",t]}));let s=[];for(let t of Object.keys(o)){let a=i.shape[t];("input"===r.io?void 0===aH(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),i.catchall?._zod.def.type==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=ac(i.catchall,r,{...n,path:[...n.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},aB=(t,r,a,n)=>{let i=t._zod.def,o=!1===i.inclusive,s=i.options.map((t,a)=>ac(t,r,{...n,path:[...n.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},aK=(t,r,a,n)=>{let i=t._zod.def,o=ac(i.left,r,{...n,path:[...n.path,"allOf",0]}),s=ac(i.right,r,{...n,path:[...n.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},aG=new WeakMap,aW=(t,r,a,n)=>{let i=t._zod.def;a.type="object";let o=i.keyType,s=aT(o).patterns;if("loose"===i.mode&&s&&s.size>0){let t=ac(i.valueType,r,{...n,path:[...n.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))en(a.patternProperties,aC(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=ac(i.keyType,r,{...n,path:[...n.path,"propertyNames"]});let o=aG.get(r);o||(o=[],aG.set(r,o),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let n of aG.get(t)??[]){let i=t.seen.get(n),o=(i?.def??i?.schema)?.propertyNames;if(!o||!0===o||a.has(o))continue;let s=function t(r,a,n){if(a.$ref){if(n.has(a))return a;n.add(a);let i=r.get(a)?.def;if(!i)return a;let o=t(r,i,n);return o===i?a:o}for(let i of["anyOf","oneOf"]){let o=a[i];if(!Array.isArray(o))continue;let s=o.map(a=>t(r,a,n));s.some((t,r)=>t!==o[r])&&(a={...a,[i]:s})}let i=Array.isArray(a.type)?a.type:[a.type],o=!i.includes("string")&&i.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!o&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:m,id:h,...f}=a;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(i.includes("number")?th:tm).source)),f}(r,o,new Set);s!==o&&a.set(o,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),o.push(t)}a.additionalProperties=ac(i.valueType,r,{...n,path:[...n.path,"additionalProperties"]})}let l=o._zod.values,c="input"===r.io&&void 0!==aH(i.valueType);if(l&&!i.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},aY=(t,r,a,n)=>{let i=t._zod.def,o=ac(i.innerType,r,n),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=i.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},aX=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},aQ=Symbol();function a0(t,r,a,n,i){let o=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(o=!0,null));return o?(al(r,a,n,i,"BigInt defaults cannot be represented in JSON Schema"),aQ):JSON.parse(s)}let a1=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType;let o=a0(i.defaultValue,t,r,a,n);o!==aQ&&(a.default=o)},a2=(t,r,a,n)=>{let i=t._zod.def;if(ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType,"input"!==r.io)return;let o=a0(i.defaultValue,t,r,a,n);o!==aQ&&(a._prefault=o)},a9=(t,r,a,n)=>{let i,o=t._zod.def;ac(o.innerType,r,n),r.seen.get(t).ref=o.innerType;try{i=o.catchValue(void 0)}catch{al(t,r,a,n,"Dynamic catch values are not supported in JSON Schema");return}a.default=i},a4=(t,r,a,n)=>{let i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?i.out:i.in:i.out;ac(s,r,n),r.seen.get(t).ref=s},a3=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType,a.readOnly=!0},a6=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},a5=(t,r,a,n)=>{let i=t._zod.innerType;ac(i,r,n),r.seen.get(t).ref=i},a7={string:aI,number:aN,boolean:aq,bigint:(t,r,a,n)=>{al(t,r,a,n,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,n)=>{al(t,r,a,n,"Symbols cannot be represented in JSON Schema")},null:aA,undefined:(t,r,a,n)=>{al(t,r,a,n,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,n)=>{al(t,r,a,n,"Void cannot be represented in JSON Schema")},never:aM,any:az,unknown:aL,date:(t,r,a,n)=>{al(t,r,a,n,"Date cannot be represented in JSON Schema")},enum:aZ,literal:aD,nan:(t,r,a,n)=>{al(t,r,a,n,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,n)=>{let i=t._zod.pattern;if(!i)throw Error("Pattern not found in template literal");a.type="string",a.pattern=i.source},file:(t,r,a,n)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:i,maximum:o,mime:s}=aT(t);void 0!==i&&(a.minLength=i),void 0!==o&&(a.maxLength=o),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,n)=>{a.type="boolean"},custom:aU,function:(t,r,a,n)=>{al(t,r,a,n,"Function types cannot be represented in JSON Schema")},transform:aV,map:(t,r,a,n)=>{al(t,r,a,n,"Map cannot be represented in JSON Schema")},set:(t,r,a,n)=>{al(t,r,a,n,"Set cannot be represented in JSON Schema")},array:aF,object:aJ,union:aB,intersection:aK,tuple:(t,r,a,n)=>{let i=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=i.items.map((t,a)=>ac(t,r,{...n,path:[...n.path,o,a]})),c=i.rest?ac(i.rest,r,{...n,path:[...n.path,s,..."openapi-3.0"===r.target?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let t=i.items[u-1];if(!("input"===r.io?void 0!==aH(t):"optional"===t._zod.optout))break;u--}let d=i.items.length,p=!i.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:m,maximum:h}=aT(t);"number"==typeof m&&(a.minItems=m),"number"==typeof h&&(a.maxItems=h)},record:aW,nullable:aY,nonoptional:aX,default:a1,prefault:a2,catch:a9,pipe:a4,readonly:a3,promise:(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},optional:a6,lazy:a5};function a8(t,r){if("_idmap"in t){let a=as({...r,processors:a7}),n={};for(let r of t._idmap.entries()){let[t,n]=r;ac(n,a)}let i={};for(let o of(a.external={registry:t,uri:r?.uri,defs:n},t._idmap.entries())){let[t,r]=o;ad(a,r),en(i,t,ag(a,r))}return Object.keys(n).length>0&&(i.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:n}),{schemas:i}}let a=as({...r,processors:a7});return ac(t,a),ad(a,t),ag(a,t)}let ne={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,Q,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},nt={value:void 0,enumerable:!1},nr=new WeakSet([Object.prototype,Error.prototype]),na=(t,r)=>{t.name="$ZodError",nt.value=r,Object.defineProperty(t,"issues",nt),nt.value=void 0,Object.defineProperty(t,"message",ne);let a=Object.getPrototypeOf(t);nr.has(a)||(nr.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},nn=eV("$ZodError",na);function ni(t,r){return{callee:r?.callee??t,Err:r?.Err}}eV("$ZodError",na,void 0,{Parent:Error});let no=t=>{let r=(a,n,i,o)=>{let s=i?{...i,async:!1}:{async:!1},l=a._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new eF;if(l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>ej(t,s,eB())));throw ed(a,o?.callee??r),a}return l.value};return r},ns=t=>{let r=async(a,n,i,o)=>{let s=i?{...i,async:!0}:{async:!0},l=a._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>ej(t,s,eB())));throw ed(a,o?.callee??r),a}return l.value};return r},nl=t=>(r,a,n)=>{let i=n?{...n,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new eF;return o.issues.length?nc(t,o.issues,i):{success:!0,data:o.value}};function nc(t,r,a){let n;return{success:!1,get error(){return n||(n=new t(r.map(t=>ej(t,a,eB()))),r=void 0,a=void 0),n},set error(e){n=e,r=void 0,a=void 0}}}let nu=t=>async(r,a,n)=>{let i=n?{...n,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?nc(t,o.issues,i):{success:!0,data:o.value}},nd=Symbol.for("zod.compile.invalid"),np=Symbol.for("zod.compile.fallback"),nm=async(t,r,a)=>{let n=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),0===i.issues.length},nh=new WeakSet([Object.prototype,Error.prototype]);function nf(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let ng=eV("ZodError",(t,r)=>{nn.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);nh.has(a)||(nh.add(a),nf(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},n=(t,i=[])=>{for(let o of t.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(t=>n({issues:t},[...i,...o.path]));else if("invalid_key"===o.code)n({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)n({issues:o.issues},[...i,...o.path]);else{let t=[...i,...o.path];if(0===t.length)a._errors.push(r(o));else{let n=a,i=0;for(;i<t.length;){let a=t[i],s=i===t.length-1;if("_errors"===a){s&&n._errors.push(r(o)),i++;continue}Object.prototype.hasOwnProperty.call(n,a)||Object.defineProperty(n,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=n[a];s&&l._errors.push(r(o)),n=l,i++}}}};return n(t),a})(t,r)),nf(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},n=[];for(let s of t.issues)if(s.path.length>0){var i,o;(i=s.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(a,i)&&("__proto__"===i?Object.defineProperty(a,i,{value:o(),writable:!0,enumerable:!0,configurable:!0}):a[i]=o()),a[i]).push(r(s))}else n.push(r(s));return{formErrors:n,fieldErrors:a}})(t,r)),nf(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Q,2)}),nf(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Q,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ny=no(ng),nv=ns(ng),n_=nl(ng),nb=nu(ng),nS=(f=no(ng),g=(t,r,a,n)=>f(t,r,a?{...a,direction:"backward"}:{direction:"backward"},ni(g,n))),n$=(y=no(ng),v=(t,r,a,n)=>y(t,r,a,ni(v,n))),nw=(_=ns(ng),b=async(t,r,a,n)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return await _(t,r,i,ni(b,n))}),nR=(S=ns(ng),$=async(t,r,a,n)=>await S(t,r,a,ni($,n))),nk=(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return nl(ng)(t,r,n)},nx=(t,r,a)=>nl(ng)(t,r,a),nP=async(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return nu(ng)(t,r,n)},nE=async(t,r,a)=>nu(ng)(t,r,a);function nT(){eJ.memoizer||eB({memoizer:e1})}let nj=eV("ZodType",(t,r)=>(eJ.localeError||eB({localeError:(()=>{let t={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"}},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"},a={nan:"NaN"};function n(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=n(a.expected),r=n(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${eb(a.values[0])}`;return`Invalid option: expected one of ${X(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",n=t[a.origin]??null;if(n)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${n.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",n=t[a.origin]??null;if(n)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${n.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${X(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tL.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(eu(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return ev(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new iU({type:"custom",check:"custom",fn:t,...e_(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let n,i;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eN(t,r.value,n._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=n),t.continue??(t.continue=!n._zod.def.abort),r.issues.push(eN(t)))},t(r.value,r)),(i=new t_({check:"custom",...e_(r)}))._zod.check=a,n=i}(t,r))},overwrite(t){return this.check(ai(t))},optional(){return iE(this)},exactOptional(){var t;return t=this,new iT({type:"optional",innerType:t})},nullable(){return iO(this)},nullish(){return iE(iO(this))},nonoptional(t){var r;return r=this,new iN({type:"nonoptional",innerType:r,...e_(t)})},array(){return il(this)},or(t){return im([this,t])},and(t){return iv(this,t)},transform(t){return iM(this,ix(t))},default(t){var r,a;return r=this,a=t,new iC({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():ef(a)}})},prefault(t){var r,a;return r=this,a=t,new iI({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():ef(a)}})},catch(t){return function(t,r){let a;return new iq({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return iM(this,t)},readonly(){var t;return t=this,new iL({type:"readonly",innerType:t})},describe(t){let r=this.clone();return r1.add(r,{description:t}),r},meta(...t){if(0===t.length)return r1.get(this);let r=this.clone();return r1.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eq(this,"~standard",{...tU(this),jsonSchema:{input:ay(this,"input"),output:ay(this,"output")}},!1)},set"~standard"(value){eq(this,"~standard",value)},parse:function t(r,a){return ny(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await nv(this,r,a,{callee:t})},safeParse(t,r){return n_(this,t,r)},async safeParseAsync(t,r){return nb(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eq(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==nd)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let n,i=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;if(o?(i[np]=!0,n=o({value:r,issues:[]},i)):n=t._zod.run({value:r,issues:[]},i),n instanceof Promise)throw new eF;return 0===n.issues.length}(this,t,r)},validateAsync(t,r){return nm(this,t,r)},encode:function t(r,a){return nS(this,r,a,{callee:t})},decode:function t(r,a){return n$(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await nw(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await nR(this,r,a,{callee:t})},safeEncode(t,r){return nk(this,t,r)},safeDecode(t,r){return nx(this,t,r)},async safeEncodeAsync(t,r){return nP(this,t,r)},async safeDecodeAsync(t,r){return nE(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let n=as({...a,processors:r});return ac(t,n),ad(n,t),ag(n,t)})(this,{})(t)},get description(){return r1.get(this)?.description},get _def(){return this._zod.def}}),nO=eV("_ZodString",(t,r)=>{tV.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aI(t,r,a,n)},eA({format:t=>aT(t).format??null,minLength:t=>aT(t).minimum??null,maxLength:t=>aT(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tj({check:"string_format",format:"regex",...e_(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tI({check:"string_format",format:"includes",...e_(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tN({check:"string_format",format:"starts_with",...e_(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tq({check:"string_format",format:"ends_with",...e_(r),suffix:t})}(...t))},min(...t){return this.check(aa(...t))},max(...t){return this.check(ar(...t))},length(...t){return this.check(an(...t))},nonempty(...t){return this.check(aa(1,...t))},lowercase(t){return this.check(new tO({check:"string_format",format:"lowercase",...e_(t)}))},uppercase(t){return this.check(new tC({check:"string_format",format:"uppercase",...e_(t)}))},trim(){return this.check(ai(t=>t.trim()))},normalize(...t){return this.check(function(t){return ai(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(ai(t=>t.toLowerCase()))},toUpperCase(){return this.check(ai(t=>t.toUpperCase()))},slugify(){return this.check(ai(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),nC=eV("ZodString",(t,r)=>{tV.init(t,r),nO.init(t,r)},{email(t){return this.check(r9(nL,t))},url(t){return this.check(r4(nU,t))},jwt(t){return this.check(new n9({type:"string",format:"jwt",check:"string_format",abort:!1,...e_(t)}))},emoji(t){return this.check(new nV({type:"string",format:"emoji",check:"string_format",abort:!1,...e_(t)}))},guid(t){return this.check(new nZ({type:"string",format:"guid",check:"string_format",abort:!1,...e_(t)}))},uuid(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,...e_(t)}))},uuidv4(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e_(t)}))},uuidv6(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e_(t)}))},uuidv7(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e_(t)}))},nanoid(t){return this.check(new nF({type:"string",format:"nanoid",check:"string_format",abort:!1,...e_(t)}))},cuid(t){return this.check(new nH({type:"string",format:"cuid",check:"string_format",abort:!1,...e_(t)}))},cuid2(t){return this.check(new nJ({type:"string",format:"cuid2",check:"string_format",abort:!1,...e_(t)}))},ulid(t){return this.check(new nB({type:"string",format:"ulid",check:"string_format",abort:!1,...e_(t)}))},base64(t){return this.check(new n0({type:"string",format:"base64",check:"string_format",abort:!1,...e_(t)}))},base64url(t){return this.check(new n1({type:"string",format:"base64url",check:"string_format",abort:!1,...e_(t)}))},xid(t){return this.check(new nK({type:"string",format:"xid",check:"string_format",abort:!1,...e_(t)}))},ksuid(t){return this.check(new nG({type:"string",format:"ksuid",check:"string_format",abort:!1,...e_(t)}))},ipv4(t){return this.check(new nW({type:"string",format:"ipv4",check:"string_format",abort:!1,...e_(t)}))},ipv6(t){return this.check(new nY({type:"string",format:"ipv6",check:"string_format",abort:!1,...e_(t)}))},cidrv4(t){return this.check(new nX({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e_(t)}))},cidrv6(t){return this.check(new nQ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e_(t)}))},e164(t){return this.check(new n2({type:"string",format:"e164",check:"string_format",abort:!1,...e_(t)}))},datetime(t){return this.check(r3(nq,t))},date(t){return this.check(r6(nA,t))},time(t){return this.check(new nM({type:"string",format:"time",check:"string_format",precision:null,...e_(t)}))},duration(t){return this.check(new nz({type:"string",format:"duration",check:"string_format",...e_(t)}))}});function nI(t){return new nC(r2({type:"string",...e_(t)}))}let nN=eV("ZodStringFormat",(t,r)=>{tF.init(t,r),nO.init(t,r)}),nq=eV("ZodISODateTime",(t,r)=>{t3.init(t,r),nN.init(t,r)}),nA=eV("ZodISODate",(t,r)=>{t6.init(t,r),nN.init(t,r)}),nM=eV("ZodISOTime",(t,r)=>{t5.init(t,r),nN.init(t,r)}),nz=eV("ZodISODuration",(t,r)=>{t7.init(t,r),nN.init(t,r)}),nL=eV("ZodEmail",(t,r)=>{tB.init(t,r),nN.init(t,r)}),nZ=eV("ZodGUID",(t,r)=>{tH.init(t,r),nN.init(t,r)}),nD=eV("ZodUUID",(t,r)=>{tJ.init(t,r),nN.init(t,r)}),nU=eV("ZodURL",(t,r)=>{tY.init(t,r),nN.init(t,r)}),nV=eV("ZodEmoji",(t,r)=>{tX.init(t,r),nN.init(t,r)}),nF=eV("ZodNanoID",(t,r)=>{tQ.init(t,r),nN.init(t,r)}),nH=eV("ZodCUID",(t,r)=>{t0.init(t,r),nN.init(t,r)}),nJ=eV("ZodCUID2",(t,r)=>{t1.init(t,r),nN.init(t,r)}),nB=eV("ZodULID",(t,r)=>{t2.init(t,r),nN.init(t,r)}),nK=eV("ZodXID",(t,r)=>{t9.init(t,r),nN.init(t,r)}),nG=eV("ZodKSUID",(t,r)=>{t4.init(t,r),nN.init(t,r)}),nW=eV("ZodIPv4",(t,r)=>{t8.init(t,r),nN.init(t,r)}),nY=eV("ZodIPv6",(t,r)=>{rr.init(t,r),nN.init(t,r)}),nX=eV("ZodCIDRv4",(t,r)=>{ra.init(t,r),nN.init(t,r)}),nQ=eV("ZodCIDRv6",(t,r)=>{rn.init(t,r),nN.init(t,r)}),n0=eV("ZodBase64",(t,r)=>{rs.init(t,r),nN.init(t,r)}),n1=eV("ZodBase64URL",(t,r)=>{rc.init(t,r),nN.init(t,r)}),n2=eV("ZodE164",(t,r)=>{ru.init(t,r),nN.init(t,r)}),n9=eV("ZodJWT",(t,r)=>{rd.init(t,r),nN.init(t,r)}),n4=eV("ZodNumber",(t,r)=>{rp.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aN(t,r,a,n),t.isFinite=!0},eA({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=aT(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=aT(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=aT(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>aT(t).format??null},{gt(t,r){return this.check(r8(t,r))},gte(t,r){return this.check(ae(t,r))},min(t,r){return this.check(ae(t,r))},lt(t,r){return this.check(r5(t,r))},lte(t,r){return this.check(r7(t,r))},max(t,r){return this.check(r7(t,r))},int(t){return this.check(n5(t))},safe(t){return this.check(n5(t))},positive(t){return this.check(r8(0,t))},nonnegative(t){return this.check(ae(0,t))},negative(t){return this.check(r5(0,t))},nonpositive(t){return this.check(r7(0,t))},multipleOf(t,r){return this.check(at(t,r))},step(t,r){return this.check(at(t,r))},finite(){return this}}));function n3(t){return new n4(r2({type:"number",checks:[],...e_(t)}))}let n6=eV("ZodNumberFormat",(t,r)=>{rm.init(t,r),n4.init(t,r)});function n5(t){return new n6({type:"number",check:"number_format",abort:!1,format:"safeint",...e_(t)})}let n7=eV("ZodBoolean",(t,r)=>{rh.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aq(t,r,a,n)});function n8(t){return new n7({type:"boolean",...e_(t)})}let ie=eV("ZodNull",(t,r)=>{rf.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aA(t,r,a,n)});function it(t){return new ie({type:"null",...e_(t)})}let ir=eV("ZodAny",(t,r)=>{rg.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>az(t,r,a,n)}),ia=eV("ZodUnknown",(t,r)=>{ry.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aL(t,r,a,n)});function ii(){return new ia({type:"unknown"})}let io=eV("ZodNever",(t,r)=>{rv.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aM(t,r,a,n)}),is=eV("ZodArray",(t,r)=>{nT(),rb.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aF(t,r,a,n),t.element=r.element},{min(t,r){return this.check(aa(t,r))},nonempty(t){return this.check(aa(1,t))},max(t,r){return this.check(ar(t,r))},length(t,r){return this.check(an(t,r))},unwrap(){return this.element}});function il(t,r){return new is({type:"array",element:t,...e_(r)})}let ic=eV("ZodObject",(t,r)=>{var a;let n,i;nT(),rx.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aJ(t,r,a,n),a="shape",(i=a in(n=Object.getPrototypeOf(t))?void 0:n)&&Object.defineProperty(i,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return i$(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(eu(this._zod.def,{catchall:t}))},passthrough(){return this.clone(eu(this._zod.def,{catchall:ii()}))},loose(){return this.clone(eu(this._zod.def,{catchall:ii()}))},strict(){return this.clone(eu(this._zod.def,{catchall:new io({type:"never",...e_(void 0)})}))},strip(){return this.clone(eu(this._zod.def,{catchall:void 0}))},extend(t){if(!eh(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=eo(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ev(this,eu(this._zod.def,{shape:eR(this,t)}))},safeExtend(t){if(!eh(t))throw Error("Invalid input to safeExtend: expected a plain object");return ev(this,eu(this._zod.def,{shape:eR(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return ec(r,this,Reflect.ownKeys(eo(this))),ec(r,t,Reflect.ownKeys(eo(t))),ev(this,eu(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,n=a.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return ec(i,t,ew(t,r)),ev(t,eu(a,{shape:i,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,n=a.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ew(t,r)),o={};return ec(o,t,Reflect.ownKeys(eo(t)).filter(t=>!i.has(t))),ev(t,eu(a,{shape:o,checks:[]}))}(this,t)},partial(...t){return ek(iP,this,t[0])},exactPartial(...t){return ek(iT,this,t[0],"exactPartial")},required(...t){var r;let a,n;return a=(r=t[0])?new Set(ew(this,r)):void 0,ec(n={},this,Reflect.ownKeys(eo(this)),(t,r)=>a&&!a.has(r)?t:new iN({type:"nonoptional",innerType:t})),ev(this,eu(this._zod.def,{shape:n}))}});function iu(t,r){return new ic({type:"object",shape:t??{},...e_(r)})}function id(t,r){return new ic({type:"object",shape:t,catchall:ii(),...e_(r)})}let ip=eV("ZodUnion",(t,r)=>{rE.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aB(t,r,a,n),t.options=r.options});function im(t,r){return new ip({type:"union",options:t,...e_(r)})}let ih=eV("ZodDiscriminatedUnion",(t,r)=>{ip.init(t,r),rT.init(t,r)});function ig(t,r,a){return new ih({type:"union",options:r,discriminator:t,...e_(a)})}let iy=eV("ZodIntersection",(t,r)=>{rj.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aK(t,r,a,n)});function iv(t,r){return new iy({type:"intersection",left:t,right:r})}let i_=eV("ZodRecord",(t,r)=>{nT(),rC.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aW(t,r,a,n),t.keyType=r.keyType,t.valueType=r.valueType});function ib(t,r,a){return new i_(r&&r._zod?{type:"record",keyType:t,valueType:r,...e_(a)}:{type:"record",keyType:nI(),valueType:t,...e_(r)})}let iS=eV("ZodEnum",(t,r)=>{rI.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aZ(t,r,a,n),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,n)=>{let i={};for(let n of t)if(a.has(n))i[n]=r.entries[n];else throw Error(`Key ${n} not found in enum`);return new iS({...r,checks:[],...e_(n),entries:i})},t.exclude=(t,n)=>{let i={...r.entries};for(let r of t)if(a.has(r))delete i[r];else throw Error(`Key ${r} not found in enum`);return new iS({...r,checks:[],...e_(n),entries:i})}});function i$(t,r){return new iS({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...e_(r)})}let iw=eV("ZodLiteral",(t,r)=>{rN.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aD(t,r,a,n),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function iR(t,r){return new iw({type:"literal",values:Array.isArray(t)?t:[t],...e_(r)})}let ik=eV("ZodTransform",(t,r)=>{nT(),rq.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aV(t,r,a,n),t._zod.parse=(a,n)=>{if("backward"===n.direction)throw new eH(t.constructor.name);a.addIssue=n=>{"string"==typeof n?a.issues.push(eN(n,a.value,r)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=a.value),n.inst??(n.inst=t),a.issues.push(eN(n)))};let i=r.transform(a.value,a);return i instanceof Promise?i.then(t=>(a.value=t,a)):(a.value=i,a)}});function ix(t){return new ik({type:"transform",transform:t})}let iP=eV("ZodOptional",(t,r)=>{rM.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a6(t,r,a,n),t.unwrap=()=>t._zod.def.innerType});function iE(t){return new iP({type:"optional",innerType:t})}let iT=eV("ZodExactOptional",(t,r)=>{rz.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a6(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),ij=eV("ZodNullable",(t,r)=>{rL.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aY(t,r,a,n),t.unwrap=()=>t._zod.def.innerType});function iO(t){return new ij({type:"nullable",innerType:t})}let iC=eV("ZodDefault",(t,r)=>{rZ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a1(t,r,a,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),iI=eV("ZodPrefault",(t,r)=>{rU.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a2(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iN=eV("ZodNonOptional",(t,r)=>{rV.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aX(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iq=eV("ZodCatch",(t,r)=>{rJ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a9(t,r,a,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),iA=eV("ZodPipe",(t,r)=>{rB.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a4(t,r,a,n),t.in=r.in,t.out=r.out});function iM(t,r){return new iA({type:"pipe",in:t,out:r})}let iz=eV("ZodPreprocess",(t,r)=>{iA.init(t,r),rG.init(t,r)}),iL=eV("ZodReadonly",(t,r)=>{rW.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a3(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iZ=eV("ZodLazy",(t,r)=>{rX.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a5(t,r,a,n),t.unwrap=()=>t._zod.def.getter()});function iD(t){return new iZ({type:"lazy",getter:t})}let iU=eV("ZodCustom",(t,r)=>{rQ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aU(t,r,a,n)});function iV(t,r){return new iz({type:"pipe",in:ix(t),out:r})}N||(N={});let iF="2025-11-25",iH=[iF,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iJ="io.modelcontextprotocol/protocolVersion",iB="io.modelcontextprotocol/clientInfo",iK="io.modelcontextprotocol/serverInfo",iG="io.modelcontextprotocol/clientCapabilities",iW="io.modelcontextprotocol/subscriptionId",iY="io.modelcontextprotocol/logLevel",iX=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),iX),il(iX)])),iQ=ib(nI(),iX),i0=il(iX),i1=im([nI(),n3().int()]),i2=nI(),i9=iu({ttl:n3().optional()}),i4=iu({taskId:nI()}),i3=id({progressToken:i1.optional(),"io.modelcontextprotocol/related-task":i4.optional()}),i6=iu({_meta:i3.optional()}),i5=i6.extend({task:i9.optional()}),i7=iu({method:nI(),params:i6.loose().optional()}),i8=iu({_meta:i3.optional()}),oe=iu({method:nI(),params:i8.loose().optional()}),ot=id({get[iK](){return og.optional().catch(void 0)}}),or=id({_meta:ot.optional()}),oa=im([nI(),n3().int()]),on=iu({jsonrpc:iR("2.0"),id:oa,...i7.shape}).strict(),oi=iu({jsonrpc:iR("2.0"),...oe.shape}).strict(),oo=iu({jsonrpc:iR("2.0"),id:oa,result:or}).strict(),os=iu({jsonrpc:iR("2.0"),id:oa.optional(),error:iu({code:n3().int(),message:nI(),data:ii().optional()})}).strict(),ol=im([on,oi,oo,os]),oc=im([oo,os]),ou=or.strict(),od=i8.extend({requestId:oa.optional(),reason:nI().optional()}),op=oe.extend({method:iR("notifications/cancelled"),params:od}),om=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),oh=iu({icons:il(om).optional()}),of=iu({name:nI(),title:nI().optional()}),og=of.extend({...of.shape,...oh.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),oy=iv(iu({applyDefaults:n8().optional()}),iQ),ov=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:oy.optional(),url:iQ.optional()}),iQ.optional())),o_=id({list:iQ.optional(),cancel:iQ.optional(),requests:id({sampling:id({createMessage:iQ.optional()}).optional(),elicitation:id({create:iQ.optional()}).optional()}).optional()}),ob=id({list:iQ.optional(),cancel:iQ.optional(),requests:id({tools:id({call:iQ.optional()}).optional()}).optional()}),oS=iu({experimental:ib(nI(),iQ).optional(),sampling:iu({context:iQ.optional(),tools:iQ.optional()}).optional(),elicitation:ov.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:o_.optional(),extensions:ib(nI(),iQ).optional()}),o$=i6.extend({protocolVersion:nI(),capabilities:oS,clientInfo:og}),ow=i7.extend({method:iR("initialize"),params:o$}),oR=iu({experimental:ib(nI(),iQ).optional(),logging:iQ.optional(),completions:iQ.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:ob.optional(),extensions:ib(nI(),iQ).optional()}),ok=or.extend({protocolVersion:nI(),capabilities:oR,serverInfo:og,instructions:nI().optional()}),ox=oe.extend({method:iR("notifications/initialized"),params:i8.optional()}),oP=i7.extend({method:iR("server/discover"),params:i6.optional()}),oE=or.extend({supportedVersions:il(nI()),capabilities:oR,instructions:nI().optional()}),oT=i7.extend({method:iR("ping"),params:i6.optional()}),oj=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),oO=iu({...i8.shape,...oj.shape,progressToken:i1}),oC=oe.extend({method:iR("notifications/progress"),params:oO}),oI=i6.extend({cursor:i2.optional()}),oN=i7.extend({params:oI.optional()}),oq=or.extend({nextCursor:i2.optional()}),oA=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()}),oM=oA.extend({text:nI()}),oz=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oL=oA.extend({blob:oz}),oZ=i$(["user","assistant"]),oD=iu({audience:il(oZ).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),oU=iu({...of.shape,...oh.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:oD.optional(),_meta:iE(id({}))}),oV=iu({...of.shape,...oh.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:oD.optional(),_meta:iE(id({}))}),oF=oN.extend({method:iR("resources/list")}),oH=oq.extend({resources:il(oU)}),oJ=oN.extend({method:iR("resources/templates/list")}),oB=oq.extend({resourceTemplates:il(oV)}),oK=i6.extend({uri:nI()}),oG=i7.extend({method:iR("resources/read"),params:oK}),oW=or.extend({contents:il(im([oM,oL]))}),oY=oe.extend({method:iR("notifications/resources/list_changed"),params:i8.optional()}),oX=i7.extend({method:iR("resources/subscribe"),params:oK}),oQ=i7.extend({method:iR("resources/unsubscribe"),params:oK}),o0=iu({toolsListChanged:n8().optional(),promptsListChanged:n8().optional(),resourcesListChanged:n8().optional(),resourceSubscriptions:il(nI()).optional()}),o1=i6.extend({notifications:o0}),o2=i7.extend({method:iR("subscriptions/listen"),params:o1}),o9=i8.extend({notifications:o0}),o4=oe.extend({method:iR("notifications/subscriptions/acknowledged"),params:o9}),o3=ot.extend({[iW]:oa}),o6=or.extend({_meta:o3}),o5=i8.extend({uri:nI()}),o7=oe.extend({method:iR("notifications/resources/updated"),params:o5}),o8=iu({name:nI(),description:iE(nI()),required:iE(n8())}),se=iu({...of.shape,...oh.shape,description:iE(nI()),arguments:iE(il(o8)),_meta:iE(id({}))}),st=oN.extend({method:iR("prompts/list")}),sr=oq.extend({prompts:il(se)}),sa=i6.extend({name:nI(),arguments:ib(nI(),nI()).optional()}),sn=i7.extend({method:iR("prompts/get"),params:sa}),si=iu({type:iR("text"),text:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),so=iu({type:iR("image"),data:oz,mimeType:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),ss=iu({type:iR("audio"),data:oz,mimeType:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),sl=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),sc=iu({type:iR("resource"),resource:im([oM,oL]),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),su=oU.extend({type:iR("resource_link")}),sd=im([si,so,ss,su,sc]),sp=iu({role:oZ,content:sd}),sm=or.extend({description:nI().optional(),messages:il(sp)}),sh=oe.extend({method:iR("notifications/prompts/list_changed"),params:i8.optional()}),sf=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),sg=iu({taskSupport:i$(["required","optional","forbidden"]).optional()}),sy=iu({...of.shape,...oh.shape,description:nI().optional(),inputSchema:iu({type:iR("object"),properties:ib(nI(),iX).optional(),required:il(nI()).optional()}).catchall(ii()),outputSchema:id({$schema:nI().optional()}).optional(),annotations:sf.optional(),execution:sg.optional(),_meta:ib(nI(),ii()).optional()}),sv=oN.extend({method:iR("tools/list")}),s_=oq.extend({tools:il(sy)}),sb=or.extend({content:il(sd).default([]),structuredContent:ii().optional(),isError:n8().optional()}),sS=sb.or(or.extend({toolResult:ii()})),s$=i5.extend({name:nI(),arguments:ib(nI(),ii()).optional()}),sw=i7.extend({method:iR("tools/call"),params:s$}),sR=oe.extend({method:iR("notifications/tools/list_changed"),params:i8.optional()}),sk=iu({autoRefresh:n8().default(!0),debounceMs:n3().int().nonnegative().default(300)}),sx=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),sP=i6.extend({level:sx}),sE=i7.extend({method:iR("logging/setLevel"),params:sP}),sT=i8.extend({level:sx,logger:nI().optional(),data:ii()}),sj=oe.extend({method:iR("notifications/message"),params:sT}),sO=iu({name:nI().optional()}),sC=iu({hints:il(sO).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),sI=iu({mode:i$(["auto","required","none"]).optional()}),sN=iu({type:iR("tool_result"),toolUseId:nI().describe("The unique identifier for the corresponding tool call."),content:il(sd),structuredContent:ii().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),sq=ig("type",[si,so,ss]),sA=ig("type",[si,so,ss,sl,sN]),sM=iu({role:oZ,content:im([sA,il(sA)]),_meta:ib(nI(),ii()).optional()}),sz=i5.extend({messages:il(sM),modelPreferences:sC.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:iQ.optional(),tools:il(sy).optional(),toolChoice:sI.optional()}),sL=i7.extend({method:iR("sampling/createMessage"),params:sz}),sZ=or.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens"]).or(nI())),role:oZ,content:sq}),sD=or.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens","toolUse"]).or(nI())),role:oZ,content:im([sA,il(sA)])}),sU=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),sV=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),sF=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),sH=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),sJ=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),sB=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),sK=im([sH,sJ]),sG=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),sW=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()}),sY=im([sG,sW]),sX=im([sB,sK,sY]),sQ=im([sX,sU,sV,sF]),s0=i5.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),sQ),required:il(nI()).optional()}).catchall(ii())}),s1=i5.extend({mode:iR("url"),message:nI(),elicitationId:nI(),url:nI().url()}),s2=im([s0,s1]),s9=i7.extend({method:iR("elicitation/create"),params:s2}),s4=i8.extend({elicitationId:nI()}),s3=oe.extend({method:iR("notifications/elicitation/complete"),params:s4}),s6=or.extend({action:i$(["accept","decline","cancel"]),content:iV(t=>null===t?void 0:t,ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional())}),s5=iu({type:iR("ref/resource"),uri:nI()}),s7=iu({type:iR("ref/prompt"),name:nI()}),s8=i6.extend({ref:im([s7,s5]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()}),le=i7.extend({method:iR("completion/complete"),params:s8}),lt=or.extend({completion:id({values:il(nI()).max(100),total:iE(n3().int()),hasMore:iE(n8())})}),lr=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),la=i7.extend({method:iR("roots/list"),params:i6.optional()}),ln=or.extend({roots:il(lr)}),li=oe.extend({method:iR("notifications/roots/list_changed"),params:i8.optional()}),lo=id({ttl:n3().optional(),pollInterval:n3().optional()}),ls=i$(["working","input_required","completed","failed","cancelled"]),ll=iu({taskId:nI(),status:ls,ttl:im([n3(),it()]),createdAt:nI(),lastUpdatedAt:nI(),pollInterval:iE(n3()),statusMessage:iE(nI())}),lc=or.extend({task:ll}),lu=i8.merge(ll),ld=oe.extend({method:iR("notifications/tasks/status"),params:lu}),lp=i7.extend({method:iR("tasks/get"),params:i6.extend({taskId:nI()})}),lm=or.merge(ll),lh=i7.extend({method:iR("tasks/result"),params:i6.extend({taskId:nI()})}),lf=or.loose(),lg=oN.extend({method:iR("tasks/list")}),ly=oq.extend({tasks:il(ll)}),lv=i7.extend({method:iR("tasks/cancel"),params:i6.extend({taskId:nI()})}),l_=or.merge(ll),lb=im([oT,ow,oP,le,sE,sn,st,oF,oJ,oG,oX,oQ,o2,sw,sv]),lS=im([op,oC,ox,li]),l$=im([ou,sZ,sD,s6,ln]),lw=im([oT,sL,s9,la]),lR=im([op,oC,sj,o7,oY,sR,sh,o4,s3]),lk=im([ou,ok,oE,lt,sm,sr,oH,oB,oW,sb,s_,o6]),lx=r4(nU,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eZ}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lP=id({resource:nI().url(),authorization_servers:il(lx).optional(),jwks_uri:nI().url().optional(),scopes_supported:il(nI()).optional(),bearer_methods_supported:il(nI()).optional(),resource_signing_alg_values_supported:il(nI()).optional(),resource_name:nI().optional(),resource_documentation:nI().optional(),resource_policy_uri:nI().url().optional(),resource_tos_uri:nI().url().optional(),tls_client_certificate_bound_access_tokens:n8().optional(),authorization_details_types_supported:il(nI()).optional(),dpop_signing_alg_values_supported:il(nI()).optional(),dpop_bound_access_tokens_required:n8().optional()}),lE=id({issuer:nI(),authorization_endpoint:lx,token_endpoint:lx,registration_endpoint:lx.optional(),scopes_supported:il(nI()).optional(),response_types_supported:il(nI()),response_modes_supported:il(nI()).optional(),grant_types_supported:il(nI()).optional(),token_endpoint_auth_methods_supported:il(nI()).optional(),token_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),service_documentation:lx.optional(),revocation_endpoint:lx.optional(),revocation_endpoint_auth_methods_supported:il(nI()).optional(),revocation_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),introspection_endpoint:nI().optional(),introspection_endpoint_auth_methods_supported:il(nI()).optional(),introspection_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),code_challenge_methods_supported:il(nI()).optional(),client_id_metadata_document_supported:n8().optional(),authorization_response_iss_parameter_supported:n8().optional().catch(void 0),dpop_signing_alg_values_supported:il(nI()).optional()}),lT=id({issuer:nI(),authorization_endpoint:lx,token_endpoint:lx,userinfo_endpoint:lx.optional(),jwks_uri:lx,registration_endpoint:lx.optional(),scopes_supported:il(nI()).optional(),response_types_supported:il(nI()),response_modes_supported:il(nI()).optional(),grant_types_supported:il(nI()).optional(),acr_values_supported:il(nI()).optional(),subject_types_supported:il(nI()),id_token_signing_alg_values_supported:il(nI()),id_token_encryption_alg_values_supported:il(nI()).optional(),id_token_encryption_enc_values_supported:il(nI()).optional(),userinfo_signing_alg_values_supported:il(nI()).optional(),userinfo_encryption_alg_values_supported:il(nI()).optional(),userinfo_encryption_enc_values_supported:il(nI()).optional(),request_object_signing_alg_values_supported:il(nI()).optional(),request_object_encryption_alg_values_supported:il(nI()).optional(),request_object_encryption_enc_values_supported:il(nI()).optional(),token_endpoint_auth_methods_supported:il(nI()).optional(),token_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),display_values_supported:il(nI()).optional(),claim_types_supported:il(nI()).optional(),claims_supported:il(nI()).optional(),service_documentation:nI().optional(),claims_locales_supported:il(nI()).optional(),ui_locales_supported:il(nI()).optional(),claims_parameter_supported:n8().optional(),request_parameter_supported:n8().optional(),request_uri_parameter_supported:n8().optional(),require_request_uri_registration:n8().optional(),op_policy_uri:lx.optional(),op_tos_uri:lx.optional(),client_id_metadata_document_supported:n8().optional(),authorization_response_iss_parameter_supported:n8().optional().catch(void 0)}),lj=iu({...lT.shape,...lE.pick({code_challenge_methods_supported:!0}).shape}),lO=iu({access_token:nI(),id_token:nI().optional(),token_type:nI(),expires_in:new n4(r2({type:"number",coerce:!0,checks:[],...e_(void 0)})).optional(),scope:nI().optional(),refresh_token:nI().optional(),issuer:nI().optional().catch(void 0)}).strip(),lC=iu({issued_token_type:iR("urn:ietf:params:oauth:token-type:id-jag"),access_token:nI(),token_type:nI().optional(),expires_in:n3().optional(),scope:nI().optional()}).strip(),lI=iu({error:nI(),error_description:nI().optional(),error_uri:nI().optional()}),lN=lx.optional().or(iR("").transform(()=>void 0)),lq=iu({redirect_uris:il(lx),token_endpoint_auth_method:nI().optional(),grant_types:il(nI()).optional(),response_types:il(nI()).optional(),application_type:nI().optional(),client_name:nI().optional(),client_uri:lx.optional(),logo_uri:lN,scope:nI().optional(),contacts:il(nI()).optional(),tos_uri:lN,policy_uri:nI().optional(),jwks_uri:lx.optional(),jwks:new ir({type:"any"}).optional(),software_id:nI().optional(),software_version:nI().optional(),software_statement:nI().optional()}).strip(),lA=iu({client_id:nI(),client_secret:nI().optional(),client_id_issued_at:n3().optional(),client_secret_expires_at:n3().optional(),issuer:nI().optional().catch(void 0)}).strip(),lM=lq.merge(lA),lz=iu({error:nI(),error_description:nI().optional()}).strip(),lL=iu({token:nI(),token_type_hint:nI().optional()}).strip(),lZ=Symbol.for("mcp.sdk.errorBrands");function lD(t,r){let a=new Set,n=r;for(;"function"==typeof n;){let t=n.mcpBrand;Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&"string"==typeof t&&a.add(t),n=Object.getPrototypeOf(n)}0!==a.size&&Object.defineProperty(t,lZ,{value:a,enumerable:!1,configurable:!0})}function lU(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lZ)){let a=r[lZ];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let lV=((k={}).InvalidRequest="invalid_request",k.InvalidClient="invalid_client",k.InvalidGrant="invalid_grant",k.UnauthorizedClient="unauthorized_client",k.UnsupportedGrantType="unsupported_grant_type",k.InvalidScope="invalid_scope",k.AccessDenied="access_denied",k.ServerError="server_error",k.TemporarilyUnavailable="temporarily_unavailable",k.UnsupportedResponseType="unsupported_response_type",k.UnsupportedTokenType="unsupported_token_type",k.InvalidToken="invalid_token",k.MethodNotAllowed="method_not_allowed",k.TooManyRequests="too_many_requests",k.InvalidClientMetadata="invalid_client_metadata",k.InvalidRedirectUri="invalid_redirect_uri",k.InsufficientScope="insufficient_scope",k.InvalidTarget="invalid_target",k.InvalidDpopProof="invalid_dpop_proof",k.UseDpopNonce="use_dpop_nonce",k);var lF=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lD(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}};let lH=((x={}).NotConnected="NOT_CONNECTED",x.AlreadyConnected="ALREADY_CONNECTED",x.NotInitialized="NOT_INITIALIZED",x.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",x.RequestTimeout="REQUEST_TIMEOUT",x.ConnectionClosed="CONNECTION_CLOSED",x.SendFailed="SEND_FAILED",x.InvalidResult="INVALID_RESULT",x.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",x.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",x.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",x.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",x.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",x.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",x.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",x.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",x.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",x.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",x.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",x);var lJ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a,n){super(r,n),this.code=t,this.data=a,this.name="SdkError",lD(this,new.target)}};(class extends lJ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a,n){super(t,r,a,n),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lB={};function lK(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function lG(t,r){let a={};for(let[n,i]of Object.entries(t)){if(void 0===i)continue;let t=void 0===r?void 0:r[n];if(void 0===t){a[n]=i;continue}if(lK(i)&&lK(t)){let r={};for(let[a,o]of Object.entries(i))void 0!==o&&void 0===t[a]&&("elicitation"!==n||"form"!==a||void 0!==t.form||void 0!==t.url)&&(r[a]=o);Object.keys(r).length>0&&(a[n]=r)}}return Object.keys(a).length>0?a:void 0}let lW="2026-07-28",lY=[lW];function lX(t){return t.filter(t=>t>=lW)}function lQ(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let l0=["task","inputRequests","requestState"];function l1(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||l0.some(r=>r in t)?t:{...t,content:[]}}function l2(){let t,r,a,n,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w,R,k,x,P,E,T,j,O,C,I,N,q,A,M,z,L,Z,D,U,V,F,H,J,B,K,G,W,Y,X,Q,ee,et,er,ea,en,ei,eo,es,el,ec,eu,ed,ep,em,eh,ef,eg,ey,ev,e_,eb,eS,e$,ew,eR,ek,ex,eP,eE,eT,ej,eO,eC,eI,eN,eq,eA,eM,ez,eL,eZ,eD,eU,eV,eF,eH,eJ,eB,eK,eG,eW,eY,eX,eQ,e0,e1,e2,e9,e4,e3,e6,e5,e7,e8,te,tt,tr,ta,tn,ti,to,ts,tl,tc,tu,td,tp,tm,th,tf,tg,ty,tv,t_,tb,tS,t$,tw;return i??=(t=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),t),il(t)])),r=ib(nI(),t),a=im([nI(),n3().int()]),n=nI(),o=iu({ttl:n3().optional()}),s=iu({taskId:nI()}),u=(c=iu({_meta:(l=id({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:o.optional()}),d=iu({method:nI(),params:c.loose().optional()}),p=iu({_meta:l.optional()}),m=iu({method:nI(),params:p.loose().optional()}),h=id({_meta:l.optional()}),f=im([nI(),n3().int()]),g=h.strict(),y=p.extend({requestId:f.optional(),reason:nI().optional()}),v=m.extend({method:iR("notifications/cancelled"),params:y}),_=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),b=iu({icons:il(_).optional()}),$=(S=iu({name:nI(),title:nI().optional()})).extend({...S.shape,...b.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),w=iv(iu({applyDefaults:n8().optional()}),r),R=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:w.optional(),url:r.optional()}),r.optional())),k=id({list:r.optional(),cancel:r.optional(),requests:id({sampling:id({createMessage:r.optional()}).optional(),elicitation:id({create:r.optional()}).optional()}).optional()}),x=id({list:r.optional(),cancel:r.optional(),requests:id({tools:id({call:r.optional()}).optional()}).optional()}),P=iu({experimental:ib(nI(),r).optional(),sampling:iu({context:r.optional(),tools:r.optional()}).optional(),elicitation:R.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:k.optional(),extensions:ib(nI(),r).optional()}),E=c.extend({protocolVersion:nI(),capabilities:P,clientInfo:$}),T=d.extend({method:iR("initialize"),params:E}),j=iu({experimental:ib(nI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:x.optional(),extensions:ib(nI(),r).optional()}),O=h.extend({protocolVersion:nI(),capabilities:j,serverInfo:$,instructions:nI().optional()}),C=m.extend({method:iR("notifications/initialized"),params:p.optional()}),I=d.extend({method:iR("ping"),params:c.optional()}),N=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),q=iu({...p.shape,...N.shape,progressToken:a}),A=m.extend({method:iR("notifications/progress"),params:q}),M=c.extend({cursor:n.optional()}),z=d.extend({params:M.optional()}),L=h.extend({nextCursor:n.optional()}),D=(Z=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()})).extend({text:nI()}),U=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=Z.extend({blob:U}),H=iu({audience:il(F=i$(["user","assistant"])).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),J=iu({...S.shape,...b.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:H.optional(),_meta:iE(id({}))}),B=iu({...S.shape,...b.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:H.optional(),_meta:iE(id({}))}),K=z.extend({method:iR("resources/list")}),G=L.extend({resources:il(J)}),W=z.extend({method:iR("resources/templates/list")}),Y=L.extend({resourceTemplates:il(B)}),X=c.extend({uri:nI()}),Q=d.extend({method:iR("resources/read"),params:X}),ee=h.extend({contents:il(im([D,V]))}),et=m.extend({method:iR("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:iR("resources/subscribe"),params:X}),ea=d.extend({method:iR("resources/unsubscribe"),params:X}),en=p.extend({uri:nI()}),ei=m.extend({method:iR("notifications/resources/updated"),params:en}),eo=iu({name:nI(),description:iE(nI()),required:iE(n8())}),es=iu({...S.shape,...b.shape,description:iE(nI()),arguments:iE(il(eo)),_meta:iE(id({}))}),el=z.extend({method:iR("prompts/list")}),ec=L.extend({prompts:il(es)}),eu=c.extend({name:nI(),arguments:ib(nI(),nI()).optional()}),ed=d.extend({method:iR("prompts/get"),params:eu}),ep=iu({type:iR("text"),text:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),em=iu({type:iR("image"),data:U,mimeType:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),eh=iu({type:iR("audio"),data:U,mimeType:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),ef=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),eg=iu({type:iR("resource"),resource:im([D,V]),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),e_=iu({role:F,content:ev=im([ep,em,eh,ey=J.extend({type:iR("resource_link")}),eg])}),eb=h.extend({description:nI().optional(),messages:il(e_)}),eS=m.extend({method:iR("notifications/prompts/list_changed"),params:p.optional()}),e$=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),ew=iu({taskSupport:i$(["required","optional","forbidden"]).optional()}),eR=iu({...S.shape,...b.shape,description:nI().optional(),inputSchema:iu({type:iR("object"),properties:ib(nI(),t).optional(),required:il(nI()).optional()}).catchall(ii()),outputSchema:iu({type:iR("object"),properties:ib(nI(),t).optional(),required:il(nI()).optional()}).catchall(ii()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:ib(nI(),ii()).optional()}),ek=z.extend({method:iR("tools/list")}),ex=L.extend({tools:il(eR)}),eP=h.extend({content:il(ev),structuredContent:ib(nI(),ii()).optional(),isError:n8().optional()}),eE=u.extend({name:nI(),arguments:ib(nI(),ii()).optional()}),eT=d.extend({method:iR("tools/call"),params:eE}),ej=m.extend({method:iR("notifications/tools/list_changed"),params:p.optional()}),eO=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:eO}),eI=d.extend({method:iR("logging/setLevel"),params:eC}),eN=p.extend({level:eO,logger:nI().optional(),data:ii()}),eq=m.extend({method:iR("notifications/message"),params:eN}),eA=iu({name:nI().optional()}),eM=iu({hints:il(eA).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),ez=iu({mode:i$(["auto","required","none"]).optional()}),eL=iu({type:iR("tool_result"),toolUseId:nI().describe("The unique identifier for the corresponding tool call."),content:il(ev),structuredContent:iu({}).loose().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),eZ=ig("type",[ep,em,eh]),eU=iu({role:F,content:im([eD=ig("type",[ep,em,eh,ef,eL]),il(eD)]),_meta:ib(nI(),ii()).optional()}),eV=u.extend({messages:il(eU),modelPreferences:eM.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:r.optional(),tools:il(eR).optional(),toolChoice:ez.optional()}),eF=d.extend({method:iR("sampling/createMessage"),params:eV}),eH=h.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens"]).or(nI())),role:F,content:eZ}),eJ=h.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens","toolUse"]).or(nI())),role:F,content:im([eD,il(eD)])}),eB=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),eK=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),eG=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),eW=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),eY=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),eX=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),eQ=im([eW,eY]),e0=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),e2=im([e0,e1=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()})]),e9=im([eX,eQ,e2]),e4=im([e9,eB,eK,eG]),e3=u.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),e4),required:il(nI()).optional()}).catchall(ii())}),e5=im([e3,e6=u.extend({mode:iR("url"),message:nI(),elicitationId:nI(),url:nI().url()})]),e7=d.extend({method:iR("elicitation/create"),params:e5}),e8=p.extend({elicitationId:nI()}),te=m.extend({method:iR("notifications/elicitation/complete"),params:e8}),tt=h.extend({action:i$(["accept","decline","cancel"]),content:iV(t=>null===t?void 0:t,ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional())}),tr=iu({type:iR("ref/resource"),uri:nI()}),ta=iu({type:iR("ref/prompt"),name:nI()}),tn=c.extend({ref:im([ta,tr]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()}),ti=d.extend({method:iR("completion/complete"),params:tn}),to=h.extend({completion:id({values:il(nI()).max(100),total:iE(n3().int()),hasMore:iE(n8())})}),ts=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),tl=d.extend({method:iR("roots/list"),params:c.optional()}),tc=h.extend({roots:il(ts)}),tu=m.extend({method:iR("notifications/roots/list_changed"),params:p.optional()}),td=id({ttl:n3().optional(),pollInterval:n3().optional()}),tp=i$(["working","input_required","completed","failed","cancelled"]),tm=iu({taskId:nI(),status:tp,ttl:im([n3(),it()]),createdAt:nI(),lastUpdatedAt:nI(),pollInterval:iE(n3()),statusMessage:iE(nI())}),th=h.extend({task:tm}),tf=p.merge(tm),tg=m.extend({method:iR("notifications/tasks/status"),params:tf}),ty=d.extend({method:iR("tasks/get"),params:c.extend({taskId:nI()})}),tv=h.merge(tm),t_=d.extend({method:iR("tasks/result"),params:c.extend({taskId:nI()})}),tb=h.loose(),tS=z.extend({method:iR("tasks/list")}),t$=L.extend({tasks:il(tm)}),tw=d.extend({method:iR("tasks/cancel"),params:c.extend({taskId:nI()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:m,ResultSchema:h,RequestIdSchema:f,EmptyResultSchema:g,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:E,InitializeRequestSchema:T,ServerCapabilitiesSchema:j,InitializeResultSchema:O,InitializedNotificationSchema:C,PingRequestSchema:I,ProgressSchema:N,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:A,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:z,PaginatedResultSchema:L,ResourceContentsSchema:Z,TextResourceContentsSchema:D,BlobResourceContentsSchema:V,RoleSchema:F,AnnotationsSchema:H,ResourceSchema:J,ResourceTemplateSchema:B,ListResourcesRequestSchema:K,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:W,ListResourceTemplatesResultSchema:Y,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:en,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:eo,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:em,AudioContentSchema:eh,ToolUseContentSchema:ef,EmbeddedResourceSchema:eg,ResourceLinkSchema:ey,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:eR,ListToolsRequestSchema:ek,ListToolsResultSchema:ex,CallToolResultSchema:eP,CallToolRequestParamsSchema:eE,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:ej,LoggingLevelSchema:eO,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eI,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eq,ModelHintSchema:eA,ModelPreferencesSchema:eM,ToolChoiceSchema:ez,ToolResultContentSchema:eL,SamplingContentSchema:eZ,SamplingMessageContentBlockSchema:eD,SamplingMessageSchema:eU,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,CreateMessageResultSchema:eH,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eB,StringSchemaSchema:eK,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eW,TitledSingleSelectEnumSchemaSchema:eY,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e3,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e7,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:tn,CompleteRequestSchema:ti,CompleteResultSchema:to,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:tm,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:tg,GetTaskRequestSchema:ty,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tm),ClientRequestSchema:im([I,T,ti,eI,ed,el,K,W,Q,er,ea,eT,ek,ty,t_,tS,tw]),ClientNotificationSchema:im([v,A,C,tu,tg]),ClientResultSchema:im([g,eH,eJ,tt,tc,tv,t$,th]),ServerRequestSchema:im([I,eF,e7,tl,ty,t_,tS,tw]),ServerNotificationSchema:im([v,A,eq,ei,et,ej,eS,tg,te]),ServerResultSchema:im([g,O,to,eb,ec,G,Y,ee,eP,ex,tv,t$,th]),CallToolResultWireSchema:ii().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of l0)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(l1).pipe(eP)})}function l9(t){return"object"!==t.type}let l4=new Set(["const","enum","default","examples"]),l3=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l6(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l5={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},l7={"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},l8={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};function ce(){if(o)return o;let t=l2();return o={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function ct(t){return Object.prototype.hasOwnProperty.call(l5,t)}function cr(t){return Object.prototype.hasOwnProperty.call(l7,t)}function ca(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cn(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(l5),Object.keys(l7);let ci={ok:!1,reason:"not-in-era"};function co(t){return ca(t)&&ca(t.outputSchema)&&l9(t.outputSchema)}let cs={era:"2025-11-25",hasRequestMethod:ct,hasNotificationMethod:cr,validateRequest:(t,r)=>cn(ct(t)?ce().requestSchemas[t]:void 0,r),validateResult:(t,r)=>cn(Object.prototype.hasOwnProperty.call(l8,t)?ce().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>cn(cr(t)?ce().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ci,validateInputResponse:()=>ci,samplingResultVariant:(t,r)=>{let a=l2();return cn(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=lQ(t),n=a.structuredContent;if(void 0===n)return a;let i="object"!=typeof n||null===n||Array.isArray(n),o=void 0!==r&&l9(r);return i||o?{...a,structuredContent:{result:n}}:a},decodeResult(t,r){if(ca(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>co(t))?{...r,tools:a.map(t=>co(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(l6(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let n="string"==typeof(r=t.$schema)&&K.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,i=(t,r)=>{if(Array.isArray(t))return t.map(t=>i(t,!1));if(null===t||"object"!=typeof t||!r&&l6(t.$id))return t;let a={},o=!1;for(let[s,l]of Object.entries(t))r?a[s]=i(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&n?o=!0:l4.has(s)?a[s]=l:l3.has(s)?a[s]=i(l,!0):a[s]=i(l,!1);return o&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:i(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function cl(){return s??=function(){let t=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),t),il(t)])),r=ib(nI(),t),a=im([nI(),n3().int()]),n=nI(),i=im([nI(),n3().int()]),o=i$(["user","assistant"]),s=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),l=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=iu({ttl:n3().optional()}),u=iu({taskId:nI()}),d=id({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=iu({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=iu({_meta:d.optional()}),f=iu({method:nI(),params:h.loose().optional()}),g=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),y=iu({icons:il(g).optional()}),v=iu({name:nI(),title:nI().optional()}),_=v.extend({...v.shape,...y.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),b=iv(iu({applyDefaults:n8().optional()}),r),S=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:b.optional(),url:r.optional()}),r.optional())),$=id({list:r.optional(),cancel:r.optional(),requests:id({sampling:id({createMessage:r.optional()}).optional(),elicitation:id({create:r.optional()}).optional()}).optional()}),w=id({list:r.optional(),cancel:r.optional(),requests:id({tools:id({call:r.optional()}).optional()}).optional()}),R=iu({experimental:ib(nI(),r).optional(),sampling:iu({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:$.optional(),extensions:ib(nI(),r).optional()}),k=iu({experimental:ib(nI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:w.optional(),extensions:ib(nI(),r).optional()}),x=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),P=iu({...h.shape,...x.shape,progressToken:a}),E=f.extend({method:iR("notifications/progress"),params:P}),T=h.extend({level:s,logger:nI().optional(),data:ii()}),j=f.extend({method:iR("notifications/message"),params:T}),O=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()}),C=O.extend({text:nI()}),I=O.extend({blob:l}),N=iu({audience:il(o).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),q=iu({...v.shape,...y.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:N.optional(),_meta:iE(id({}))}),A=iu({...v.shape,...y.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:N.optional(),_meta:iE(id({}))}),M=f.extend({method:iR("notifications/resources/list_changed"),params:h.optional()}),z=h.extend({uri:nI()}),L=f.extend({method:iR("notifications/resources/updated"),params:z}),Z=iu({name:nI(),description:iE(nI()),required:iE(n8())}),D=iu({...v.shape,...y.shape,description:iE(nI()),arguments:iE(il(Z)),_meta:iE(id({}))}),U=f.extend({method:iR("notifications/prompts/list_changed"),params:h.optional()}),V=iu({type:iR("text"),text:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),F=iu({type:iR("image"),data:l,mimeType:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),H=iu({type:iR("audio"),data:l,mimeType:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),J=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),B=iu({type:iR("resource"),resource:im([C,I]),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),K=q.extend({type:iR("resource_link")}),G=im([V,F,H,K,B]),W=iu({role:o,content:G}),Y=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),X=f.extend({method:iR("notifications/tools/list_changed"),params:h.optional()}),Q=iu({name:nI().optional()}),ee=iu({hints:il(Q).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),et=iu({mode:i$(["auto","required","none"]).optional()}),er=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),ea=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),en=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),ei=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),eo=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),es=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),el=im([ei,eo]),ec=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),eu=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()}),ed=im([ec,eu]),ep=im([es,el,ed]),em=im([ep,er,ea,en]),eh=m.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),em),required:il(nI()).optional()}).catchall(ii())}),ef=iu({type:iR("ref/resource"),uri:nI()}),eg=iu({type:iR("ref/prompt"),name:nI()}),ey=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),ev=R.shape,e_=iu({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=k.shape,eS=iu({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),e$=id({progressToken:a.optional(),[iJ]:nI(),[iB]:_.optional(),[iG]:e_,[iY]:s.optional()}),ew=iu({...v.shape,...y.shape,description:nI().optional(),inputSchema:id({$schema:nI().optional(),type:iR("object")}),outputSchema:id({$schema:nI().optional()}).optional(),annotations:Y.optional(),_meta:ib(nI(),ii()).optional()}),eR=iu({type:iR("tool_result"),toolUseId:nI(),content:il(G),structuredContent:ii().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),ek=im([V,F,H,J,eR]),ex=iu({role:o,content:im([ek,il(ek)]),_meta:ib(nI(),ii()).optional()}),eP=nI(),eE=id({[iK]:_.optional().catch(void 0)}),eT=eE.optional();function ej(t){return id({_meta:eT,resultType:eP.default("complete"),...t})}let eO=ej({}),eC=ej({nextCursor:n.optional()}),eI=ej({content:il(G),structuredContent:ii().optional(),isError:n8().optional()}),eN=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),tools:il(ew),nextCursor:n.optional()}),eq=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),prompts:il(D),nextCursor:n.optional()}),eA=ej({description:nI().optional(),messages:il(W)}),eM=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resources:il(q),nextCursor:n.optional()}),ez=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resourceTemplates:il(A),nextCursor:n.optional()}),eL=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),contents:il(im([C,I]))}),eZ=ej({completion:iu({values:il(nI()).max(100),total:n3().int().optional(),hasMore:n8().optional()}).loose()}),eD=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"])}),eU=ej({ttlMs:n3().int().min(0).catch(0),cacheScope:i$(["public","private"]).catch("private"),supportedVersions:il(nI()),capabilities:eS,instructions:nI().optional()}),eV=iu({messages:il(ex),modelPreferences:ee.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:r.optional(),tools:il(ew).optional(),toolChoice:et.optional()}),eF=iu({method:iR("sampling/createMessage"),params:eV}),eH=iu({method:iR("roots/list"),params:iu({_meta:ib(nI(),ii()).optional()}).optional()}),eJ=iu({...ex.shape,model:nI(),stopReason:nI().optional()}),eB=iu({roots:il(ey)}),eK=iu({action:i$(["accept","decline","cancel"]),content:ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional()}),eG=iu({mode:iR("url"),message:nI(),url:nI().url()}),eW=im([eh,eG]),eY=iu({method:iR("elicitation/create"),params:eW}),eX=im([eF,eH,eY]),eQ=im([eJ,eB,eK]),e0=ib(nI(),eX),e1=ib(nI(),eQ),e2=ej({inputRequests:e0.optional(),requestState:nI().optional()}),e9={inputResponses:e1.optional(),requestState:nI().optional()},e4=iu({_meta:e$,...e9}),e3=id({progressToken:a.optional()});function e6(t,r){return iu({method:iR(t),params:iu({_meta:e$,...r})})}function e5(t,r){return iu({method:iR(t),params:iu({_meta:e3.optional(),...r}).optional()})}let e7={name:nI(),arguments:ib(nI(),ii()).optional(),...e9},e8={cursor:n.optional()},te=e6("tools/call",e7),tt=e6("tools/list",e8),tr=e6("prompts/list",e8),ta=e6("prompts/get",{name:nI(),arguments:ib(nI(),nI()).optional(),...e9}),tn=e6("resources/list",e8),ti=e6("resources/templates/list",e8),to=e6("resources/read",{uri:nI(),...e9}),ts={ref:im([eg,ef]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()},tl=e6("completion/complete",ts),tc=e6("server/discover",{}),tu=iu({toolsListChanged:n8().optional(),promptsListChanged:n8().optional(),resourcesListChanged:n8().optional(),resourceSubscriptions:il(nI()).optional()}),td={notifications:tu},tp=e6("subscriptions/listen",td),tm=eE.extend({"io.modelcontextprotocol/subscriptionId":i}),th=id({_meta:tm,resultType:eP.default("complete")}),tf={"tools/call":e5("tools/call",e7),"tools/list":e5("tools/list",e8),"prompts/get":e5("prompts/get",{name:nI(),arguments:ib(nI(),nI()).optional()}),"prompts/list":e5("prompts/list",e8),"resources/list":e5("resources/list",e8),"resources/templates/list":e5("resources/templates/list",e8),"resources/read":e5("resources/read",{uri:nI()}),"completion/complete":e5("completion/complete",ts),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",td)};function tg(t){return id({_meta:eT,...t})}let ty={"tools/call":tg({content:il(G),structuredContent:ii().optional(),isError:n8().optional()}),"tools/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),tools:il(ew),nextCursor:n.optional()}),"prompts/get":tg({description:nI().optional(),messages:il(W)}),"prompts/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),prompts:il(D),nextCursor:n.optional()}),"resources/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resources:il(q),nextCursor:n.optional()}),"resources/templates/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resourceTemplates:il(A),nextCursor:n.optional()}),"resources/read":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),contents:il(im([C,I]))}),"completion/complete":tg({completion:iu({values:il(nI()).max(100),total:n3().int().optional(),hasMore:n8().optional()}).loose()}),"server/discover":tg({ttlMs:n3().int().min(0).catch(0),cacheScope:i$(["public","private"]).catch("private"),supportedVersions:il(nI()),capabilities:eS,instructions:nI().optional()}),"subscriptions/listen":tg({})},tv=id({"io.modelcontextprotocol/subscriptionId":i.optional()}),t_=iu({method:iR("notifications/subscriptions/acknowledged"),params:iu({_meta:tv.optional(),notifications:tu})}),tb=iu({_meta:tv.optional(),requestId:i,reason:nI().optional()}),tS=iu({method:iR("notifications/cancelled"),params:tb}),t$=t=>iu({jsonrpc:iR("2.0"),id:im([nI(),n3().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,RequestIdSchema:i,RoleSchema:o,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:g,IconsSchema:y,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:R,ServerCapabilitiesSchema:k,ProgressSchema:x,ProgressNotificationParamsSchema:P,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:j,ResourceContentsSchema:O,TextResourceContentsSchema:C,BlobResourceContentsSchema:I,AnnotationsSchema:N,ResourceSchema:q,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:M,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:Z,PromptSchema:D,PromptListChangedNotificationSchema:U,TextContentSchema:V,ImageContentSchema:F,AudioContentSchema:H,ToolUseContentSchema:J,EmbeddedResourceSchema:B,ResourceLinkSchema:K,ContentBlockSchema:G,PromptMessageSchema:W,ToolAnnotationsSchema:Y,ToolListChangedNotificationSchema:X,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:en,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:eo,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:eg,RootSchema:ey,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:eR,SamplingMessageContentBlockSchema:ek,SamplingMessageSchema:ex,ResultTypeSchema:eP,ResultMetaSchema:eE,ResultSchema:eO,PaginatedResultSchema:eC,CallToolResultSchema:eI,ListToolsResultSchema:eN,ListPromptsResultSchema:eq,GetPromptResultSchema:eA,ListResourcesResultSchema:eM,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eL,CompleteResultSchema:eZ,CacheableResultSchema:eD,DiscoverResultSchema:eU,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,ListRootsRequestSchema:eH,CreateMessageResultSchema:eJ,ListRootsResultSchema:eB,ElicitResultSchema:eK,ElicitRequestURLParamsSchema:eG,ElicitRequestParamsSchema:eW,ElicitRequestSchema:eY,InputRequestSchema:eX,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:tn,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:to,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tf,dispatchResultSchemas:ty,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":E,"notifications/message":j,"notifications/resources/updated":L,"notifications/resources/list_changed":M,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":U,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:t$(eO),CallToolResultResponseSchema:t$(im([eI,e2])),ListToolsResultResponseSchema:t$(eN),ListPromptsResultResponseSchema:t$(eq),GetPromptResultResponseSchema:t$(im([eA,e2])),ListResourcesResultResponseSchema:t$(eM),ListResourceTemplatesResultResponseSchema:t$(ez),ReadResourceResultResponseSchema:t$(im([eL,e2])),CompleteResultResponseSchema:t$(eZ),DiscoverResultResponseSchema:t$(eU),SubscriptionsListenResultResponseSchema:t$(th)}}()}let cc=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],cu=Symbol("modelcontextprotocol.resultCacheHintFallback");function cd(t,r){if(void 0===r)return t;let a=t[cu];if(void 0===a)return{...t,[cu]:r};let n={},i=a.ttlMs??r.ttlMs;void 0!==i&&(n.ttlMs=i);let o=a.cacheScope??r.cacheScope;return void 0!==o&&(n.cacheScope=o),{...t,[cu]:n}}function cp(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cm(t){return"public"===t||"private"===t}function ch(t,r){if(void 0!==t.ttlMs&&!cp(t.ttlMs))throw RangeError(`Invalid cache hint for ${r}: ttlMs must be a non-negative safe integer (got ${String(t.ttlMs)})`);if(void 0!==t.cacheScope&&!cm(t.cacheScope))throw RangeError(`Invalid cache hint for ${r}: cacheScope must be 'public' or 'private' (got ${String(t.cacheScope)})`)}let cf=((P={})[P.ParseError=-32700]="ParseError",P[P.InvalidRequest=-32600]="InvalidRequest",P[P.MethodNotFound=-32601]="MethodNotFound",P[P.InvalidParams=-32602]="InvalidParams",P[P.InternalError=-32603]="InternalError",P[P.ResourceNotFound=-32002]="ResourceNotFound",P[P.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",P[P.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",P[P.UrlElicitationRequired=-32042]="UrlElicitationRequired",P);var cg=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lD(this,new.target)}static fromError(r,a,n){return r===cf.UrlElicitationRequired&&n&&n.elicitations?new cv(n.elicitations,a):r===cf.UnsupportedProtocolVersion&&n&&Array.isArray(n.supported)&&"string"==typeof n.requested?new c_({supported:n.supported,requested:n.requested},a):(r===cf.InvalidParams||r===cf.ResourceNotFound)&&"string"==typeof n?.uri&&(r===cf.ResourceNotFound||1===Object.keys(n).length)?new cy(n.uri,a):r===cf.MissingRequiredClientCapability&&n&&null!==n.requiredCapabilities&&"object"==typeof n.requiredCapabilities&&!Array.isArray(n.requiredCapabilities)?new cb({requiredCapabilities:n.requiredCapabilities},a):new t(r,a,n)}},cy=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cf.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cv=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cf.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},c_=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cf.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},cb=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cf.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cS=["tools/call","prompts/get","resources/read"],c$=["elicitation/create","sampling/createMessage","roots/list"];function cw(){if(l)return l;let t=cl();return l={request:{"elicitation/create":iu({method:iR("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":iu({method:iR("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":iu({method:iR("roots/list"),params:id({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cR(t){return c$.includes(t)}function ck(t){return cR(t)?cw().request[t]:void 0}let cx={"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},cP={"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 cE(t){return Object.prototype.hasOwnProperty.call(cx,t)}function cT(t){return Object.prototype.hasOwnProperty.call(cP,t)}function cj(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cO(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(cx),Object.keys(cP);let cC={ok:!1,reason:"not-in-era"},cI=[iJ,iG],cN={era:"2026-07-28",hasRequestMethod:cE,hasNotificationMethod:cT,hasInputRequestMethod:t=>void 0!==ck(t),validateRequest:(t,r)=>cO(cE(t)?cl().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>cO(Object.prototype.hasOwnProperty.call(cx,t)?cl().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>cO(cT(t)?cl().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>cO(ck(t),r),validateInputResponse:(t,r)=>cO(cR(t)?cw().response[t]:void 0,r),samplingResultVariant:()=>cC,outboundEnvelope:t=>({[iJ]:t.protocolVersion,[iB]:t.clientInfo,[iG]:t.clientCapabilities,...void 0!==t.logLevel&&{[iY]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of cI)a in t||r.push({key:a,problem:"missing"});let a=cl().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),n=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===n&&"missing"===t.problem)||r.push({key:n,problem:t.message})}return r},projectCallToolResult:t=>lQ(t),inputRequestSchema:ck,decodeResult(t,r){if(!cj(r))return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,n=cj(a)?a:{},i=r.requestState,o=void 0===r._meta?void 0:cl().ResultMetaSchema.safeParse(r._meta),s=o?.success?o.data:void 0;return 0===Object.keys(n).length&&"string"!=typeof i?{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:n,..."string"==typeof i&&{requestState:i},...void 0!==s&&{_meta:s}}}if("complete"!==a)return{kind:"invalid",error:new lJ(lH.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let n=function(){if(c)return c;let t=cl();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),i=Object.hasOwn(n,t)?n[t]:void 0;if(void 0!==i){let a=i.safeParse(r);if(!a.success)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let o={...r};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[iK]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[iK]?t:{...t,_meta:{...a,[iK]:r}}})(function(t,r){var a,n;let i=r[cu];if("complete"!==r.resultType||!cc.includes(t)){let t;return void 0===i?r:(t={...r},delete t[cu],t)}let o=cp(r.ttlMs)?r.ttlMs:void 0!==(a=i)&&cp(a.ttlMs)?a.ttlMs:0,s=cm(r.cacheScope)?r.cacheScope:void 0!==(n=i)&&cm(n.cacheScope)?n.cacheScope:"private",l={...r,ttlMs:o,cacheScope:s};return delete l[cu],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||cS.includes(t))return r;throw new cg(cf.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,n=!1,i=()=>(n||(a={...a},n=!0),a),o=r.tools;"tools/list"===t&&Array.isArray(o)&&o.some(t=>cj(t)&&"execution"in t)&&(i().tools=o.map(t=>{if(!cj(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(cj(s)&&"tasks"in s){let t={...s};delete t.tasks,i().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=cl().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cq="2026-07-28";function cA(t){return void 0!==t&&t>=lW?cN:cs}function cM(t){return void 0!==t.revision?cA(t.revision).era:"modern"===t.era?cN.era:cs.era}function cz(t){return cD.some(r=>r.hasRequestMethod(t))}function cL(t){return cD.some(r=>r.hasNotificationMethod(t))}function cZ(t){return"tasks/get"===t||"tasks/cancel"===t}let cD=[cs,cN];function cU(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cV(t){if(!cU(t))return;let r=t._meta;return cU(r)?r:void 0}function cF(t){let r=cV(t);return void 0!==r&&iJ in r}function cH(t){let r=cV(t)?.[iJ];return"string"==typeof r?r:void 0}function cJ(t){return cA(cq).validateEnvelopeMeta(t)}var cB=((t,r)=>{let a={};for(var n in t)Z(a,n,{get:t[n],enumerable:!0});return r&&Z(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>oD,AudioContentSchema:()=>ss,BaseMetadataSchema:()=>of,BaseRequestParamsSchema:()=>i6,BlobResourceContentsSchema:()=>oL,BooleanSchemaSchema:()=>sU,CallToolRequestParamsSchema:()=>s$,CallToolRequestSchema:()=>sw,CallToolResultSchema:()=>sb,CancelTaskRequestSchema:()=>lv,CancelTaskResultSchema:()=>l_,CancelledNotificationParamsSchema:()=>od,CancelledNotificationSchema:()=>op,ClientCapabilitiesSchema:()=>oS,ClientNotificationSchema:()=>lS,ClientRequestSchema:()=>lb,ClientResultSchema:()=>l$,ClientTasksCapabilitySchema:()=>o_,CompatibilityCallToolResultSchema:()=>sS,CompleteRequestParamsSchema:()=>s8,CompleteRequestSchema:()=>le,CompleteResultSchema:()=>lt,ContentBlockSchema:()=>sd,CreateMessageRequestParamsSchema:()=>sz,CreateMessageRequestSchema:()=>sL,CreateMessageResultSchema:()=>sZ,CreateMessageResultWithToolsSchema:()=>sD,CreateTaskResultSchema:()=>lc,CursorSchema:()=>i2,DiscoverRequestSchema:()=>oP,DiscoverResultSchema:()=>oE,ElicitRequestFormParamsSchema:()=>s0,ElicitRequestParamsSchema:()=>s2,ElicitRequestSchema:()=>s9,ElicitRequestURLParamsSchema:()=>s1,ElicitResultSchema:()=>s6,ElicitationCompleteNotificationParamsSchema:()=>s4,ElicitationCompleteNotificationSchema:()=>s3,EmbeddedResourceSchema:()=>sc,EmptyResultSchema:()=>ou,EnumSchemaSchema:()=>sX,GetPromptRequestParamsSchema:()=>sa,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>sm,GetTaskPayloadRequestSchema:()=>lh,GetTaskPayloadResultSchema:()=>lf,GetTaskRequestSchema:()=>lp,GetTaskResultSchema:()=>lm,IconSchema:()=>om,IconsSchema:()=>oh,ImageContentSchema:()=>so,ImplementationSchema:()=>og,InitializeRequestParamsSchema:()=>o$,InitializeRequestSchema:()=>ow,InitializeResultSchema:()=>ok,InitializedNotificationSchema:()=>ox,JSONArraySchema:()=>i0,JSONObjectSchema:()=>iQ,JSONRPCErrorResponseSchema:()=>os,JSONRPCMessageSchema:()=>ol,JSONRPCNotificationSchema:()=>oi,JSONRPCRequestSchema:()=>on,JSONRPCResponseSchema:()=>oc,JSONRPCResultResponseSchema:()=>oo,JSONValueSchema:()=>iX,LegacyTitledEnumSchemaSchema:()=>sB,ListChangedOptionsBaseSchema:()=>sk,ListPromptsRequestSchema:()=>st,ListPromptsResultSchema:()=>sr,ListResourceTemplatesRequestSchema:()=>oJ,ListResourceTemplatesResultSchema:()=>oB,ListResourcesRequestSchema:()=>oF,ListResourcesResultSchema:()=>oH,ListRootsRequestSchema:()=>la,ListRootsResultSchema:()=>ln,ListTasksRequestSchema:()=>lg,ListTasksResultSchema:()=>ly,ListToolsRequestSchema:()=>sv,ListToolsResultSchema:()=>s_,LoggingLevelSchema:()=>sx,LoggingMessageNotificationParamsSchema:()=>sT,LoggingMessageNotificationSchema:()=>sj,ModelHintSchema:()=>sO,ModelPreferencesSchema:()=>sC,MultiSelectEnumSchemaSchema:()=>sY,NotificationSchema:()=>oe,NotificationsParamsSchema:()=>i8,NumberSchemaSchema:()=>sF,PaginatedRequestParamsSchema:()=>oI,PaginatedRequestSchema:()=>oN,PaginatedResultSchema:()=>oq,PingRequestSchema:()=>oT,PrimitiveSchemaDefinitionSchema:()=>sQ,ProgressNotificationParamsSchema:()=>oO,ProgressNotificationSchema:()=>oC,ProgressSchema:()=>oj,ProgressTokenSchema:()=>i1,PromptArgumentSchema:()=>o8,PromptListChangedNotificationSchema:()=>sh,PromptMessageSchema:()=>sp,PromptReferenceSchema:()=>s7,PromptSchema:()=>se,ReadResourceRequestParamsSchema:()=>oK,ReadResourceRequestSchema:()=>oG,ReadResourceResultSchema:()=>oW,RelatedTaskMetadataSchema:()=>i4,RequestIdSchema:()=>oa,RequestMetaSchema:()=>i3,RequestSchema:()=>i7,ResourceContentsSchema:()=>oA,ResourceLinkSchema:()=>su,ResourceListChangedNotificationSchema:()=>oY,ResourceRequestParamsSchema:()=>oK,ResourceSchema:()=>oU,ResourceTemplateReferenceSchema:()=>s5,ResourceTemplateSchema:()=>oV,ResourceUpdatedNotificationParamsSchema:()=>o5,ResourceUpdatedNotificationSchema:()=>o7,ResultMetaObjectSchema:()=>ot,ResultSchema:()=>or,RoleSchema:()=>oZ,RootSchema:()=>lr,RootsListChangedNotificationSchema:()=>li,SamplingContentSchema:()=>sq,SamplingMessageContentBlockSchema:()=>sA,SamplingMessageSchema:()=>sM,ServerCapabilitiesSchema:()=>oR,ServerNotificationSchema:()=>lR,ServerRequestSchema:()=>lw,ServerResultSchema:()=>lk,ServerTasksCapabilitySchema:()=>ob,SetLevelRequestParamsSchema:()=>sP,SetLevelRequestSchema:()=>sE,SingleSelectEnumSchemaSchema:()=>sK,StringSchemaSchema:()=>sV,SubscribeRequestParamsSchema:()=>oK,SubscribeRequestSchema:()=>oX,SubscriptionFilterSchema:()=>o0,SubscriptionsAcknowledgedNotificationParamsSchema:()=>o9,SubscriptionsAcknowledgedNotificationSchema:()=>o4,SubscriptionsListenRequestParamsSchema:()=>o1,SubscriptionsListenRequestSchema:()=>o2,SubscriptionsListenResultMetaSchema:()=>o3,SubscriptionsListenResultSchema:()=>o6,TaskAugmentedRequestParamsSchema:()=>i5,TaskCreationParamsSchema:()=>lo,TaskMetadataSchema:()=>i9,TaskSchema:()=>ll,TaskStatusNotificationParamsSchema:()=>lu,TaskStatusNotificationSchema:()=>ld,TaskStatusSchema:()=>ls,TextContentSchema:()=>si,TextResourceContentsSchema:()=>oM,TitledMultiSelectEnumSchemaSchema:()=>sW,TitledSingleSelectEnumSchemaSchema:()=>sJ,ToolAnnotationsSchema:()=>sf,ToolChoiceSchema:()=>sI,ToolExecutionSchema:()=>sg,ToolListChangedNotificationSchema:()=>sR,ToolResultContentSchema:()=>sN,ToolSchema:()=>sy,ToolUseContentSchema:()=>sl,UnsubscribeRequestParamsSchema:()=>oK,UnsubscribeRequestSchema:()=>oQ,UntitledMultiSelectEnumSchemaSchema:()=>sG,UntitledSingleSelectEnumSchemaSchema:()=>sH});let cK=t=>on.safeParse(t).success,cG=t=>oi.safeParse(t).success,cW=t=>oo.safeParse(t).success,cY=t=>os.safeParse(t).success,cX=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cQ="x-mcp-header",c0=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,c1=new Set(["string","integer","boolean","number"]);function c2(t){let r=[],a=new Map,n=(t,i,o)=>{if(null===t||"object"!=typeof t)return;if(cQ in t){if(!o||0===i.length)return`${c3(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 n=t[cQ];if("string"!=typeof n||0===n.length)return`${c3(i)}: x-mcp-header MUST be a non-empty string`;if(!c0.test(n))return`${c3(i)}: x-mcp-header '${n}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!c1.has(s))return`${c3(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=n.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${n}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,n),r.push({path:i,headerName:n,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=n(r,[...i,t],o);if(void 0!==a)return a}for(let r of c9){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&c4.has(r)?Object.values(a):[a]){let a=n(t,[...i,`<${r}>`],!1);if(void 0!==a)return a}}},i=n(t,[],!0);return void 0===i?{valid:!0,declarations:r}:{valid:!1,reason:i}}let c9=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],c4=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function c3(t){return 0===t.length?"<root>":t.join(".")}let c6=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c5=/^-?\d+(\.\d+)?$/;function c7(t){if(!(t.startsWith("=?base64?")&&t.endsWith("?=")))return t;let r=t.slice(9,t.length-2);if(c6.test(r))try{let t=atob(r),a=new Uint8Array(t.length);for(let r=0;r<t.length;r++)a[r]=t.codePointAt(r);return new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{return}}function c8(t,r,a){return{kind:"reject",rung:"param-header-validation",cell:t,httpStatus:400,code:ue,message:`Bad Request: the request headers and body disagree: ${a}`,data:{mismatch:{header:r,body:a}},settled:!0}}let ue=-32020;cf.InvalidRequest,cf.UnsupportedProtocolVersion,cf.InvalidParams,cf.MethodNotFound,cf.InvalidParams,cf.MissingRequiredClientCapability;let ut={[cf.ParseError]:400,[cf.InvalidRequest]:400,[cf.MethodNotFound]:404,[cf.UnsupportedProtocolVersion]:400,[cf.MissingRequiredClientCapability]:400,[ue]:400};function ur(t,r,a,n,i){return{kind:"reject",rung:t,cell:r,httpStatus:a,code:n.code,message:n.message,...void 0!==n.data&&{data:n.data},settled:i}}function ua(t,r,a,n="era-classification"){return ur(n,t,400,new cg(ue,`Bad Request: the request headers and body disagree: ${a}`,{mismatch:{header:r,body:a}}),!0)}let un={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function ui(t){let r=0;for(;r<t.length;){let a=t.codePointAt(r);if(9!==a&&32!==a)break;r+=1}let a=t.length;for(;a>r;){let r=t.codePointAt(a-1);if(9!==r&&32!==r)break;a-=1}return 0===r&&a===t.length?t:t.slice(r,a)}function uo(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function us(t){return void 0===t?{era:"modern"}:{era:t>=lW?"modern":"legacy",revision:t}}function ul(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function uc(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let uu=!1,ud="draft-2020-12";function up(t,r="input"){let a,n=t["~standard"];if(n.jsonSchema)a=n.jsonSchema[r]({target:ud});else if("zod"===n.vendor){if(!("_zod"in t))throw 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().");uu||(uu=!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.")),a=a8(t,{target:ud,io:r})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let n=r[a];if(Array.isArray(n)&&n.length>0)return n.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}async function um(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let uh=/\\\.\\d\{(\d+)\}/;function uf(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ug=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function uy(t){return ug.has(t)||t.startsWith("x-")}let uv=new Set(["$schema",...Object.keys(s0.shape.requestedSchema.shape)]),u_={string:ul([sV,sH,sJ,sB]),number:ul([sF]),integer:ul([sF]),boolean:ul([sU]),array:ul([sG,sW])},ub=new Set(sV.shape.format.unwrap().options);Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw 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",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!uc(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,n=function(t,r){let a={},n=[];for(let[i,o]of Object.entries(t))"properties"===i&&uf(o)?a[i]=Object.fromEntries(Object.entries(o).map(([t,a])=>[t,function(t,r,a,n){if(!uf(t))return t;let i="string"==typeof t.type&&Object.hasOwn(u_,t.type)?u_[t.type]:void 0;if(void 0===i)return t;let o={};for(let[l,c]of Object.entries(t))if(i.has(l)||uy(l))o[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(ub.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[r9(nL,void 0)];break;case"uri":a=[r4(nU,void 0)];break;case"date":a=[r6(nA,void 0)];break;case"date-time":let n,i;n=uh.exec(r),i=[void 0,-1,0],n&&i.push(Number(n[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(a=>r3(nq,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=a8(t,{target:ud,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||n.push(`${r}.${l}`)}else o[l]=c;else n.push(`${r}.${l}`);return o}(a,`properties.${t}`,r,n)])):uv.has(i)?a[i]=o:uy(i)||n.push(i);if(n.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return a}(function(t){try{return up(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cg(cf.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=s0.shape.requestedSchema,n_(r,n));if(!i.success)throw new cg(cf.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!uf(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!n_(sQ,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(n,i.error.message)}`);let o=function t(r,a,n=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,i)=>t(r,a[i],`${n}[${i}]`)):uf(r)&&uf(a)?Object.entries(r).flatMap(([r,i])=>{let o=n?`${n}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(i,a[r],o):uy(r)?[]:[o]}):[]}(n,i.data);if(o.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(i.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(i.data.properties,t));if(s.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}(t)}}catch(t){throw t instanceof cg?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let uS={},u$={};function uw(t,r){let a=t.slice(0,-6);uS[a]=r,u$[a]=t=>r.safeParse(t).success}for(let t of["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"])uw(t,cB[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lC,OAuthClientInformationFullSchema:lM,OAuthClientInformationSchema:lA,OAuthClientMetadataSchema:lq,OAuthClientRegistrationErrorSchema:lz,OAuthErrorResponseSchema:lI,OAuthMetadataSchema:lE,OAuthProtectedResourceMetadataSchema:lP,OAuthTokenRevocationRequestSchema:lL,OAuthTokensSchema:lO,OpenIdProviderDiscoveryMetadataSchema:lj,OpenIdProviderMetadataSchema:lT}))uw(t,r);let uR=Object.freeze(uS);Object.freeze(u$);let uk=[iJ,iB,iG,iY],ux=["inputResponses","requestState"];function uP(t,r){let a=t.params;if(!uC(a))return{message:t,lifted:{}};let n=a._meta,i=uC(n)?uk.filter(t=>t in n):[],o="request"===r?ux.filter(t=>t in a):[];if(0===i.length&&0===o.length)return{message:t,lifted:{}};let s={},l={...a};if(i.length>0&&uC(n)){let t={},r={...n};for(let a of i)t[a]=n[a],delete r[a];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of o)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function uE(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let n=t.validateResult(r,a);return n.ok?{value:n.value}:{issues:[{message:"invalid"===n.reason?n.message:`not-in-era: ${r}`}]}}}}}let uT=(E=void 0,()=>E);function uj(t,r){return{...t,mcpReq:{...t.mcpReq,requestState:()=>r}}}var uO=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{u=(t,r)=>{t._negotiatedProtocolVersion=r}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??iH,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lJ(lH.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){void 0!==t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,n,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lJ(lH.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let n=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{n?.(t,r),cW(t)||cY(t)?this._onresponse(t):cK(t)?this._onrequest(t,r):cG(t)?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new lJ(lH.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=uP(t,"notification"),n=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cM(r.classification);if(t!==n.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${n.era}`))}if(cL(a.method)&&!n.hasNotificationMethod(a.method))return;let i=this._notificationHandlers.get(a.method),o=this.fallbackNotificationHandler;(void 0!==i||void 0!==o)&&Promise.resolve().then(()=>void 0===i?o(a):i(a,n)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:n,lifted:i}=uP(t,"request"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,a)=>{let i={jsonrpc:"2.0",id:n.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(i).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cM(r.classification);if(t!==o.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${t} but this instance serves ${o.era}`));let a=r.classification.revision??t;l(cf.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(cz(n.method)&&!o.hasRequestMethod(n.method)&&!(cZ(n.method)&&this._customSchemaRequestMethods.has(n.method)))return void l(cf.MethodNotFound,"Method not found");let c=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cf.MethodNotFound,"Method not found");let u=o.checkInboundEnvelope(i);if(void 0!==u)return void l(cf.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:n.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:n.id}),m=new AbortController;this._requestHandlerAbortControllers.set(n.id,m);let h=void 0===i.inputResponses?void 0:function(t){let r={},a=[];if(!uI(t))return{accepted:r,droppedKeys:a};for(let[n,i]of Object.entries(t)){if(!uI(i)||"method"in i||"result"in i){a.push(n);continue}r[n]=i}return{accepted:r,droppedKeys:a}}(i.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===i.requestState?uT:(a=i.requestState,()=>a),signal:m.signal,send:(t,r,a)=>{let n=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(n,t.method),uc(r))return p(t,r,a);let i=uE(n,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,i,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},g=this.buildContext(f,r);Promise.resolve().then(()=>c(n,g)).then(async t=>{let r;if(m.signal.aborted)return;try{r=o.encodeResult(n.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${n.method}: ${t}`)),l(cf.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:n.id};await s?.send(a)},async t=>{if(m.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cf.InternalError,a={jsonrpc:"2.0",id:n.id,error:{code:o.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===m&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,n=Number(r),i=this._progressHandlers.get(n);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let o=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(t){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),o(t);return}i(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(cW(t)?t:cg.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let n=this._resolveOutboundCodec(t.method);if(uc(r))return cZ(t.method)||this._assertOutboundRequestInEra(n,t.method),this._requestWithSchemaViaCodec(n,t,r,a);this._assertOutboundRequestInEra(n,t.method);let i=uE(n,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,t,i,r)}_negotiatedWireCodec(){return cA(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cA(void 0);case"server/discover":return cA(cq);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cz(r)&&!t.hasRequestMethod(r))throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let n=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(n,t.method),this._requestWithSchemaViaCodec(n,t,r,a)}_requestWithSchemaViaCodec(t,r,a,n){let i,o,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=n??{},d=Date.now();return new Promise((p,m)=>{let h=t=>{m(t)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){h(t);return}if(n?.signal?.aborted){let t=n.signal.reason;throw t instanceof lJ?t:new lJ(lH.RequestTimeout,String(t))}let f=t.era===cq&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,g=this._requestMessageId++;o=g;let y={...r,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),y.params={...r.params,_meta:{...r.params?._meta,progressToken:g}});let v=this._envelopeOutbound(y),_=!1,b=t=>{_||(this._progressHandlers.delete(g),void 0===f?"initialize"!==r.method&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),m(t instanceof lJ?t:new lJ(lH.RequestTimeout,String(t))))};this._responseHandlers.set(g,i=>{let o;if(!n?.signal?.aborted){if(_=!0,i instanceof Error)return m(i);try{o=t.decodeResult(r.method,i.result)}catch(t){return m(t instanceof Error?t:Error(String(t)))}if("invalid"===o.kind)return m(o.error);if("input_required"===o.kind){var s;return n?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=o).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState},...void 0!==s._meta&&{_meta:s._meta}}):p(this._resolveNonCompleteResult(o,{codec:t,request:r,resultSchema:a,options:n,flowStartedAt:d,retry:(n,i)=>this._requestWithSchemaViaCodec(t,void 0===n?{method:r.method}:{method:r.method,params:n},a,i)}))}um(a,o.result).then(t=>{t.success?p(t.data):m(new lJ(lH.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},m)}}),i=()=>b(n?.signal?.reason),n?.signal?.addEventListener("abort",i,{once:!0});let S=n?.timeout??6e4;this._setupTimeout(g,S,n?.maxTotalTimeout,()=>b(new lJ(lH.RequestTimeout,"Request timed out",{timeout:S})),n?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(g),m(t)})}).finally(()=>{i&&n?.signal?.removeEventListener("abort",i),void 0!==o&&(this._responseHandlers.delete(o),this._cleanupTimeout(o))})}async notification(t,r){return await this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,a){if(!this._transport)throw new lJ(lH.NotConnected,"Not connected");if(cL(r.method)&&!t.hasNotificationMethod(r.method))throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let n=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&a?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(n,a).catch(t=>this._onerror(t))});return}await this._transport.send(n,a)}setRequestHandler(t,r,a){let n;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cz(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(a,n)=>{let i=this._negotiatedWireCodec(),o=i.validateRequest(t,a);if(o.ok||"not-in-era"!==o.reason||(o=i.validateInputRequest(t,a)),!o.ok){if("not-in-era"===o.reason)throw new cg(cf.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(o.message)}return Promise.resolve(r(o.value,n))}}else if(a)n=async(n,i)=>{let o=await um(r.params,{...n.params});if(!o.success)throw new cg(cf.InvalidParams,`Invalid params for ${t}: ${o.error}`);return a(o.data,i)};else throw TypeError("setRequestHandler: handler is required");"function"==typeof r?this._customSchemaRequestMethods.delete(t):this._customSchemaRequestMethods.add(t),this._requestHandlers.set(t,this._wrapHandler(t,n))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!cL(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,n)=>{let i=n.validateNotification(t,a);if(!i.ok){if("not-in-era"===i.reason)throw new cg(cf.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(i.message)}return Promise.resolve(r(i.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async n=>{let i=await um(r.params,{...n.params});if(!i.success)throw new cg(cf.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await a(i.data,n)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function uC(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function uI(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}var uN=J(H(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var o,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!n.test(d))throw TypeError("invalid media type");var p=new i(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,o=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(a,"$1")),p.parameters[o]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1);function uq(t){if(t)try{return uN.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}function uA(t){return"application/json"===t||"application/json"===uq(t)}let uM=/^[A-Za-z0-9._-]{1,128}$/;function uz(t){let r=function(t){let r=[];if(0===t.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&r.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&r.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&r.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&r.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!uM.test(t)){let a=[...t].filter(t=>!/[A-Za-z0-9._-]/.test(t)).filter((t,r,a)=>a.indexOf(t)===r);return r.push(`Tool name contains invalid characters: ${a.map(t=>`"${t}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:r}}return{isValid:!0,warnings:r}}(t);var a=r.warnings;if(a.length>0){for(let r of(console.warn(`Tool name validation warning for "${t}":`),a))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.")}return r.isValid}var uL=class t{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,a){if(t.length>r)throw Error(`${a} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>"string"==typeof t?[]:t.names)}constructor(r){t.validateLength(r,1e6,"Template"),this.template=r,this.parts=this.parse(r)}toString(){return this.template}parse(r){let a=[],n="",i=0,o=0;for(;i<r.length;)if("{"===r[i]){n&&(a.push(n),n="");let s=r.indexOf("}",i);if(-1===s)throw Error("Unclosed template expression");if(++o>1e4)throw Error("Template contains too many expressions (max 10000)");let l=r.slice(i+1,s),c=this.getOperator(l),u=l.includes("*"),d=this.getNames(l),p=d[0];for(let r of d)t.validateLength(r,1e6,"Variable name");a.push({name:p,operator:c,names:d,exploded:u}),i=s+1}else n+=r[i],i++;return n&&a.push(n),a}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(r,a){return(t.validateLength(r,1e6,"Variable value"),"+"===a||"#"===a)?encodeURI(r):encodeURIComponent(r)}expandPart(t,r){if("?"===t.operator||"&"===t.operator){let a=t.names.map(a=>{let n=r[a];return void 0===n?"":`${a}=${Array.isArray(n)?n.map(r=>this.encodeValue(r,t.operator)).join(","):this.encodeValue(n.toString(),t.operator)}`}).filter(t=>t.length>0);return 0===a.length?"":("?"===t.operator?"?":"&")+a.join("&")}if(t.names.length>1){let a=t.names.map(t=>r[t]).filter(t=>void 0!==t);return 0===a.length?"":a.map(t=>Array.isArray(t)?t[0]:t).join(",")}let a=r[t.name];if(void 0===a)return"";let n=(Array.isArray(a)?a:[a]).map(r=>this.encodeValue(r,t.operator));switch(t.operator){case"":case"+":default:return n.join(",");case"#":return"#"+n.join(",");case".":return"."+n.join(".");case"/":return"/"+n.join("/")}}expand(t){let r="",a=!1;for(let n of this.parts){if("string"==typeof n){r+=n;continue}let i=this.expandPart(n,t);i&&(r+=("?"===n.operator||"&"===n.operator)&&a?i.replace("?","&"):i,("?"===n.operator||"&"===n.operator)&&(a=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(r){let a,n=[];for(let a of r.names)t.validateLength(a,1e6,"Variable name");if("?"===r.operator||"&"===r.operator){for(let t=0;t<r.names.length;t++){let a=r.names[t],i=0===t?"\\"+r.operator:"&";n.push({pattern:i+this.escapeRegExp(a)+"=([^&]+)",name:a})}return n}let i=r.name;switch(r.operator){case"":a=r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":a="(.+)";break;case".":a=String.raw`\.([^/,]+)`;break;case"/":a="/"+(r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:a="([^/]+)"}return n.push({pattern:a,name:i}),n}match(r){t.validateLength(r,1e6,"URI");let a="^",n=[];for(let t of this.parts)if("string"==typeof t)a+=this.escapeRegExp(t);else for(let{pattern:r,name:i}of this.partToRegExp(t))a+=r,n.push({name:i,exploded:t.exploded});a+="$",t.validateLength(a,1e6,"Generated regex pattern");let i=new RegExp(a),o=r.match(i);if(!o)return null;let s={};for(let[t,r]of n.entries()){let{name:a,exploded:n}=r,i=o[t+1];s[a.replace("*","")]=n&&i.includes(",")?i.split(","):i}return s}};function uZ(t){if(void 0!==t){if(function(t){if("object"!=typeof t||null===t||uc(t))return!1;let r=Object.getPrototypeOf(t);return(r===Object.prototype||null===r)&&Object.values(t).every(t=>"object"==typeof t&&null!==t&&"_zod"in t)}(t))return iu(t);if("object"==typeof t&&null!==t&&!uc(t)&&Object.values(t).some(t=>"object"==typeof t&&null!==t&&!("_zod"in t)&&"_def"in t&&"string"==typeof t._def?.typeName))throw 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(!uc(t))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return t}}var uD=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var n=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function i(t,...r){let a=[t[0]],o=0;for(;o<r.length;)l(a,r[o]),a.push(t[++o]);return new n(a)}t._Code=n,t.nil=new n(""),t._=i;let o=new n("+");function s(t,...r){let i=[c(t[0])],u=0;for(;u<r.length;)i.push(o),l(i,r[u]),i.push(o,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===o){var n,i;let o=(n=t[r-1],'""'===(i=t[r+1])?n:'""'===n?i:"string"==typeof n?i instanceof a||'"'!==n[n.length-1]?void 0:"string"!=typeof i?`${n.slice(0,-1)}${i}"`:'"'===i[0]?n.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||n instanceof a?void 0:`"${n}${i.slice(1)}`);if(void 0!==o){t.splice(r-1,3,o);continue}t[r++]="+"}r++}}(i),new n(i)}function l(t,r){var i;r instanceof n?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(i=r)||"boolean"==typeof i||null===i?i:c(Array.isArray(i)?i.join(","):i))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new n(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new n(`.${r}`):i`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new n(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new n(t.toString())}}),uU=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uD();var a,n,i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=n||(t.UsedValueState=n={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=o;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:n}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${n}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:i}=n,o=null!=(a=r.key)?a:r.ref,s=this._values[i];if(s){let t=s.get(o);if(t)return t}else s=this._values[i]=new Map;s.set(o,n);let l=this._scope[i]||(this._scope[i]=[]),c=l.length;return l[c]=r.ref,n.setValue(r,{property:i,itemIndex:c}),n}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,o,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,n.Started);let s=o(a);if(s){let n=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${n} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new i(a);p.set(a,n.Completed)})}return c}};t.ValueScope=c}),uV=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=uD(),a=uU();var n=uD();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var i=uU();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var o=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends o{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let n=t?a.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends o{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,t,a),this}get names(){return j(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,n){super(t,a,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends o{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},m=class extends o{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=O(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},h=class extends o{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,n=a.length;for(;n--;){let i=a[n];i.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,i.names),a.splice(n,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(t,r.names),{})}},f=class extends h{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},g=class extends h{},y=class extends f{};y.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new y(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=O(this.condition,t,r),this}get names(){let t=super.names;return j(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=O(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,a,n){super(),this.varKind=t,this.name=r,this.from=a,this.to=n}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){return j(j(super.names,this.from),this.to)}},$=class extends _{constructor(t,r,a,n){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=O(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},w=class extends f{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};w.kind="func";var R=class extends h{render(t){return"return "+super.render(t)}};R.kind="return";var k=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var a,n;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(n=this.finally)||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},x=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};x.kind="catch";var P=class extends f{render(t){return"finally"+super.render(t)}};P.kind="finally";var E=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new a.Scope({parent:t}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,n){let i=this._scope.toName(r);return void 0!==a&&n&&(this._constants[i.str]=a),this._leafNode(new s(t,i,a)),i}const(t,r,n){return this._def(a.varKinds.const,t,r,n)}let(t,r,n){return this._def(a.varKinds.let,t,r,n)}var(t,r,n){return this._def(a.varKinds.var,t,r,n)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new m(t)),this}object(...t){let a=["{"];for(let[n,i]of t)a.length>1&&a.push(","),a.push(n),(n!==i||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,i));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(v,y)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,n,i,o=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(o,s,r,n),()=>i(s))}forOf(t,n,i,o=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=n instanceof r.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),i(s)})}return this._for(new $("of",o,s,n),()=>i(s))}forIn(t,n,i,o=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${n})`,i);let s=this._scope.toName(t);return this._for(new $("in",o,s,n),()=>i(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new R;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(R)}try(t,r,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new k;if(this._blockNode(n),this.code(t),r){let t=this.name("e");this._currNode=n.catch=new x(t),r(t)}return a&&(this._currNode=n.finally=new P,this.code(a)),this._endBlockNode(x,P)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,n,i){return this._blockNode(new w(t,a,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function j(t,a){return a instanceof r._CodeOrName?T(t,a.names):t}function O(t,a,n){var i;if(t instanceof r.Name)return o(t);if(!((i=t)instanceof r._Code&&i._items.some(t=>t instanceof r.Name&&1===a[t.str]&&void 0!==n[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=o(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function o(t){let r=n[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${A(t)}`}t.CodeGen=E,t.not=C;let I=q(t.operators.AND);t.and=function(...t){return t.reduce(I)};let N=q(t.operators.OR);function q(t){return(a,n)=>a===r.nil?n:n===r.nil?a:(0,r._)`${A(a)} ${t} ${A(n)}`}function A(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(N)}}),uF=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let n=uV(),i=uD();function o(t,r=t.schema){let{opts:a,self:n}=t;if(!a.strictSchema||"boolean"==typeof r)return;let i=n.RULES.keywords;for(let a in r)i[a]||h(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:i}){return(o,s,l,c)=>{let u=void 0===l?s:l instanceof n.Name?(s instanceof n.Name?t(o,s,l):r(o,s,l),l):s instanceof n.Name?(r(o,l,s),s):a(s,l);return c!==n.Name||u instanceof n.Name?u:i(o,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,n._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,n._)`${r}${(0,n.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(o(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,i,o){if(!o){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,n._)`${a}`}return(0,n._)`${t}${r}${(0,n.getProperty)(i)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,n._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,n._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,n._)`${a} || {}`).code((0,n._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,n._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,n._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,n._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,n._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,n._)`${a} !== true`,()=>t.assign(a,!0===r||(0,n._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let m={};function h(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:m[r.code]||(m[r.code]=new i._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,i){if(t instanceof n.Name){let o=a===r.Num;return i?o?(0,n._)`"[" + ${t} + "]"`:(0,n._)`"['" + ${t} + "']"`:o?(0,n._)`"/" + ${t}`:(0,n._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,n.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=h}),uH=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),uJ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uV(),a=uF(),n=uH();function i(t,a){let i=t.const("err",a);t.if((0,r._)`${n.default.vErrors} === null`,()=>t.assign(n.default.vErrors,(0,r._)`[${i}]`),(0,r._)`${n.default.vErrors}.push(${i})`),t.code((0,r._)`${n.default.errors}++`)}function o(t,a){let{gen:n,validateName:i,schemaEnv:o}=t;o.$async?n.throw((0,r._)`new ${t.ValidationError}(${a})`):(n.assign((0,r._)`${i}.errors`,a),n.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,n=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:m}=u,h=l(a,n,s);(null!=c?c:p||m)?i(d,h):o(u,(0,r._)`[${h}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,a,s)),d||p||o(c,n.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(n.default.errors,a),t.if((0,r._)`${n.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${n.default.vErrors}.length`,a),()=>t.assign(n.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,schemaValue:i,data:o,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,n.default.errors,s=>{t.const(c,(0,r._)`${n.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(n.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,i),t.assign((0,r._)`${c}.data`,o))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,i,o){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,i,o={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:i}){let o=i?(0,r.str)`${t}${(0,a.getErrorPath)(i,a.Type.Str)}`:t;return[n.default.instancePath,(0,r.strConcat)(n.default.instancePath,o)]}(c,o),function({keyword:t,it:{errSchemaPath:n}},{schemaPath:i,parentSchema:o}){let l=o?n:(0,r.str)`${n}/${t}`;return i&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(i,a.Type.Str)}`),[s.schemaPath,l]}(t,o)];return function(t,{params:a,message:i},o){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:m,topSchemaRef:h,schemaPath:f}=d;o.push([s.keyword,l],[s.params,"function"==typeof a?a(t):a||(0,r._)`{}`]),p.messages&&o.push([s.message,"function"==typeof i?i(t):i]),p.verbose&&o.push([s.schema,u],[s.parentSchema,(0,r._)`${h}${f}`],[n.default.data,c]),m&&o.push([s.propertyName,m])}(t,i,u),l.object(...u)}(t,i,o)}}),uB=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uJ(),a=uV(),n=uH(),i={message:"boolean schema is false"};function o(t,a){let{gen:n,data:o}=t;(0,r.reportError)({gen:n,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:s}=t;!1===i?o(t,!1):"object"==typeof i&&!0===i.$async?r.return(n.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:n}=t;!1===n?(a.var(r,!1),o(t)):a.var(r,!0)}}),uK=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),uG=H(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},n){let i=a.RULES.types[n];return i&&!0!==i&&r(t,i)},t.shouldUseGroup=r,t.shouldUseRule=a}),uW=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let n=uK(),i=uG(),o=uJ(),s=uV(),l=uF();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(n.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var n,o;let{gen:l,data:c,opts:d}=t,m=(n=a,(o=d.coerceTypes)?n.filter(t=>u.has(t)||"array"===o&&"array"===t):[]),f=a.length>0&&!(0===m.length&&1===a.length&&(0,i.schemaHasRulesForType)(t,a[0]));if(f){let n=p(a,c,d.strictNumbers,r.Wrong);l.if(n,()=>{m.length?function(t,r,a){let{gen:n,data:i,opts:o}=t,l=n.let("dataType",(0,s._)`typeof ${i}`),c=n.let("coerced",(0,s._)`undefined`);for(let t of("array"===o.coerceTypes&&n.if((0,s._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,s._)`${i}[0]`).assign(l,(0,s._)`typeof ${i}`).if(p(r,i,o.strictNumbers),()=>n.assign(c,i))),n.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===o.coerceTypes)&&function(t){switch(t){case"string":n.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(c,(0,s._)`""`);return;case"number":n.elseIf((0,s._)`${l} == "boolean" || ${i} === null
|
|
56
|
-
|| (${
|
|
57
|
-
|| (${
|
|
58
|
-
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,s._)`[${i}]`)}}(t);n.else(),h(t),n.endIf(),n.if((0,s._)`${c} !== undefined`,()=>{n.assign(i,c),function({gen:t,parentData:r,parentDataProperty:a},n){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,n))}(t,c)})}(t,a,m):h(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,n,i=r.Correct){let o,l=i===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":o=(0,s._)`Array.isArray(${a})`;break;case"object":o=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":o=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":o=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return i===r.Correct?o:(0,s.not)(o);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,n?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,n){let i;if(1===t.length)return d(t[0],r,a,n);let o=(0,l.toHash)(t);if(o.array&&o.object){let t=(0,s._)`typeof ${r} != "object"`;i=o.null?t:(0,s._)`!${r} || ${t}`,delete o.null,delete o.array,delete o.object}else i=s.nil;for(let t in o.number&&delete o.integer,o)i=(0,s.and)(i,d(t,r,a,n));return i}t.checkDataType=d,t.checkDataTypes=p;let m={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function h(t){let r=function(t){let{gen:r,data:a,schema:n}=t,i=(0,l.schemaRefOrVal)(t,n,"type");return{gen:r,keyword:"type",data:a,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}(t);(0,o.reportError)(r,m)}t.reportTypeError=h}),uY=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uV(),a=uF();function n(t,n,i){let{gen:o,compositeRule:s,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(n)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),o.if(d,(0,r._)`${u} = ${(0,r.stringify)(i)}`)}t.assignDefaults=function(t,r){let{properties:a,items:i}=t.schema;if("object"===r&&a)for(let r in a)n(t,r,a[r].default);else"array"===r&&Array.isArray(i)&&i.forEach((r,a)=>n(t,a,r.default))}}),uX=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=uV(),a=uF(),n=uH(),i=uF();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,n){return(0,r._)`${o(t)}.call(${a}, ${n})`}function l(t,a,n,i){let o=(0,r._)`${a}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(o,(0,r.not)(s(t,a,n))):o}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:n,data:i,it:o}=t;n.if(l(n,i,a,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:n}},i,o){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,a,i,n.ownProperties),(0,r._)`${o} = ${i}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=o,t.isOwnProperty=s,t.propertyInData=function(t,a,n,i){let o=(0,r._)`${a}${(0,r.getProperty)(n)} !== undefined`;return i?(0,r._)`${o} && ${s(t,a,n)}`:o},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(n=>!(0,a.alwaysValidSchema)(t,r[n]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:i,topSchemaRef:o,schemaPath:s,errorPath:l},it:c},u,d,p){let m=p?(0,r._)`${t}, ${a}, ${o}${s}`:a,h=[[n.default.instancePath,(0,r.strConcat)(n.default.instancePath,l)],[n.default.parentData,c.parentData],[n.default.parentDataProperty,c.parentDataProperty],[n.default.rootData,n.default.rootData]];c.opts.dynamicRef&&h.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let f=(0,r._)`${m}, ${i.object(...h)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:a}},n){let o=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(n,o);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,i.useFunc)(t,s)}(${n}, ${o})`})},t.validateArray=function(t){let{gen:n,data:i,keyword:o,it:s}=t,l=n.name("valid");if(s.allErrors){let t=n.let("valid",!0);return c(()=>n.assign(t,!1)),t}return n.var(l,!0),c(()=>n.break()),l;function c(s){let c=n.const("len",(0,r._)`${i}.length`);n.forRange("i",0,c,i=>{t.subschema({keyword:o,dataProp:i,dataPropType:a.Type.Num},l),n.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:n,schema:i,keyword:o,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=n.let("valid",!1),c=n.name("_valid");n.block(()=>i.forEach((a,i)=>{let s=t.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);n.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||n.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uQ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uV(),a=uH(),n=uX(),i=uJ();function o(t){let{gen:a,data:n,it:i}=t;a.if(i.parentData,()=>a.assign(n,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function s(t,a,n){if(void 0===n)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,r.stringify)(n)})}t.macroKeywordCode=function(t,a){let{gen:n,keyword:i,schema:o,parentSchema:l,it:c}=t,u=a.macro.call(c.self,o,l,c),d=s(n,i,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=n.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${i}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:m,$data:h,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let g=s(u,d,!h&&l.compile?l.compile.call(f.self,p,m,f):l.validate),y=u.let("valid");function v(i=l.async?(0,r._)`await `:r.nil){let o=f.opts.passContext?a.default.this:a.default.self,s=!("compile"in l&&!h||!1===l.schema);u.assign(y,(0,r._)`${i}${(0,n.callValidateCode)(t,g,o,s)}`,l.modifying)}function _(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:y),t)}t.block$data(y,function(){if(!1===l.errors)v(),l.modifying&&o(t),_(()=>t.error());else{let n,s,c=l.async?(n=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(y,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(n,(0,r._)`${t}.errors`),()=>u.throw(t))),n):(s=(0,r._)`${g}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&o(t),_(()=>(function(t,n){let{gen:o}=t;o.if((0,r._)`Array.isArray(${n})`,()=>{o.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${n} : ${a.default.vErrors}.concat(${n})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,i.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:y)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw Error("ajv implementation error");let s=i.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let t=`keyword "${o}" value is invalid at path "${n}": `+a.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),u0=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uV(),a=uF();t.getSubschema=function(t,{keyword:n,schemaProp:i,schema:o,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==n&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){let o=t.schema[n];return void 0===i?{schema:o,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${n}`}:{schema:o[i],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(n)}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${n}/${(0,a.escapeFragment)(i)}`}}if(void 0!==o){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,n,{dataProp:i,dataPropType:o,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=n;if(void 0!==i){let{errorPath:s,dataPathArr:l,opts:c}=n;d(u.let("data",(0,r._)`${n.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(i,o,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${i}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=n.dataLevel+1,t.dataTypes=[],n.definedProperties=new Set,t.parentData=n.data,t.dataNames=[...n.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(t.compositeRule=n),void 0!==i&&(t.createErrors=i),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=r,t.jtdMetadata=a}}),u1=H((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((n=r.length)!=a.length)return!1;for(i=n;0!=i--;)if(!t(r[i],a[i]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((n=(o=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,o[i]))return!1;for(i=n;0!=i--;){var n,i,o,s=o[i];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),u2=H((t,r)=>{var a=r.exports=function(t,r,n){"function"==typeof r&&(n=r,r={});var i="function"==typeof(n=r.cb||n)?n:n.pre||function(){};!function t(r,n,i,o,s,l,c,u,d,p){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var m in n(o,s,l,c,u,d,p),o){var h=o[m];if(Array.isArray(h)){if(m in a.arrayKeywords)for(var f=0;f<h.length;f++)t(r,n,i,h[f],s+"/"+m+"/"+f,l,s,m,o,f)}else if(m in a.propsKeywords){if(h&&"object"==typeof h)for(var g in h)t(r,n,i,h[g],s+"/"+m+"/"+g.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,m,o,g)}else(m in a.keywords||r.allKeys&&!(m in a.skipKeywords))&&t(r,n,i,h,s+"/"+m,l,s,m,o)}i(o,s,l,c,u,d,p)}}(r,i,n.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.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}}),u9=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uF(),a=u1(),n=u2(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(o.has(a))return!0;let n=r[a];if(Array.isArray(n)&&n.some(t)||"object"==typeof n&&t(n))return!0}return!1}(t):!!a&&function t(a){let n=0;for(let o in a)if("$ref"===o||(n++,!i.has(o)&&("object"==typeof a[o]&&(0,r.eachItem)(a[o],r=>n+=t(r)),n===1/0)))return 1/0;return n}(t)<=a)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:i,uriResolver:o}=this.opts,l=u(t[i]||r),c={"":l},p=s(o,l,!1),m={},h=new Set;return n(t,{allKeys:!0},(t,r,a,n)=>{if(void 0===n)return;let o=p+r,s=c[n];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),h.has(r))throw g(r);h.add(r);let n=this.refs[r];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(t,n.schema,r):r!==u(o)&&("#"===r[0]?(f(t,m[r],r),m[r]=t):this.refs[r]=o),r}function y(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[i]&&(s=l.call(this,t[i])),y.call(this,t.$anchor),y.call(this,t.$dynamicAnchor),c[r]=s}),m;function f(t,r,n){if(void 0!==r&&!a(t,r))throw g(n)}function g(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),u4=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uB(),a=uW(),n=uG(),i=uW(),o=uY(),s=uQ(),l=u0(),c=uV(),u=uH(),d=u9(),p=uF(),m=uJ();function h({gen:t,validateName:r,schema:a,schemaEnv:n,opts:i},o){var s;i.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,n.$async,()=>{var r,n;t.code((0,c._)`"use strict"; ${f(a,i)}`),r=t,n=i,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),n.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),n.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(o)}):t.func(r,(0,c._)`${u.default.data}, ${(s=i,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,n.$async,()=>t.code(f(a,i)).code(o))}function f(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function g({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function y(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:n,self:i}=t;r.$ref&&n.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let n=(0,a.getSchemaTypes)(t.schema);S(t,n,!(0,a.coerceAndCheckDataType)(t,n),r)}function b({gen:t,schemaEnv:r,schema:a,errSchemaPath:n,opts:i}){let o=a.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){let a=(0,c.str)`${n}/$comment`,i=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`)}}function S(t,r,a,o){var s,l,d,m;let{gen:h,schema:f,data:g,allErrors:y,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void h.block(()=>x(t,"$ref",b.all.$ref.definition));function S(s){(0,n.shouldUseGroup)(f,s)&&(s.type?(h.if((0,i.checkDataType)(s.type,g,v.strictNumbers)),$(t,s),1===r.length&&r[0]===s.type&&a&&(h.else(),(0,i.reportTypeError)(t)),h.endIf()):$(t,s),y||h.if((0,c._)`${u.default.errors} === ${o||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(t.dataTypes,r)||R(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let a=[];for(let n of t.dataTypes)w(r,n)?a.push(n):r.includes("integer")&&"number"===n&&a.push("integer");t.dataTypes=a}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(m=l).length>1&&!(2===m.length&&m.includes("null"))&&R(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let a=t.self.RULES.all;for(let i in a){let o=a[i];if("object"==typeof o&&(0,n.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(t=>{var a,n;return a=r,n=t,a.includes(n)||"number"===n&&a.includes("integer")})&&R(t,`missing type "${a.join(",")}" for keyword "${i}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function $(t,r){let{gen:a,schema:i,opts:{useDefaults:s}}=t;s&&(0,o.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,n.shouldUseRule)(i,a)&&x(t,a.keyword,a.definition,r.type)})}function w(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function R(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){y(t)&&(v(t),g(t))?function(t){let{schema:r,opts:a,gen:n}=t;h(t,()=>{a.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),n.let(u.default.vErrors,null),n.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:a,validateName:n,ValidationError:i,opts:o}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${i}(${u.default.vErrors})`)):(r.assign((0,c._)`${n}.errors`,u.default.vErrors),o.unevaluated&&function({gen:t,evaluated:r,props:a,items:n}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),n instanceof c.Name&&t.assign((0,c._)`${r}.items`,n)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):h(t,()=>(0,r.topBoolOrEmptySchema)(t))};var k=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?m.reportExtraError:m.reportError)(this,this.def.error,r)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:n,schemaType:i,def:o}=this;a.if((0,c.or)((0,c._)`${n} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(i.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:n,it:o}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,i.checkDataTypes)(t,r,o.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}(),function(){if(n.validateSchema){let a=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let n=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(n,this.it,t),(0,l.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return!function(t,a){if(y(t)&&(v(t),g(t)))return function(t,r){var a;let n,{schema:i,gen:o,opts:s}=t;s.$comment&&i.$comment&&b(t),(n=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,n)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=o.const("_errs",u.default.errors);_(t,l),o.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(i,a),i}mergeEvaluated(t,r){let{it:a,gen:n}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(n,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(n,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:n}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return n.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function x(t,r,a,n){let i=new k(t,a,r);"code"in a?a.code(i,n):i.$data&&a.validate?(0,s.funcKeywordCode)(i,a):"macro"in a?(0,s.macroKeywordCode)(i,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(i,a)}t.KeywordCxt=k;let P=/^\/(?:[^~]|~0|~1)*$/,E=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:a,dataPathArr:n}){let i,o;if(""===t)return u.default.rootData;if("/"===t[0]){if(!P.test(t))throw Error(`Invalid JSON-pointer: ${t}`);i=t,o=u.default.rootData}else{let s=E.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(i=s[2])){if(c>=r)throw Error(l("property/index",c));return n[r-c]}if(c>r)throw Error(l("data",c));if(o=a[r-c],!i)return o}let s=o;for(let t of i.split("/"))t&&(o=(0,c._)`${o}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${o}`);return s;function l(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=T}),u3=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),u6=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u9();t.default=class extends Error{constructor(t,a,n,i){super(i||`can't resolve reference ${n} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,n),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),u5=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uV(),a=u3(),n=uH(),i=u9(),o=uF(),s=u4();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,i.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let o,l,c=d.call(this,t);if(c)return c;let u=(0,i.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:m}=this.opts.code,{ownProperties:h}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:m,ownProperties:h});t.$async&&(o=f.scopeValue("Error",{ref:a.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let g=f.scopeName("validate");t.validateName=g;let y={gen:f,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:g,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(y),f.optimize(this.opts.code.optimize);let a=f.toString();l=`${f.scopeRefs(n.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let i=Function(`${n.default.self}`,`${n.default.scope}`,l)(this,this.scope.get());if(this.scope.value(g,{ref:i}),i.errors=null,i.schema=t.schema,i.schemaEnv=t,t.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:g,validateCode:a,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:a}=y;i.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},i.source&&(i.source.evaluated=(0,r.stringify)(i.evaluated))}return t.validate=i,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,i.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let n of this._compilations){var r,a;if(r=n,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return n}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||m.call(this,t,r)}function m(t,r){let a=this.opts.uriResolver.parse(r),n=(0,i._getFullPath)(this.opts.uriResolver,a),o=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return f.call(this,a,t);let s=(0,i.normalizeId)(n),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=m.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,n=r[a];return n&&(o=(0,i.resolveUrl)(this.opts.uriResolver,o,n)),new l({schema:r,schemaId:a,root:t,baseId:o})}return f.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var n;a=(0,i.resolveUrl)(this.opts.uriResolver,r,a);let o=t.refs[a];if(o)return o;let s=p.call(this,t,a);if(void 0===s){let i=null==(n=t.localRefs)?void 0:n[a],{schemaId:o}=this.opts;i&&(s=new l({schema:i,schemaId:o,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=m;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:a,root:n}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let n of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,o.unescapeFragment)(n)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!h.has(n)&&s&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,o.schemaHasRulesButRef)(a,this.RULES)){let t=(0,i.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=m.call(this,n,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:n,baseId:r})).schema!==c.root.schema)return c}}),u7=H((t,r)=>{r.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}}),u8=H((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=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 i(t){let r="",a=0,n=0;for(n=0;n<t.length;n++)if(48!==(a=t[n].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[n];break}for(n+=1;n<t.length;n++){if(!((a=t[n].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[n]}return r}function o(t){return t.length=0,!0}function s(t,r,a){if(t.length){let n=i(t);if(""===n)return a.error=!0,!1;r.push(n),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},n=[],l=[],c=!1,u=!1,d=s;for(let i=0;i<t.length;i++){let s=t[i];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,n,a))break;if(++r>7){a.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),n.push(":");continue}else if("%"===s){if(!d(l,n,a))break;d=o}else{l.push(s);continue}}return l.length&&(d===o?a.zone=l.join(""):u?n.push(l.join("")):n.push(i(l))),a.address=n.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!n(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],n=-1,i=0;for(;i=r.length;){if(1===i)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===i){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===i&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(n=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,n)),r=r.slice(n)}return a.join("")},isIPv4:n,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:i}}),de=H((t,r)=>{let{isUUID:a}=u8(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function o(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=o(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(o(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},m={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let a=t.path.match(n);if(a){let n=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let i=h(`${n}:${r.nid||t.nid}`);t.path=void 0,i&&(t=i.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=h(`${a}:${r.nid||n}`);i&&(t=i.serialize(t,r));let o=t,s=t.nss;return o.path=`${n||r.nid}:${s}`,r.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function h(t){return t&&(m[t]||m[t.toLowerCase()])||void 0}Object.setPrototypeOf(m,null),r.exports={wsIsSecure:o,SCHEMES:m,isValidSchemeName:function(t){return -1!==i.indexOf(t)},getSchemeHandler:h}}),dt=H((t,r)=>{let{normalizeIPv6:a,removeDotSegments:n,recomposeAuthority:i,normalizeComponentEncoding:o,isIPv4:s,nonSimpleDomain:l}=u8(),{SCHEMES:c,getSchemeHandler:u}=de();function d(t,r,a,i){let o={};return i||(t=h(p(t,a),a),r=h(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=n(r.path||""),o.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=n(r.path||""),o.query=r.query):(r.path?("/"===r.path[0]?o.path=n(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=n(o.path)),o.query=r.query):(o.path=t.path,void 0!==r.query?o.query=r.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=r.fragment,o}function p(t,r){let a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},r),s=[],l=u(o.scheme||a.scheme);l&&l.serialize&&l.serialize(a,o),void 0!==a.path&&(o.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==o.reference&&a.scheme&&s.push(a.scheme,":");let c=i(a);if(void 0!==c&&("suffix"!==o.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;o.absolutePath||l&&l.absolutePath||(t=n(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){let n=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;"suffix"===n.reference&&(t=n.scheme?n.scheme+":"+t:"//"+t);let c=t.match(m);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||"",i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(!1===s(i.host)){let t=a(i.host);i.host=t.host.toLowerCase(),o=t.isIPV6}else o=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==i.reference&&(i.error=i.error||"URI is not a "+n.reference+" reference.");let r=u(n.scheme||i.scheme);if(!n.unicodeSupport&&(!r||!r.unicodeSupport)&&i.host&&(n.domainHost||r&&r.domainHost)&&!1===o&&l(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(t){i.error=i.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),r&&r.parse&&r.parse(i,n)}else i.error=i.error||"URI can not be parsed.";return i}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(h(t,r),r):"object"==typeof t&&(t=h(p(t,r),r)),t},resolve:function(t,r,a){let n=a?Object.assign({scheme:"null"},a):{scheme:"null"},i=d(h(t,n),h(r,n),n,!0);return n.skipEscape=!0,p(i,n)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(o(h(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(o(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(o(h(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(o(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:h};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),dr=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),da=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let n=u3(),i=u6(),o=uK(),s=u5(),l=uV(),c=u9(),u=uW(),d=uF(),p=u7(),m=dr(),h=(t,r)=>new RegExp(t,r);h.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,n,i,o,s,l,c,u,d,p,f,g,y,v,_,b,S,$,w,R,k,x,P,E;let T=t.strict,j=null==(r=t.code)?void 0:r.optimize,O=!0===j||void 0===j?1:j||0,C=null!=(n=null==(a=t.code)?void 0:a.regExp)?n:h,I=null!=(i=t.uriResolver)?i:m.default;return{strictSchema:null==(s=null!=(o=t.strictSchema)?o:T)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:T)?f:"log",strictRequired:null!=(y=null!=(g=t.strictRequired)?g:T)&&y,code:t.code?{...t.code,optimize:O,regExp:C}:{optimize:O,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(R=t.addUsedSchema)||R,validateSchema:null==(k=t.validateSchema)||k,validateFormats:null==(x=t.validateFormats)||x,unicodeRegExp:null==(P=t.unicodeRegExp)||P,int32range:null==(E=t.int32range)||E,uriResolver:I}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:g,es5:r,lines:a}),this.logger=function(t){if(!1===t)return x;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,y,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=k.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&R.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,n=p;"id"===a&&((n={...p}).id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let n=a(r);return"$async"in a||(this.errors=a.errors),n}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return n.call(this,t,r);async function n(t,r){await o.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function o(t){t&&!this.getSchema(t)&&await n.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof i.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await o.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,n=this.opts.validateSchema){let i;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,n);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(i=t[r])&&"string"!=typeof i)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,n,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(a,t);if(!n&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return n}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,n=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,n,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(E.call(this,a,r),!r)return(0,d.eachItem)(a,t=>T.call(this,t)),this;O.call(this,r);let n={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===n.type.length?t=>T.call(this,t,n):t=>n.type.forEach(r=>T.call(this,t,n,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let n of(t=JSON.parse(JSON.stringify(t)),r)){let r=n.split("/").slice(1),i=t;for(let t of r)i=i[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:n}=r.definition,o=i[t];n&&o&&(i[t]=I(o))}}return t}_removeAllSchemas(t,r){for(let a in t){let n=t[a];(!r||r.test(a))&&("string"==typeof n?delete t[a]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[a]))}}_addSchema(t,r,a,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if("object"==typeof t)o=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;a=(0,c.normalizeId)(o||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),n&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,a,n="error"){for(let i in t)i in r&&this.logger[n](`${a}: option ${i}. ${t[i]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function R(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function k(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=n.default,_.MissingRefError=i.default,t.default=_;let x={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function E(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!P.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function T(t,r,a){var n;let i=null==r?void 0:r.post;if(a&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:t})=>t===a);if(s||(s={type:a,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?j.call(this,s,l,r.before):s.rules.push(l),o.all[t]=l,null==(n=r.implements)||n.forEach(t=>this.addKeyword(t))}function j(t,r,a){let n=t.rules.findIndex(t=>t.keyword===a);n>=0?t.rules.splice(n,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function O(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=I(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(t){return{anyOf:[t,C]}}}),dn=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),di=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=u6(),a=uX(),n=uV(),i=uH(),o=u5(),s=uF();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,n._)`${a.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,o,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:m}=u,h=m.passContext?i.default.this:n.nil;function f(t){let r=(0,n._)`${t}.errors`;c.assign(i.default.vErrors,(0,n._)`${i.default.vErrors} === null ? ${r} : ${i.default.vErrors}.concat(${r})`),c.assign(i.default.errors,(0,n._)`${i.default.vErrors}.length`)}function g(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==o?void 0:o.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,n._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,n.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,n._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,n.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let i=c.let("valid");c.try(()=>{c.code((0,n._)`await ${(0,a.callValidateCode)(t,r,h)}`),g(r),d||c.assign(i,!0)},t=>{c.if((0,n._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(i,!1)}),t.ok(i)}():t.result((0,a.callValidateCode)(t,r,h),()=>g(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,i;let s,u,d,{gen:p,schema:m,it:h}=t,{baseId:f,schemaEnv:g,validateName:y,opts:v,self:_}=h,{root:b}=g;if(("#"===m||"#/"===m)&&f===b.baseId){if(g===b)return c(t,y,g,g.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,n._)`${r}.validate`,b,b.$async)}let S=o.resolveRef.call(_,b,f,m);if(void 0===S)throw new r.default(h.opts.uriResolver,f,m);return S instanceof o.SchemaEnv?void c(t,l(t,a=S),a,a.$async):(i=S,s=p.scopeValue("schema",!0===v.code.source?{ref:i,code:(0,n.stringify)(i)}:{ref:i}),u=p.name("valid"),d=t.subschema({schema:i,dataTypes:[],schemaPath:n.nil,topSchemaRef:s,errSchemaPath:m},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),ds=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dn(),a=di();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),dl=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=r.operators,n={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${n[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${n[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:i,schemaCode:o}=t;t.fail$data((0,r._)`${i} ${n[a].fail} ${o} || isNaN(${i})`)}}}),dc=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:n,schemaCode:i,it:o}=t,s=o.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${n}/${i}, ${c}))`)}}}),du=H(t=>{function r(t){let r,a=t.length,n=0,i=0;for(;i<a;)n++,(r=t.charCodeAt(i++))>=55296&&r<=56319&&i<a&&(64512&(r=t.charCodeAt(i)))==56320&&i++;return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),dd=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=du();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:i,data:o,schemaCode:s,it:l}=t,c="maxLength"===i?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${o}.length`:(0,r._)`${(0,a.useFunc)(t.gen,n.default)}(${o})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),dp=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uF(),n=uV();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,n.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,n._)`{pattern: ${t}}`},code(t){let{gen:i,data:o,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,n._)`new RegExp`:(0,a.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,n._)`${s}(${c}, ${d}).test(${o})`),()=>i.assign(l,!1)),t.fail$data((0,n._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,n._)`!${a}.test(${o})`)}}}}),dm=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:i}=t,o="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${n}).length ${o} ${i}`)}}}),dh=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uF();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:i,schema:o,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===o.length)return;let p=o.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(a.nil,m);else for(let a of o)(0,r.checkReportMissingProp)(t,a)}():function(){let n=i.let("missing");if(p||c){let o=i.let("valid",!0);t.block$data(o,()=>{var c,u;return c=n,u=o,void(t.setParams({missingProperty:c}),i.forOf(c,s,()=>{i.assign(u,(0,r.propertyInData)(i,l,c,d.ownProperties)),i.if((0,a.not)(u),()=>{t.error(),i.break()})},a.nil))}),t.ok(o)}else i.if((0,r.checkMissingProp)(t,o,n)),(0,r.reportMissingProp)(t,n),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of o)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(u,r,u.opts.strictRequired)}}function m(){i.forOf("prop",s,a=>{t.setParams({missingProperty:a}),i.if((0,r.noPropertyInData)(i,l,a,d.ownProperties),()=>t.error())})}}}}),df=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:i}=t,o="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${n}.length ${o} ${i}`)}}}),dg=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u1();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),dy=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uW(),a=uV(),n=uF(),i=dg();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen:o,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let m=o.let("valid"),h=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(m,function(){let l=o.let("i",(0,a._)`${s}.length`),c=o.let("j");t.setParams({i:l,j:c}),o.assign(m,!0),o.if((0,a._)`${l} > 1`,()=>(h.length>0&&!h.some(t=>"object"===t||"array"===t)?function(n,i){let l=o.name("item"),c=(0,r.checkDataTypes)(h,l,p.opts.strictNumbers,r.DataType.Wrong),u=o.const("indices",(0,a._)`{}`);o.for((0,a._)`;${n}--;`,()=>{o.let(l,(0,a._)`${s}[${n}]`),o.if(c,(0,a._)`continue`),h.length>1&&o.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),o.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{o.assign(i,(0,a._)`${u}[${l}]`),t.error(),o.assign(m,!1).break()}).code((0,a._)`${u}[${l}] = ${n}`)})}:function(r,l){let c=(0,n.useFunc)(o,i.default),u=o.name("outer");o.label(u).for((0,a._)`;${r}--;`,()=>o.for((0,a._)`${l} = ${r}; ${l}--;`,()=>o.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),o.assign(m,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(m)}}}),dv=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=dg();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:i,data:o,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,a.useFunc)(i,n.default)}(${o}, ${l})`):t.fail((0,r._)`${c} !== ${o}`)}}}),d_=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=dg();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let i,o,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let m=u.length>=p.opts.loopEnum,h=()=>null!=i?i:i=(0,a.useFunc)(s,n.default);if(m||c)o=s.let("valid"),t.block$data(o,function(){s.assign(o,!1),s.forOf("v",d,t=>s.if((0,r._)`${h()}(${l}, ${t})`,()=>s.assign(o,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);o=(0,r.or)(...u.map((a,n)=>{var i,o;let s;return i=t,"object"==typeof(s=u[o=n])&&null!==s?(0,r._)`${h()}(${l}, ${i}[${o}])`:(0,r._)`${l} === ${s}`}))}t.pass(o)}}}),db=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dl(),a=dc(),n=dd(),i=dp(),o=dm(),s=dh(),l=df(),c=dy(),u=dv(),d=d_();t.default=[r.default,a.default,n.default,i.default,o.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),dS=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uV(),a=uF();function n(t,n){let{gen:i,schema:o,data:s,keyword:l,it:c}=t;c.items=!0;let u=i.const("len",(0,r._)`${s}.length`);if(!1===o)t.setParams({len:n.length}),t.pass((0,r._)`${u} <= ${n.length}`);else if("object"==typeof o&&!(0,a.alwaysValidSchema)(c,o)){let o=i.var("valid",(0,r._)`${u} <= ${n.length}`);i.if((0,r.not)(o),()=>{var s;return s=o,void i.forRange("i",n.length,u,n=>{t.subschema({keyword:l,dataProp:n,dataPropType:a.Type.Num},s),c.allErrors||i.if((0,r.not)(s),()=>i.break())})}),t.ok(o)}}t.validateAdditionalItems=n,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:i}=t,{items:o}=r;Array.isArray(o)?n(t,o):(0,a.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),d$=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uV(),a=uF(),n=uX();function i(t,n,o=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:i}=d,s=o.length,l=s===t.minItems&&(s===t.maxItems||!1===t[n]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${n} are not specified or different at path "${i}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&o.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,o.length,d.items));let p=s.name("valid"),m=s.const("len",(0,r._)`${c}.length`);o.forEach((n,i)=>{(0,a.alwaysValidSchema)(d,n)||(s.if((0,r._)`${m} > ${i}`,()=>t.subschema({keyword:u,schemaProp:i,dataProp:i},p)),t.ok(p))})}t.validateTuple=i,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:o}=t;if(Array.isArray(r))return i(t,"additionalItems",r);o.items=!0,(0,a.alwaysValidSchema)(o,r)||t.ok((0,n.validateArray)(t))}}}),dw=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),dR=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=uX(),i=dS();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:o,it:s}=t,{prefixItems:l}=o;s.items=!0,(0,a.alwaysValidSchema)(s,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,n.validateArray)(t)))}}}),dk=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let n,i,{gen:o,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(n=void 0===d?1:d,i=p):n=1;let m=o.const("len",(0,r._)`${c}.length`);if(t.setParams({min:n,max:i}),void 0===i&&0===n)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&n>i){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${m} >= ${n}`;void 0!==i&&(a=(0,r._)`${a} && ${m} <= ${i}`),t.pass(a);return}u.items=!0;let h=o.name("valid");function f(){let t=o.name("_valid"),a=o.let("count",0);g(t,()=>o.if(t,()=>{var t;return t=a,void(o.code((0,r._)`${t}++`),void 0===i?o.if((0,r._)`${t} >= ${n}`,()=>o.assign(h,!0).break()):(o.if((0,r._)`${t} > ${i}`,()=>o.assign(h,!1).break()),1===n?o.assign(h,!0):o.if((0,r._)`${t} >= ${n}`,()=>o.assign(h,!0))))}))}function g(r,n){o.forRange("i",0,m,i=>{t.subschema({keyword:"contains",dataProp:i,dataPropType:a.Type.Num,compositeRule:!0},r),n()})}void 0===i&&1===n?g(h,()=>o.if(h,()=>o.break())):0===n?(o.let(h,!0),void 0!==i&&o.if((0,r._)`${c}.length > 0`,f)):(o.let(h,!1),f()),t.result(h,()=>t.reset())}}}),dx=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uV(),a=uF(),n=uX();t.error={message:({params:{property:t,depsCount:a,deps:n}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${n} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:n,missingProperty:i}})=>(0,r._)`{property: ${t},
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let a=r[1];if(t===r[0]){i(r);continue}if(e.external){let a=e.external.registry.get(r[0])?.id;if(t!==r[0]&&a){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||a.cycle){i(r);continue}a.count>1&&"ref"===e.reused&&i(r)}e.external&&(e.sharedDefsExtractedFor=e.external)}let ap=new Set(["type","properties","required","additionalProperties"]),am=["oneOf","anyOf"];function ah(e){let t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function af(e){let t=[];for(let r of e){if("object"!=typeof r||"object"!==r.type)return null;for(let e in r)if(!ap.has(e))return null;t.push(r)}let r={},a=new Set;for(let e of t){for(let a in e.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let e=[];for(let r of t){let t=r.properties?.[a]??ah(r);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ei(r,a,1===e.length?e[0]:af(e)??{allOf:e})}for(let t of e.required??[])a.add(t)}let i={type:"object",properties:r};if(a.size&&(i.required=[...a]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{let e=[];for(let r of t){let t=ah(r);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function ag(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,n={...i},o=r.ref;if(r.ref=null,o){a(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):ao(i,s),ao(i,n),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){a(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())a(t[0]);if("openapi-3.0"!==e.target)for(let t of e.seen.entries())!function e(t){let r=t.anyOf;if(!Array.isArray(r)||0===r.length||void 0!==t.type)return;let a=[];for(let t of r){if(!t||"object"!=typeof t)return;e(t);let r=Object.keys(t);if(1!==r.length||"type"!==r[0])return;let i=t.type;for(let e of Array.isArray(i)?i:[i]){if("string"!=typeof e)return;a.includes(e)||a.push(e)}}delete t.anyOf,t.type=1===a.length?a[0]:a}(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let r of e.seen.values())for(let e of[r.schema,r.def]){let r=e?.allOf;if(!Array.isArray(r))continue;let a=t.get(r);a?a.push(e):t.set(r,[e])}for(let r of e.intersections)for(let e of t.get(r)??[])!function(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ap)if(t in e)return;let r=t.filter(e=>am.some(t=>Array.isArray(e[t]))),a=null;if(r.length){let e=r[0],i=am.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;let n=t.filter(t=>t!==e),o=e[i].map(e=>af([...n,e]));if(o.some(e=>!e))return;a={[i]:o}}else a=af(t);a&&(delete e.allOf,ao(e,a))}(e)}}let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}ao(i,r.defId?r.schema:r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&i.id===n&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ei(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ay(t,"input",e.processors),output:ay(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let ay=(e,t,r={})=>a=>{let{libraryOptions:i,target:n}=a??{},o=as({...i??{},target:n,io:t,processors:r});return ac(e,o),ad(o,e),ag(o,e)},av=(e,t,r)=>{(void 0===e[t]||r>e[t])&&(e[t]=r)},a_=(e,t,r)=>{(void 0===e[t]||r<e[t])&&(e[t]=r)},ab=(e,t)=>{av(e,"minimum",t),a_(e,"maximum",t)},aS=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},a$=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},aw=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},aR=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ak=(e,t)=>av(e,"minimum",t.minimum),ax=(e,t)=>a_(e,"maximum",t.maximum),aP=e=>(t,r)=>{aR(t,r.format);let[a,i]=e[r.format];av(t,"minimum",a),a_(t,"maximum",i)},aE={greater_than:(e,t)=>av(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>a_(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>aS(e,t.value),number_format:aP(eS),bigint_format:aP(e$),min_length:ak,max_length:ax,length_equals:(e,t)=>ab(e,t.length),min_size:ak,max_size:ax,size_equals:(e,t)=>ab(e,t.size),string_format:(e,t)=>{aR(e,t.format),t.pattern&&a$(e,t.pattern),("base64"===t.format||"base64url"===t.format)&&(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>aw(e,t.mime)};function aT(e){let t={},r=e._zod.def;for(let a of e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[])aE[a._zod.def.check]?.(t,a._zod.def);let a=e._zod.bag;for(let e of(void 0!==a.minimum&&av(t,"minimum",a.minimum),void 0!==a.exclusiveMinimum&&av(t,"exclusiveMinimum",a.exclusiveMinimum),void 0!==a.maximum&&a_(t,"maximum",a.maximum),void 0!==a.exclusiveMaximum&&a_(t,"exclusiveMaximum",a.exclusiveMaximum),void 0!==a.multipleOf&&aS(t,a.multipleOf),void 0!==a.format&&(t.format??(t.format=a.format),a.format.includes("int")&&(t.isInt=!0)),a.mime&&aw(t,a.mime),a.patterns??[]))a$(t,e);return t}let aj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aO=new Map([[rn,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rs,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aC=e=>aO.get(e)??e,aI=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:n,format:o,patterns:s,contentEncoding:l,laxFormat:c}=aT(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),o&&(r.format=aj[o]??o,""===r.format&&delete r.format,("time"===o||c)&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s].map(aC);1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},aN=(e,t,r,a)=>{let{minimum:i,maximum:n,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:l,isInt:c}=aT(e);r.type=c?"integer":"number";let u="number"==typeof l&&l>=(i??-1/0),d="number"==typeof s&&s<=(n??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;if(u?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof i&&(r.minimum=i),d?p?(r.maximum=s,r.exclusiveMaximum=!0):r.exclusiveMaximum=s:"number"==typeof n&&(r.maximum=n),o){let i=new Set;for(let n of o)Number.isFinite(n)&&0!==n?i.add(Math.abs(n)):al(e,t,r,a,`A multipleOf divisor of ${n} cannot be represented in JSON Schema`);let[n,...s]=i;void 0!==n&&(r.multipleOf=n),s.length&&(r.allOf=[...r.allOf??[],...s.map(e=>({multipleOf:e}))])}},aq=(e,t,r,a)=>{r.type="boolean"},aA=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},az=(e,t,r,a)=>{r.not={}},aM=(e,t,r,a)=>{},aL=(e,t,r,a)=>{},aZ=(e,t,r,a)=>{let i=Y(e._zod.def.entries);if(0===i.length){r.not={};return}i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},aD=(e,t,r,a)=>{let i=e._zod.def;if(0===i.values.length){r.not={};return}let n=[];for(let o of i.values)if(void 0===o){if(al(e,t,r,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof o){if(al(e,t,r,a,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(o))}else n.push(o);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},aU=(e,t,r,a)=>{al(e,t,r,a,"Custom types cannot be represented in JSON Schema")},aV=(e,t,r,a)=>{al(e,t,r,a,"Transforms cannot be represented in JSON Schema")},aF=(e,t,r,a)=>{let i=e._zod.def,{minimum:n,maximum:o}=aT(e);"number"==typeof n&&(r.minItems=n),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=ac(i.element,t,{...a,path:[...a.path,"items"]})};function aH(e){let t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?aH(t.out):"catch"===t.type?aH(t.innerType):e._zod.optin}let aJ=(e,t,r,a)=>{let i=e._zod.def,n=i.shape;if(Object.getOwnPropertySymbols(n).length&&al(e,t,r,a,"Symbol keys cannot be represented in JSON Schema"))return;for(let e in r.type="object",r.properties={},n)ei(r.properties,e,ac(n[e],t,{...a,path:[...a.path,"properties",e]}));let o=[];for(let e of Object.keys(n)){let r=i.shape[e];("input"===t.io?void 0===aH(r):void 0===r._zod.optout)&&o.push(e)}o.length>0&&(r.required=o),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=ac(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},aB=(e,t,r,a)=>{let i=e._zod.def,n=!1===i.inclusive,o=i.options.map((e,r)=>ac(e,t,{...a,path:[...a.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=o:r.anyOf=o},aK=(e,t,r,a)=>{let i=e._zod.def,n=ac(i.left,t,{...a,path:[...a.path,"allOf",0]}),o=ac(i.right,t,{...a,path:[...a.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,l=[...s(n)?n.allOf:[n],...s(o)?o.allOf:[o]];r.allOf=l,t.intersections.push(l)},aG=new WeakMap,aW=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let n=i.keyType,o=aT(n).patterns;if("loose"===i.mode&&o&&o.size>0){let e=ac(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},o))ei(r.patternProperties,aC(t).source,e)}else{if("draft-07"===t.target||"draft-2020-12"===t.target){r.propertyNames=ac(i.keyType,t,{...a,path:[...a.path,"propertyNames"]});let n=aG.get(t);n||(n=[],aG.set(t,n),t.deferred.push(()=>(function(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let r=new Map;for(let a of aG.get(e)??[]){let i=e.seen.get(a),n=(i?.def??i?.schema)?.propertyNames;if(!n||!0===n||r.has(n))continue;let o=function e(t,r,a){if(r.$ref){if(a.has(r))return r;a.add(r);let i=t.get(r)?.def;if(!i)return r;let n=e(t,i,a);return n===i?r:n}for(let i of["anyOf","oneOf"]){let n=r[i];if(!Array.isArray(n))continue;let o=n.map(r=>e(t,r,a));o.some((e,t)=>e!==n[t])&&(r={...r,[i]:o})}let i=Array.isArray(r.type)?r.type:[r.type],n=!i.includes("string")&&i.some(e=>"number"===e||"integer"===e),o=r.enum??(void 0!==r.const?[r.const]:void 0);if(!n&&!o?.some(e=>"number"==typeof e))return r;let{minimum:s,maximum:l,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:d,format:p,id:m,...h}=r;return h.enum?h.enum=h.enum.map(e=>"number"==typeof e?String(e):e):"number"==typeof h.const&&(h.const=String(h.const)),n&&(h.type="string",o||(h.pattern=(i.includes("number")?th:tm).source)),h}(t,n,new Set);o!==n&&r.set(n,o)}if(r.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&r.get(e.propertyNames);t&&(e.propertyNames=t)}})(t))),n.push(e)}r.additionalProperties=ac(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})}let s=n._zod.values,l="input"===t.io&&void 0!==aH(i.valueType);if(s&&!i.partial&&!l){let e=[...s].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e.map(String))}},aY=(e,t,r,a)=>{let i=e._zod.def,n=ac(i.innerType,t,a),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},aX=(e,t,r,a)=>{let i=e._zod.def;ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType},aQ=Symbol();function a0(e,t,r,a,i){let n=!1,o=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(n=!0,null));return n?(al(t,r,a,i,"BigInt defaults cannot be represented in JSON Schema"),aQ):JSON.parse(o)}let a1=(e,t,r,a)=>{let i=e._zod.def;ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType;let n=a0(i.defaultValue,e,t,r,a);n!==aQ&&(r.default=n)},a2=(e,t,r,a)=>{let i=e._zod.def;if(ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;let n=a0(i.defaultValue,e,t,r,a);n!==aQ&&(r._prefault=n)},a9=(e,t,r,a)=>{let i,n=e._zod.def;ac(n.innerType,t,a),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{al(e,t,r,a,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},a4=(e,t,r,a)=>{let i=e._zod.def,n=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?n?i.out:i.in:i.out;ac(o,t,a),t.seen.get(e).ref=o},a3=(e,t,r,a)=>{let i=e._zod.def;ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},a5=(e,t,r,a)=>{let i=e._zod.def;ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType},a6=(e,t,r,a)=>{let i=e._zod.innerType;ac(i,t,a),t.seen.get(e).ref=i},a7={string:aI,number:aN,boolean:aq,bigint:(e,t,r,a)=>{al(e,t,r,a,"BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{al(e,t,r,a,"Symbols cannot be represented in JSON Schema")},null:aA,undefined:(e,t,r,a)=>{al(e,t,r,a,"Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{al(e,t,r,a,"Void cannot be represented in JSON Schema")},never:az,any:aM,unknown:aL,date:(e,t,r,a)=>{al(e,t,r,a,"Date cannot be represented in JSON Schema")},enum:aZ,literal:aD,nan:(e,t,r,a)=>{al(e,t,r,a,"NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,a)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},file:(e,t,r,a)=>{r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:i,maximum:n,mime:o}=aT(e);void 0!==i&&(r.minLength=i),void 0!==n&&(r.maxLength=n),o&&(0===o.length?r.not={}:1===o.length?r.contentMediaType=o[0]:r.anyOf=o.map(e=>({contentMediaType:e})))},success:(e,t,r,a)=>{r.type="boolean"},custom:aU,function:(e,t,r,a)=>{al(e,t,r,a,"Function types cannot be represented in JSON Schema")},transform:aV,map:(e,t,r,a)=>{al(e,t,r,a,"Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{al(e,t,r,a,"Set cannot be represented in JSON Schema")},array:aF,object:aJ,union:aB,intersection:aK,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>ac(e,t,{...a,path:[...a.path,n,r]})),l=i.rest?ac(i.rest,t,{...a,path:[...a.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null,c=i.items.length;for(;c>0;){let e=i.items[c-1];if(!("input"===t.io?void 0!==aH(e):"optional"===e._zod.optout))break;c--}let u=i.items.length,d=!i.rest;"draft-2020-12"===t.target?(r.prefixItems=s,d?r.items=!1:l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l)):(r.items=s,d?r.additionalItems=!1:l&&(r.additionalItems=l)),c>0&&(r.minItems=c),d&&(r.maxItems=u);let{minimum:p,maximum:m}=aT(e);"number"==typeof p&&(r.minItems=p),"number"==typeof m&&(r.maxItems=m)},record:aW,nullable:aY,nonoptional:aX,default:a1,prefault:a2,catch:a9,pipe:a4,readonly:a3,promise:(e,t,r,a)=>{let i=e._zod.def;ac(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:a5,lazy:a6};function a8(e,t){if("_idmap"in e){let r=as({...t,processors:a7}),a={};for(let t of e._idmap.entries()){let[e,a]=t;ac(a,r)}let i={};for(let n of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=n;ad(r,t),ei(i,e,ag(r,t))}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=as({...t,processors:a7});return ac(e,r),ad(r,e),ag(r,e)}let ie={get:function(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Q,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},it={value:void 0,enumerable:!1},ir=new WeakSet([Object.prototype,Error.prototype]),ia=(e,t)=>{e.name="$ZodError",it.value=t,Object.defineProperty(e,"issues",it),it.value=void 0,Object.defineProperty(e,"message",ie);let r=Object.getPrototypeOf(e);ir.has(r)||(ir.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ii=eF("$ZodError",ia);function io(e,t){return{callee:t?.callee??e,Err:t?.Err}}eF("$ZodError",ia,void 0,{Parent:Error});let is=e=>{let t=(r,a,i,n)=>{let o=i?{...i,async:!1}:{async:!1},s=r._zod.run({value:a,issues:[]},o);if(s instanceof Promise)throw new eH;if(s.issues.length){let r=new(n?.Err??e)(s.issues.map(e=>eO(e,o,eK())));throw ed(r,n?.callee??t),r}return s.value};return t},il=e=>{let t=async(r,a,i,n)=>{let o=i?{...i,async:!0}:{async:!0},s=r._zod.run({value:a,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let r=new(n?.Err??e)(s.issues.map(e=>eO(e,o,eK())));throw ed(r,n?.callee??t),r}return s.value};return t},ic=e=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new eH;return n.issues.length?iu(e,n.issues,i):{success:!0,data:n.value}};function iu(e,t,r){let a;return{success:!1,get error(){return a||(a=new e(t.map(e=>eO(e,r,eK()))),t=void 0,r=void 0),a},set error(e){a=e,t=void 0,r=void 0}}}let id=e=>async(t,r,a)=>{let i=a?{...a,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?iu(e,n.issues,i):{success:!0,data:n.value}},ip=Symbol.for("zod.compile.invalid"),im=Symbol.for("zod.compile.fallback"),ih=new WeakSet([Object.prototype,Error.prototype]);function ig(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=r(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let iy=eF("ZodError",(e,t)=>{ii.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);ih.has(r)||(ih.add(r),ig(r,"format",e=>t=>(function(e,t=e=>e.message){let r={_errors:[]},a=(e,i=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>a({issues:e},[...i,...n.path]));else if("invalid_key"===n.code)a({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)a({issues:n.issues},[...i,...n.path]);else{let e=[...i,...n.path];if(0===e.length)r._errors.push(t(n));else{let a=r,i=0;for(;i<e.length;){let r=e[i],o=i===e.length-1;if("_errors"===r){o&&a._errors.push(t(n)),i++;continue}Object.prototype.hasOwnProperty.call(a,r)||Object.defineProperty(a,r,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=a[r];o&&s._errors.push(t(n)),a=s,i++}}}};return a(e),r})(e,t)),ig(r,"flatten",e=>t=>(function(e,t=e=>e.message){let r={},a=[];for(let o of e.issues)if(o.path.length>0){var i,n;(i=o.path[0],n=()=>[],!Object.prototype.hasOwnProperty.call(r,i)&&("__proto__"===i?Object.defineProperty(r,i,{value:n(),writable:!0,enumerable:!0,configurable:!0}):r[i]=n()),r[i]).push(t(o))}else a.push(t(o));return{formErrors:a,fieldErrors:r}})(e,t)),ig(r,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Q,2)}),ig(r,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Q,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),iv=is(iy),i_=il(iy),ib=ic(iy),iS=id(iy),i$=(f=is(iy),g=(e,t,r,a)=>f(e,t,r?{...r,direction:"backward"}:{direction:"backward"},io(g,a))),iw=(y=is(iy),v=(e,t,r,a)=>y(e,t,r,io(v,a))),iR=(_=il(iy),b=async(e,t,r,a)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return await _(e,t,i,io(b,a))}),ik=(S=il(iy),$=async(e,t,r,a)=>await S(e,t,r,io($,a))),ix=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return ic(iy)(e,t,a)},iP=(e,t,r)=>ic(iy)(e,t,r),iE=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return id(iy)(e,t,a)},iT=async(e,t,r)=>id(iy)(e,t,r);function ij(){eB.memoizer||eK({memoizer:e2})}let iO=eF("ZodType",(e,t)=>(eB.localeError||eK({localeError:(()=>{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"}},t={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"},r={nan:"NaN"};function a(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?r[e]??e:String(t)}return r=>{switch(r.code){case"invalid_type":{let e=a(r.expected),t=a(function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t}(r.input),r.input);return`Invalid input: expected ${e}, received ${t}`}case"invalid_value":if(1===r.values.length)return`Invalid input: expected ${eb(r.values[0])}`;return`Invalid option: expected one of ${X(r.values,"|")}`;case"too_big":{let t=r.exact?"exactly ":r.inclusive?"<=":"<",a=e[r.origin]??null;if(a)return`Too big: expected ${r.origin??"value"} to have ${t}${r.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${r.origin??"value"} to be ${t}${r.maximum.toString()}`}case"too_small":{let t=r.exact?"exactly ":r.inclusive?">=":">",a=e[r.origin]??null;if(a)return`Too small: expected ${r.origin} to have ${t}${r.minimum.toString()} ${a.unit}`;return`Too small: expected ${r.origin} to be ${t}${r.minimum.toString()}`}case"invalid_format":if("starts_with"===r.format)return`Invalid string: must start with "${r.prefix}"`;if("ends_with"===r.format)return`Invalid string: must end with "${r.suffix}"`;if("includes"===r.format)return`Invalid string: must include "${r.includes}"`;if("regex"===r.format)return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${t[r.format]??r.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${X(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":if(r.options&&Array.isArray(r.options)&&r.options.length>0){let e=r.options.map(e=>`'${e}'`).join(" | ");return`Invalid discriminator value. Expected ${e}`}if(!1===r.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}})()}),tL.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(eu(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ev(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new nD({type:"custom",check:"custom",fn:e,...e_(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let a,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eq(e,t.value,a._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),"input"in e||(e.input=t.value),e.inst??(e.inst=a),e.continue??(e.continue=!a._zod.def.abort),t.issues.push(eq(e)))},e(t.value,t)),(i=new t_({check:"custom",...e_(t)}))._zod.check=r,a=i}(e,t))},overwrite(e){return this.check(an(e))},optional(){return nP(this)},exactOptional(){var e;return e=this,new nE({type:"optional",innerType:e})},nullable(){return nj(this)},nullish(){return nP(nj(this))},nonoptional(e){var t;return t=this,new nI({type:"nonoptional",innerType:t,...e_(e)})},array(){return nl(this)},or(e){return nm([this,e])},and(e){return ny(this,e)},transform(e){return nA(this,nk(e))},default(e){var t,r;return t=this,r=e,new nO({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():ef(r)}})},prefault(e){var t,r;return t=this,r=e,new nC({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():ef(r)}})},catch(e){return function(e,t){let r;return new nN({type:"catch",innerType:e,catchValue:"function"==typeof t?t:((r=()=>t)["~constantCatch"]=!0,r)})}(this,e)},pipe(e){return nA(this,e)},readonly(){var e;return e=this,new nM({type:"readonly",innerType:e})},describe(e){let t=this.clone();return r1.add(t,{description:e}),t},meta(...e){if(0===e.length)return r1.get(this);let t=this.clone();return r1.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return eA(this,"~standard",{...tD(this),jsonSchema:{input:ay(this,"input"),output:ay(this,"output")}},!1)},set"~standard"(e){eA(this,"~standard",e)},parse:function e(t,r){return iv(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await i_(this,t,r,{callee:e})},safeParse(e,t){return ib(this,e,t)},async safeParseAsync(e,t){return iS(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){eA(this,"spa",e)},validate(e,t){let r=this._zod.bag.validator;if(void 0!==r){if(r(e)!==ip)return!0;if(!0===r.definite&&void 0===t)return!1}return function(e,t,r){let a,i=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun;if(n?(i[im]=!0,a=n({value:t,issues:[]},i)):a=e._zod.run({value:t,issues:[]},i),a instanceof Promise)throw new eH;return 0===a.issues.length}(this,e,t)},validateAsync(e,t){return(async(e,t,r)=>{let a=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},a);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,r){return i$(this,t,r,{callee:e})},decode:function e(t,r){return iw(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await iR(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ik(this,t,r,{callee:e})},safeEncode(e,t){return ix(this,e,t)},safeDecode(e,t){return iP(this,e,t)},async safeEncodeAsync(e,t){return iE(this,e,t)},async safeDecodeAsync(e,t){return iT(this,e,t)},toJSONSchema(e){return((e,t={})=>r=>{let a=as({...r,processors:t});return ac(e,a),ad(a,e),ag(a,e)})(this,{})(e)},get description(){return r1.get(this)?.description},get _def(){return this._zod.def}}),iC=eF("_ZodString",(e,t)=>{tU.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aI(e,t,r,a)},ez({format:e=>aT(e).format??null,minLength:e=>aT(e).minimum??null,maxLength:e=>aT(e).maximum??null},{regex(...e){return this.check(function(e,t){return new tj({check:"string_format",format:"regex",...e_(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new tI({check:"string_format",format:"includes",...e_(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new tN({check:"string_format",format:"starts_with",...e_(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new tq({check:"string_format",format:"ends_with",...e_(t),suffix:e})}(...e))},min(...e){return this.check(aa(...e))},max(...e){return this.check(ar(...e))},length(...e){return this.check(ai(...e))},nonempty(...e){return this.check(aa(1,...e))},lowercase(e){return this.check(new tO({check:"string_format",format:"lowercase",...e_(e)}))},uppercase(e){return this.check(new tC({check:"string_format",format:"uppercase",...e_(e)}))},trim(){return this.check(an(e=>e.trim()))},normalize(...e){return this.check(function(e){return an(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(an(e=>e.toLowerCase()))},toUpperCase(){return this.check(an(e=>e.toUpperCase()))},slugify(){return this.check(an(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iI=eF("ZodString",(e,t)=>{tU.init(e,t),iC.init(e,t)},{email(e){return this.check(r9(iZ,e))},url(e){return this.check(r4(iV,e))},jwt(e){return this.check(new i4({type:"string",format:"jwt",check:"string_format",abort:!1,...e_(e)}))},emoji(e){return this.check(new iF({type:"string",format:"emoji",check:"string_format",abort:!1,...e_(e)}))},guid(e){return this.check(new iD({type:"string",format:"guid",check:"string_format",abort:!1,...e_(e)}))},uuid(e){return this.check(new iU({type:"string",format:"uuid",check:"string_format",abort:!1,...e_(e)}))},uuidv4(e){return this.check(new iU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e_(e)}))},uuidv6(e){return this.check(new iU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e_(e)}))},uuidv7(e){return this.check(new iU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e_(e)}))},nanoid(e){return this.check(new iH({type:"string",format:"nanoid",check:"string_format",abort:!1,...e_(e)}))},cuid(e){return this.check(new iJ({type:"string",format:"cuid",check:"string_format",abort:!1,...e_(e)}))},cuid2(e){return this.check(new iB({type:"string",format:"cuid2",check:"string_format",abort:!1,...e_(e)}))},ulid(e){return this.check(new iK({type:"string",format:"ulid",check:"string_format",abort:!1,...e_(e)}))},base64(e){return this.check(new i1({type:"string",format:"base64",check:"string_format",abort:!1,...e_(e)}))},base64url(e){return this.check(new i2({type:"string",format:"base64url",check:"string_format",abort:!1,...e_(e)}))},xid(e){return this.check(new iG({type:"string",format:"xid",check:"string_format",abort:!1,...e_(e)}))},ksuid(e){return this.check(new iW({type:"string",format:"ksuid",check:"string_format",abort:!1,...e_(e)}))},ipv4(e){return this.check(new iY({type:"string",format:"ipv4",check:"string_format",abort:!1,...e_(e)}))},ipv6(e){return this.check(new iX({type:"string",format:"ipv6",check:"string_format",abort:!1,...e_(e)}))},cidrv4(e){return this.check(new iQ({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e_(e)}))},cidrv6(e){return this.check(new i0({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e_(e)}))},e164(e){return this.check(new i9({type:"string",format:"e164",check:"string_format",abort:!1,...e_(e)}))},datetime(e){return this.check(r3(iA,e))},date(e){return this.check(r5(iz,e))},time(e){return this.check(new iM({type:"string",format:"time",check:"string_format",precision:null,...e_(e)}))},duration(e){return this.check(new iL({type:"string",format:"duration",check:"string_format",...e_(e)}))}});function iN(e){return new iI(r2({type:"string",...e_(e)}))}let iq=eF("ZodStringFormat",(e,t)=>{tV.init(e,t),iC.init(e,t)}),iA=eF("ZodISODateTime",(e,t)=>{t4.init(e,t),iq.init(e,t)}),iz=eF("ZodISODate",(e,t)=>{t3.init(e,t),iq.init(e,t)}),iM=eF("ZodISOTime",(e,t)=>{t5.init(e,t),iq.init(e,t)}),iL=eF("ZodISODuration",(e,t)=>{t6.init(e,t),iq.init(e,t)}),iZ=eF("ZodEmail",(e,t)=>{tJ.init(e,t),iq.init(e,t)}),iD=eF("ZodGUID",(e,t)=>{tF.init(e,t),iq.init(e,t)}),iU=eF("ZodUUID",(e,t)=>{tH.init(e,t),iq.init(e,t)}),iV=eF("ZodURL",(e,t)=>{tW.init(e,t),iq.init(e,t)}),iF=eF("ZodEmoji",(e,t)=>{tY.init(e,t),iq.init(e,t)}),iH=eF("ZodNanoID",(e,t)=>{tX.init(e,t),iq.init(e,t)}),iJ=eF("ZodCUID",(e,t)=>{tQ.init(e,t),iq.init(e,t)}),iB=eF("ZodCUID2",(e,t)=>{t0.init(e,t),iq.init(e,t)}),iK=eF("ZodULID",(e,t)=>{t1.init(e,t),iq.init(e,t)}),iG=eF("ZodXID",(e,t)=>{t2.init(e,t),iq.init(e,t)}),iW=eF("ZodKSUID",(e,t)=>{t9.init(e,t),iq.init(e,t)}),iY=eF("ZodIPv4",(e,t)=>{t7.init(e,t),iq.init(e,t)}),iX=eF("ZodIPv6",(e,t)=>{rt.init(e,t),iq.init(e,t)}),iQ=eF("ZodCIDRv4",(e,t)=>{rr.init(e,t),iq.init(e,t)}),i0=eF("ZodCIDRv6",(e,t)=>{ra.init(e,t),iq.init(e,t)}),i1=eF("ZodBase64",(e,t)=>{ro.init(e,t),iq.init(e,t)}),i2=eF("ZodBase64URL",(e,t)=>{rl.init(e,t),iq.init(e,t)}),i9=eF("ZodE164",(e,t)=>{rc.init(e,t),iq.init(e,t)}),i4=eF("ZodJWT",(e,t)=>{ru.init(e,t),iq.init(e,t)}),i3=eF("ZodNumber",(e,t)=>{rd.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aN(e,t,r,a),e.isFinite=!0},ez({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=aT(e);return Math.max(t??-1/0,r??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=aT(e);return Math.min(t??1/0,r??1/0)},isInt:e=>{let{isInt:t,multipleOf:r}=aT(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>aT(e).format??null},{gt(e,t){return this.check(r8(e,t))},gte(e,t){return this.check(ae(e,t))},min(e,t){return this.check(ae(e,t))},lt(e,t){return this.check(r6(e,t))},lte(e,t){return this.check(r7(e,t))},max(e,t){return this.check(r7(e,t))},int(e){return this.check(i7(e))},safe(e){return this.check(i7(e))},positive(e){return this.check(r8(0,e))},nonnegative(e){return this.check(ae(0,e))},negative(e){return this.check(r6(0,e))},nonpositive(e){return this.check(r7(0,e))},multipleOf(e,t){return this.check(at(e,t))},step(e,t){return this.check(at(e,t))},finite(){return this}}));function i5(e){return new i3(r2({type:"number",checks:[],...e_(e)}))}let i6=eF("ZodNumberFormat",(e,t)=>{rp.init(e,t),i3.init(e,t)});function i7(e){return new i6({type:"number",check:"number_format",abort:!1,format:"safeint",...e_(e)})}let i8=eF("ZodBoolean",(e,t)=>{rm.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aq(e,t,r,a)});function ne(e){return new i8({type:"boolean",...e_(e)})}let nt=eF("ZodNull",(e,t)=>{rh.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aA(e,t,r,a)});function nr(e){return new nt({type:"null",...e_(e)})}let na=eF("ZodAny",(e,t)=>{rf.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aM(e,t,r,a)}),ni=eF("ZodUnknown",(e,t)=>{rg.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aL(e,t,r,a)});function nn(){return new ni({type:"unknown"})}let no=eF("ZodNever",(e,t)=>{ry.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>az(e,t,r,a)}),ns=eF("ZodArray",(e,t)=>{ij(),rb.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aF(e,t,r,a),e.element=t.element},{min(e,t){return this.check(aa(e,t))},nonempty(e){return this.check(aa(1,e))},max(e,t){return this.check(ar(e,t))},length(e,t){return this.check(ai(e,t))},unwrap(){return this.element}});function nl(e,t){return new ns({type:"array",element:e,...e_(t)})}let nc=eF("ZodObject",(e,t)=>{var r;let a,i;ij(),rx.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aJ(e,t,r,a),r="shape",(i=r in(a=Object.getPrototypeOf(e))?void 0:a)&&Object.defineProperty(i,r,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,r,e),e.value=(e=>e._zod.def.shape)(this),Object.defineProperty(this,r,e),e.value},set(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!1,value:e})}})},{keyof(){return nS(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(eu(this._zod.def,{catchall:e}))},passthrough(){return this.clone(eu(this._zod.def,{catchall:nn()}))},loose(){return this.clone(eu(this._zod.def,{catchall:nn()}))},strict(){return this.clone(eu(this._zod.def,{catchall:new no({type:"never",...e_(void 0)})}))},strip(){return this.clone(eu(this._zod.def,{catchall:void 0}))},extend(e){if(!eh(e))throw Error("Invalid input to extend: expected a plain object");let t=this._zod.def.checks;if(t&&t.length>0){let t=eo(this);for(let r of Reflect.ownKeys(e))if(void 0!==Object.getOwnPropertyDescriptor(t,r))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ev(this,eu(this._zod.def,{shape:eR(this,e)}))},safeExtend(e){if(!eh(e))throw Error("Invalid input to safeExtend: expected a plain object");return ev(this,eu(this._zod.def,{shape:eR(this,e)}))},merge(e){if(!e?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t={};return ec(t,this,Reflect.ownKeys(eo(this))),ec(t,e,Reflect.ownKeys(eo(e))),ev(this,eu(this._zod.def,{shape:t,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]}))},pick(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return ec(i,e,ew(e,t)),ev(e,eu(r,{shape:i,checks:[]}))}(this,e)},omit(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ew(e,t)),n={};return ec(n,e,Reflect.ownKeys(eo(e)).filter(e=>!i.has(e))),ev(e,eu(r,{shape:n,checks:[]}))}(this,e)},partial(...e){return ek(nx,this,e[0])},exactPartial(...e){return ek(nE,this,e[0],"exactPartial")},required(...e){var t;let r,a;return r=(t=e[0])?new Set(ew(this,t)):void 0,ec(a={},this,Reflect.ownKeys(eo(this)),(e,t)=>r&&!r.has(t)?e:new nI({type:"nonoptional",innerType:e})),ev(this,eu(this._zod.def,{shape:a}))}});function nu(e,t){return new nc({type:"object",shape:e??{},...e_(t)})}function nd(e,t){return new nc({type:"object",shape:e,catchall:nn(),...e_(t)})}let np=eF("ZodUnion",(e,t)=>{rE.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aB(e,t,r,a),e.options=t.options});function nm(e,t){return new np({type:"union",options:e,...e_(t)})}let nh=eF("ZodDiscriminatedUnion",(e,t)=>{np.init(e,t),rT.init(e,t)});function nf(e,t,r){return new nh({type:"union",options:t,discriminator:e,...e_(r)})}let ng=eF("ZodIntersection",(e,t)=>{rj.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aK(e,t,r,a)});function ny(e,t){return new ng({type:"intersection",left:e,right:t})}let nv=eF("ZodRecord",(e,t)=>{ij(),rC.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aW(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function n_(e,t,r){return new nv(t&&t._zod?{type:"record",keyType:e,valueType:t,...e_(r)}:{type:"record",keyType:iN(),valueType:e,...e_(t)})}let nb=eF("ZodEnum",(e,t)=>{rI.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aZ(e,t,r,a),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let i={};for(let a of e)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new nb({...t,checks:[],...e_(a),entries:i})},e.exclude=(e,a)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nb({...t,checks:[],...e_(a),entries:i})}});function nS(e,t){return new nb({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...e_(t)})}let n$=eF("ZodLiteral",(e,t)=>{rN.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aD(e,t,r,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nw(e,t){return new n$({type:"literal",values:Array.isArray(e)?e:[e],...e_(t)})}let nR=eF("ZodTransform",(e,t)=>{ij(),rq.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aV(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new eJ(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(eq(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=r.value),a.inst??(a.inst=e),r.issues.push(eq(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function nk(e){return new nR({type:"transform",transform:e})}let nx=eF("ZodOptional",(e,t)=>{rz.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a5(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function nP(e){return new nx({type:"optional",innerType:e})}let nE=eF("ZodExactOptional",(e,t)=>{rM.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a5(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nT=eF("ZodNullable",(e,t)=>{rL.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aY(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function nj(e){return new nT({type:"nullable",innerType:e})}let nO=eF("ZodDefault",(e,t)=>{rZ.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a1(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),nC=eF("ZodPrefault",(e,t)=>{rU.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a2(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nI=eF("ZodNonOptional",(e,t)=>{rV.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aX(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nN=eF("ZodCatch",(e,t)=>{rJ.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a9(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),nq=eF("ZodPipe",(e,t)=>{rB.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a4(e,t,r,a),e.in=t.in,e.out=t.out});function nA(e,t){return new nq({type:"pipe",in:e,out:t})}let nz=eF("ZodPreprocess",(e,t)=>{nq.init(e,t),rG.init(e,t)}),nM=eF("ZodReadonly",(e,t)=>{rW.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a3(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),nL=eF("ZodLazy",(e,t)=>{rX.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>a6(e,t,r,a),e.unwrap=()=>e._zod.def.getter()});function nZ(e){return new nL({type:"lazy",getter:e})}let nD=eF("ZodCustom",(e,t)=>{rQ.init(e,t),iO.init(e,t),e._zod.processJSONSchema=(t,r,a)=>aU(e,t,r,a)});function nU(e,t){return new nz({type:"pipe",in:nk(e),out:t})}let nV="2025-11-25",nF=[nV,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nH="io.modelcontextprotocol/protocolVersion",nJ="io.modelcontextprotocol/clientInfo",nB="io.modelcontextprotocol/serverInfo",nK="io.modelcontextprotocol/clientCapabilities",nG="io.modelcontextprotocol/subscriptionId",nW="io.modelcontextprotocol/logLevel",nY=nZ(()=>nm([iN(),i5(),ne(),nr(),n_(iN(),nY),nl(nY)])),nX=n_(iN(),nY),nQ=nl(nY),n0=nm([iN(),i5().int()]),n1=iN(),n2=nu({ttl:i5().optional()}),n9=nu({taskId:iN()}),n4=nd({progressToken:n0.optional(),"io.modelcontextprotocol/related-task":n9.optional()}),n3=nu({_meta:n4.optional()}),n5=n3.extend({task:n2.optional()}),n6=nu({method:iN(),params:n3.loose().optional()}),n7=nu({_meta:n4.optional()}),n8=nu({method:iN(),params:n7.loose().optional()}),oe=nd({get[nB](){return of.optional().catch(void 0)}}),ot=nd({_meta:oe.optional()}),or=nm([iN(),i5().int()]),oa=nu({jsonrpc:nw("2.0"),id:or,...n6.shape}).strict(),oi=nu({jsonrpc:nw("2.0"),...n8.shape}).strict(),on=nu({jsonrpc:nw("2.0"),id:or,result:ot}).strict(),oo=nu({jsonrpc:nw("2.0"),id:or.optional(),error:nu({code:i5().int(),message:iN(),data:nn().optional()})}).strict(),os=nm([oa,oi,on,oo]),ol=nm([on,oo]),oc=ot.strict(),ou=n7.extend({requestId:or.optional(),reason:iN().optional()}),od=n8.extend({method:nw("notifications/cancelled"),params:ou}),op=nu({src:iN(),mimeType:iN().optional(),sizes:nl(iN()).optional(),theme:nS(["light","dark"]).optional()}),om=nu({icons:nl(op).optional()}),oh=nu({name:iN(),title:iN().optional()}),of=oh.extend({...oh.shape,...om.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),og=ny(nu({applyDefaults:ne().optional()}),nX),oy=nU(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,ny(nu({form:og.optional(),url:nX.optional()}),nX.optional())),ov=nd({list:nX.optional(),cancel:nX.optional(),requests:nd({sampling:nd({createMessage:nX.optional()}).optional(),elicitation:nd({create:nX.optional()}).optional()}).optional()}),o_=nd({list:nX.optional(),cancel:nX.optional(),requests:nd({tools:nd({call:nX.optional()}).optional()}).optional()}),ob=nu({experimental:n_(iN(),nX).optional(),sampling:nu({context:nX.optional(),tools:nX.optional()}).optional(),elicitation:oy.optional(),roots:nu({listChanged:ne().optional()}).optional(),tasks:ov.optional(),extensions:n_(iN(),nX).optional()}),oS=n3.extend({protocolVersion:iN(),capabilities:ob,clientInfo:of}),o$=n6.extend({method:nw("initialize"),params:oS}),ow=nu({experimental:n_(iN(),nX).optional(),logging:nX.optional(),completions:nX.optional(),prompts:nu({listChanged:ne().optional()}).optional(),resources:nu({subscribe:ne().optional(),listChanged:ne().optional()}).optional(),tools:nu({listChanged:ne().optional()}).optional(),tasks:o_.optional(),extensions:n_(iN(),nX).optional()}),oR=ot.extend({protocolVersion:iN(),capabilities:ow,serverInfo:of,instructions:iN().optional()}),ok=n8.extend({method:nw("notifications/initialized"),params:n7.optional()}),ox=n6.extend({method:nw("server/discover"),params:n3.optional()}),oP=ot.extend({supportedVersions:nl(iN()),capabilities:ow,instructions:iN().optional()}),oE=n6.extend({method:nw("ping"),params:n3.optional()}),oT=nu({progress:i5(),total:nP(i5()),message:nP(iN())}),oj=nu({...n7.shape,...oT.shape,progressToken:n0}),oO=n8.extend({method:nw("notifications/progress"),params:oj}),oC=n3.extend({cursor:n1.optional()}),oI=n6.extend({params:oC.optional()}),oN=ot.extend({nextCursor:n1.optional()}),oq=nu({uri:iN(),mimeType:nP(iN()),_meta:n_(iN(),nn()).optional()}),oA=oq.extend({text:iN()}),oz=iN().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),oM=oq.extend({blob:oz}),oL=nS(["user","assistant"]),oZ=nu({audience:nl(oL).optional(),priority:i5().min(0).max(1).optional(),lastModified:r3(iA,{offset:!0}).optional()}),oD=nu({...oh.shape,...om.shape,uri:iN(),description:nP(iN()),mimeType:nP(iN()),size:nP(i5()),annotations:oZ.optional(),_meta:nP(nd({}))}),oU=nu({...oh.shape,...om.shape,uriTemplate:iN(),description:nP(iN()),mimeType:nP(iN()),annotations:oZ.optional(),_meta:nP(nd({}))}),oV=oI.extend({method:nw("resources/list")}),oF=oN.extend({resources:nl(oD)}),oH=oI.extend({method:nw("resources/templates/list")}),oJ=oN.extend({resourceTemplates:nl(oU)}),oB=n3.extend({uri:iN()}),oK=n6.extend({method:nw("resources/read"),params:oB}),oG=ot.extend({contents:nl(nm([oA,oM]))}),oW=n8.extend({method:nw("notifications/resources/list_changed"),params:n7.optional()}),oY=n6.extend({method:nw("resources/subscribe"),params:oB}),oX=n6.extend({method:nw("resources/unsubscribe"),params:oB}),oQ=nu({toolsListChanged:ne().optional(),promptsListChanged:ne().optional(),resourcesListChanged:ne().optional(),resourceSubscriptions:nl(iN()).optional()}),o0=n3.extend({notifications:oQ}),o1=n6.extend({method:nw("subscriptions/listen"),params:o0}),o2=n7.extend({notifications:oQ}),o9=n8.extend({method:nw("notifications/subscriptions/acknowledged"),params:o2}),o4=oe.extend({[nG]:or}),o3=ot.extend({_meta:o4}),o5=n7.extend({uri:iN()}),o6=n8.extend({method:nw("notifications/resources/updated"),params:o5}),o7=nu({name:iN(),description:nP(iN()),required:nP(ne())}),o8=nu({...oh.shape,...om.shape,description:nP(iN()),arguments:nP(nl(o7)),_meta:nP(nd({}))}),se=oI.extend({method:nw("prompts/list")}),st=oN.extend({prompts:nl(o8)}),sr=n3.extend({name:iN(),arguments:n_(iN(),iN()).optional()}),sa=n6.extend({method:nw("prompts/get"),params:sr}),si=nu({type:nw("text"),text:iN(),annotations:oZ.optional(),_meta:n_(iN(),nn()).optional()}),sn=nu({type:nw("image"),data:oz,mimeType:iN(),annotations:oZ.optional(),_meta:n_(iN(),nn()).optional()}),so=nu({type:nw("audio"),data:oz,mimeType:iN(),annotations:oZ.optional(),_meta:n_(iN(),nn()).optional()}),ss=nu({type:nw("tool_use"),name:iN(),id:iN(),input:n_(iN(),nn()),_meta:n_(iN(),nn()).optional()}),sl=nu({type:nw("resource"),resource:nm([oA,oM]),annotations:oZ.optional(),_meta:n_(iN(),nn()).optional()}),sc=oD.extend({type:nw("resource_link")}),su=nm([si,sn,so,sc,sl]),sd=nu({role:oL,content:su}),sp=ot.extend({description:iN().optional(),messages:nl(sd)}),sm=n8.extend({method:nw("notifications/prompts/list_changed"),params:n7.optional()}),sh=nu({title:iN().optional(),readOnlyHint:ne().optional(),destructiveHint:ne().optional(),idempotentHint:ne().optional(),openWorldHint:ne().optional()}),sf=nu({taskSupport:nS(["required","optional","forbidden"]).optional()}),sg=nu({...oh.shape,...om.shape,description:iN().optional(),inputSchema:nu({type:nw("object"),properties:n_(iN(),nY).optional(),required:nl(iN()).optional()}).catchall(nn()),outputSchema:nd({$schema:iN().optional()}).optional(),annotations:sh.optional(),execution:sf.optional(),_meta:n_(iN(),nn()).optional()}),sy=oI.extend({method:nw("tools/list")}),sv=oN.extend({tools:nl(sg)}),s_=ot.extend({content:nl(su).default([]),structuredContent:nn().optional(),isError:ne().optional()}),sb=s_.or(ot.extend({toolResult:nn()})),sS=n5.extend({name:iN(),arguments:n_(iN(),nn()).optional()}),s$=n6.extend({method:nw("tools/call"),params:sS}),sw=n8.extend({method:nw("notifications/tools/list_changed"),params:n7.optional()}),sR=nu({autoRefresh:ne().default(!0),debounceMs:i5().int().nonnegative().default(300)}),sk=nS(["debug","info","notice","warning","error","critical","alert","emergency"]),sx=n3.extend({level:sk}),sP=n6.extend({method:nw("logging/setLevel"),params:sx}),sE=n7.extend({level:sk,logger:iN().optional(),data:nn()}),sT=n8.extend({method:nw("notifications/message"),params:sE}),sj=nu({name:iN().optional()}),sO=nu({hints:nl(sj).optional(),costPriority:i5().min(0).max(1).optional(),speedPriority:i5().min(0).max(1).optional(),intelligencePriority:i5().min(0).max(1).optional()}),sC=nu({mode:nS(["auto","required","none"]).optional()}),sI=nu({type:nw("tool_result"),toolUseId:iN().describe("The unique identifier for the corresponding tool call."),content:nl(su),structuredContent:nn().optional(),isError:ne().optional(),_meta:n_(iN(),nn()).optional()}),sN=nf("type",[si,sn,so]),sq=nf("type",[si,sn,so,ss,sI]),sA=nu({role:oL,content:nm([sq,nl(sq)]),_meta:n_(iN(),nn()).optional()}),sz=n5.extend({messages:nl(sA),modelPreferences:sO.optional(),systemPrompt:iN().optional(),includeContext:nS(["none","thisServer","allServers"]).optional(),temperature:i5().optional(),maxTokens:i5().int(),stopSequences:nl(iN()).optional(),metadata:nX.optional(),tools:nl(sg).optional(),toolChoice:sC.optional()}),sM=n6.extend({method:nw("sampling/createMessage"),params:sz}),sL=ot.extend({model:iN(),stopReason:nP(nS(["endTurn","stopSequence","maxTokens"]).or(iN())),role:oL,content:sN}),sZ=ot.extend({model:iN(),stopReason:nP(nS(["endTurn","stopSequence","maxTokens","toolUse"]).or(iN())),role:oL,content:nm([sq,nl(sq)])}),sD=nu({type:nw("boolean"),title:iN().optional(),description:iN().optional(),default:ne().optional()}),sU=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),minLength:i5().optional(),maxLength:i5().optional(),format:nS(["email","uri","date","date-time"]).optional(),default:iN().optional()}),sV=nu({type:nS(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i5().optional(),maximum:i5().optional(),default:i5().optional()}),sF=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),default:iN().optional()}),sH=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),oneOf:nl(nu({const:iN(),title:iN()})),default:iN().optional()}),sJ=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),enumNames:nl(iN()).optional(),default:iN().optional()}),sB=nm([sF,sH]),sK=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({type:nw("string"),enum:nl(iN())}),default:nl(iN()).optional()}),sG=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({anyOf:nl(nu({const:iN(),title:iN()}))}),default:nl(iN()).optional()}),sW=nm([sK,sG]),sY=nm([sJ,sB,sW]),sX=nm([sY,sD,sU,sV]),sQ=n5.extend({mode:nw("form").optional(),message:iN(),requestedSchema:nu({type:nw("object"),properties:n_(iN(),sX),required:nl(iN()).optional()}).catchall(nn())}),s0=n5.extend({mode:nw("url"),message:iN(),elicitationId:iN(),url:iN().url()}),s1=nm([sQ,s0]),s2=n6.extend({method:nw("elicitation/create"),params:s1}),s9=n7.extend({elicitationId:iN()}),s4=n8.extend({method:nw("notifications/elicitation/complete"),params:s9}),s3=ot.extend({action:nS(["accept","decline","cancel"]),content:nU(e=>null===e?void 0:e,n_(iN(),nm([iN(),i5(),ne(),nl(iN())])).optional())}),s5=nu({type:nw("ref/resource"),uri:iN()}),s6=nu({type:nw("ref/prompt"),name:iN()}),s7=n3.extend({ref:nm([s6,s5]),argument:nu({name:iN(),value:iN()}),context:nu({arguments:n_(iN(),iN()).optional()}).optional()}),s8=n6.extend({method:nw("completion/complete"),params:s7}),le=ot.extend({completion:nd({values:nl(iN()).max(100),total:nP(i5().int()),hasMore:nP(ne())})}),lt=nu({uri:iN().startsWith("file://"),name:iN().optional(),_meta:n_(iN(),nn()).optional()}),lr=n6.extend({method:nw("roots/list"),params:n3.optional()}),la=ot.extend({roots:nl(lt)}),li=n8.extend({method:nw("notifications/roots/list_changed"),params:n7.optional()}),ln=nd({ttl:i5().optional(),pollInterval:i5().optional()}),lo=nS(["working","input_required","completed","failed","cancelled"]),ls=nu({taskId:iN(),status:lo,ttl:nm([i5(),nr()]),createdAt:iN(),lastUpdatedAt:iN(),pollInterval:nP(i5()),statusMessage:nP(iN())}),ll=ot.extend({task:ls}),lc=n7.merge(ls),lu=n8.extend({method:nw("notifications/tasks/status"),params:lc}),ld=n6.extend({method:nw("tasks/get"),params:n3.extend({taskId:iN()})}),lp=ot.merge(ls),lm=n6.extend({method:nw("tasks/result"),params:n3.extend({taskId:iN()})}),lh=ot.loose(),lf=oI.extend({method:nw("tasks/list")}),lg=oN.extend({tasks:nl(ls)}),ly=n6.extend({method:nw("tasks/cancel"),params:n3.extend({taskId:iN()})}),lv=ot.merge(ls),l_=nm([oE,o$,ox,s8,sP,sa,se,oV,oH,oK,oY,oX,o1,s$,sy]),lb=nm([od,oO,ok,li]),lS=nm([oc,sL,sZ,s3,la]),l$=nm([oE,sM,s2,lr]),lw=nm([od,oO,sT,o6,oW,sw,sm,o9,s4]),lR=nm([oc,oR,oP,le,sp,st,oF,oJ,oG,s_,sv,o3]);N||(N={});let lk=r4(iV,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eD}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lx=nd({resource:iN().url(),authorization_servers:nl(lk).optional(),jwks_uri:iN().url().optional(),scopes_supported:nl(iN()).optional(),bearer_methods_supported:nl(iN()).optional(),resource_signing_alg_values_supported:nl(iN()).optional(),resource_name:iN().optional(),resource_documentation:iN().optional(),resource_policy_uri:iN().url().optional(),resource_tos_uri:iN().url().optional(),tls_client_certificate_bound_access_tokens:ne().optional(),authorization_details_types_supported:nl(iN()).optional(),dpop_signing_alg_values_supported:nl(iN()).optional(),dpop_bound_access_tokens_required:ne().optional()}),lP=nd({issuer:iN(),authorization_endpoint:lk,token_endpoint:lk,registration_endpoint:lk.optional(),scopes_supported:nl(iN()).optional(),response_types_supported:nl(iN()),response_modes_supported:nl(iN()).optional(),grant_types_supported:nl(iN()).optional(),token_endpoint_auth_methods_supported:nl(iN()).optional(),token_endpoint_auth_signing_alg_values_supported:nl(iN()).optional(),service_documentation:lk.optional(),revocation_endpoint:lk.optional(),revocation_endpoint_auth_methods_supported:nl(iN()).optional(),revocation_endpoint_auth_signing_alg_values_supported:nl(iN()).optional(),introspection_endpoint:iN().optional(),introspection_endpoint_auth_methods_supported:nl(iN()).optional(),introspection_endpoint_auth_signing_alg_values_supported:nl(iN()).optional(),code_challenge_methods_supported:nl(iN()).optional(),client_id_metadata_document_supported:ne().optional(),authorization_response_iss_parameter_supported:ne().optional().catch(void 0),dpop_signing_alg_values_supported:nl(iN()).optional()}),lE=nd({issuer:iN(),authorization_endpoint:lk,token_endpoint:lk,userinfo_endpoint:lk.optional(),jwks_uri:lk,registration_endpoint:lk.optional(),scopes_supported:nl(iN()).optional(),response_types_supported:nl(iN()),response_modes_supported:nl(iN()).optional(),grant_types_supported:nl(iN()).optional(),acr_values_supported:nl(iN()).optional(),subject_types_supported:nl(iN()),id_token_signing_alg_values_supported:nl(iN()),id_token_encryption_alg_values_supported:nl(iN()).optional(),id_token_encryption_enc_values_supported:nl(iN()).optional(),userinfo_signing_alg_values_supported:nl(iN()).optional(),userinfo_encryption_alg_values_supported:nl(iN()).optional(),userinfo_encryption_enc_values_supported:nl(iN()).optional(),request_object_signing_alg_values_supported:nl(iN()).optional(),request_object_encryption_alg_values_supported:nl(iN()).optional(),request_object_encryption_enc_values_supported:nl(iN()).optional(),token_endpoint_auth_methods_supported:nl(iN()).optional(),token_endpoint_auth_signing_alg_values_supported:nl(iN()).optional(),display_values_supported:nl(iN()).optional(),claim_types_supported:nl(iN()).optional(),claims_supported:nl(iN()).optional(),service_documentation:iN().optional(),claims_locales_supported:nl(iN()).optional(),ui_locales_supported:nl(iN()).optional(),claims_parameter_supported:ne().optional(),request_parameter_supported:ne().optional(),request_uri_parameter_supported:ne().optional(),require_request_uri_registration:ne().optional(),op_policy_uri:lk.optional(),op_tos_uri:lk.optional(),client_id_metadata_document_supported:ne().optional(),authorization_response_iss_parameter_supported:ne().optional().catch(void 0)}),lT=nu({...lE.shape,...lP.pick({code_challenge_methods_supported:!0}).shape}),lj=nu({access_token:iN(),id_token:iN().optional(),token_type:iN(),expires_in:new i3(r2({type:"number",coerce:!0,checks:[],...e_(void 0)})).optional(),scope:iN().optional(),refresh_token:iN().optional(),issuer:iN().optional().catch(void 0)}).strip(),lO=nu({issued_token_type:nw("urn:ietf:params:oauth:token-type:id-jag"),access_token:iN(),token_type:iN().optional(),expires_in:i5().optional(),scope:iN().optional()}).strip(),lC=nu({error:iN(),error_description:iN().optional(),error_uri:iN().optional()}),lI=lk.optional().or(nw("").transform(()=>void 0)),lN=nu({redirect_uris:nl(lk),token_endpoint_auth_method:iN().optional(),grant_types:nl(iN()).optional(),response_types:nl(iN()).optional(),application_type:iN().optional(),client_name:iN().optional(),client_uri:lk.optional(),logo_uri:lI,scope:iN().optional(),contacts:nl(iN()).optional(),tos_uri:lI,policy_uri:iN().optional(),jwks_uri:lk.optional(),jwks:new na({type:"any"}).optional(),software_id:iN().optional(),software_version:iN().optional(),software_statement:iN().optional()}).strip(),lq=nu({client_id:iN(),client_secret:iN().optional(),client_id_issued_at:i5().optional(),client_secret_expires_at:i5().optional(),issuer:iN().optional().catch(void 0)}).strip(),lA=lN.merge(lq),lz=nu({error:iN(),error_description:iN().optional()}).strip(),lM=nu({token:iN(),token_type_hint:iN().optional()}).strip(),lL=Symbol.for("mcp.sdk.errorBrands");function lZ(e,t){let r=new Set,a=t;for(;"function"==typeof a;){let e=a.mcpBrand;Object.prototype.hasOwnProperty.call(a,"mcpBrand")&&"string"==typeof e&&r.add(e),a=Object.getPrototypeOf(a)}0!==r.size&&Object.defineProperty(e,lL,{value:r,enumerable:!1,configurable:!0})}function lD(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,lL)){let r=t[lL];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let lU=((k={}).InvalidRequest="invalid_request",k.InvalidClient="invalid_client",k.InvalidGrant="invalid_grant",k.UnauthorizedClient="unauthorized_client",k.UnsupportedGrantType="unsupported_grant_type",k.InvalidScope="invalid_scope",k.AccessDenied="access_denied",k.ServerError="server_error",k.TemporarilyUnavailable="temporarily_unavailable",k.UnsupportedResponseType="unsupported_response_type",k.UnsupportedTokenType="unsupported_token_type",k.InvalidToken="invalid_token",k.MethodNotAllowed="method_not_allowed",k.TooManyRequests="too_many_requests",k.InvalidClientMetadata="invalid_client_metadata",k.InvalidRedirectUri="invalid_redirect_uri",k.InsufficientScope="insufficient_scope",k.InvalidTarget="invalid_target",k.InvalidDpopProof="invalid_dpop_proof",k.UseDpopNonce="use_dpop_nonce",k);var lV=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return lD(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lD(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",lZ(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let lF=((x={}).NotConnected="NOT_CONNECTED",x.AlreadyConnected="ALREADY_CONNECTED",x.NotInitialized="NOT_INITIALIZED",x.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",x.RequestTimeout="REQUEST_TIMEOUT",x.ConnectionClosed="CONNECTION_CLOSED",x.SendFailed="SEND_FAILED",x.InvalidResult="INVALID_RESULT",x.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",x.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",x.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",x.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",x.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",x.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",x.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",x.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",x.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",x.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",x.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",x);var lH=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return lD(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lD(this,e)}constructor(e,t,r,a){super(t,a),this.code=e,this.data=r,this.name="SdkError",lZ(this,new.target)}};(class extends lH{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,a){super(e,t,r,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lJ={};function lB(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lK(e,t){let r={};for(let[a,i]of Object.entries(e)){if(void 0===i)continue;let e=void 0===t?void 0:t[a];if(void 0===e){r[a]=i;continue}if(lB(i)&&lB(e)){let t={};for(let[r,n]of Object.entries(i))void 0!==n&&void 0===e[r]&&("elicitation"!==a||"form"!==r||void 0!==e.form||void 0!==e.url)&&(t[r]=n);Object.keys(t).length>0&&(r[a]=t)}}return Object.keys(r).length>0?r:void 0}let lG="2026-07-28",lW=[lG];function lY(e){return e.filter(e=>e>=lG)}function lX(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let lQ=["task","inputRequests","requestState"];function l0(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||lQ.some(t=>t in e)?e:{...e,content:[]}}function l1(){let e,t,r,a,n,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w,R,k,x,P,E,T,j,O,C,I,N,q,A,z,M,L,Z,D,U,V,F,H,J,B,K,G,W,Y,X,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,eg,ey,ev,e_,eb,eS,e$,ew,eR,ek,ex,eP,eE,eT,ej,eO,eC,eI,eN,eq,eA,ez,eM,eL,eZ,eD,eU,eV,eF,eH,eJ,eB,eK,eG,eW,eY,eX,eQ,e0,e1,e2,e9,e4,e3,e5,e6,e7,e8,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,tg,ty,tv,t_,tb,tS,t$;return i??=(e=nZ(()=>nm([iN(),i5(),ne(),nr(),n_(iN(),e),nl(e)])),t=n_(iN(),e),r=nm([iN(),i5().int()]),a=iN(),n=nu({ttl:i5().optional()}),o=nu({taskId:iN()}),c=(l=nu({_meta:(s=nd({progressToken:r.optional(),"io.modelcontextprotocol/related-task":o.optional()})).optional()})).extend({task:n.optional()}),u=nu({method:iN(),params:l.loose().optional()}),d=nu({_meta:s.optional()}),p=nu({method:iN(),params:d.loose().optional()}),m=nd({_meta:s.optional()}),h=nm([iN(),i5().int()]),f=m.strict(),g=d.extend({requestId:h.optional(),reason:iN().optional()}),y=p.extend({method:nw("notifications/cancelled"),params:g}),v=nu({src:iN(),mimeType:iN().optional(),sizes:nl(iN()).optional(),theme:nS(["light","dark"]).optional()}),_=nu({icons:nl(v).optional()}),S=(b=nu({name:iN(),title:iN().optional()})).extend({...b.shape,..._.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),$=ny(nu({applyDefaults:ne().optional()}),t),w=nU(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,ny(nu({form:$.optional(),url:t.optional()}),t.optional())),R=nd({list:t.optional(),cancel:t.optional(),requests:nd({sampling:nd({createMessage:t.optional()}).optional(),elicitation:nd({create:t.optional()}).optional()}).optional()}),k=nd({list:t.optional(),cancel:t.optional(),requests:nd({tools:nd({call:t.optional()}).optional()}).optional()}),x=nu({experimental:n_(iN(),t).optional(),sampling:nu({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:nu({listChanged:ne().optional()}).optional(),tasks:R.optional(),extensions:n_(iN(),t).optional()}),P=l.extend({protocolVersion:iN(),capabilities:x,clientInfo:S}),E=u.extend({method:nw("initialize"),params:P}),T=nu({experimental:n_(iN(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:nu({listChanged:ne().optional()}).optional(),resources:nu({subscribe:ne().optional(),listChanged:ne().optional()}).optional(),tools:nu({listChanged:ne().optional()}).optional(),tasks:k.optional(),extensions:n_(iN(),t).optional()}),j=m.extend({protocolVersion:iN(),capabilities:T,serverInfo:S,instructions:iN().optional()}),O=p.extend({method:nw("notifications/initialized"),params:d.optional()}),C=u.extend({method:nw("ping"),params:l.optional()}),I=nu({progress:i5(),total:nP(i5()),message:nP(iN())}),N=nu({...d.shape,...I.shape,progressToken:r}),q=p.extend({method:nw("notifications/progress"),params:N}),A=l.extend({cursor:a.optional()}),z=u.extend({params:A.optional()}),M=m.extend({nextCursor:a.optional()}),Z=(L=nu({uri:iN(),mimeType:nP(iN()),_meta:n_(iN(),nn()).optional()})).extend({text:iN()}),D=iN().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),U=L.extend({blob:D}),F=nu({audience:nl(V=nS(["user","assistant"])).optional(),priority:i5().min(0).max(1).optional(),lastModified:r3(iA,{offset:!0}).optional()}),H=nu({...b.shape,..._.shape,uri:iN(),description:nP(iN()),mimeType:nP(iN()),size:nP(i5()),annotations:F.optional(),_meta:nP(nd({}))}),J=nu({...b.shape,..._.shape,uriTemplate:iN(),description:nP(iN()),mimeType:nP(iN()),annotations:F.optional(),_meta:nP(nd({}))}),B=z.extend({method:nw("resources/list")}),K=M.extend({resources:nl(H)}),G=z.extend({method:nw("resources/templates/list")}),W=M.extend({resourceTemplates:nl(J)}),Y=l.extend({uri:iN()}),X=u.extend({method:nw("resources/read"),params:Y}),Q=m.extend({contents:nl(nm([Z,U]))}),ee=p.extend({method:nw("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:nw("resources/subscribe"),params:Y}),er=u.extend({method:nw("resources/unsubscribe"),params:Y}),ea=d.extend({uri:iN()}),ei=p.extend({method:nw("notifications/resources/updated"),params:ea}),en=nu({name:iN(),description:nP(iN()),required:nP(ne())}),eo=nu({...b.shape,..._.shape,description:nP(iN()),arguments:nP(nl(en)),_meta:nP(nd({}))}),es=z.extend({method:nw("prompts/list")}),el=M.extend({prompts:nl(eo)}),ec=l.extend({name:iN(),arguments:n_(iN(),iN()).optional()}),eu=u.extend({method:nw("prompts/get"),params:ec}),ed=nu({type:nw("text"),text:iN(),annotations:F.optional(),_meta:n_(iN(),nn()).optional()}),ep=nu({type:nw("image"),data:D,mimeType:iN(),annotations:F.optional(),_meta:n_(iN(),nn()).optional()}),em=nu({type:nw("audio"),data:D,mimeType:iN(),annotations:F.optional(),_meta:n_(iN(),nn()).optional()}),eh=nu({type:nw("tool_use"),name:iN(),id:iN(),input:n_(iN(),nn()),_meta:n_(iN(),nn()).optional()}),ef=nu({type:nw("resource"),resource:nm([Z,U]),annotations:F.optional(),_meta:n_(iN(),nn()).optional()}),ev=nu({role:V,content:ey=nm([ed,ep,em,eg=H.extend({type:nw("resource_link")}),ef])}),e_=m.extend({description:iN().optional(),messages:nl(ev)}),eb=p.extend({method:nw("notifications/prompts/list_changed"),params:d.optional()}),eS=nu({title:iN().optional(),readOnlyHint:ne().optional(),destructiveHint:ne().optional(),idempotentHint:ne().optional(),openWorldHint:ne().optional()}),e$=nu({taskSupport:nS(["required","optional","forbidden"]).optional()}),ew=nu({...b.shape,..._.shape,description:iN().optional(),inputSchema:nu({type:nw("object"),properties:n_(iN(),e).optional(),required:nl(iN()).optional()}).catchall(nn()),outputSchema:nu({type:nw("object"),properties:n_(iN(),e).optional(),required:nl(iN()).optional()}).catchall(nn()).optional(),annotations:eS.optional(),execution:e$.optional(),_meta:n_(iN(),nn()).optional()}),eR=z.extend({method:nw("tools/list")}),ek=M.extend({tools:nl(ew)}),ex=m.extend({content:nl(ey),structuredContent:n_(iN(),nn()).optional(),isError:ne().optional()}),eP=c.extend({name:iN(),arguments:n_(iN(),nn()).optional()}),eE=u.extend({method:nw("tools/call"),params:eP}),eT=p.extend({method:nw("notifications/tools/list_changed"),params:d.optional()}),ej=nS(["debug","info","notice","warning","error","critical","alert","emergency"]),eO=l.extend({level:ej}),eC=u.extend({method:nw("logging/setLevel"),params:eO}),eI=d.extend({level:ej,logger:iN().optional(),data:nn()}),eN=p.extend({method:nw("notifications/message"),params:eI}),eq=nu({name:iN().optional()}),eA=nu({hints:nl(eq).optional(),costPriority:i5().min(0).max(1).optional(),speedPriority:i5().min(0).max(1).optional(),intelligencePriority:i5().min(0).max(1).optional()}),ez=nu({mode:nS(["auto","required","none"]).optional()}),eM=nu({type:nw("tool_result"),toolUseId:iN().describe("The unique identifier for the corresponding tool call."),content:nl(ey),structuredContent:nu({}).loose().optional(),isError:ne().optional(),_meta:n_(iN(),nn()).optional()}),eL=nf("type",[ed,ep,em]),eD=nu({role:V,content:nm([eZ=nf("type",[ed,ep,em,eh,eM]),nl(eZ)]),_meta:n_(iN(),nn()).optional()}),eU=c.extend({messages:nl(eD),modelPreferences:eA.optional(),systemPrompt:iN().optional(),includeContext:nS(["none","thisServer","allServers"]).optional(),temperature:i5().optional(),maxTokens:i5().int(),stopSequences:nl(iN()).optional(),metadata:t.optional(),tools:nl(ew).optional(),toolChoice:ez.optional()}),eV=u.extend({method:nw("sampling/createMessage"),params:eU}),eF=m.extend({model:iN(),stopReason:nP(nS(["endTurn","stopSequence","maxTokens"]).or(iN())),role:V,content:eL}),eH=m.extend({model:iN(),stopReason:nP(nS(["endTurn","stopSequence","maxTokens","toolUse"]).or(iN())),role:V,content:nm([eZ,nl(eZ)])}),eJ=nu({type:nw("boolean"),title:iN().optional(),description:iN().optional(),default:ne().optional()}),eB=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),minLength:i5().optional(),maxLength:i5().optional(),format:nS(["email","uri","date","date-time"]).optional(),default:iN().optional()}),eK=nu({type:nS(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i5().optional(),maximum:i5().optional(),default:i5().optional()}),eG=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),default:iN().optional()}),eW=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),oneOf:nl(nu({const:iN(),title:iN()})),default:iN().optional()}),eY=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),enumNames:nl(iN()).optional(),default:iN().optional()}),eX=nm([eG,eW]),eQ=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({type:nw("string"),enum:nl(iN())}),default:nl(iN()).optional()}),e1=nm([eQ,e0=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({anyOf:nl(nu({const:iN(),title:iN()}))}),default:nl(iN()).optional()})]),e2=nm([eY,eX,e1]),e9=nm([e2,eJ,eB,eK]),e4=c.extend({mode:nw("form").optional(),message:iN(),requestedSchema:nu({type:nw("object"),properties:n_(iN(),e9),required:nl(iN()).optional()}).catchall(nn())}),e5=nm([e4,e3=c.extend({mode:nw("url"),message:iN(),elicitationId:iN(),url:iN().url()})]),e6=u.extend({method:nw("elicitation/create"),params:e5}),e7=d.extend({elicitationId:iN()}),e8=p.extend({method:nw("notifications/elicitation/complete"),params:e7}),te=m.extend({action:nS(["accept","decline","cancel"]),content:nU(e=>null===e?void 0:e,n_(iN(),nm([iN(),i5(),ne(),nl(iN())])).optional())}),tt=nu({type:nw("ref/resource"),uri:iN()}),tr=nu({type:nw("ref/prompt"),name:iN()}),ta=l.extend({ref:nm([tr,tt]),argument:nu({name:iN(),value:iN()}),context:nu({arguments:n_(iN(),iN()).optional()}).optional()}),ti=u.extend({method:nw("completion/complete"),params:ta}),tn=m.extend({completion:nd({values:nl(iN()).max(100),total:nP(i5().int()),hasMore:nP(ne())})}),to=nu({uri:iN().startsWith("file://"),name:iN().optional(),_meta:n_(iN(),nn()).optional()}),ts=u.extend({method:nw("roots/list"),params:l.optional()}),tl=m.extend({roots:nl(to)}),tc=p.extend({method:nw("notifications/roots/list_changed"),params:d.optional()}),tu=nd({ttl:i5().optional(),pollInterval:i5().optional()}),td=nS(["working","input_required","completed","failed","cancelled"]),tp=nu({taskId:iN(),status:td,ttl:nm([i5(),nr()]),createdAt:iN(),lastUpdatedAt:iN(),pollInterval:nP(i5()),statusMessage:nP(iN())}),tm=m.extend({task:tp}),th=d.merge(tp),tf=p.extend({method:nw("notifications/tasks/status"),params:th}),tg=u.extend({method:nw("tasks/get"),params:l.extend({taskId:iN()})}),ty=m.merge(tp),tv=u.extend({method:nw("tasks/result"),params:l.extend({taskId:iN()})}),t_=m.loose(),tb=z.extend({method:nw("tasks/list")}),tS=M.extend({tasks:nl(tp)}),t$=u.extend({method:nw("tasks/cancel"),params:l.extend({taskId:iN()})}),{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,TaskMetadataSchema:n,RelatedTaskMetadataSchema:o,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:y,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:k,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:P,InitializeRequestSchema:E,ServerCapabilitiesSchema:T,InitializeResultSchema:j,InitializedNotificationSchema:O,PingRequestSchema:C,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:A,PaginatedRequestSchema:z,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:Z,BlobResourceContentsSchema:U,RoleSchema:V,AnnotationsSchema:F,ResourceSchema:H,ResourceTemplateSchema:J,ListResourcesRequestSchema:B,ListResourcesResultSchema:K,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:W,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:X,ReadResourceResultSchema:Q,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:eo,ListPromptsRequestSchema:es,ListPromptsResultSchema:el,GetPromptRequestParamsSchema:ec,GetPromptRequestSchema:eu,TextContentSchema:ed,ImageContentSchema:ep,AudioContentSchema:em,ToolUseContentSchema:eh,EmbeddedResourceSchema:ef,ResourceLinkSchema:eg,ContentBlockSchema:ey,PromptMessageSchema:ev,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eb,ToolAnnotationsSchema:eS,ToolExecutionSchema:e$,ToolSchema:ew,ListToolsRequestSchema:eR,ListToolsResultSchema:ek,CallToolResultSchema:ex,CallToolRequestParamsSchema:eP,CallToolRequestSchema:eE,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eO,SetLevelRequestSchema:eC,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eq,ModelPreferencesSchema:eA,ToolChoiceSchema:ez,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eD,CreateMessageRequestParamsSchema:eU,CreateMessageRequestSchema:eV,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eJ,StringSchemaSchema:eB,NumberSchemaSchema:eK,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eW,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eX,UntitledMultiSelectEnumSchemaSchema:eQ,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e6,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:e8,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:to,ListRootsRequestSchema:ts,ListRootsResultSchema:tl,RootsListChangedNotificationSchema:tc,TaskCreationParamsSchema:tu,TaskStatusSchema:td,TaskSchema:tp,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:th,TaskStatusNotificationSchema:tf,GetTaskRequestSchema:tg,GetTaskResultSchema:ty,GetTaskPayloadRequestSchema:tv,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tb,ListTasksResultSchema:tS,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(tp),ClientRequestSchema:nm([C,E,ti,eC,eu,es,B,G,X,et,er,eE,eR,tg,tv,tb,t$]),ClientNotificationSchema:nm([y,q,O,tc,tf]),ClientResultSchema:nm([f,eF,eH,te,tl,ty,tS,tm]),ServerRequestSchema:nm([C,eV,e6,ts,tg,tv,tb,t$]),ServerNotificationSchema:nm([y,q,eN,ei,ee,eT,eb,tf,e8]),ServerResultSchema:nm([f,j,tn,e_,el,K,W,Q,ex,ek,ty,tS,tm]),CallToolResultWireSchema:nn().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of lQ)if(r in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${r}' — another result family cannot default into an empty tools/call success`})}}).transform(l0).pipe(ex)})}function l2(e){return"object"!==e.type}let l9=new Set(["const","enum","default","examples"]),l4=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l3(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let l5={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},l6={"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},l7={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};function l8(){if(n)return n;let e=l1();return n={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}}}function ce(e){return Object.prototype.hasOwnProperty.call(l5,e)}function ct(e){return Object.prototype.hasOwnProperty.call(l6,e)}function cr(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ca(e,t){if(void 0===e)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)}}Object.keys(l5),Object.keys(l6);let ci={ok:!1,reason:"not-in-era"};function cn(e){return cr(e)&&cr(e.outputSchema)&&l2(e.outputSchema)}let co={era:"2025-11-25",hasRequestMethod:ce,hasNotificationMethod:ct,validateRequest:(e,t)=>ca(ce(e)?l8().requestSchemas[e]:void 0,t),validateResult:(e,t)=>ca(Object.prototype.hasOwnProperty.call(l7,e)?l8().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>ca(ct(e)?l8().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ci,validateInputResponse:()=>ci,samplingResultVariant:(e,t)=>{let r=l1();return ca(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=lX(e),a=r.structuredContent;if(void 0===a)return r;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==t&&l2(t);return i||n?{...r,structuredContent:{result:a}}:r},decodeResult(e,t){if(cr(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let r=t.tools;return Array.isArray(r)&&r.some(e=>cn(e))?{...t,tools:r.map(e=>cn(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(l3(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let a="string"==typeof(t=e.$schema)&&K.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,i=(e,t)=>{if(Array.isArray(e))return e.map(e=>i(e,!1));if(null===e||"object"!=typeof e||!t&&l3(e.$id))return e;let r={},n=!1;for(let[o,s]of Object.entries(e))t?r[o]=i(s,!1):("$ref"===o||"$dynamicRef"===o)&&"string"==typeof s?r[o]="#"===s?"#/properties/result":s.startsWith("#/")?`#/properties/result${s.slice(1)}`:s:"$recursiveRef"===o&&"#"===s&&a?n=!0:l9.has(o)?r[o]=s:l4.has(o)?r[o]=i(s,!0):r[o]=i(s,!1);return n&&("$ref"in r?r.allOf=[...Array.isArray(r.allOf)?r.allOf:[],{$ref:"#/properties/result"}]:r.$ref="#/properties/result"),r};return{...void 0!==r&&{$schema:r},type:"object",properties:{result:i(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function cs(){return o??=function(){let e=nZ(()=>nm([iN(),i5(),ne(),nr(),n_(iN(),e),nl(e)])),t=n_(iN(),e),r=nm([iN(),i5().int()]),a=iN(),i=nm([iN(),i5().int()]),n=nS(["user","assistant"]),o=nS(["debug","info","notice","warning","error","critical","alert","emergency"]),s=iN().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=nu({ttl:i5().optional()}),c=nu({taskId:iN()}),u=nd({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=nu({_meta:u.optional()}),p=d.extend({task:l.optional()}),m=nu({_meta:u.optional()}),h=nu({method:iN(),params:m.loose().optional()}),f=nu({src:iN(),mimeType:iN().optional(),sizes:nl(iN()).optional(),theme:nS(["light","dark"]).optional()}),g=nu({icons:nl(f).optional()}),y=nu({name:iN(),title:iN().optional()}),v=y.extend({...y.shape,...g.shape,version:iN(),websiteUrl:iN().optional(),description:iN().optional()}),_=ny(nu({applyDefaults:ne().optional()}),t),b=nU(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,ny(nu({form:_.optional(),url:t.optional()}),t.optional())),S=nd({list:t.optional(),cancel:t.optional(),requests:nd({sampling:nd({createMessage:t.optional()}).optional(),elicitation:nd({create:t.optional()}).optional()}).optional()}),$=nd({list:t.optional(),cancel:t.optional(),requests:nd({tools:nd({call:t.optional()}).optional()}).optional()}),w=nu({experimental:n_(iN(),t).optional(),sampling:nu({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:nu({listChanged:ne().optional()}).optional(),tasks:S.optional(),extensions:n_(iN(),t).optional()}),R=nu({experimental:n_(iN(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:nu({listChanged:ne().optional()}).optional(),resources:nu({subscribe:ne().optional(),listChanged:ne().optional()}).optional(),tools:nu({listChanged:ne().optional()}).optional(),tasks:$.optional(),extensions:n_(iN(),t).optional()}),k=nu({progress:i5(),total:nP(i5()),message:nP(iN())}),x=nu({...m.shape,...k.shape,progressToken:r}),P=h.extend({method:nw("notifications/progress"),params:x}),E=m.extend({level:o,logger:iN().optional(),data:nn()}),T=h.extend({method:nw("notifications/message"),params:E}),j=nu({uri:iN(),mimeType:nP(iN()),_meta:n_(iN(),nn()).optional()}),O=j.extend({text:iN()}),C=j.extend({blob:s}),I=nu({audience:nl(n).optional(),priority:i5().min(0).max(1).optional(),lastModified:r3(iA,{offset:!0}).optional()}),N=nu({...y.shape,...g.shape,uri:iN(),description:nP(iN()),mimeType:nP(iN()),size:nP(i5()),annotations:I.optional(),_meta:nP(nd({}))}),q=nu({...y.shape,...g.shape,uriTemplate:iN(),description:nP(iN()),mimeType:nP(iN()),annotations:I.optional(),_meta:nP(nd({}))}),A=h.extend({method:nw("notifications/resources/list_changed"),params:m.optional()}),z=m.extend({uri:iN()}),M=h.extend({method:nw("notifications/resources/updated"),params:z}),L=nu({name:iN(),description:nP(iN()),required:nP(ne())}),Z=nu({...y.shape,...g.shape,description:nP(iN()),arguments:nP(nl(L)),_meta:nP(nd({}))}),D=h.extend({method:nw("notifications/prompts/list_changed"),params:m.optional()}),U=nu({type:nw("text"),text:iN(),annotations:I.optional(),_meta:n_(iN(),nn()).optional()}),V=nu({type:nw("image"),data:s,mimeType:iN(),annotations:I.optional(),_meta:n_(iN(),nn()).optional()}),F=nu({type:nw("audio"),data:s,mimeType:iN(),annotations:I.optional(),_meta:n_(iN(),nn()).optional()}),H=nu({type:nw("tool_use"),name:iN(),id:iN(),input:n_(iN(),nn()),_meta:n_(iN(),nn()).optional()}),J=nu({type:nw("resource"),resource:nm([O,C]),annotations:I.optional(),_meta:n_(iN(),nn()).optional()}),B=N.extend({type:nw("resource_link")}),K=nm([U,V,F,B,J]),G=nu({role:n,content:K}),W=nu({title:iN().optional(),readOnlyHint:ne().optional(),destructiveHint:ne().optional(),idempotentHint:ne().optional(),openWorldHint:ne().optional()}),Y=h.extend({method:nw("notifications/tools/list_changed"),params:m.optional()}),X=nu({name:iN().optional()}),Q=nu({hints:nl(X).optional(),costPriority:i5().min(0).max(1).optional(),speedPriority:i5().min(0).max(1).optional(),intelligencePriority:i5().min(0).max(1).optional()}),ee=nu({mode:nS(["auto","required","none"]).optional()}),et=nu({type:nw("boolean"),title:iN().optional(),description:iN().optional(),default:ne().optional()}),er=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),minLength:i5().optional(),maxLength:i5().optional(),format:nS(["email","uri","date","date-time"]).optional(),default:iN().optional()}),ea=nu({type:nS(["number","integer"]),title:iN().optional(),description:iN().optional(),minimum:i5().optional(),maximum:i5().optional(),default:i5().optional()}),ei=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),default:iN().optional()}),en=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),oneOf:nl(nu({const:iN(),title:iN()})),default:iN().optional()}),eo=nu({type:nw("string"),title:iN().optional(),description:iN().optional(),enum:nl(iN()),enumNames:nl(iN()).optional(),default:iN().optional()}),es=nm([ei,en]),el=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({type:nw("string"),enum:nl(iN())}),default:nl(iN()).optional()}),ec=nu({type:nw("array"),title:iN().optional(),description:iN().optional(),minItems:i5().optional(),maxItems:i5().optional(),items:nu({anyOf:nl(nu({const:iN(),title:iN()}))}),default:nl(iN()).optional()}),eu=nm([el,ec]),ed=nm([eo,es,eu]),ep=nm([ed,et,er,ea]),em=p.extend({mode:nw("form").optional(),message:iN(),requestedSchema:nu({type:nw("object"),properties:n_(iN(),ep),required:nl(iN()).optional()}).catchall(nn())}),eh=nu({type:nw("ref/resource"),uri:iN()}),ef=nu({type:nw("ref/prompt"),name:iN()}),eg=nu({uri:iN().startsWith("file://"),name:iN().optional(),_meta:n_(iN(),nn()).optional()}),ey=w.shape,ev=nu({experimental:ey.experimental,sampling:ey.sampling,elicitation:ey.elicitation,roots:ey.roots,extensions:ey.extensions}),e_=R.shape,eb=nu({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=nd({progressToken:r.optional(),[nH]:iN(),[nJ]:v.optional(),[nK]:ev,[nW]:o.optional()}),e$=nu({...y.shape,...g.shape,description:iN().optional(),inputSchema:nd({$schema:iN().optional(),type:nw("object")}),outputSchema:nd({$schema:iN().optional()}).optional(),annotations:W.optional(),_meta:n_(iN(),nn()).optional()}),ew=nu({type:nw("tool_result"),toolUseId:iN(),content:nl(K),structuredContent:nn().optional(),isError:ne().optional(),_meta:n_(iN(),nn()).optional()}),eR=nm([U,V,F,H,ew]),ek=nu({role:n,content:nm([eR,nl(eR)]),_meta:n_(iN(),nn()).optional()}),ex=iN(),eP=nd({[nB]:v.optional().catch(void 0)}),eE=eP.optional();function eT(e){return nd({_meta:eE,resultType:ex.default("complete"),...e})}let ej=eT({}),eO=eT({nextCursor:a.optional()}),eC=eT({content:nl(K),structuredContent:nn().optional(),isError:ne().optional()}),eI=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),tools:nl(e$),nextCursor:a.optional()}),eN=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),prompts:nl(Z),nextCursor:a.optional()}),eq=eT({description:iN().optional(),messages:nl(G)}),eA=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),resources:nl(N),nextCursor:a.optional()}),ez=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),resourceTemplates:nl(q),nextCursor:a.optional()}),eM=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),contents:nl(nm([O,C]))}),eL=eT({completion:nu({values:nl(iN()).max(100),total:i5().int().optional(),hasMore:ne().optional()}).loose()}),eZ=eT({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"])}),eD=eT({ttlMs:i5().int().min(0).catch(0),cacheScope:nS(["public","private"]).catch("private"),supportedVersions:nl(iN()),capabilities:eb,instructions:iN().optional()}),eU=nu({messages:nl(ek),modelPreferences:Q.optional(),systemPrompt:iN().optional(),includeContext:nS(["none","thisServer","allServers"]).optional(),temperature:i5().optional(),maxTokens:i5().int(),stopSequences:nl(iN()).optional(),metadata:t.optional(),tools:nl(e$).optional(),toolChoice:ee.optional()}),eV=nu({method:nw("sampling/createMessage"),params:eU}),eF=nu({method:nw("roots/list"),params:nu({_meta:n_(iN(),nn()).optional()}).optional()}),eH=nu({...ek.shape,model:iN(),stopReason:iN().optional()}),eJ=nu({roots:nl(eg)}),eB=nu({action:nS(["accept","decline","cancel"]),content:n_(iN(),nm([iN(),i5(),ne(),nl(iN())])).optional()}),eK=nu({mode:nw("url"),message:iN(),url:iN().url()}),eG=nm([em,eK]),eW=nu({method:nw("elicitation/create"),params:eG}),eY=nm([eV,eF,eW]),eX=nm([eH,eJ,eB]),eQ=n_(iN(),eY),e0=n_(iN(),eX),e1=eT({inputRequests:eQ.optional(),requestState:iN().optional()}),e2={inputResponses:e0.optional(),requestState:iN().optional()},e9=nu({_meta:eS,...e2}),e4=nd({progressToken:r.optional()});function e3(e,t){return nu({method:nw(e),params:nu({_meta:eS,...t})})}function e5(e,t){return nu({method:nw(e),params:nu({_meta:e4.optional(),...t}).optional()})}let e6={name:iN(),arguments:n_(iN(),nn()).optional(),...e2},e7={cursor:a.optional()},e8=e3("tools/call",e6),te=e3("tools/list",e7),tt=e3("prompts/list",e7),tr=e3("prompts/get",{name:iN(),arguments:n_(iN(),iN()).optional(),...e2}),ta=e3("resources/list",e7),ti=e3("resources/templates/list",e7),tn=e3("resources/read",{uri:iN(),...e2}),to={ref:nm([ef,eh]),argument:nu({name:iN(),value:iN()}),context:nu({arguments:n_(iN(),iN()).optional()}).optional()},ts=e3("completion/complete",to),tl=e3("server/discover",{}),tc=nu({toolsListChanged:ne().optional(),promptsListChanged:ne().optional(),resourcesListChanged:ne().optional(),resourceSubscriptions:nl(iN()).optional()}),tu={notifications:tc},td=e3("subscriptions/listen",tu),tp=eP.extend({"io.modelcontextprotocol/subscriptionId":i}),tm=nd({_meta:tp,resultType:ex.default("complete")}),th={"tools/call":e5("tools/call",e6),"tools/list":e5("tools/list",e7),"prompts/get":e5("prompts/get",{name:iN(),arguments:n_(iN(),iN()).optional()}),"prompts/list":e5("prompts/list",e7),"resources/list":e5("resources/list",e7),"resources/templates/list":e5("resources/templates/list",e7),"resources/read":e5("resources/read",{uri:iN()}),"completion/complete":e5("completion/complete",to),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",tu)};function tf(e){return nd({_meta:eE,...e})}let tg={"tools/call":tf({content:nl(K),structuredContent:nn().optional(),isError:ne().optional()}),"tools/list":tf({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),tools:nl(e$),nextCursor:a.optional()}),"prompts/get":tf({description:iN().optional(),messages:nl(G)}),"prompts/list":tf({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),prompts:nl(Z),nextCursor:a.optional()}),"resources/list":tf({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),resources:nl(N),nextCursor:a.optional()}),"resources/templates/list":tf({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),resourceTemplates:nl(q),nextCursor:a.optional()}),"resources/read":tf({ttlMs:i5().int().min(0),cacheScope:nS(["public","private"]),contents:nl(nm([O,C]))}),"completion/complete":tf({completion:nu({values:nl(iN()).max(100),total:i5().int().optional(),hasMore:ne().optional()}).loose()}),"server/discover":tf({ttlMs:i5().int().min(0).catch(0),cacheScope:nS(["public","private"]).catch("private"),supportedVersions:nl(iN()),capabilities:eb,instructions:iN().optional()}),"subscriptions/listen":tf({})},ty=nd({"io.modelcontextprotocol/subscriptionId":i.optional()}),tv=nu({method:nw("notifications/subscriptions/acknowledged"),params:nu({_meta:ty.optional(),notifications:tc})}),t_=nu({_meta:ty.optional(),requestId:i,reason:iN().optional()}),tb=nu({method:nw("notifications/cancelled"),params:t_}),tS=e=>nu({jsonrpc:nw("2.0"),id:nm([iN(),i5().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:o,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:f,IconsSchema:g,BaseMetadataSchema:y,ImplementationSchema:v,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:R,ProgressSchema:k,ProgressNotificationParamsSchema:x,ProgressNotificationSchema:P,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:T,ResourceContentsSchema:j,TextResourceContentsSchema:O,BlobResourceContentsSchema:C,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:q,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:Z,PromptListChangedNotificationSchema:D,TextContentSchema:U,ImageContentSchema:V,AudioContentSchema:F,ToolUseContentSchema:H,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:K,PromptMessageSchema:G,ToolAnnotationsSchema:W,ToolListChangedNotificationSchema:Y,ModelHintSchema:X,ModelPreferencesSchema:Q,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:eo,SingleSelectEnumSchemaSchema:es,UntitledMultiSelectEnumSchemaSchema:el,TitledMultiSelectEnumSchemaSchema:ec,MultiSelectEnumSchemaSchema:eu,EnumSchemaSchema:ed,PrimitiveSchemaDefinitionSchema:ep,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:eh,PromptReferenceSchema:ef,RootSchema:eg,ClientCapabilities2026Schema:ev,ServerCapabilities2026Schema:eb,RequestMetaEnvelopeSchema:eS,ToolSchema:e$,ToolResultContentSchema:ew,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:ek,ResultTypeSchema:ex,ResultMetaSchema:eP,ResultSchema:ej,PaginatedResultSchema:eO,CallToolResultSchema:eC,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eq,ListResourcesResultSchema:eA,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eZ,DiscoverResultSchema:eD,CreateMessageRequestParamsSchema:eU,CreateMessageRequestSchema:eV,ListRootsRequestSchema:eF,CreateMessageResultSchema:eH,ListRootsResultSchema:eJ,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eK,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eW,InputRequestSchema:eY,InputResponseSchema:eX,InputRequestsSchema:eQ,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e8,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:ts,DiscoverRequestSchema:tl,SubscriptionFilterSchema:tc,SubscriptionsListenRequestSchema:td,SubscriptionsListenResultMetaSchema:tp,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:th,dispatchResultSchemas:tg,NotificationMetaSchema:ty,SubscriptionsAcknowledgedNotificationSchema:tv,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tb,notificationSchemas2026:{"notifications/cancelled":tb,"notifications/progress":P,"notifications/message":T,"notifications/resources/updated":M,"notifications/resources/list_changed":A,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":D,"notifications/subscriptions/acknowledged":tv},JSONRPCResultResponseSchema:tS(ej),CallToolResultResponseSchema:tS(nm([eC,e1])),ListToolsResultResponseSchema:tS(eI),ListPromptsResultResponseSchema:tS(eN),GetPromptResultResponseSchema:tS(nm([eq,e1])),ListResourcesResultResponseSchema:tS(eA),ListResourceTemplatesResultResponseSchema:tS(ez),ReadResourceResultResponseSchema:tS(nm([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eD),SubscriptionsListenResultResponseSchema:tS(tm)}}()}let cl=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],cc=Symbol("modelcontextprotocol.resultCacheHintFallback");function cu(e,t){if(void 0===t)return e;let r=e[cc];if(void 0===r)return{...e,[cc]:t};let a={},i=r.ttlMs??t.ttlMs;void 0!==i&&(a.ttlMs=i);let n=r.cacheScope??t.cacheScope;return void 0!==n&&(a.cacheScope=n),{...e,[cc]:a}}function cd(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function cp(e){return"public"===e||"private"===e}function cm(e,t){if(void 0!==e.ttlMs&&!cd(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(void 0!==e.cacheScope&&!cp(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let ch=((P={})[P.ParseError=-32700]="ParseError",P[P.InvalidRequest=-32600]="InvalidRequest",P[P.MethodNotFound=-32601]="MethodNotFound",P[P.InvalidParams=-32602]="InvalidParams",P[P.InternalError=-32603]="InternalError",P[P.ResourceNotFound=-32002]="ResourceNotFound",P[P.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",P[P.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",P[P.UrlElicitationRequired=-32042]="UrlElicitationRequired",P);var cf=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return lD(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lD(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",lZ(this,new.target)}static fromError(t,r,a){return t===ch.UrlElicitationRequired&&a&&a.elicitations?new cy(a.elicitations,r):t===ch.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new cv({supported:a.supported,requested:a.requested},r):(t===ch.InvalidParams||t===ch.ResourceNotFound)&&"string"==typeof a?.uri&&(t===ch.ResourceNotFound||1===Object.keys(a).length)?new cg(a.uri,r):t===ch.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new c_({requiredCapabilities:a.requiredCapabilities},r):new e(t,r,a)}},cg=class extends cf{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(ch.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},cy=class extends cf{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ch.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},cv=class extends cf{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(ch.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},c_=class extends cf{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(ch.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cb=["tools/call","prompts/get","resources/read"],cS=["elicitation/create","sampling/createMessage","roots/list"];function c$(){if(s)return s;let e=cs();return s={request:{"elicitation/create":nu({method:nw("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":nu({method:nw("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":nu({method:nw("roots/list"),params:nd({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function cw(e){return cS.includes(e)}function cR(e){return cw(e)?c$().request[e]:void 0}let ck={"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},cx={"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 cP(e){return Object.prototype.hasOwnProperty.call(ck,e)}function cE(e){return Object.prototype.hasOwnProperty.call(cx,e)}function cT(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cj(e,t){if(void 0===e)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)}}Object.keys(ck),Object.keys(cx);let cO={ok:!1,reason:"not-in-era"},cC=[nH,nK],cI={era:"2026-07-28",hasRequestMethod:cP,hasNotificationMethod:cE,hasInputRequestMethod:e=>void 0!==cR(e),validateRequest:(e,t)=>cj(cP(e)?cs().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>cj(Object.prototype.hasOwnProperty.call(ck,e)?cs().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>cj(cE(e)?cs().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>cj(cR(e),t),validateInputResponse:(e,t)=>cj(cw(e)?c$().response[e]:void 0,t),samplingResultVariant:()=>cO,outboundEnvelope:e=>({[nH]:e.protocolVersion,[nJ]:e.clientInfo,[nK]:e.clientCapabilities,...void 0!==e.logLevel&&{[nW]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of cC)r in e||t.push({key:r,problem:"missing"});let r=cs().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),a=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===a&&"missing"===e.problem)||t.push({key:a,problem:e.message})}return t},projectCallToolResult:e=>lX(e),inputRequestSchema:cR,decodeResult(e,t){if(!cT(t))return{kind:"invalid",error:new lH(lF.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new lH(lF.InvalidResult,`Invalid result for ${e}: missing required resultType — 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("string"!=typeof r)return{kind:"invalid",error:new lH(lF.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,a=cT(r)?r:{},i=t.requestState,n=void 0===t._meta?void 0:cs().ResultMetaSchema.safeParse(t._meta),o=n?.success?n.data:void 0;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new lH(lF.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,..."string"==typeof i&&{requestState:i},...void 0!==o&&{_meta:o}}}if("complete"!==r)return{kind:"invalid",error:new lH(lF.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let a=function(){if(l)return l;let e=cs();return l={"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}}(),i=Object.hasOwn(a,e)?a[e]:void 0;if(void 0!==i){let r=i.safeParse(t);if(!r.success)return{kind:"invalid",error:new lH(lF.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[nB]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[nB]?e:{...e,_meta:{...r,[nB]:t}}})(function(e,t){var r,a;let i=t[cc];if("complete"!==t.resultType||!cl.includes(e)){let e;return void 0===i?t:(e={...t},delete e[cc],e)}let n=cd(t.ttlMs)?t.ttlMs:void 0!==(r=i)&&cd(r.ttlMs)?r.ttlMs:0,o=cp(t.cacheScope)?t.cacheScope:void 0!==(a=i)&&cp(a.cacheScope)?a.cacheScope:"private",s={...t,ttlMs:n,cacheScope:o};return delete s[cc],s}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||cb.includes(e))return t;throw new cf(ch.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let r=t,a=!1,i=()=>(a||(r={...r},a=!0),r),n=t.tools;"tools/list"===e&&Array.isArray(n)&&n.some(e=>cT(e)&&"execution"in e)&&(i().tools=n.map(e=>{if(!cT(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(cT(o)&&"tasks"in o){let e={...o};delete e.tasks,i().capabilities=e}return r}(e,t))),r),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=cs().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},cN="2026-07-28";function cq(e){return void 0!==e&&e>=lG?cI:co}function cA(e){return void 0!==e.revision?cq(e.revision).era:"modern"===e.era?cI.era:co.era}function cz(e){return cZ.some(t=>t.hasRequestMethod(e))}function cM(e){return cZ.some(t=>t.hasNotificationMethod(e))}function cL(e){return"tasks/get"===e||"tasks/cancel"===e}let cZ=[co,cI];function cD(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cU(e){if(!cD(e))return;let t=e._meta;return cD(t)?t:void 0}function cV(e){let t=cU(e);return void 0!==t&&nH in t}function cF(e){let t=cU(e)?.[nH];return"string"==typeof t?t:void 0}function cH(e){return cq(cN).validateEnvelopeMeta(e)}var cJ=(e=>{let t={};for(var r in e)Z(t,r,{get:e[r],enumerable:!0});return t})({AnnotationsSchema:()=>oZ,AudioContentSchema:()=>so,BaseMetadataSchema:()=>oh,BaseRequestParamsSchema:()=>n3,BlobResourceContentsSchema:()=>oM,BooleanSchemaSchema:()=>sD,CallToolRequestParamsSchema:()=>sS,CallToolRequestSchema:()=>s$,CallToolResultSchema:()=>s_,CancelTaskRequestSchema:()=>ly,CancelTaskResultSchema:()=>lv,CancelledNotificationParamsSchema:()=>ou,CancelledNotificationSchema:()=>od,ClientCapabilitiesSchema:()=>ob,ClientNotificationSchema:()=>lb,ClientRequestSchema:()=>l_,ClientResultSchema:()=>lS,ClientTasksCapabilitySchema:()=>ov,CompatibilityCallToolResultSchema:()=>sb,CompleteRequestParamsSchema:()=>s7,CompleteRequestSchema:()=>s8,CompleteResultSchema:()=>le,ContentBlockSchema:()=>su,CreateMessageRequestParamsSchema:()=>sz,CreateMessageRequestSchema:()=>sM,CreateMessageResultSchema:()=>sL,CreateMessageResultWithToolsSchema:()=>sZ,CreateTaskResultSchema:()=>ll,CursorSchema:()=>n1,DiscoverRequestSchema:()=>ox,DiscoverResultSchema:()=>oP,ElicitRequestFormParamsSchema:()=>sQ,ElicitRequestParamsSchema:()=>s1,ElicitRequestSchema:()=>s2,ElicitRequestURLParamsSchema:()=>s0,ElicitResultSchema:()=>s3,ElicitationCompleteNotificationParamsSchema:()=>s9,ElicitationCompleteNotificationSchema:()=>s4,EmbeddedResourceSchema:()=>sl,EmptyResultSchema:()=>oc,EnumSchemaSchema:()=>sY,GetPromptRequestParamsSchema:()=>sr,GetPromptRequestSchema:()=>sa,GetPromptResultSchema:()=>sp,GetTaskPayloadRequestSchema:()=>lm,GetTaskPayloadResultSchema:()=>lh,GetTaskRequestSchema:()=>ld,GetTaskResultSchema:()=>lp,IconSchema:()=>op,IconsSchema:()=>om,ImageContentSchema:()=>sn,ImplementationSchema:()=>of,InitializeRequestParamsSchema:()=>oS,InitializeRequestSchema:()=>o$,InitializeResultSchema:()=>oR,InitializedNotificationSchema:()=>ok,JSONArraySchema:()=>nQ,JSONObjectSchema:()=>nX,JSONRPCErrorResponseSchema:()=>oo,JSONRPCMessageSchema:()=>os,JSONRPCNotificationSchema:()=>oi,JSONRPCRequestSchema:()=>oa,JSONRPCResponseSchema:()=>ol,JSONRPCResultResponseSchema:()=>on,JSONValueSchema:()=>nY,LegacyTitledEnumSchemaSchema:()=>sJ,ListChangedOptionsBaseSchema:()=>sR,ListPromptsRequestSchema:()=>se,ListPromptsResultSchema:()=>st,ListResourceTemplatesRequestSchema:()=>oH,ListResourceTemplatesResultSchema:()=>oJ,ListResourcesRequestSchema:()=>oV,ListResourcesResultSchema:()=>oF,ListRootsRequestSchema:()=>lr,ListRootsResultSchema:()=>la,ListTasksRequestSchema:()=>lf,ListTasksResultSchema:()=>lg,ListToolsRequestSchema:()=>sy,ListToolsResultSchema:()=>sv,LoggingLevelSchema:()=>sk,LoggingMessageNotificationParamsSchema:()=>sE,LoggingMessageNotificationSchema:()=>sT,ModelHintSchema:()=>sj,ModelPreferencesSchema:()=>sO,MultiSelectEnumSchemaSchema:()=>sW,NotificationSchema:()=>n8,NotificationsParamsSchema:()=>n7,NumberSchemaSchema:()=>sV,PaginatedRequestParamsSchema:()=>oC,PaginatedRequestSchema:()=>oI,PaginatedResultSchema:()=>oN,PingRequestSchema:()=>oE,PrimitiveSchemaDefinitionSchema:()=>sX,ProgressNotificationParamsSchema:()=>oj,ProgressNotificationSchema:()=>oO,ProgressSchema:()=>oT,ProgressTokenSchema:()=>n0,PromptArgumentSchema:()=>o7,PromptListChangedNotificationSchema:()=>sm,PromptMessageSchema:()=>sd,PromptReferenceSchema:()=>s6,PromptSchema:()=>o8,ReadResourceRequestParamsSchema:()=>oB,ReadResourceRequestSchema:()=>oK,ReadResourceResultSchema:()=>oG,RelatedTaskMetadataSchema:()=>n9,RequestIdSchema:()=>or,RequestMetaSchema:()=>n4,RequestSchema:()=>n6,ResourceContentsSchema:()=>oq,ResourceLinkSchema:()=>sc,ResourceListChangedNotificationSchema:()=>oW,ResourceRequestParamsSchema:()=>oB,ResourceSchema:()=>oD,ResourceTemplateReferenceSchema:()=>s5,ResourceTemplateSchema:()=>oU,ResourceUpdatedNotificationParamsSchema:()=>o5,ResourceUpdatedNotificationSchema:()=>o6,ResultMetaObjectSchema:()=>oe,ResultSchema:()=>ot,RoleSchema:()=>oL,RootSchema:()=>lt,RootsListChangedNotificationSchema:()=>li,SamplingContentSchema:()=>sN,SamplingMessageContentBlockSchema:()=>sq,SamplingMessageSchema:()=>sA,ServerCapabilitiesSchema:()=>ow,ServerNotificationSchema:()=>lw,ServerRequestSchema:()=>l$,ServerResultSchema:()=>lR,ServerTasksCapabilitySchema:()=>o_,SetLevelRequestParamsSchema:()=>sx,SetLevelRequestSchema:()=>sP,SingleSelectEnumSchemaSchema:()=>sB,StringSchemaSchema:()=>sU,SubscribeRequestParamsSchema:()=>oB,SubscribeRequestSchema:()=>oY,SubscriptionFilterSchema:()=>oQ,SubscriptionsAcknowledgedNotificationParamsSchema:()=>o2,SubscriptionsAcknowledgedNotificationSchema:()=>o9,SubscriptionsListenRequestParamsSchema:()=>o0,SubscriptionsListenRequestSchema:()=>o1,SubscriptionsListenResultMetaSchema:()=>o4,SubscriptionsListenResultSchema:()=>o3,TaskAugmentedRequestParamsSchema:()=>n5,TaskCreationParamsSchema:()=>ln,TaskMetadataSchema:()=>n2,TaskSchema:()=>ls,TaskStatusNotificationParamsSchema:()=>lc,TaskStatusNotificationSchema:()=>lu,TaskStatusSchema:()=>lo,TextContentSchema:()=>si,TextResourceContentsSchema:()=>oA,TitledMultiSelectEnumSchemaSchema:()=>sG,TitledSingleSelectEnumSchemaSchema:()=>sH,ToolAnnotationsSchema:()=>sh,ToolChoiceSchema:()=>sC,ToolExecutionSchema:()=>sf,ToolListChangedNotificationSchema:()=>sw,ToolResultContentSchema:()=>sI,ToolSchema:()=>sg,ToolUseContentSchema:()=>ss,UnsubscribeRequestParamsSchema:()=>oB,UnsubscribeRequestSchema:()=>oX,UntitledMultiSelectEnumSchemaSchema:()=>sK,UntitledSingleSelectEnumSchemaSchema:()=>sF});let cB=e=>oa.safeParse(e).success,cK=e=>oi.safeParse(e).success,cG=e=>on.safeParse(e).success,cW=e=>oo.safeParse(e).success,cY=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,cX="x-mcp-header",cQ=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,c0=new Set(["string","integer","boolean"]);function c1(e){let t,r=[],a=new Map,i=(e,n,o)=>{if(null===e||"object"!=typeof e)return;if(cX in e){if(!o||0===n.length)return`${c4(n)}: 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 i=e[cX];if("string"!=typeof i||0===i.length)return`${c4(n)}: x-mcp-header MUST be a non-empty string`;if(!cQ.test(i))return`${c4(n)}: x-mcp-header '${i}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof e.type?e.type:void 0;if(void 0===s||!c0.has(s)){let e=`${c4(n)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;if("number"!==s)return e;t??=e}let l=i.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,i),r.push({path:n,headerName:i,type:s})}let s=e.properties;if(null!==s&&"object"==typeof s)for(let[e,t]of Object.entries(s)){let r=i(t,[...n,e],o);if(void 0!==r)return r}for(let t of c2){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&c9.has(t)?Object.values(r):[r]){let r=i(e,[...n,`<${t}>`],!1);if(void 0!==r)return r}}},n=i(e,[],!0);return void 0!==n?{valid:!1,reason:t??n}:void 0===t?{valid:!0,declarations:r}:{valid:!1,reason:t,declarations:r}}let c2=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],c9=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function c4(e){return 0===e.length?"<root>":e.join(".")}let c3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c5=/^-?\d+(\.\d+)?$/;function c6(e){if(!(e.startsWith("=?base64?")&&e.endsWith("?=")))return e;let t=e.slice(9,e.length-2);if(c3.test(t))try{let e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.codePointAt(t);return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return}}function c7(e,t,r){return{kind:"reject",rung:"param-header-validation",cell:e,httpStatus:400,code:c8,message:`Bad Request: the request headers and body disagree: ${r}`,data:{mismatch:{header:t,body:r}},settled:!0}}let c8=-32020;ch.InvalidRequest,ch.UnsupportedProtocolVersion,ch.InvalidParams,ch.MethodNotFound,ch.InvalidParams,ch.MissingRequiredClientCapability;let ue={[ch.ParseError]:400,[ch.InvalidRequest]:400,[ch.MethodNotFound]:404,[ch.UnsupportedProtocolVersion]:400,[ch.MissingRequiredClientCapability]:400,[c8]:400};function ut(e,t,r,a,i){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:a.code,message:a.message,...void 0!==a.data&&{data:a.data},settled:i}}function ur(e,t,r,a="era-classification"){return ut(a,e,400,new cf(c8,`Bad Request: the request headers and body disagree: ${r}`,{mismatch:{header:t,body:r}}),!0)}let ua={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function ui(e){let t=0;for(;t<e.length;){let r=e.codePointAt(t);if(9!==r&&32!==r)break;t+=1}let r=e.length;for(;r>t;){let t=e.codePointAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}function un(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function uo(e){return void 0===e?{era:"modern"}:{era:e>=lG?"modern":"legacy",revision:e}}function us(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function ul(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}let uc=!1,uu="draft-2020-12";function ud(e,t="input"){let r,a=e["~standard"];if(a.jsonSchema)r=a.jsonSchema[t]({target:uu});else if("zod"===a.vendor){if(!("_zod"in e))throw 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().");uc||(uc=!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.")),r=a8(e,{target:uu,io:t})}else throw Error(`Schema library "${a.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==r.type||!function e(t,r=t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;let a="string"==typeof t.$ref&&up.exec(t.$ref);if(a&&r[a[1]]?.[a[2]]?.type==="object")return!0;for(let a of["oneOf","anyOf","allOf"]){let i=t[a];if(Array.isArray(i)&&i.length>0)return i.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t,"$id"in t?{}:r)))}return!1}(r)?r:{type:"object",...r};if(void 0!==r.type&&"object"!==r.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}let up=/^#\/(\$defs|definitions)\/([^/~%]+)$/;async function um(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let uh=/\\\.\\d\{(\d+)\}/;function uf(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ug=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function uy(e){return ug.has(e)||e.startsWith("x-")}let uv=new Set(["$schema",...Object.keys(sQ.shape.requestedSchema.shape)]),u_={string:us([sU,sF,sH,sJ]),number:us([sV]),integer:us([sV]),boolean:us([sD]),array:us([sK,sG])},ub=new Set(sU.shape.format.unwrap().options);Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,r="string"==typeof e.requestState;if(!t&&!r)throw 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",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!ul(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,a=function(e,t){let r={},a=[];for(let[i,n]of Object.entries(e))"properties"===i&&uf(n)?r[i]=Object.fromEntries(Object.entries(n).map(([e,r])=>[e,function(e,t,r,a){if(!uf(e))return e;let i="string"==typeof e.type&&Object.hasOwn(u_,e.type)?u_[e.type]:void 0;if(void 0===i)return e;let n={};for(let[s,l]of Object.entries(e))if(i.has(s)||uy(s))n[s]=l;else if("pattern"===s&&"string"===e.type&&"string"==typeof e.format)if(ub.has(e.format)){var o;"string"==typeof l&&(o=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[r9(iZ,void 0)];break;case"uri":r=[r4(iV,void 0)];break;case"date":r=[r5(iz,void 0)];break;case"date-time":let a,i;a=uh.exec(t),i=[void 0,-1,0],a&&i.push(Number(a[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>i.map(r=>r3(iA,{local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=a8(e,{target:uu,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(o,l).has(l))||a.push(`${t}.${s}`)}else n[s]=l;else a.push(`${t}.${s}`);return n}(r,`properties.${e}`,t,a)])):uv.has(i)?r[i]=n:uy(i)||a.push(i);if(a.length>0)throw new cf(ch.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return r}(function(e){try{return ud(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new cf(ch.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),i=(t=sQ.shape.requestedSchema,ib(t,a));if(!i.success)throw new cf(ch.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!uf(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!ib(sX,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(a,i.error.message)}`);let n=function e(t,r,a=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,i)=>e(t,r[i],`${a}[${i}]`)):uf(t)&&uf(r)?Object.entries(t).flatMap(([t,i])=>{let n=a?`${a}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(i,r[t],n):uy(t)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new cf(ch.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let o=(i.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(i.data.properties,e));if(o.length>0)throw new cf(ch.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${o.join(", ")}`);return{...e,mode:"form",requestedSchema:i.data}}(e)}}catch(e){throw e instanceof cf?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let uS={},u$={};function uw(e,t){let r=e.slice(0,-6);uS[r]=t,u$[r]=e=>t.safeParse(e).success}for(let e of["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"])uw(e,cJ[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:lO,OAuthClientInformationFullSchema:lA,OAuthClientInformationSchema:lq,OAuthClientMetadataSchema:lN,OAuthClientRegistrationErrorSchema:lz,OAuthErrorResponseSchema:lC,OAuthMetadataSchema:lP,OAuthProtectedResourceMetadataSchema:lx,OAuthTokenRevocationRequestSchema:lM,OAuthTokensSchema:lj,OpenIdProviderDiscoveryMetadataSchema:lT,OpenIdProviderMetadataSchema:lE}))uw(e,t);let uR=Object.freeze(uS);Object.freeze(u$);let uk=[nH,nJ,nK,nW],ux=["inputResponses","requestState"];function uP(e,t){let r=e.params;if(!uC(r))return{message:e,lifted:{}};let a=r._meta,i=uC(a)?uk.filter(e=>e in a):[],n="request"===t?ux.filter(e=>e in r):[];if(0===i.length&&0===n.length)return{message:e,lifted:{}};let o={},s={...r};if(i.length>0&&uC(a)){let e={},t={...a};for(let r of i)e[r]=a[r],delete t[r];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of n)"inputResponses"===e&&(o.inputResponses=s[e]),"requestState"===e&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function uE(e,t){let r=e.validateResult(t,void 0);if(r.ok||"not-in-era"!==r.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let a=e.validateResult(t,r);return a.ok?{value:a.value}:{issues:[{message:"invalid"===a.reason?a.message:`not-in-era: ${t}`}]}}}}}let uT=(E=void 0,()=>E);function uj(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:()=>t}}}var uO=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{c=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??nF,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new lH(lF.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){void 0!==e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,a,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_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 lH(lF.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=e=>{r?.(e),this._onerror(e)};let a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{a?.(e,t),cG(e)||cW(e)?this._onresponse(e):cB(e)?this._onrequest(e,t):cK(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new lH(lF.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(r);for(let e of t.values())e.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=uP(e,"notification"),a=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=cA(t.classification);if(e!==a.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${a.era}`))}if(cM(r.method)&&!a.hasNotificationMethod(r.method))return;let i=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(r):i(r,a)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:a,lifted:i}=uP(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let o=this._transport,s=(e,t,r)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};o?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=cA(t.classification);if(e!==n.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${e} but this instance serves ${n.era}`));let r=t.classification.revision??e;s(ch.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(cz(a.method)&&!n.hasRequestMethod(a.method)&&!(cL(a.method)&&this._customSchemaRequestMethods.has(a.method)))return void s(ch.MethodNotFound,"Method not found");let l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===l)return void s(ch.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(i);if(void 0!==c)return void s(ch.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:a.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);let m=void 0===i.inputResponses?void 0:function(e){let t={},r=[];if(!uI(e))return{accepted:t,droppedKeys:r};for(let[a,i]of Object.entries(e)){if(!uI(i)||"method"in i||"result"in i){r.push(a);continue}t[a]=i}return{accepted:t,droppedKeys:r}}(i.inputResponses),h={sessionId:o?.sessionId,mcpReq:{id:a.id,method:a.method,_meta:a.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===i.requestState?uT:(r=i.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),ul(t))return d(e,t,r);let i=uE(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,i,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=n.encodeResult(a.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${a.method}: ${e}`)),s(ch.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:a.id};await o?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:ch.InternalError,r={jsonrpc:"2.0",id:a.id,error:{code:n.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await o?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),n(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);void 0===r?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),r(cG(e)?e:cf.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 a=this._resolveOutboundCodec(e.method);if(ul(t))return cL(e.method)||this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r);this._assertOutboundRequestInEra(a,e.method);let i=uE(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(a,e,i,t)}_negotiatedWireCodec(){return cq(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return cq(void 0);case"server/discover":return cq(cN);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(cz(t)&&!e.hasRequestMethod(t))throw new lH(lF.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 a=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r)}_requestWithSchemaViaCodec(e,t,r,a){let i,n,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c}=a??{},u=Date.now();return new Promise((d,p)=>{let m=e=>{p(e)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){m(e);return}if(a?.signal?.aborted){let e=a.signal.reason;throw e instanceof lH?e:new lH(lF.RequestTimeout,String(e))}let h=e.era===cN&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;n=f;let g={...t,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let y=this._envelopeOutbound(g),v=!1,_=e=>{v||(this._progressHandlers.delete(f),void 0===h?"initialize"!==t.method&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):h.abort(),p(e instanceof lH?e:new lH(lF.RequestTimeout,String(e))))};this._responseHandlers.set(f,i=>{let n;if(!a?.signal?.aborted){if(v=!0,i instanceof Error)return p(i);try{n=e.decodeResult(t.method,i.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===n.kind)return p(n.error);if("input_required"===n.kind){var o;return a?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(o=n).inputRequests,...void 0!==o.requestState&&{requestState:o.requestState},...void 0!==o._meta&&{_meta:o._meta}}):d(this._resolveNonCompleteResult(n,{codec:e,request:t,resultSchema:r,options:a,flowStartedAt:u,retry:(a,i)=>this._requestWithSchemaViaCodec(e,void 0===a?{method:t.method}:{method:t.method,params:a},r,i)}))}um(r,n.result).then(e=>{e.success?d(e.data):p(new lH(lF.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),i=()=>_(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let b=a?.timeout??6e4;this._setupTimeout(f,b,a?.maxTotalTimeout,()=>_(new lH(lF.RequestTimeout,"Request timed out",{timeout:b})),a?.resetTimeoutOnProgress??!1),this._transport.send(y,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c,requestSignal:h?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{i&&a?.signal?.removeEventListener("abort",i),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new lH(lF.NotConnected,"Not connected");if(cM(t.method)&&!e.hasNotificationMethod(t.method))throw new lH(lF.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 a=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){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(a,r).catch(e=>this._onerror(e))});return}await this._transport.send(a,r)}setRequestHandler(e,t,r){let a;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!cz(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);a=(r,a)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(e,r);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(e,r)),!n.ok){if("not-in-era"===n.reason)throw new cf(ch.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value,a))}}else if(r)a=async(a,i)=>{let n=await um(t.params,{...a.params});if(!n.success)throw new cf(ch.InvalidParams,`Invalid params for ${e}: ${n.error}`);return r(n.data,i)};else throw TypeError("setRequestHandler: handler is required");"function"==typeof t?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,a))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if("function"==typeof t){if(!cM(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,a)=>{let i=a.validateNotification(e,r);if(!i.ok){if("not-in-era"===i.reason)throw new cf(ch.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async a=>{let i=await um(t.params,{...a.params});if(!i.success)throw new cf(ch.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await r(i.data,a)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function uC(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function uI(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var uN=J((H(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,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var n,o,s,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!a.test(u))throw TypeError("invalid media type");var d=new i(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;o=t.exec(l);){if(o.index!==c)throw TypeError("invalid parameter format");c+=o[0].length,n=o[1].toLowerCase(),34===(s=o[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(r,"$1")),d.parameters[n]=s}if(c!==l.length)throw TypeError("invalid parameter format")}return d}}))(),1);function uq(e){if(e)try{return uN.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}function uA(e){return"application/json"===e||"application/json"===uq(e)}let uz=/^[A-Za-z0-9._-]{1,128}$/;function uM(e){let t=function(e){let t=[];if(0===e.length)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"),!uz.test(e)){let r=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);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.")}return t.isValid}var uL=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(t){e.validateLength(t,1e6,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let r=[],a="",i=0,n=0;for(;i<t.length;)if("{"===t[i]){a&&(r.push(a),a="");let o=t.indexOf("}",i);if(-1===o)throw Error("Unclosed template expression");if(++n>1e4)throw Error("Template contains too many expressions (max 10000)");let s=t.slice(i+1,o),l=this.getOperator(s),c=s.includes("*"),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,1e6,"Variable name");r.push({name:d,operator:l,names:u,exploded:c}),i=o+1}else a+=t[i],i++;return a&&r.push(a),r}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(t,r){return(e.validateLength(t,1e6,"Variable value"),"+"===r||"#"===r)?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];return void 0===a?"":`${r}=${Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator)}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let i=this.expandPart(a,e);i&&(t+=("?"===a.operator||"&"===a.operator)&&r?i.replace("?","&"):i,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let r,a=[];for(let r of t.names)e.validateLength(r,1e6,"Variable name");if("?"===t.operator||"&"===t.operator){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=0===e?"\\"+t.operator:"&";a.push({pattern:i+this.escapeRegExp(r)+"=([^&]+)",name:r})}return a}let i=t.name;switch(t.operator){case"":r=t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r=String.raw`\.([^/,]+)`;break;case"/":r="/"+(t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return a.push({pattern:r,name:i}),a}match(t){e.validateLength(t,1e6,"URI");let r="^",a=[];for(let e of this.parts)if("string"==typeof e)r+=this.escapeRegExp(e);else for(let{pattern:t,name:i}of this.partToRegExp(e))r+=t,a.push({name:i,exploded:e.exploded});r+="$",e.validateLength(r,1e6,"Generated regex pattern");let i=new RegExp(r),n=t.match(i);if(!n)return null;let o={};for(let[e,t]of a.entries()){let{name:r,exploded:a}=t,i=n[e+1];o[r.replace("*","")]=a&&i.includes(",")?i.split(","):i}return o}};function uZ(e){if(void 0!==e){if(function(e){if("object"!=typeof e||null===e||ul(e))return!1;let t=Object.getPrototypeOf(e);return(t===Object.prototype||null===t)&&Object.values(e).every(e=>"object"==typeof e&&null!==e&&"_zod"in e)}(e))return nu(e);if("object"==typeof e&&null!==e&&!ul(e)&&Object.values(e).some(e=>"object"==typeof e&&null!==e&&!("_zod"in e)&&"_def"in e&&"string"==typeof e._def?.typeName))throw 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(!ul(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var uD=H(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(t){if(super(),!e.IDENTIFIER.test(t))throw Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var a=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function i(e,...t){let r=[e[0]],n=0;for(;n<t.length;)s(r,t[n]),r.push(e[++n]);return new a(r)}e._Code=a,e.nil=new a(""),e._=i;let n=new a("+");function o(e,...t){let i=[l(e[0])],c=0;for(;c<t.length;)i.push(n),s(i,t[c]),i.push(n,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var a,i;let n=(a=e[t-1],'""'===(i=e[t+1])?a:'""'===a?i:"string"==typeof a?i instanceof r||'"'!==a[a.length-1]?void 0:"string"!=typeof i?`${a.slice(0,-1)}${i}"`:'"'===i[0]?a.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||a instanceof r?void 0:`"${a}${i.slice(1)}`);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(i),new a(i)}function s(e,t){var i;t instanceof a?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(i=t)||"boolean"==typeof i||null===i?i:l(Array.isArray(i)?i.join(","):i))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=o,e.addCodeArg=s,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},e.stringify=function(e){return new a(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new a(`.${t}`):i`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new a(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new a(e.toString())}}),uU=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=uD();var r,a,i=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=a||(e.UsedValueState=a={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=n;var o=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:a}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${a}]`}};e.ValueScopeName=o;let s=(0,t._)`\n`;var l=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:i}=a,n=null!=(r=t.key)?r:t.ref,o=this._values[i];if(o){let e=o.get(n);if(e)return e}else o=this._values[i]=new Map;o.set(n,a);let s=this._scope[i]||(this._scope[i]=[]),l=s.length;return s[l]=t.ref,a.setValue(t,{property:i,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw Error(`CodeGen: name "${r}" has no value`);return(0,t._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,n,o={},s){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=o[c]=o[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,a.Started);let o=n(r);if(o){let a=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${a} ${r} = ${o};${this.opts._n}`}else if(o=null==s?void 0:s(r))l=(0,t._)`${l}${o}${this.opts._n}`;else throw new i(r);d.set(r,a.Completed)})}return l}};e.ValueScope=l}),uV=H(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=uD(),r=uU();var a=uD();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var i=uU();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.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 n=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let a=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends n{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends s{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},p=class extends n{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends n{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,a=r.length;for(;a--;){let i=r[a];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},h=class extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends m{},g=class extends h{};g.kind="else";var y=class e extends h{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){let e=r.optimizeNodes();r=this.else=Array.isArray(e)?new g(e):e}return r?!1===t?r instanceof e?r:r.nodes:this.nodes.length?this:new e(O(t),r instanceof e?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&E(e,this.else.names),e}};y.kind="if";var v=class extends h{};v.kind="for";var _=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:a,from:i,to:n}=this;return`for(${t} ${a}=${i}; ${a}<${n}; ${a}++)`+super.render(e)}get names(){return T(T(super.names,this.from),this.to)}},S=class extends v{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},$=class extends h{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$.kind="func";var w=class extends m{render(e){return"return "+super.render(e)}};w.kind="return";var R=class extends h{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},k=class extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};k.kind="catch";var x=class extends h{render(e){return"finally"+super.render(e)}};x.kind="finally";var P=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,a){let i=this._scope.toName(t);return void 0!==r&&a&&(this._constants[i.str]=r),this._leafNode(new o(e,i,r)),i}const(e,t,a){return this._def(r.varKinds.const,e,t,a)}let(e,t,a){return this._def(r.varKinds.let,e,t,a)}var(e,t,a){return this._def(r.varKinds.var,e,t,a)}assign(e,t,r){return this._leafNode(new s(e,t,r))}add(t,r){return this._leafNode(new l(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){let r=["{"];for(let[a,i]of e)r.length>1&&r.push(","),r.push(a),(a!==i||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,i));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.let){let o=this._scope.toName(e);return this._for(new b(n,o,t,a),()=>i(o))}forOf(e,a,i,n=r.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=a instanceof t.Name?a:this.var("_arr",a);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(o,(0,t._)`${e}[${r}]`),i(o)})}return this._for(new S("of",n,o,a),()=>i(o))}forIn(e,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${a})`,i);let o=this._scope.toName(e);return this._for(new S("in",n,o,a),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new R;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new k(e),t(e)}return r&&(this._currNode=a.finally=new x,this.code(r)),this._endBlockNode(k,x)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,a,i){return this._blockNode(new $(e,r,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function E(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,r){return r instanceof t._CodeOrName?E(e,r.names):e}function j(e,r,a){var i;if(e instanceof t.Name)return n(e);if(!((i=e)instanceof t._Code&&i._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==a[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=n(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function n(e){let t=a[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function O(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=P,e.not=O;let C=N(e.operators.AND);e.and=function(...e){return e.reduce(C)};let I=N(e.operators.OR);function N(e){return(r,a)=>r===t.nil?a:a===t.nil?r:(0,t._)`${q(r)} ${e} ${q(a)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(I)}}),uF=H(e=>{var t,r;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 a=uV(),i=uD();function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=a.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,l)=>{let c=void 0===s?o:s instanceof a.Name?(o instanceof a.Name?e(n,o,s):t(n,o,s),s):o instanceof a.Name?(t(n,s,o),o):r(o,s);return l!==a.Name||c instanceof a.Name?c:i(n,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.getProperty)(r)}`,!0))}e.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(i)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,e.unescapeJsonPointer=l,e.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},e.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=u,e.setEvaluated=d;let p={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new i._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,i){if(e instanceof a.Name){let n=r===t.Num;return i?n?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:n?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=m}),uH=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV();e.default={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")}}),uJ=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=uV(),r=uF(),a=uH();function i(e,r){let i=e.const("err",r);e.if((0,t._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${a.default.vErrors}.push(${i})`),e.code((0,t._)`${a.default.errors}++`)}function n(e,r){let{gen:a,validateName:i,schemaEnv:n}=e;n.$async?a.throw((0,t._)`new ${e.ValidationError}(${r})`):(a.assign((0,t._)`${i}.errors`,r),a.return(!1))}e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?(0,t.str)`"${e}" keyword must be ${r} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},e.reportError=function(r,a=e.keywordError,o,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,m=s(r,a,o);(null!=l?l:d||p)?i(u,m):n(c,(0,t._)`[${m}]`)},e.reportExtraError=function(t,r=e.keywordError,o){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;i(c,s(t,r,o)),u||d||n(l,a.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(a.default.errors,r),e.if((0,t._)`${a.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${a.default.vErrors}.length`,r),()=>e.assign(a.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:i,data:n,errsCount:o,it:s}){if(void 0===o)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",o,a.default.errors,o=>{e.const(l,(0,t._)`${a.default.vErrors}[${o}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(a.default.instancePath,s.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${r}`),s.opts.verbose&&(e.assign((0,t._)`${l}.schema`,i),e.assign((0,t._)`${l}.data`,n))})};let o={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 s(e,i,n){let{createErrors:s}=e.it;return!1===s?(0,t._)`{}`:function(e,i,n={}){let{gen:s,it:l}=e,c=[function({errorPath:e},{instancePath:i}){let n=i?(0,t.str)`${e}${(0,r.getErrorPath)(i,r.Type.Str)}`:e;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,n)]}(l,n),function({keyword:e,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:n}){let s=n?a:(0,t.str)`${a}/${e}`;return i&&(s=(0,t.str)`${s}${(0,r.getErrorPath)(i,r.Type.Str)}`),[o.schemaPath,s]}(e,n)];return function(e,{params:r,message:i},n){let{keyword:s,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:h}=u;n.push([o.keyword,s],[o.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&n.push([o.message,"function"==typeof i?i(e):i]),d.verbose&&n.push([o.schema,c],[o.parentSchema,(0,t._)`${m}${h}`],[a.default.data,l]),p&&n.push([o.propertyName,p])}(e,i,c),s.object(...c)}(e,i,n)}}),uB=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=uJ(),r=uV(),a=uH(),i={message:"boolean schema is false"};function n(e,r){let{gen:a,data:n}=e;(0,t.reportError)({gen:a,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:i,validateName:o}=e;!1===i?n(e,!1):"object"==typeof i&&!0===i.$async?t.return(a.default.data):(t.assign((0,r._)`${o}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}}),uK=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}),uG=H(e=>{function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},a){let i=r.RULES.types[a];return i&&!0!==i&&t(e,i)},e.shouldUseGroup=t,e.shouldUseRule=r}),uW=H(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let a=uK(),i=uG(),n=uJ(),o=uV(),s=uF();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t||(e.DataType=t={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){let t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=l,e.coerceAndCheckDataType=function(e,r){var a,n;let{gen:s,data:l,opts:u}=e,p=(a=r,(n=u.coerceTypes)?a.filter(e=>c.has(e)||"array"===n&&"array"===e):[]),h=r.length>0&&!(0===p.length&&1===r.length&&(0,i.schemaHasRulesForType)(e,r[0]));if(h){let a=d(r,l,u.strictNumbers,t.Wrong);s.if(a,()=>{p.length?function(e,t,r){let{gen:a,data:i,opts:n}=e,s=a.let("dataType",(0,o._)`typeof ${i}`),l=a.let("coerced",(0,o._)`undefined`);for(let e of("array"===n.coerceTypes&&a.if((0,o._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,o._)`${i}[0]`).assign(s,(0,o._)`typeof ${i}`).if(d(t,i,n.strictNumbers),()=>a.assign(l,i))),a.if((0,o._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,o._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,o._)`"" + ${i}`).elseIf((0,o._)`${i} === null`).assign(l,(0,o._)`""`);return;case"number":a.elseIf((0,o._)`${s} == "boolean" || ${i} === null
|
|
56
|
+
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,o._)`+${i}`);return;case"integer":a.elseIf((0,o._)`${s} === "boolean" || ${i} === null
|
|
57
|
+
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,o._)`+${i}`);return;case"boolean":a.elseIf((0,o._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,o._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":a.elseIf((0,o._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(l,null);return;case"array":a.elseIf((0,o._)`${s} === "string" || ${s} === "number"
|
|
58
|
+
|| ${s} === "boolean" || ${i} === null`).assign(l,(0,o._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,o._)`${l} !== undefined`,()=>{a.assign(i,l),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,o._)`${t} !== undefined`,()=>e.assign((0,o._)`${t}[${r}]`,a))}(e,l)})}(e,r,p):m(e)})}return h};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,a,i=t.Correct){let n,s=i===t.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${r} ${s} null`;case"array":n=(0,o._)`Array.isArray(${r})`;break;case"object":n=(0,o._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":n=l((0,o._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":n=l();break;default:return(0,o._)`typeof ${r} ${s} ${e}`}return i===t.Correct?n:(0,o.not)(n);function l(e=o.nil){return(0,o.and)((0,o._)`typeof ${r} == "number"`,e,a?(0,o._)`isFinite(${r})`:o.nil)}}function d(e,t,r,a){let i;if(1===e.length)return u(e[0],t,r,a);let n=(0,s.toHash)(e);if(n.array&&n.object){let e=(0,o._)`typeof ${t} != "object"`;i=n.null?e:(0,o._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=o.nil;for(let e in n.number&&delete n.integer,n)i=(0,o.and)(i,u(e,t,r,a));return i}e.checkDataType=u,e.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,s.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:e}}(e);(0,n.reportError)(t,p)}e.reportTypeError=m}),uY=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=uV(),r=uF();function a(e,a,i){let{gen:n,compositeRule:o,data:s,opts:l}=e;if(void 0===i)return;let c=(0,t._)`${s}${(0,t.getProperty)(a)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,t._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,t._)`${u} || ${c} === null || ${c} === ""`),n.if(u,(0,t._)`${c} = ${(0,t.stringify)(i)}`)}e.assignDefaults=function(e,t){let{properties:r,items:i}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(i)&&i.forEach((t,r)=>a(e,r,t.default))}}),uX=H(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=uV(),r=uF(),a=uH(),i=uF();function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function o(e,r,a){return(0,t._)`${n(e)}.call(${r}, ${a})`}function s(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} === undefined`;return i?(0,t.or)(n,(0,t.not)(o(e,r,a))):n}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:a,data:i,it:n}=e;a.if(s(a,i,r,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:a}},i,n){return(0,t.or)(...i.map(i=>(0,t.and)(s(e,r,i,a.ownProperties),(0,t._)`${n} = ${i}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=n,e.isOwnProperty=o,e.propertyInData=function(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} !== undefined`;return i?(0,t._)`${n} && ${o(e,r,a)}`:n},e.noPropertyInData=s,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(a=>!(0,r.alwaysValidSchema)(e,t[a]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:i,topSchemaRef:n,schemaPath:o,errorPath:s},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${n}${o}`:r,m=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,s)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&m.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,t._)`${p}, ${i.object(...m)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${h})`:(0,t._)`${c}(${h})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},a){let n=r.unicodeRegExp?"u":"",{regExp:o}=r.code,s=o(a,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,t._)`${"new RegExp"===o.code?c:(0,i.useFunc)(e,o)}(${a}, ${n})`})},e.validateArray=function(e){let{gen:a,data:i,keyword:n,it:o}=e,s=a.name("valid");if(o.allErrors){let e=a.let("valid",!0);return l(()=>a.assign(e,!1)),e}return a.var(s,!0),l(()=>a.break()),s;function l(o){let l=a.const("len",(0,t._)`${i}.length`);a.forRange("i",0,l,i=>{e.subschema({keyword:n,dataProp:i,dataPropType:r.Type.Num},s),a.if((0,t.not)(s),o)})}},e.validateUnion=function(e){let{gen:a,schema:i,keyword:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(e=>(0,r.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=a.let("valid",!1),l=a.name("_valid");a.block(()=>i.forEach((r,i)=>{let o=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);a.assign(s,(0,t._)`${s} || ${l}`),e.mergeValidEvaluated(o,l)||a.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}}),uQ=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=uV(),r=uH(),a=uX(),i=uJ();function n(e){let{gen:r,data:a,it:i}=e;r.if(i.parentData,()=>r.assign(a,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function o(e,r,a){if(void 0===a)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,t.stringify)(a)})}e.macroKeywordCode=function(e,r){let{gen:a,keyword:i,schema:n,parentSchema:s,it:l}=e,c=r.macro.call(l.self,n,s,l),u=o(a,i,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=a.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,s){var l;let{gen:c,keyword:u,schema:d,parentSchema:p,$data:m,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,s);let f=o(c,u,!m&&s.compile?s.compile.call(h.self,d,p,h):s.validate),g=c.let("valid");function y(i=s.async?(0,t._)`await `:t.nil){let n=h.opts.passContext?r.default.this:r.default.self,o=!("compile"in s&&!m||!1===s.schema);c.assign(g,(0,t._)`${i}${(0,a.callValidateCode)(e,f,n,o)}`,s.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=s.valid)?r:g),e)}e.block$data(g,function(){if(!1===s.errors)y(),s.modifying&&n(e),v(()=>e.error());else{let a,o,l=s.async?(a=c.let("ruleErrs",null),c.try(()=>y((0,t._)`await `),e=>c.assign(g,!1).if((0,t._)`${e} instanceof ${h.ValidationError}`,()=>c.assign(a,(0,t._)`${e}.errors`),()=>c.throw(e))),a):(o=(0,t._)`${f}.errors`,c.assign(o,null),y(t.nil),o);s.modifying&&n(e),v(()=>(function(e,a){let{gen:n}=e;n.if((0,t._)`Array.isArray(${a})`,()=>{n.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${a} : ${r.default.vErrors}.concat(${a})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=s.valid)?l:g)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:a},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let o=i.dependencies;if(null==o?void 0:o.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[n])){let e=`keyword "${n}" value is invalid at path "${a}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),u0=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=uV(),r=uF();e.getSubschema=function(e,{keyword:a,schemaProp:i,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:l}){if(void 0!==a&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let n=e.schema[a];return void 0===i?{schema:n,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:n[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,r.escapeFragment)(i)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:l,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,a,{dataProp:i,dataPropType:n,data:o,dataTypes:s,propertyName:l}){if(void 0!==o&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=a;if(void 0!==i){let{errorPath:o,dataPathArr:s,opts:l}=a;u(c.let("data",(0,t._)`${a.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,r.getErrorPath)(i,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,t]}void 0!==o&&(u(o instanceof t.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),s&&(e.dataTypes=s)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:i,allErrors:n}){void 0!==a&&(e.compositeRule=a),void 0!==i&&(e.createErrors=i),void 0!==n&&(e.allErrors=n),e.jtdDiscriminator=t,e.jtdMetadata=r}}),u1=H((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(i=a;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=a;0!=i--;){var a,i,n,o=n[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}}),u2=H((e,t)=>{var r=t.exports=function(e,t,a){"function"==typeof t&&(a=t,t={});var i="function"==typeof(a=t.cb||a)?a:a.pre||function(){};!function e(t,a,i,n,o,s,l,c,u,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in a(n,o,s,l,c,u,d),n){var m=n[p];if(Array.isArray(m)){if(p in r.arrayKeywords)for(var h=0;h<m.length;h++)e(t,a,i,m[h],o+"/"+p+"/"+h,s,o,p,n,h)}else if(p in r.propsKeywords){if(m&&"object"==typeof m)for(var f in m)e(t,a,i,m[f],o+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),s,o,p,n,f)}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,a,i,m,o+"/"+p,s,o,p,n)}i(n,o,s,l,c,u,d)}}(t,i,a.post||function(){},e,"",e)};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}}),u9=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=uF(),r=u1(),a=u2(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,r=!0){return"boolean"==typeof e||(!0===r?!function e(t){for(let r in t){if(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!r&&function e(r){let a=0;for(let n in r)if("$ref"===n||(a++,!i.has(n)&&("object"==typeof r[n]&&(0,t.eachItem)(r[n],t=>a+=e(t)),1/0===a)))return 1/0;return a}(e)<=r)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function o(e,t="",r){return!1!==r&&(t=c(t)),s(e,e.parse(t))}function s(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=o,e._getFullPath=s;let l=/#\/?$/;function c(e){return e?e.replace(l,""):""}e.normalizeId=c,e.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:i,uriResolver:n}=this.opts,s=c(e[i]||t),l={"":s},d=o(n,s,!1),p={},m=new Set;return a(e,{allKeys:!0},(e,t,r,a)=>{if(void 0===a)return;let n=d+t,o=l[a];function s(t){let r=this.opts.uriResolver.resolve;if(t=c(o?r(o,t):t),m.has(t))throw f(t);m.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?h(e,a.schema,t):t!==c(n)&&("#"===t[0]?(h(e,p[t],t),p[t]=e):this.refs[t]=n),t}function g(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[i]&&(o=s.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),l[t]=o}),p;function h(e,t,a){if(void 0!==t&&!r(e,t))throw f(a)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),u4=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=uB(),r=uW(),a=uG(),i=uW(),n=uY(),o=uQ(),s=u0(),l=uV(),c=uH(),u=u9(),d=uF(),p=uJ();function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},n){var o;i.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,l._)`"use strict"; ${h(r,i)}`),t=e,a=i,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,l._)`""`),t.var(c.default.parentData,(0,l._)`undefined`),t.var(c.default.parentDataProperty,(0,l._)`undefined`),t.var(c.default.rootData,c.default.data),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(n)}):e.func(t,(0,l._)`${c.default.data}, ${(o=i,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${o.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,a.$async,()=>e.code(h(r,i)).code(n))}function h(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function f({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function y(e){(0,d.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:a,self:i}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,t){if(e.opts.jtd)return b(e,[],!1,t);let a=(0,r.getSchemaTypes)(e.schema);b(e,a,!(0,r.coerceAndCheckDataType)(e,a),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:i}){let n=r.$comment;if(!0===i.$comment)e.code((0,l._)`${c.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let r=(0,l.str)`${a}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${n}, ${r}, ${i}.schema)`)}}function b(e,t,r,n){var o,s,u,p;let{gen:m,schema:h,data:f,allErrors:g,opts:y,self:v}=e,{RULES:_}=v;if(h.$ref&&(y.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(h,_)))return void m.block(()=>k(e,"$ref",_.all.$ref.definition));function b(o){(0,a.shouldUseGroup)(h,o)&&(o.type?(m.if((0,i.checkDataType)(o.type,f,y.strictNumbers)),S(e,o),1===t.length&&t[0]===o.type&&r&&(m.else(),(0,i.reportTypeError)(e)),m.endIf()):S(e,o),g||m.if((0,l._)`${c.default.errors} === ${n||0}`))}y.jtd||(o=e,s=t,!o.schemaEnv.meta&&o.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)$(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(o,s),o.opts.allowUnionTypes||(u=o,(p=s).length>1&&!(2===p.length&&p.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if("object"==typeof n&&(0,a.shouldUseRule)(e.schema,n)){let{type:r}=n.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(o,o.dataTypes))),m.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function S(e,t){let{gen:r,schema:i,opts:{useDefaults:o}}=e;o&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(i,r)&&k(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){g(e)&&(y(e),f(e))?function(e){let{schema:t,opts:r,gen:a}=e;m(e,()=>{r.$comment&&t.$comment&&_(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),a.let(c.default.vErrors,null),a.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`),t.if((0,l._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)),t.if((0,l._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`))}(e),v(e),function(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:i,opts:n}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${i}(${c.default.vErrors})`)):(t.assign((0,l._)`${a}.errors`,c.default.vErrors),n.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),a instanceof l.Name&&e.assign((0,l._)`${t}.items`,a)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,o.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",E(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e){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:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=l.nil,t=l.nil){if(!this.$data)return;let{gen:r,schemaCode:a,schemaType:i,def:n}=this;r.if((0,l.or)((0,l._)`${a} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||n.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:a,it:n}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,l._)`${(0,i.checkDataTypes)(e,t,n.opts.strictNumbers,i.DataType.Wrong)}`}return l.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let a=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(a,this.it,e),(0,s.extendSubschemaMode)(a,e);let i={...this.it,...a,items:void 0,props:void 0};return!function(e,r){if(g(e)&&(y(e),f(e)))return function(e,t){var r;let a,{schema:i,gen:n,opts:o}=e;o.$comment&&i.$comment&&_(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let s=n.const("_errs",c.default.errors);v(e,s),n.var(t,(0,l._)`${s} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(i,r),i}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function k(e,t,r,a){let i=new R(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,o.funcKeywordCode)(i,r):"macro"in r?(0,o.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,o.funcKeywordCode)(i,r)}e.KeywordCxt=R;let x=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let i,n;if(""===e)return c.default.rootData;if("/"===e[0]){if(!x.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=c.default.rootData}else{let o=P.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let l=+o[1];if("#"===(i=o[2])){if(l>=t)throw Error(s("property/index",l));return a[t-l]}if(l>t)throw Error(s("data",l));if(n=r[t-l],!i)return n}let o=n;for(let e of i.split("/"))e&&(n=(0,l._)`${n}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,l._)`${o} && ${n}`);return o;function s(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=E}),u3=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}}),u5=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u9();e.default=class extends Error{constructor(e,r,a,i){super(i||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),u6=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=uV(),r=u3(),a=uH(),i=u9(),n=uF(),o=u4();var s=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,i.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function l(e){let n,s,l=u.call(this,e);if(l)return l;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:p}=this.opts.code,{ownProperties:m}=this.opts,h=new t.CodeGen(this.scope,{es5:d,lines:p,ownProperties:m});e.$async&&(n=h.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=h.scopeName("validate");e.validateName=f;let g={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,o.validateFunctionCode)(g),h.optimize(this.opts.code.optimize);let r=h.toString();s=`${h.scopeRefs(a.default.scope)}return ${r}`,this.opts.code.process&&(s=this.opts.code.process(s,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,s)(this,this.scope.get());if(this.scope.value(f,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:f,validateCode:r,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:r}=g;i.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,s&&this.logger.error("Error compiling schema, function code:",s),t}finally{this._compilations.delete(e)}}function c(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){let r=this.opts.uriResolver.parse(t),a=(0,i._getFullPath)(this.opts.uriResolver,r),n=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return h.call(this,r,e);let o=(0,i.normalizeId)(a),c=this.refs[o]||this.schemas[o];if("string"==typeof c){let t=p.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),o===(0,i.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,a=t[r];return a&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,a)),new s({schema:t,schemaId:r,root:e,baseId:n})}return h.call(this,r,c)}}e.SchemaEnv=s,e.compileSchema=l,e.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=d.call(this,e,r);if(void 0===o){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(o=new s({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=c.call(this,o)},e.getCompilingSchema=u,e.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:a}){var o;let l;if((null==(o=e.fragment)?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let o="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=p.call(this,a,e)}let{schemaId:c}=this.opts;if((l=l||new s({schema:r,schemaId:c,root:a,baseId:t})).schema!==l.root.schema)return l}}),u7=H((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}}),u8=H((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),a=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),i=RegExp.prototype.test.bind(/^\d*$/u),n=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),u=Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)u[t]="%"+e[t>>4]+e[15&t]}function d(e){return e<2048?u[192|e>>6]+u[128|63&e]:e<65536?u[224|e>>12]+u[128|e>>6&63]+u[128|63&e]:u[240|e>>18]+u[128|e>>12&63]+u[128|e>>6&63]+u[128|63&e]}let p=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),m=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),h=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),f=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function g(e){let t=-1,r=0,a=-1,i=0;for(let n=0;n<e.length;n++)"0"===e[n]?(-1===a&&(a=n),++i>r&&(r=i,t=a)):(a=-1,i=0);return r<2?e.join(":"):e.slice(0,t).join(":")+"::"+e.slice(t+r).join(":")}function y(e){let t="["===e[0]&&"]"===e[e.length-1];if(("["===e[0]||"]"===e[e.length-1])&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&m(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(2>function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(r))return{host:e,isIPV6:!1,error:t};let i="",o=r.indexOf("%");if(-1!==o){let t="%25"===r.slice(o,o+3).toLowerCase()?3:1;if(!function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++)if(!h(e[t])){if("%"===e[t]&&t+2<e.length&&n(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}(i=r.slice(o+t)))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let s=function(e){let t=e.indexOf("::");if(-1!==t&&-1!==e.indexOf("::",t+1))return;let r=-1===t?e.split(":"):e.slice(0,t).split(":"),i=-1===t?[]:e.slice(t+2).split(":");-1!==t&&(1===r.length&&""===r[0]&&(r.length=0),1===i.length&&""===i[0]&&(i.length=0));let n=r.concat(i),o=0;for(let e=0;e<n.length;e++){let r=n[e];if(""===r)return;if(-1!==r.indexOf(".")){if(e!==n.length-1||-1!==t&&0===i.length||!a(r))return;o+=2;continue}if(!p(r))return;n[e]=parseInt(r,16).toString(16),o++}if(-1===t){if(8!==o)return;return g(n)}if(o>=8)return;let s=n.slice(0,r.length);for(let e=o;e<8;e++)s.push("0");for(let e=r.length;e<n.length;e++)s.push(n[e]);return g(s)}(r);return void 0===s?{host:e,isIPV6:!1,error:!0}:{host:s+(i?"%"+i:""),escapedHost:s+(i?"%25"+i:""),isIPV6:!0}}let v={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},_=/[@/?#:]/g,b=/[@/?#]/g;function S(e,t){let r=t?b:_;return r.lastIndex=0,e.replace(r,e=>v[e])}function $(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let a=0;a<e.length;a++){if("%"===e[a]&&a+2<e.length){let i=e.slice(a+1,a+3);if(n(i)){let e=i.toUpperCase(),n=String.fromCharCode(parseInt(e,16));t&&o(n)?r+=n:r+="%"+e,a+=2;continue}}r+=e[a]}return r}function w(e,t){let r="";for(let a=0;a<e.length;a++){let i=e[a];if("%"===i&&a+2<e.length){let t=e.slice(a+1,a+3);if(n(t)){r+="%"+t.toUpperCase(),a+=2;continue}}if(t(i))r+=i;else{let t=e.charCodeAt(a);if(t<128)r+=u[t];else if(t<55296||t>57343)r+=d(t);else if(t<=56319&&a+1<e.length){let i=e.charCodeAt(a+1);i>=56320&&i<=57343?(r+=d(65536+(t-55296<<10)+(i-56320)),a++):r+=d(65533)}else r+=d(65533)}}return r}function R(e){return w(e,c)}function k(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||42===e||43===e||45===e||46===e||47===e||64===e||95===e}t.exports={nonSimpleDomain:f,recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(R(e.userinfo)),t.push("@")),void 0!==e.host){let r=e.host;if(!a(r)){let e=y(r);!0!==e.isIPV6&&!0!==e.isIPVFuture&&(e=y(r=$(r,!0))),r=!0===e.isIPV6||!0===e.isIPVFuture?`[${e.escapedHost}]`:S(r,!1)}t.push(r)}if("number"==typeof e.port||"string"==typeof e.port){let r=String(e.port);if(!i(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0},reescapeHostDelimiters:S,normalizePercentEncoding:$,normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if("%"===a&&r+2<e.length){let a=e.slice(r+1,r+3);if(n(a)){let e=a.toUpperCase(),i=String.fromCharCode(parseInt(e,16));"."!==i&&o(i)?t+=i:t+="%"+e,r+=2;continue}}if(s(a))t+=a;else{let i=e.charCodeAt(r);if(i<128)t+=k(i)?a:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&r+1<e.length){let a=e.charCodeAt(r+1);a>=56320&&a<=57343?(t+=d(65536+(i-55296<<10)+(a-56320)),r++):t+=d(65533)}else t+=d(65533)}}return t},serializePathEncoding:function(e,t=!1){let r="",a=t&&"/"!==e[0];for(let t=0;t<e.length;t++){let i=e[t];if("%"===i&&t+2<e.length){let a=e.slice(t+1,t+3);if(n(a)){r+="%"+a.toUpperCase(),t+=2;continue}}if("/"===i&&(a=!1),s(i)&&(":"!==i||!a))r+=i;else{let a=e.charCodeAt(t);if(a<128)r+=u[a];else if(a<55296||a>57343)r+=d(a);else if(a<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(r+=d(65536+(a-55296<<10)+(i-56320)),t++):r+=d(65533)}else r+=d(65533)}}return r},normalizeQueryFragmentEncoding:function(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if("%"===a&&r+2<e.length){let a=e.slice(r+1,r+3);if(n(a)){let e=a.toUpperCase(),i=String.fromCharCode(parseInt(e,16));o(i)?t+=i:t+="%"+e,r+=2;continue}}if(l(a))t+=a;else{let i=e.charCodeAt(r);if(i<128)t+=k(i)?a:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&r+1<e.length){let a=e.charCodeAt(r+1);a>=56320&&a<=57343?(t+=d(65536+(i-55296<<10)+(a-56320)),r++):t+=d(65533)}else t+=d(65533)}}return t},encodeUserinfo:R,encodeQuery:function(e){return w(e,l)},encodeFragment:function(e){return w(e,l)},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let a=e.slice(r+1,r+3);if(n(a)){t+="%"+a.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e,r=[],a=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:a,isUUID:r,normalizeIPv6:y,stringArrayToHexStripped:function(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}}}),de=H((e,t)=>{let{isUUID:r}=u8(),a=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let l={scheme:"http",domainHost:!0,parse:o,serialize:s},c={scheme:"https",domainHost:l.domainHost,parse:o,serialize:s},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=-1===t?e.resourceName:e.resourceName.slice(0,t);e.path=r&&"/"!==r?r:void 0,e.query=-1===t?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}},d={scheme:"wss",domainHost:u.domainHost,parse:u.parse,serialize:u.serialize},p={http:l,https:c,ws:u,wss:d,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(a);if(r&&r[0]===e.path){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=m(`${a}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),i=m(`${r}:${t.nid||a}`);i&&(e=i.serialize(e,t));let n=e,o=e.nss;return n.path=`${a||t.nid}:${o}`,t.skipEscape=!0,n},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&r(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function m(e){return e&&(p[e]||p[e.toLowerCase()])||void 0}Object.setPrototypeOf(p,null),t.exports={wsIsSecure:n,SCHEMES:p,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:m}}),dt=H((e,t)=>{let{normalizeIPv6:r,removeDotSegments:a,recomposeAuthority:i,normalizePercentEncoding:n,normalizePathEncoding:o,serializePathEncoding:s,normalizeQueryFragmentEncoding:l,encodeQuery:c,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:p,nonSimpleDomain:m}=u8(),{SCHEMES:h,getSchemeHandler:f}=de(),g=/^[A-Za-z][A-Za-z0-9+.-]*$/u,y="URI scheme is malformed.";function v(e){let t=unescape(String(e));if(!g.test(t))throw TypeError(y);return t}function _(e,t,r,i){let n={};return i||(e=E(b(e,r),r),t=E(b(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(t.path?("/"===t.path[0]?n.path=a(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=a(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function b(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),l=[];r.scheme&&(r.scheme=v(r.scheme));let d=f(o.scheme||r.scheme);d&&d.serialize&&d.serialize(r,o);let p=void 0!==r.userinfo||void 0!==r.host||void 0!==r.port,m=!o.skipEscape&&void 0===r.scheme&&!p;void 0!==r.path&&(o.skipEscape?r.path=n(r.path):r.path=s(r.path,m)),"suffix"!==o.reference&&r.scheme&&(r.scheme=v(r.scheme),l.push(r.scheme,":"));let h=i(r);if(void 0!==h&&("suffix"!==o.reference&&l.push("//"),l.push(h),r.path&&"/"!==r.path[0]&&l.push("/")),void 0!==r.path){let e=r.path;o.absolutePath||d&&d.absolutePath||(e=a(e)),m&&(e=s(e,!0)),void 0===h&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),l.push(e)}return void 0!==r.query&&l.push("?",c(r.query)),void 0!==r.fragment&&l.push("#",u(r.fragment)),l.join("")}let S=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,$=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,w=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function R(e){if(void 0===e)return!1;let t=e.indexOf("%");for(;-1!==t;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function k(e){return"["===e[0]&&"]"===e[e.length-1]}function x(e,t,r,a){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!k(e.host)&&(t.domainHost||r&&r.domainHost)&&!1===a&&m(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(t){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+t,!0}return!1}function P(e,t){let a=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,c=!1,u=!1,m=!1,v=!1,_=!1,b=!1;"suffix"===a.reference&&(e=a.scheme?a.scheme+":"+e:"//"+e);let P=e.match($);null!==P&&-1!==P[1].indexOf("\\")&&(i.error="URI authority must not contain a literal backslash.",s=!0);let E=e.match(w);if(null!==E){let e=E[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(i.error=i.error||"URI authority must not contain a literal backslash.",s=!0):e.length!==t.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",s=!0))}let T=e.match(S);if(T){let t;if(i.scheme=T[1],i.userinfo=T[3],i.host=T[4],i.port=parseInt(T[5],10),i.path=T[6]||"",i.query=T[7],i.fragment=T[8],void 0!==i.scheme){let e=unescape(i.scheme);g.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||y,_=!0)}t=T[4],(c=R(T[3])||void 0!==t&&!k(t)&&R(t)||R(T[6])||R(T[7])||R(T[8]))&&(i.error=i.error||"URI contains malformed percent-encoding."),isNaN(i.port)&&(i.port=T[5]);let S=void 0!==T[2]&&i.path&&"/"!==i.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof i.port&&(i.port<0||i.port>65535)?"URI port is malformed.":void 0;if(void 0!==S&&(i.error=i.error||S,s=!0),i.host)if(!1===p(i.host)){let e=k(i.host),t=-1!==i.host.indexOf("[")||-1!==i.host.indexOf("]"),a=r(i.host);b=a.isIPV6||!0===a.isIPVFuture,v=t&&(!e||!0===a.error),i.host=b?a.host:a.host.toLowerCase(),v&&(i.error=i.error||"URI host is malformed.",s=!0)}else b=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==i.reference&&(i.error=i.error||"URI is not a "+a.reference+" reference.");let $=f(a.scheme||i.scheme);if(v||(m=x(i,a,$,b)),-1!==e.indexOf("%")&&void 0!==i.host&&!v){let e=b?i.host:n(i.host,!0);b||(e=n(e.toLowerCase())),i.host=d(e,b)}(!$||$&&!$.skipNormalize)&&(i.path&&(i.path=o(i.path)),i.query&&(i.query=l(i.query)),i.fragment&&(i.fragment=l(i.fragment))),$&&$.parse&&($.parse(i,a),$===h.urn&&void 0===i.nid&&(u=!0))}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:c,malformedSchemeSpecific:u,malformedHost:m,malformedScheme:_}}function E(e,t){return P(e,t).parsed}function T(e,t){let{parsed:r,malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:n,malformedHost:o,malformedScheme:s}=P(e,t);return{normalized:a||i||n||o||s?e:b(r,t),malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:n,malformedHost:o,malformedScheme:s}}function j(e,t){let r;if("string"!=typeof e&&"object"!=typeof e)return;try{r="string"==typeof e?e:b(e,t)}catch{return}let{normalized:a,malformedAuthorityOrPort:i,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:l}=T(r,t);return i||n||o||s||l?void 0:a}let O={SCHEMES:h,normalize:function(e,t){return"string"==typeof e?e=T(e,t).normalized:"object"==typeof e&&(e=E(b(e,t),t)),e},resolve:function(e,t,a){let i=a?Object.assign({scheme:"null"},a):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:l,malformedHost:c,malformedScheme:u}=P(e,i),{parsed:d,malformedAuthorityOrPort:m,malformedPercentEncoding:h,malformedSchemeSpecific:g,malformedHost:y,malformedScheme:v}=P(t,i);if(o||m||s||h||l||g||c||y||u||v)throw Error(n.error||d.error||"URI is malformed.");let S=_(n,d,i,!0),$=f(a&&a.scheme||S.scheme),w=S.host;x(S,a||{},$,void 0!==w&&""!==w&&(p(w)||r(w).isIPV6));let R=w&&-1!==w.indexOf("%")&&!/\P{ASCII}/u.test(w);if(S.error&&!R)throw Error(S.error);return i.skipEscape=!0,b(S,i)},resolveComponent:_,equal:function(e,t,r){let a=j(e,r),i=j(t,r);return void 0!==a&&void 0!==i&&a===i},serialize:b,parse:E};t.exports=O,t.exports.default=O,t.exports.fastUri=O}),dr=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dt();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),da=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=u4();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=uV();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 a=u3(),i=u5(),n=uK(),o=u6(),s=uV(),l=u9(),c=uW(),u=uF(),d=u7(),p=dr(),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={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."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var v=class{constructor(e={}){var t,r,a,i,o,l,c,u,d,h,v,b,x,P,E,T,j,O,C,I,N,q,A,z,M,L;let Z,D,U,V,F;this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...(Z=(t=e).strict,U=!0===(D=null==(r=t.code)?void 0:r.optimize)||void 0===D?1:D||0,V=null!=(i=null==(a=t.code)?void 0:a.regExp)?i:m,F=null!=(o=t.uriResolver)?o:p.default,{strictSchema:null==(c=null!=(l=t.strictSchema)?l:Z)||c,strictNumbers:null==(d=null!=(u=t.strictNumbers)?u:Z)||d,strictTypes:null!=(v=null!=(h=t.strictTypes)?h:Z)?v:"log",strictTuples:null!=(x=null!=(b=t.strictTuples)?b:Z)?x:"log",strictRequired:null!=(E=null!=(P=t.strictRequired)?P:Z)&&E,code:t.code?{...t.code,optimize:U,regExp:V}:{optimize:U,regExp:V},loopRequired:null!=(T=t.loopRequired)?T:200,loopEnum:null!=(j=t.loopEnum)?j:200,meta:null==(O=t.meta)||O,messages:null==(C=t.messages)||C,inlineRefs:null==(I=t.inlineRefs)||I,schemaId:null!=(N=t.schemaId)?N:"$id",addUsedSchema:null==(q=t.addUsedSchema)||q,validateSchema:null==(A=t.validateSchema)||A,validateFormats:null==(z=t.validateFormats)||z,unicodeRegExp:null==(M=t.unicodeRegExp)||M,int32range:null==(L=t.int32range)||L,uriResolver:F})};let{es5:H,lines:J}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:f,es5:H,lines:J}),this.logger=function(e){if(!1===e)return k;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);let B=e.validateFormats;e.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,g,e,"NOT SUPPORTED"),_.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=B}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=d;"id"===r&&((a={...d}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let a=r(t);return"$async"in r||(this.errors=r.errors),a}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return a.call(this,e,t);async function a(e,t){await n.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await l.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await n.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,a=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:r});if(!(t=o.resolveSchema.call(this,a,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=b.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(P.call(this,r,t),!t)return(0,u.eachItem)(r,e=>E.call(this,e)),this;j.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===a.type.length?e=>E.call(this,e,a):e=>a.type.forEach(t=>E.call(this,e,a,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,n=i[e];a&&n&&(i[e]=C(n))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let n,{schemaId:s}=this.opts;if("object"==typeof e)n=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(n||r);let u=l.getSchemaRefs.call(this,e,r);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),a&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}function b(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function S(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function R(){let e={...this.opts};for(let t of h)delete e[t];return e}v.ValidationError=a.default,v.MissingRefError=i.default,e.default=v;let k={log(){},warn(){},error(){}},x=/^[a-z_$][a-z0-9_$:-]*$/i;function P(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!x.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function E(e,t,r){var a;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,o=i?n.post:n.rules.find(({type:e})=>e===r);if(o||(o={type:r,rules:[]},n.rules.push(o)),n.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?T.call(this,o,s,t.before):o.rules.push(s),n.all[e]=s,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function T(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}let O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,O]}}}),di=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),dn=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=u5(),r=uX(),a=uV(),i=uH(),n=u6(),o=uF();function s(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,n,s){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:p}=c,m=p.passContext?i.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;l.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),l.assign(i.default.errors,(0,a._)`${i.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==n?void 0:n.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=o.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,a._)`${e}.evaluated.props`);c.props=o.mergeEvaluated.props(l,t,c.props,a.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=o.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,a._)`${e}.evaluated.items`);c.items=o.mergeEvaluated.items(l,t,c.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let i=l.let("valid");l.try(()=>{l.code((0,a._)`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||l.assign(i,!0)},e=>{l.if((0,a._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),h(e),u||l.assign(i,!1)}),e.ok(i)}():e.result((0,r.callValidateCode)(e,t,m),()=>f(t),()=>h(t))}e.getValidate=s,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,i;let o,c,u,{gen:d,schema:p,it:m}=e,{baseId:h,schemaEnv:f,validateName:g,opts:y,self:v}=m,{root:_}=f;if(("#"===p||"#/"===p)&&h===_.baseId){if(f===_)return l(e,g,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,a._)`${t}.validate`,_,_.$async)}let b=n.resolveRef.call(v,_,h,p);if(void 0===b)throw new t.default(m.opts.uriResolver,h,p);return b instanceof n.SchemaEnv?void l(e,s(e,r=b),r,r.$async):(i=b,o=d.scopeValue("schema",!0===y.code.source?{ref:i,code:(0,a.stringify)(i)}:{ref:i}),c=d.name("valid"),u=e.subschema({schema:i,dataTypes:[],schemaPath:a.nil,topSchemaRef:o,errSchemaPath:p},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),ds=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=di(),r=dn();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),dl=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=t.operators,a={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}};e.default={keyword:Object.keys(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${a[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${a[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:i,schemaCode:n}=e;e.fail$data((0,t._)`${i} ${a[r].fail} ${n} || isNaN(${i})`)}}}),dc=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV();e.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:r,data:a,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=r.let("res"),l=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${a}/${i}, ${l}))`)}}}),du=H(e=>{function t(e){let t,r=e.length,a=0,i=0;for(;i<r;)a++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),dd=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF(),a=du();e.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${r} characters`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:n,schemaCode:o,it:s}=e,l="maxLength"===i?t.operators.GT:t.operators.LT,c=!1===s.opts.unicode?(0,t._)`${n}.length`:(0,t._)`${(0,r.useFunc)(e.gen,a.default)}(${n})`;e.fail$data((0,t._)`${c} ${l} ${o}`)}}}),dp=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uX(),r=uF(),a=uV();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`},code(e){let{gen:i,data:n,$data:o,schema:s,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(o){let{regExp:t}=c.opts.code,o="new RegExp"===t.code?(0,a._)`new RegExp`:(0,r.useFunc)(i,t),s=i.let("valid");i.try(()=>i.assign(s,(0,a._)`${o}(${l}, ${u}).test(${n})`),()=>i.assign(s,!1)),e.fail$data((0,a._)`!${s}`)}else{let r=(0,t.usePattern)(e,s);e.fail$data((0,a._)`!${r}.test(${n})`)}}}}),dm=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV();e.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${r} properties`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:a,schemaCode:i}=e,n="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${a}).length ${n} ${i}`)}}}),dh=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uX(),r=uV(),a=uF();e.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,r.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,r._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:n,schemaCode:o,data:s,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;let d=n.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,p);else for(let r of n)(0,t.checkReportMissingProp)(e,r)}():function(){let a=i.let("missing");if(d||l){let n=i.let("valid",!0);e.block$data(n,()=>{var l,c;return l=a,c=n,void(e.setParams({missingProperty:l}),i.forOf(l,o,()=>{i.assign(c,(0,t.propertyInData)(i,s,l,u.ownProperties)),i.if((0,r.not)(c),()=>{e.error(),i.break()})},r.nil))}),e.ok(n)}else i.if((0,t.checkMissingProp)(e,n,a)),(0,t.reportMissingProp)(e,a),i.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of n)if((null==t?void 0:t[e])===void 0&&!r.has(e)){let t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,a.checkStrictMode)(c,t,c.opts.strictRequired)}}function p(){i.forOf("prop",o,r=>{e.setParams({missingProperty:r}),i.if((0,t.noPropertyInData)(i,s,r,u.ownProperties),()=>e.error())})}}}}),df=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV();e.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${r} items`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:a,schemaCode:i}=e,n="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${a}.length ${n} ${i}`)}}}),dg=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u1();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),dy=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uW(),r=uV(),a=uF(),i=dg();e.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,r.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,r._)`{i: ${e}, j: ${t}}`},code(e){let{gen:n,data:o,$data:s,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!s&&!l)return;let p=n.let("valid"),m=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let s=n.let("i",(0,r._)`${o}.length`),l=n.let("j");e.setParams({i:s,j:l}),n.assign(p,!0),n.if((0,r._)`${s} > 1`,()=>(m.length>0&&!m.some(e=>"object"===e||"array"===e)?function(a,i){let s=n.name("item"),l=(0,t.checkDataTypes)(m,s,d.opts.strictNumbers,t.DataType.Wrong),c=n.const("indices",(0,r._)`{}`);n.for((0,r._)`;${a}--;`,()=>{n.let(s,(0,r._)`${o}[${a}]`),n.if(l,(0,r._)`continue`),m.length>1&&n.if((0,r._)`typeof ${s} == "string"`,(0,r._)`${s} += "_"`),n.if((0,r._)`typeof ${c}[${s}] == "number"`,()=>{n.assign(i,(0,r._)`${c}[${s}]`),e.error(),n.assign(p,!1).break()}).code((0,r._)`${c}[${s}] = ${a}`)})}:function(t,s){let l=(0,a.useFunc)(n,i.default),c=n.name("outer");n.label(c).for((0,r._)`;${t}--;`,()=>n.for((0,r._)`${s} = ${t}; ${s}--;`,()=>n.if((0,r._)`${l}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),n.assign(p,!1).break(c)})))})(s,l))},(0,r._)`${u} === false`),e.ok(p)}}}),dv=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF(),a=dg();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:n,$data:o,schemaCode:s,schema:l}=e;o||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(i,a.default)}(${n}, ${s})`):e.fail((0,t._)`${l} !== ${n}`)}}}),d_=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF(),a=dg();e.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let i,n,{gen:o,data:s,$data:l,schema:c,schemaCode:u,it:d}=e;if(!l&&0===c.length)throw Error("enum must have non-empty array");let p=c.length>=d.opts.loopEnum,m=()=>null!=i?i:i=(0,r.useFunc)(o,a.default);if(p||l)n=o.let("valid"),e.block$data(n,function(){o.assign(n,!1),o.forOf("v",u,e=>o.if((0,t._)`${m()}(${s}, ${e})`,()=>o.assign(n,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=o.const("vSchema",u);n=(0,t.or)(...c.map((r,a)=>{var i,n;let o;return i=e,"object"==typeof(o=c[n=a])&&null!==o?(0,t._)`${m()}(${s}, ${i}[${n}])`:(0,t._)`${s} === ${o}`}))}e.pass(n)}}}),db=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dl(),r=dc(),a=dd(),i=dp(),n=dm(),o=dh(),s=df(),l=dy(),c=dv(),u=d_();e.default=[t.default,r.default,a.default,i.default,n.default,o.default,s.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),dS=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=uV(),r=uF();function a(e,a){let{gen:i,schema:n,data:o,keyword:s,it:l}=e;l.items=!0;let c=i.const("len",(0,t._)`${o}.length`);if(!1===n)e.setParams({len:a.length}),e.pass((0,t._)`${c} <= ${a.length}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(l,n)){let n=i.var("valid",(0,t._)`${c} <= ${a.length}`);i.if((0,t.not)(n),()=>{var o;return o=n,void i.forRange("i",a.length,c,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},o),l.allErrors||i.if((0,t.not)(o),()=>i.break())})}),e.ok(n)}}e.validateAdditionalItems=a,e.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:i}=e,{items:n}=t;Array.isArray(n)?a(e,n):(0,r.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),d$=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=uV(),r=uF(),a=uX();function i(e,a,n=e.schema){let{gen:o,parentSchema:s,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:i}=u,o=n.length,s=o===e.minItems&&(o===e.maxItems||!1===e[a]);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(s),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(o,n.length,u.items));let d=o.name("valid"),p=o.const("len",(0,t._)`${l}.length`);n.forEach((a,i)=>{(0,r.alwaysValidSchema)(u,a)||(o.if((0,t._)`${p} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},d)),e.ok(d))})}e.validateTuple=i,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return i(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,a.validateArray)(e))}}}),dw=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=d$();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),dR=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF(),a=uX(),i=dS();e.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:n,it:o}=e,{prefixItems:s}=n;o.items=!0,(0,r.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,a.validateArray)(e)))}}}),dk=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF();e.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${r}}`},code(e){let a,i,{gen:n,schema:o,parentSchema:s,data:l,it:c}=e,{minContains:u,maxContains:d}=s;c.opts.next?(a=void 0===u?1:u,i=d):a=1;let p=n.const("len",(0,t._)`${l}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,o)){let r=(0,t._)`${p} >= ${a}`;void 0!==i&&(r=(0,t._)`${r} && ${p} <= ${i}`),e.pass(r);return}c.items=!0;let m=n.name("valid");function h(){let e=n.name("_valid"),r=n.let("count",0);f(e,()=>n.if(e,()=>{var e;return e=r,void(n.code((0,t._)`${e}++`),void 0===i?n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0).break()):(n.if((0,t._)`${e} > ${i}`,()=>n.assign(m,!1).break()),1===a?n.assign(m,!0):n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0))))}))}function f(t,a){n.forRange("i",0,p,i=>{e.subschema({keyword:"contains",dataProp:i,dataPropType:r.Type.Num,compositeRule:!0},t),a()})}void 0===i&&1===a?f(m,()=>n.if(m,()=>n.break())):0===a?(n.let(m,!0),void 0!==i&&n.if((0,t._)`${l}.length > 0`,h)):(n.let(m,!1),h()),e.result(m,()=>e.reset())}}}),dx=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=uV(),r=uF(),a=uX();e.error={message:({params:{property:e,depsCount:r,deps:a}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${a} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:a,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
59
59
|
missingProperty: ${i},
|
|
60
|
-
depsCount: ${
|
|
61
|
-
deps: ${n}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let n in t)"__proto__"!==n&&((Array.isArray(t[n])?r:a)[n]=t[n]);return[r,a]}(t);o(t,r),s(t,a)}};function o(t,a=t.schema){let{gen:i,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=i.let("missing");for(let o in a){let u=a[o];if(0===u.length)continue;let d=(0,n.propertyInData)(i,s,o,l.opts.ownProperties);t.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),l.allErrors?i.if(d,()=>{for(let r of u)(0,n.checkReportMissingProp)(t,r)}):(i.if((0,r._)`${d} && (${(0,n.checkMissingProp)(t,u,c)})`),(0,n.reportMissingProp)(t,c),i.else())}}function s(t,r=t.schema){let{gen:i,data:o,keyword:l,it:c}=t,u=i.name("valid");for(let s in r)(0,a.alwaysValidSchema)(c,r[s])||(i.if((0,n.propertyInData)(i,o,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>i.var(u,!0)),t.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=s,t.default=i}),dP=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:n,schema:i,data:o,it:s}=t;if((0,a.alwaysValidSchema)(s,i))return;let l=n.name("valid");n.forIn("key",o,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),n.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||n.break()})}),t.ok(l)}}}),dE=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uH(),i=uF();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:o,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:m}=d;if(d.props=!0,"all"!==m.removeAdditional&&(0,i.alwaysValidSchema)(d,s))return;let h=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function g(t){o.code((0,a._)`delete ${c}[${t}]`)}function y(r){if("all"===m.removeAdditional||m.removeAdditional&&!1===s)return void g(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||o.break();return}if("object"==typeof s&&!(0,i.alwaysValidSchema)(d,s)){let n=o.name("valid");"failing"===m.removeAdditional?(v(r,n,!1),o.if((0,a.not)(n),()=>{t.reset(),g(r)})):(v(r,n),p||o.if((0,a.not)(n),()=>o.break()))}}function v(r,a,n){let o={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}o.forIn("key",c,n=>{h.length||f.length?o.if(function(n){let s;if(h.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(o,t,n)}else s=h.length?(0,a.or)(...h.map(t=>(0,a._)`${n} === ${t}`)):a.nil;return f.length&&(s=(0,a.or)(s,...f.map(i=>(0,a._)`${(0,r.usePattern)(t,i)}.test(${n})`))),(0,a.not)(s)}(n),()=>y(n)):y(n)}),t.ok((0,a._)`${u} === ${n.default.errors}`)}}}),dT=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u4(),a=uX(),n=uF(),i=dE();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&i.default.code(new r.KeywordCxt(u,i.default,"additionalProperties"));let d=(0,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=n.mergeEvaluated.props(o,(0,n.toHash)(d),u.props));let p=d.filter(t=>!(0,n.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let m=o.name("valid");for(let r of p){var h;(h=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[h].default)?f(r):(o.if((0,a.propertyInData)(o,c,r,u.opts.ownProperties)),f(r),u.allErrors||o.else().var(m,!0),o.endIf()),t.it.definedProperties.add(r),t.ok(m)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},m)}}}}),dj=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uF(),i=uF();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),m=p.filter(t=>(0,n.alwaysValidSchema)(u,s[t]));if(0===p.length||m.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=o.name("valid");!0===u.props||u.props instanceof a.Name||(u.props=(0,i.evaluatedPropsToName)(o,u.props));let{props:g}=u;for(let t of p)h&&function(t){for(let r in h)new RegExp(t).test(r)&&(0,n.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?y(t):(o.var(f,!0),y(t),o.if(f));function y(n){o.forIn("key",l,s=>{o.if((0,a._)`${(0,r.usePattern)(t,n)}.test(${s})`,()=>{let r=m.includes(n);r||t.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:i.Type.Str},f),u.opts.unevaluated&&!0!==g?o.assign((0,a._)`${g}[${s}]`,!0):r||u.allErrors||o.if((0,a.not)(f),()=>o.break())})})}}}}),dO=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:n,it:i}=t;if((0,r.alwaysValidSchema)(i,n))return void t.fail();let o=a.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),dC=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uX().validateUnion,error:{message:"must match a schema in anyOf"}}}),dI=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:n,schema:i,parentSchema:o,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;let l=n.let("valid",!1),c=n.let("passing",null),u=n.name("_valid");t.setParams({passing:c}),n.block(function(){i.forEach((i,o)=>{let d;(0,a.alwaysValidSchema)(s,i)?n.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&n.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${o}]`).else(),n.if(u,()=>{n.assign(l,!0),n.assign(c,o),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dN=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:n,it:i}=t;if(!Array.isArray(n))throw Error("ajv implementation error");let o=a.name("valid");n.forEach((a,n)=>{if((0,r.alwaysValidSchema)(i,a))return;let s=t.subschema({keyword:"allOf",schemaProp:n},o);t.ok(o),t.mergeEvaluated(s)})}}}),dq=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();function n(t,r){let n=t.schema[r];return void 0!==n&&!(0,a.alwaysValidSchema)(t,n)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let i,{gen:o,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=n(l,"then"),u=n(l,"else");if(!c&&!u)return;let d=o.let("valid",!0),p=o.name("_valid");if(i=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(i),t.reset(),c&&u){let r=o.let("ifClause");t.setParams({ifClause:r}),o.if(p,m("then",r),m("else",r))}else c?o.if(p,m("then")):o.if((0,r.not)(p),m("else"));function m(a,n){return()=>{let i=t.subschema({keyword:a},p);o.assign(d,p),t.mergeValidEvaluated(i,d),n?o.assign(n,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),dA=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:n}){void 0===a.if&&(0,r.checkStrictMode)(n,`"${t}" without "if" is ignored`)}}}),dM=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dS(),a=dw(),n=d$(),i=dR(),o=dk(),s=dx(),l=dP(),c=dE(),u=dT(),d=dj(),p=dO(),m=dC(),h=dI(),f=dN(),g=dq(),y=dA();t.default=function(t=!1){let v=[p.default,m.default,h.default,f.default,g.default,y.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(a.default,i.default):v.push(r.default,n.default),v.push(o.default),v}}),dz=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let n,i,o,s,l,c,{gen:u,data:d,$data:p,schema:m,schemaCode:h,it:f}=t,{opts:g,errSchemaPath:y,schemaEnv:v,self:_}=f;g.validateFormats&&(p?(n=u.scopeValue("formats",{ref:_.formats,code:g.code.formats}),i=u.const("fDef",(0,r._)`${n}[${h}]`),o=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(o,(0,r._)`${i}.type || "string"`).assign(s,(0,r._)`${i}.validate`),()=>u.assign(o,(0,r._)`"string"`).assign(s,i)),t.fail$data((0,r.or)(!1===g.strictSchema?r.nil:(0,r._)`${h} && !${s}`,(l=v.$async?(0,r._)`(${i}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${o} === ${a} && !${c}`)))):function(){var n;let i,o,s=_.formats[m];if(!s){if(!1===g.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${m}" ignored in schema at path "${y}"`}}if(!0===s)return;let[c,p,h]=(i=(n=s)instanceof RegExp?(0,r.regexpCode)(n):g.code.formats?(0,r._)`${g.code.formats}${(0,r.getProperty)(m)}`:void 0,o=u.scopeValue("formats",{key:m,ref:n,code:i}),"object"!=typeof n||n instanceof RegExp?["string",n,o]:[n.type||"string",n.validate,(0,r._)`${o}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${h}(${d})`}return"function"==typeof p?(0,r._)`${h}(${d})`:(0,r._)`${h}.test(${d})`}())}())}}}),dL=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[dz().default]}),dZ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dD=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ds(),a=db(),n=dM(),i=dL(),o=dZ();t.default=[r.default,a.default,(0,n.default)(),i.default,o.metadataVocabulary,o.contentVocabulary]}),dU=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),dV=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=dU(),n=u5(),i=u6(),o=uF();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:n}})=>(0,r._)`{error: ${t}, tag: ${n}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let m=c.propertyName;if("string"!=typeof m)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(m)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=n.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof n.SchemaEnv&&(u=u.schema),void 0===u)throw new i.default(d.opts.uriResolver,d.baseId,t)}let h=null==(t=null==u?void 0:u.properties)?void 0:t[m];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);s=s&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}(h,r)}if(!s)throw Error(`discriminator: "${m}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(m)}function c(t,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${m}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${f} === ${a}`),s.assign(h,function(a){let n=s.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:a},n);return t.mergeEvaluated(i,r.Name),n}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:f,tagName:m}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:f,tagName:m})),t.ok(h)}}}),dF=H((t,r)=>{r.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}}),dH=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=da(),n=dD(),i=dV(),o=dF(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),dJ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uV(),a=uH(),n=u5(),i=di();function o(t,o){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[o]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(o)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:o}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=o.opts,p=new n.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return n.compileSchema.call(o,p),(0,i.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=o,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>o(t,t.schema)}}),dB=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uV(),a=uH(),n=di();function i(t,i){let{gen:o,keyword:s,it:l}=t;if("#"!==i[0])throw Error(`"${s}" only supports hash fragment reference`);let c=i.slice(1);if(l.allErrors)u();else{let r=o.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let n=o.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);o.if(n,d(n,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>o.block(()=>{(0,n.callRef)(t,r),o.let(a,!0)}):()=>(0,n.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),dK=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=uF();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dG=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dB();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dW=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=dB(),n=dK(),i=dG();t.default=[r.default,a.default,n.default,i.default]}),dY=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dx();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dX=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dx();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dQ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:n}){void 0===a.contains&&(0,r.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}}}),d0=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dY(),a=dX(),n=dQ();t.default=[r.default,a.default,n.default]}),d1=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=uH();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:i,schema:o,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(n){if(!1===o){t.setParams({unevaluatedProperty:n}),t.error(),u||i.break();return}if(!(0,a.alwaysValidSchema)(c,o)){let o=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:n,dataPropType:a.Type.Str},o),u||i.if((0,r.not)(o),()=>i.break())}}d instanceof r.Name?i.if((0,r._)`${d} !== true`,()=>i.forIn("key",s,t=>{var a,n;return i.if((a=d,n=t,(0,r._)`!${a} || !${a}[${n}]`),()=>p(t))})):!0!==d&&i.forIn("key",s,t=>void 0===d?p(t):i.if(function(t,a){let n=[];for(let i in t)!0===t[i]&&n.push((0,r._)`${a} !== ${i}`);return(0,r.and)(...n)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${n.default.errors}`)}}}),d2=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:n,schema:i,data:o,it:s}=t,l=s.items||0;if(!0===l)return;let c=n.const("len",(0,r._)`${o}.length`);if(!1===i)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof i&&!(0,a.alwaysValidSchema)(s,i)){let i=n.var("valid",(0,r._)`${c} <= ${l}`);n.if((0,r.not)(i),()=>{var o,u;return o=i,u=l,void n.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:a.Type.Num},o),s.allErrors||n.if((0,r.not)(o),()=>n.break())})}),t.ok(i)}s.items=!0}}}),d9=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d1(),a=d2();t.default=[r.default,a.default]}),d4=H((t,r)=>{r.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"}]}}}}}),d3=H((t,r)=>{r.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:"#"}}}}}),d6=H((t,r)=>{r.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:"#"}}}}),d5=H((t,r)=>{r.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:{}}}}}),d7=H((t,r)=>{r.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"}}}}),d8=H((t,r)=>{r.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}}}}),pe=H((t,r)=>{r.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:[]}}}}),pt=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d4(),a=d3(),n=d6(),i=d5(),o=d7(),s=d8(),l=pe(),c=["/properties"];t.default=function(t){return[r,a,n,i,u(this,o),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),pr=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=da(),n=dD(),i=dW(),o=d0(),s=d9(),l=dV(),c=pt(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),n.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(o.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var m=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var f=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),pa=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ds(),a=db(),n=dM(),i=dW(),o=d0(),s=d9(),l=dL(),c=dZ();t.default=[i.default,r.default,a.default,(0,n.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,o.default,s.default]}),pn=H((t,r)=>{r.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}}}}),pi=H((t,r)=>{r.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"}}}}}),po=H((t,r)=>{r.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"}}}}),ps=H((t,r)=>{r.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"}}}}),pl=H((t,r)=>{r.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"}}}}),pc=H((t,r)=>{r.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"}}}}),pu=H((t,r)=>{r.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}}}}),pd=H((t,r)=>{r.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:[]}}}}),pp=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=pn(),a=pi(),n=po(),i=ps(),o=pl(),s=pc(),l=pu(),c=pd(),u=["/properties"];t.default=function(t){return[r,a,n,i,o,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),pm=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=da(),n=pa(),i=dV(),o=pp(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(o.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),ph=H(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,o),time:r(l(!0),c),"date-time":r(p(!0),m),"iso-time":r(l(),u),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&g.test(t)},"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:function(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},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:function(t){return y.lastIndex=0,y.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\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,m),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\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,h),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},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(t){var r;let i=a.exec(t);if(!i)return!1;let o=+i[1],s=+i[2],l=+i[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=o)%4==0&&(r%100!=0||r%400==0)?29:n[s])}function o(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let a=s.exec(r);if(!a)return!1;let n=+a[1],i=+a[2],o=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(n<=23&&i<=59&&o<60)return!0;let p=i-d*c,m=n-u*c-(p<0);return(23===m||-1===m)&&(59===p||-1===p)&&o<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+r).valueOf();if(a&&n)return a-n}function u(t,r){if(!(t&&r))return;let a=s.exec(t),n=s.exec(r);if(a&&n)return(t=a[1]+a[2]+a[3])>(r=n[1]+n[2]+n[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&i(a[0])&&r(a[1])}}function m(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),n=new Date(r).valueOf();if(a&&n)return a-n}function h(t,r){if(!(t&&r))return;let[a,n]=t.split(d),[i,s]=r.split(d),l=o(a,i);if(void 0!==l)return l||c(n,s)}let f=/\/|:/,g=/^(?:[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,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),pf=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dH(),a=uV(),n=a.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${i[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${i[t].okStr}, limit: ${r}}`},code(t){let n,o,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:m}=d;if(!p.validateFormats)return;let h=new r.KeywordCxt(d,m.RULES.all.format.definition,"format");function f(t){return(0,a._)`${t}.compare(${l}, ${c}) ${i[u].fail} 0`}h.$data?(n=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),o=s.const("fmt",(0,a._)`${n}[${h.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${o} != "object"`,(0,a._)`${o} instanceof RegExp`,(0,a._)`typeof ${o}.compare != "function"`,f(o)))):function(){let r=h.schema,n=m.formats[r];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let i=s.scopeValue("formats",{key:r,ref:n,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(f(i))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),pg=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=ph(),n=pf(),i=uV(),o=new i.Name("fullFormats"),s=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,o),t;let[i,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,o];return c(t,r.formats||a.formatNames,i,l),r.keywords&&(0,n.default)(t),t};function c(t,r,a,n){var o;for(let s of(null!=(o=t.opts.code).formats||(o.formats=(0,i._)`require("ajv-formats/dist/formats").${n}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let n=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!n)throw Error(`Unknown format "${t}"`);return n},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),py=dH(),pv=pr(),p_=pm();let pb=J(pg(),1).default;function pS(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pb(r),r}var p$=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=pS(p_.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(B.has(a))return"2020-12";if(K.has(a))return"2019-09";if(G.has(a)||W.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=pS(pv.Ajv2019):this._ajvDraft7??=pS(py.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};py.Ajv,require("node:process");let pw=Symbol.for("mcp.completable");function pR(t){return!!t&&"object"==typeof t&&pw in t}let pk=0x80000000-1;function px(t,r){if(!Number.isFinite(t)||t<1)return;let a=setInterval(r,Math.min(t,pk));return a.unref?.(),a}var pP=class{_listeners=new Set;constructor(t){this.onerror=t}publish(t){for(let r of this._listeners)try{r(t)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}subscribe(t){this._listeners.add(t);let r=!0;return()=>{r&&(r=!1,this._listeners.delete(t))}}get listenerCount(){return this._listeners.size}};function pE(t,r,a){return Response.json({jsonrpc:"2.0",error:{code:r,message:a},id:t},{status:200})}function pT(t,r){return{method:t.method,params:{...t.params,_meta:{...t.params?._meta,[iW]:r}}}}function pj(t){return t.replaceAll(/[\\"]/g,String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g," ")}function pO(t,r,a,n){let i=`Bearer error="${pj(t)}", error_description="${pj(r)}"`;return a.length>0&&(i+=`, scope="${pj(a.join(" "))}"`),n&&(i+=`, resource_metadata="${pj(n)}"`),i}async function pC(t,r,a){for(let i of t){let t=await a({request:i,...void 0!==r&&{authInfo:r}});if(void 0!==t){if(null===t||"object"!=typeof t||!Array.isArray(t.scopes)||0===t.scopes.length)throw TypeError("scope challenge must contain at least one scope");for(let[r,a]of t.scopes.entries()){var n=`scope challenge scopes[${r}]`;if("string"!=typeof a||!/^[\u0021\u0023-\u005B\u005D-\u007E]+$/.test(a))throw TypeError(`${n} must satisfy the OAuth scope-token grammar`)}if(void 0!==t.errorDescription&&"string"!=typeof t.errorDescription)throw TypeError("scope challenge errorDescription must be a string");if(void 0!==t.errorDescription&&!/^[\u0020-\u0021\u0023-\u005B\u005D-\u007E]+$/.test(t.errorDescription))throw TypeError("scope challenge errorDescription must satisfy the RFC 6750 error-description grammar");return t}}}function pI(t){if(t?.resourceMetadataUrl!==void 0)return t.resourceMetadataUrl;if(t?.resource?.protocol==="https:"||t?.resource?.protocol==="http:"){var r,a;let n,i;return n=new URL(r=t.resource),i=(a=r.pathname).length>1&&a.endsWith("/")?a.slice(0,-1):a,n.pathname=`/.well-known/oauth-protected-resource${"/"===i?"":i}`,n.hash="",n.href}}function pN(t,r){return function(t,r){let{requiredScopes:a=[],resourceMetadataUrl:n}=r??{};if(!(t instanceof lF)){let t=new lF(lV.ServerError,"Internal Server Error");return Response.json(t.toResponseObject(),{status:500})}switch(t.code){case lV.InvalidToken:{let r=pO(t.code,t.message,a,n);return Response.json(t.toResponseObject(),{status:401,headers:{"WWW-Authenticate":r}})}case lV.InsufficientScope:{let r=pO(t.code,t.message,a,n);return Response.json(t.toResponseObject(),{status:403,headers:{"WWW-Authenticate":r}})}case lV.ServerError:return Response.json(t.toResponseObject(),{status:500});default:return Response.json(t.toResponseObject(),{status:400})}}(new lF(lV.InsufficientScope,t.errorDescription??"Insufficient scope"),{requiredScopes:[...t.scopes],resourceMetadataUrl:r})}function pq(t,r,a){if(null===a||"object"!=typeof a||"string"!=typeof a.method)throw new cg(cf.InternalError,`Handler for ${t} returned an invalid input request '${r}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=function(t){switch(t.method){case"elicitation/create":if(t.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let r=t.params;if(void 0!==r&&(void 0!==r.tools||void 0!==r.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(a);if(void 0===n)throw new cg(cf.InternalError,`Handler for ${t} returned an input request '${r}' of kind '${a.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:a,required:n}}function pA(t,r){if("tools/call"===t)return{content:[{type:"text",text:r}],isError:!0};throw new cg(cf.InternalError,r)}var pM=class{constructor(t){this._host=t}async fulfill(t,r,a,n,i){let{maxRounds:o,roundTimeoutMs:s}=this._host,l=n.mcpReq.signal,c=i,u=0;for(;;){let i;if((u+=1)>o)return pA(t,`Multi-round-trip request '${t}' still required input after ${o} rounds (inputRequired.maxRounds)`);let d=c.inputRequests,p=null!=d&&Object.keys(d).length>0,m="string"==typeof c.requestState?c.requestState:void 0;if(!p&&void 0===m)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(p){let r=this._host.resolvedClientCapabilities(n),a=[];for(let[n,i]of Object.entries(d)){let{embedded:o,required:s}=pq(t,n,i);if("roots/list"!==o.method&&void 0===o.params)throw new cg(cf.InternalError,`Handler for ${t} returned an input request '${n}' of kind '${o.method}' without params`);if(void 0!==lG(s,r))return pA(t,`Cannot request input '${n}' (${o.method}): the client on this 2025-era connection did not declare the required capability${void 0===r?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);a.push([n,o])}let o=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(l);try{let t={relatedRequestId:n.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:o.signal},r=await Promise.all(a.map(async([r,a])=>{try{return[r,await this._dispatchLeg(a,t)]}catch(t){throw o.abort(t),t}}));i=Object.fromEntries(r)}catch(r){if(l.aborted)throw r;return pA(t,`Fulfilling input required by '${t}' failed: ${r instanceof Error?r.message:String(r)}`)}finally{o.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof lJ?r.reason:new lJ(lH.RequestTimeout,String(r.reason)));let n=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(n),a(r?.reason instanceof lJ?r.reason:new lJ(lH.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",i,{once:!0})})}(0,l);let h={...n,mcpReq:{...n.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(t){return()=>t}(m)}};if(void 0!==m){let r=await this._host.verifyRequestState(m,h,t);void 0!==r&&(h=uj(h,r))}let f=await r(a,h);if(!cX(f))return f;c=f}}async _dispatchLeg(t,r){switch(t.method){case"elicitation/create":{let a=t.params;return"url"===a.mode&&void 0===a.elicitationId&&(a={...a,elicitationId:function(){let t=globalThis.crypto;if(t?.randomUUID!==void 0)return t.randomUUID();let r=new Uint8Array(16);t.getRandomValues(r),r[6]=15&r[6]|64,r[8]=63&r[8]|128;let a=[...r].map(t=>t.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}()}),await this._host.sendElicitation(a,r)}case"sampling/createMessage":return await this._host.sendSampling(t.params,r);case"roots/list":return await this._host.listRoots(t.params,r)}}};let pz=new Set(["tools/call","prompts/get","resources/read"]);var pL=class extends uO{_clientCapabilities;_clientVersion;static{d=(t,r)=>{void 0!==r.clientCapabilities&&(t._clientCapabilities=r.clientCapabilities),void 0!==r.clientInfo&&(t._clientVersion=r.clientInfo)},p=(t,r)=>{let a=r.filter(r=>!t._supportedProtocolVersions.includes(r));a.length>0&&(t._supportedProtocolVersions=[...t._supportedProtocolVersions,...a]),t.setRequestHandler("server/discover",()=>t._ondiscover())},m=t=>t._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pM({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:t=>this._inputRequestCapabilityView(t),verifyRequestState:(t,r,a)=>this._verifyRequestState(t,r,a),sendElicitation:(t,r)=>this._sendElicitationLeg(t,r,{validateAcceptedContent:!1}),sendSampling:(t,r)=>this.createMessage(t,r),listRoots:(t,r)=>this.listRoots(t,r)})}oninitialized;constructor(t,r){if(super(r),this._serverInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new p$,this._requestStateVerify=r?.requestState?.verify,this._inputRequiredServing=function(t){if(t?.maxRounds!==void 0&&(!Number.isInteger(t.maxRounds)||t.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${t.maxRounds})`);if(t?.roundTimeoutMs!==void 0&&(!Number.isFinite(t.roundTimeoutMs)||t.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${t.roundTimeoutMs})`);return{maxRounds:t?.maxRounds??8,roundTimeoutMs:t?.roundTimeoutMs??6e5,legacyShim:t?.legacyShim??!0}}(r?.inputRequired),r?.cacheHints!==void 0){for(const[t,a]of Object.entries(r.cacheHints))void 0!==a&&ch(a,`cacheHints['${t}']`);this._cacheHints=r.cacheHints}this.setRequestHandler("initialize",t=>this._oninitialize(t)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lX(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}async connect(t){if(void 0!==this.transport)throw new lJ(lH.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(t)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(t,r)=>{let a=r.sessionId||r.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=t.params,i=n_(sx,n);return i.success&&this._loggingLevels.set(a,i.data),{}})}buildContext(t,r){let a=t.http||r?.request||r?.closeSSEStream||r?.closeStandaloneSSEStream;return{...t,mcpReq:{...t.mcpReq,log:(r,a,n)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=t.mcpReq.envelope?.[iY]))return Promise.resolve()}else i=this._loggingLevels.get(t.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():t.mcpReq.notify({method:"notifications/message",params:{level:r,data:a,logger:n}})},elicitInput:(t,r)=>this.elicitInput(t,r),requestSampling:(t,r)=>this.createMessage(t,r)},http:a?{...t.http,req:r?.request,closeSSE:r?.closeSSEStream,closeStandaloneSSE:r?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(sx.options.map((t,r)=>[t,r]));isMessageIgnored=(t,r)=>{let a=this._loggingLevels.get(r);return!!a&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(a)};registerCapabilities(t){if(this.transport)throw new lJ(lH.AlreadyConnected,"Cannot register capabilities after connecting to transport");let r=!!this._capabilities.logging;this._capabilities=function(t,r){let a={...t};for(let t in r){let n=r[t];if(void 0===n)continue;let i=a[t];a[t]=uC(i)&&uC(n)?{...i,...n}:n}return a}(this._capabilities,t),!r&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(t,r){if("tools/call"!==t){let a=this._cacheHints?.[t],n=pz.has(t);return void 0!==a||n?async(i,o)=>{let s=n?await this._invokeInputRequiredCapableHandler(t,r,i,o):await r(i,o);if(cX(s)){if(!n)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return void 0===a?s:cd(s,a)}:async(a,n)=>{let i=await r(a,n);if(cX(i))throw new cg(cf.InternalError,`Handler for ${t} 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 async(t,a)=>{let n=cA(this._negotiatedProtocolVersion),i=n.validateRequest("tools/call",t);if(!i.ok)throw new cg("not-in-era"===i.reason?cf.InternalError:cf.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let o=await this._invokeInputRequiredCapableHandler("tools/call",r,t,a);if(cX(o))return o;let s=l1(o),l=n.validateResult("tools/call",s);if(!l.ok)throw new cg("not-in-era"===l.reason?cf.InternalError:cf.InvalidParams,"not-in-era"===l.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${l.message}`);return l.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lW}async _invokeInputRequiredCapableHandler(t,r,a,n){let i,o=this._servedModernEra(),s=n.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cg(cf.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let l=n;if("string"==typeof s){let r=await this._verifyRequestState(s,n,t);void 0!==r&&(l=uj(n,r))}try{i=await r(a,l)}catch(t){if(t instanceof cg&&t.code===cf.UrlElicitationRequired){if(!o)throw t;throw new cg(cf.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw t}if(!cX(i))return i;if(!o){if(!this._inputRequiredServing.legacyShim)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??iF}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(t,r,a,l,i)}let c=i.inputRequests,u=null!=c&&Object.keys(c).length>0,d="string"==typeof i.requestState;if(!u&&!d)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let r=this._inputRequestCapabilityView(n);for(let[a,n]of Object.entries(c)){let{embedded:i,required:o}=pq(t,a,n),s=lG(o,r);if(void 0!==s)throw new cb({requiredCapabilities:s},`Cannot request input '${a}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(t,r,a){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(t,r)}catch(t){throw this.onerror?.(Error(`requestState verification rejected ${a}: ${t instanceof Error?t.message:String(t)}`)),new cg(cf.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(t){return this._servedModernEra()?t.mcpReq.envelope?.[iG]:this._clientCapabilities}_assertPushApiInServedEra(t){if(this._servedModernEra())throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${t}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:t,era:"2026-07-28"})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new lJ(lH.CapabilityNotSupported,`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lJ(lH.CapabilityNotSupported,`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lJ(lH.CapabilityNotSupported,`Client does not support listing roots (required for ${t})`)}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new lJ(lH.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,`Client does not support URL elicitation (required for ${t})`)}}assertRequestHandlerCapability(t){switch(t){case"completion/complete":if(!this._capabilities.completions)throw new lJ(lH.CapabilityNotSupported,`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lJ(lH.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lJ(lH.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new lJ(lH.CapabilityNotSupported,`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lJ(lH.CapabilityNotSupported,`Server does not support tools (required for ${t})`)}}async _oninitialize(t){let r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo;let a=this._supportedProtocolVersions.filter(t=>!(t>=lW)),n=a.includes(r)?r:a[0]??iF;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lX(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(t,r){return this._wireCodec().projectCallToolResult(t,r)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(t,r){if(this._assertPushApiInServedEra("sampling/createMessage"),(t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new lJ(lH.CapabilityNotSupported,"Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages.at(-1),a=Array.isArray(r.content)?r.content:[r.content],n=a.some(t=>"tool_result"===t.type),i=t.messages.length>1?t.messages.at(-2):void 0,o=i?Array.isArray(i.content)?i.content:[i.content]:[],s=o.some(t=>"tool_use"===t.type);if(n){if(a.some(t=>"tool_result"!==t.type))throw new cg(cf.InvalidParams,"The last message must contain only tool_result content if any is present");if(!s)throw new cg(cf.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(s){let t=new Set(o.filter(t=>"tool_use"===t.type).map(t=>t.id)),r=new Set(a.filter(t=>"tool_result"===t.type).map(t=>t.toolUseId));if(t.size!==r.size||![...t].every(t=>r.has(t)))throw new cg(cf.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let a=!!(t.tools||t.toolChoice),n=await this.request({method:"sampling/createMessage",params:t},r),i=this._wireCodec().samplingResultVariant(a,n);if(!i.ok)throw new lJ(lH.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(t,r){switch(this._assertPushApiInServedEra("elicitation/create"),t.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lJ(lH.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(t,r)}async _sendElicitationLeg(t,r,a){let n=t.mode??"form",i=a?.validateAcceptedContent??!0;switch(n){case"url":return this.request({method:"elicitation/create",params:t},r);case"form":{let a="form"===t.mode?t:{...t,mode:"form"},n=await this.request({method:"elicitation/create",params:a},r);if(i&&"accept"===n.action&&n.content&&a.requestedSchema)try{let t=this._jsonSchemaValidator.getValidator(a.requestedSchema)(n.content);if(!t.valid)throw new cg(cf.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(t){if(t instanceof cg)throw t;throw new cg(cf.InternalError,`Error validating elicitation response: ${t instanceof Error?t.message:String(t)}`)}return n}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:t},r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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"})}},pZ=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(t){let r=this._registeredTools[t];if(void 0!==r&&r.enabled){if(Object.hasOwn(this._toolInputSchemaJson,t))return this._toolInputSchemaJson[t];if(void 0===r.inputSchema)return pV;try{let a=up(r.inputSchema,"input");return this._toolInputSchemaJson[t]=a,a}catch{return}}}constructor(t,r){this.server=new pL(t,r),this._maxToolInputElements=function(t){if(void 0!==t&&t!==1/0){if("number"!=typeof t||Number.isNaN(t)||t<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(t)}`);return t}}(r?.maxToolInputElements),r?.capabilities?.tools&&this.setToolRequestHandlers(),r?.capabilities?.resources&&this.setResourceRequestHandlers(),r?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(t){return"object"==typeof t&&null!==t&&"setScopeChallengeResolver"in t&&"function"==typeof t.setScopeChallengeResolver&&t.setScopeChallengeResolver(t=>this.resolveScopeChallenge(t)),await this.server.connect(t)}async close(){await this.server.close()}resolveScopeChallenge=t=>{switch(t.request.method){case"tools/call":{let r=t.request.params?.name;if("string"!=typeof r)return;let a=this._registeredTools[r];if(void 0===a||!a.enabled)return;return a.scopeChallenge?.(t)}case"resources/read":{let r,a=t.request.params?.uri;if("string"!=typeof a)return;try{r=new URL(a)}catch{return}let n=this._registeredResources[r.toString()];if(void 0!==n)return n.enabled?n.scopeChallenge?.(t):void 0;for(let a of Object.values(this._registeredResourceTemplates))if(a.resourceTemplate.uriTemplate.match(r.toString()))return a.enabled?a.scopeChallenge?.(t):void 0;return}case"prompts/get":{let r=t.request.params?.name;if("string"!=typeof r)return;let a=this._registeredPrompts[r];if(void 0===a||!a.enabled)return;return a.scopeChallenge?.(t)}default:return}};_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(([,t])=>t.enabled).map(([t,r])=>{var a;let n,i,o={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?(a=t,(i=c2(n=up(r.inputSchema,"input"))).valid||console.warn(`[mcp-sdk] tool '${a}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${i.reason}`),n):pV,annotations:r.annotations,icons:r.icons,execution:r.execution,_meta:r._meta};return r.outputSchema&&(o.outputSchema=up(r.outputSchema,"output")),o})})),this.server.setRequestHandler("tools/call",async(t,r)=>{let a=this._registeredTools[t.params.name];if(!a)throw new cg(cf.InvalidParams,`Tool ${t.params.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Tool ${t.params.name} disabled`);try{let n=await this.validateToolInput(a,t.params.arguments,t.params.name),i=await this.executeToolHandler(a,n,r);if(await this.validateToolOutput(a,i,t.params.name),cX(i))return i;return this.server.projectCallToolResult(i,a.outputSchemaJson)}catch(t){if(t instanceof cg&&t.code===cf.UrlElicitationRequired)throw t;return this.createToolError(t instanceof Error?t.message:String(t))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,a){if(void 0!==this._maxToolInputElements&&function(t,r){let a=0,n=[t];for(;n.length>0;){let t=n.pop();if(null!==t&&"object"==typeof t)if(Array.isArray(t))for(let i of t){if(++a>r)return a;null!==i&&"object"==typeof i&&n.push(i)}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(++a>r)return a;let o=t[i];null!==o&&"object"==typeof o&&n.push(o)}}return a}(r,this._maxToolInputElements)>this._maxToolInputElements)throw new cg(cf.InvalidParams,`Invalid arguments for tool ${a}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!t.inputSchema)return;let n=await um(t.inputSchema,r??{});if(!n.success)throw new cg(cf.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${n.error}`);return n.data}async validateToolOutput(t,r,a){if(!t.outputSchema||cX(r)||r.isError)return;if(void 0===r.structuredContent)throw new cg(cf.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);let n=await um(t.outputSchema,r.structuredContent);if(!n.success)throw new cg(cf.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${n.error}`)}async executeToolHandler(t,r,a){return t.executor(r,a)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async t=>{switch(t.params.ref.type){case"ref/prompt":if("ref/prompt"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`);return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":if("ref/resource"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`);return this.handleResourceCompletion(t,t.params.ref);default:throw new cg(cf.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let a=this._registeredPrompts[r.name];if(!a)throw new cg(cf.InvalidParams,`Prompt ${r.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Prompt ${r.name} disabled`);if(!a.argsSchema)return pB;let n=pG(pK(a.argsSchema)?.[t.params.argument.name]);if(!pR(n))return pB;let i=n[pw]?.complete;return i?pJ(await i(t.params.argument.value,t.params.context)):pB}async handleResourceCompletion(t,r){let a=Object.values(this._registeredResourceTemplates).find(t=>t.resourceTemplate.uriTemplate.toString()===r.uri);if(!a){if(this._registeredResources[r.uri])return pB;throw new cg(cf.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let n=a.resourceTemplate.completeCallback(t.params.argument.name);return n?pJ(await n(t.params.argument.value,t.params.context)):pB}_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(t,r)=>{let a=Object.entries(this._registeredResources).filter(([t,r])=>r.enabled).map(([t,r])=>({uri:t,name:r.name,...r.metadata})),n=[];for(let t of Object.values(this._registeredResourceTemplates))if(t.resourceTemplate.listCallback)for(let a of(await t.resourceTemplate.listCallback(r)).resources)n.push({...t.metadata,...a});return{resources:[...a,...n]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler("resources/read",async(t,r)=>{let a;try{a=new URL(t.params.uri)}catch{throw new cg(cf.InvalidParams,`Resource URI ${t.params.uri} is invalid`,{uri:t.params.uri,reason:"invalid_uri"})}let n=this._registeredResources[a.toString()];if(n){if(!n.enabled)throw new cg(cf.InvalidParams,`Resource ${a} disabled`);return cd(await n.readCallback(a,r),n.cacheHint)}for(let t of Object.values(this._registeredResourceTemplates)){let n=t.resourceTemplate.uriTemplate.match(a.toString());if(n){if(!t.enabled)throw new cg(cf.InvalidParams,`Resource template ${t.resourceTemplate.uriTemplate} disabled`);return cd(await t.readCallback(a,n,r),t.cacheHint)}}throw new cy(t.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(([,t])=>t.enabled).map(([t,r])=>{let a,n,i;return{name:t,title:r.title,description:r.description,arguments:r.argsSchema?(n=(a=up(r.argsSchema,"input")).properties||{},i=a.required||[],Object.entries(n).map(([t,r])=>({name:t,description:r?.description,required:i.includes(t)}))):void 0,icons:r.icons,_meta:r._meta}})})),this.server.setRequestHandler("prompts/get",async(t,r)=>{let a=this._registeredPrompts[t.params.name];if(!a)throw new cg(cf.InvalidParams,`Prompt ${t.params.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Prompt ${t.params.name} disabled`);return a.handler(t.params.arguments,r)}),this._promptHandlersInitialized=!0)}registerResource(t,r,a,n){let{cacheHint:i,scopeChallenge:o,...s}=a;if(void 0!==i&&ch(i,`resource ${t}`),"string"==typeof r){if(this._registeredResources[r])throw Error(`Resource ${r} is already registered`);let l=this._createRegisteredResource(t,a.title,r,s,o,n);return void 0!==i&&(l.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let l=this._createRegisteredResourceTemplate(t,a.title,r,s,o,n);return void 0!==i&&(l.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}}_createRegisteredResource(t,r,a,n,i,o){let s={name:t,title:r,metadata:n,readCallback:o,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:t=>{void 0!==t.uri&&t.uri!==a&&(delete this._registeredResources[a],t.uri&&(this._registeredResources[t.uri]=s)),void 0!==t.name&&(s.name=t.name),void 0!==t.title&&(s.title=t.title),void 0!==t.metadata&&(s.metadata=t.metadata),void 0!==t.callback&&(s.readCallback=t.callback),void 0!==t.scopeChallenge&&(s.scopeChallenge=null===t.scopeChallenge?void 0:t.scopeChallenge),void 0!==t.enabled&&(s.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=s,s}_createRegisteredResourceTemplate(t,r,a,n,i,o){let s={resourceTemplate:a,title:r,metadata:n,readCallback:o,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredResourceTemplates[t],r.name&&(this._registeredResourceTemplates[r.name]=s)),void 0!==r.title&&(s.title=r.title),void 0!==r.template&&(s.resourceTemplate=r.template),void 0!==r.metadata&&(s.metadata=r.metadata),void 0!==r.callback&&(s.readCallback=r.callback),void 0!==r.scopeChallenge&&(s.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r.enabled&&(s.enabled=r.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let l=a.uriTemplate.variableNames;return Array.isArray(l)&&l.some(t=>!!a.completeCallback(t))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,a,n,i,o,s,l){let c=n,u=i,d={title:r,description:a,argsSchema:n,icons:o,scopeChallenge:s,_meta:l,handler:pH(t,n,i),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredPrompts[t],r.name&&(this._registeredPrompts[r.name]=d)),void 0!==r.title&&(d.title=r.title),void 0!==r.description&&(d.description=r.description),void 0!==r.icons&&(d.icons=r.icons),void 0!==r.scopeChallenge&&(d.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r._meta&&(d._meta=r._meta);let a=!1;void 0!==r.argsSchema&&(d.argsSchema=r.argsSchema,c=r.argsSchema,a=!0),void 0!==r.callback&&(u=r.callback,a=!0),a&&(d.handler=pH(t,c,u)),void 0!==r.enabled&&(d.enabled=r.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[t]=d,n){let t=pK(n);t&&Object.values(t).some(t=>pR(pG(t)))&&this.setCompletionRequestHandler()}return d}_createRegisteredTool(t,r,a,n,i,o,s,l,c,u,d){let p;uz(t);let m=d,h={title:r,description:a,inputSchema:n,outputSchema:i,get outputSchemaJson(){return p??=pF(h.outputSchema)},set outputSchemaJson(value){p=value},annotations:o,icons:s,execution:l,scopeChallenge:c,_meta:u,handler:d,executor:pU(n,d),enabled:!0,disable:()=>h.update({enabled:!1}),enable:()=>h.update({enabled:!0}),remove:()=>h.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&("string"==typeof r.name&&uz(r.name),delete this._registeredTools[t],delete this._toolInputSchemaJson[t],r.name&&(delete this._toolInputSchemaJson[r.name],this._registeredTools[r.name]=h,t=r.name)),void 0!==r.title&&(h.title=r.title),void 0!==r.description&&(h.description=r.description);let a=!1;void 0!==r.paramsSchema&&(h.inputSchema=r.paramsSchema,delete this._toolInputSchemaJson[t],a=!0),void 0!==r.callback&&(h.handler=r.callback,m=r.callback,a=!0),a&&(h.executor=pU(h.inputSchema,m)),void 0!==r.outputSchema&&(h.outputSchema=r.outputSchema,h.outputSchemaJson=pF(r.outputSchema)),void 0!==r.annotations&&(h.annotations=r.annotations),void 0!==r.icons&&(h.icons=r.icons),void 0!==r.scopeChallenge&&(h.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r._meta&&(h._meta=r._meta),void 0!==r.enabled&&(h.enabled=r.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=h,this.setToolRequestHandlers(),this.sendToolListChanged(),h}registerTool(t,r,a){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:n,description:i,inputSchema:o,outputSchema:s,annotations:l,icons:c,scopeChallenge:u,_meta:d}=r;return this._createRegisteredTool(t,n,i,uZ(o),uZ(s),l,c,void 0,u,d,a)}registerPrompt(t,r,a){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:n,description:i,argsSchema:o,icons:s,scopeChallenge:l,_meta:c}=r,u=this._createRegisteredPrompt(t,n,i,uZ(o),a,s,l,c);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),u}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},pD=class{_uriTemplate;constructor(t,r){this._callbacks=r,this._uriTemplate="string"==typeof t?new uL(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){return this._callbacks.complete?.[t]}};function pU(t,r){return t?async(t,a)=>r(t,a):async(t,a)=>r(a)}let pV={type:"object",properties:{}};function pF(t){if(void 0!==t)try{return up(t,"output")}catch{return}}function pH(t,r,a){return r?async(n,i)=>{let o=await um(r,n??{});if(!o.success)throw new cg(cf.InvalidParams,`Invalid arguments for prompt ${t}: ${o.error}`);return a(o.data,i)}:async(t,r)=>a(r)}function pJ(t){return{completion:{values:t.map(String).slice(0,100),total:t.length,hasMore:t.length>100}}}let pB={completion:{values:[],hasMore:!1}};function pK(t){if(t.shape&&"object"==typeof t.shape)return t.shape}function pG(t){return t?.type!=="optional"?t:t.def?.innerType??t}var pW=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(t){this._classification=t.classification,this._responseMode=t.responseMode??"auto",this._keepAliveMs=t.keepAliveMs??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(t,r){if(this._used)throw Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||void 0===this.onmessage)throw Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw Error("PerRequestHTTPServerTransport is closed");this._used=!0;let a=r?.request?.signal;if(a?.aborted)throw await this.close(),new lJ(lH.ConnectionClosed,"The request was aborted before it could be handled");let n={classification:this._classification,...r?.request!==void 0&&{request:r.request},...r?.authInfo!==void 0&&{authInfo:r.authInfo}};if(cK(t)){let r,i;this._requestId=t.id;let o=new Promise((t,a)=>{r=t,i=a});if(this._deferredResponse={promise:o,resolve:r,reject:i,settled:!1},void 0!==a){let t=()=>void this.close();a.addEventListener("abort",t,{once:!0}),this._abortCleanup=()=>a.removeEventListener("abort",t)}this._dispatchWindowOpen=!0;try{this.onmessage(t,n)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),o}return this.onmessage(t,n),new Response(null,{status:202})}async send(t,r){if(this._closed)return;let a=cW(t)||cY(t),n=a?t.id:r?.relatedRequestId;if(void 0===this._requestId||void 0===n||n!==this._requestId){a&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(t.id)}`));return}if(a){if(this._terminalDelivered)return;this._terminalDelivered=!0;let r=cY(t)?t.error.code:void 0,a=void 0!==r&&(this._dispatchWindowOpen||r===cf.MissingRequiredClientCapability)?ut[r]:void 0;if(void 0!==a&&void 0===this._sse){this.settleResponse(Response.json(t,{status:a,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(void 0!==this._sse||"sse"===this._responseMode){void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(t),this.finalizeStream();return}this.settleResponse(Response.json(t,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(t))}writeCommentFrame(t){if(this._closed||void 0===this._sse||this._sse.closed)return;let r=t.split("\n").map(t=>`: ${t}`).join("\n");this.writeFrame(`${r}
|
|
60
|
+
depsCount: ${r},
|
|
61
|
+
deps: ${a}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);n(e,t),o(e,r)}};function n(e,r=e.schema){let{gen:i,data:o,it:s}=e;if(0===Object.keys(r).length)return;let l=i.let("missing");for(let n in r){let c=r[n];if(0===c.length)continue;let u=(0,a.propertyInData)(i,o,n,s.opts.ownProperties);e.setParams({property:n,depsCount:c.length,deps:c.join(", ")}),s.allErrors?i.if(u,()=>{for(let t of c)(0,a.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,a.checkMissingProp)(e,c,l)})`),(0,a.reportMissingProp)(e,l),i.else())}}function o(e,t=e.schema){let{gen:i,data:n,keyword:s,it:l}=e,c=i.name("valid");for(let o in t)(0,r.alwaysValidSchema)(l,t[o])||(i.if((0,a.propertyInData)(i,n,o,l.opts.ownProperties),()=>{let t=e.subschema({keyword:s,schemaProp:o},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validatePropertyDeps=n,e.validateSchemaDeps=o,e.default=i}),dP=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF();e.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:a,schema:i,data:n,it:o}=e;if((0,r.alwaysValidSchema)(o,i))return;let s=a.name("valid");a.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),a.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||a.break()})}),e.ok(s)}}}),dE=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uX(),r=uV(),a=uH(),i=uF();e.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:n,schema:o,parentSchema:s,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:p}=u;if(u.props=!0,"all"!==p.removeAdditional&&(0,i.alwaysValidSchema)(u,o))return;let m=(0,t.allSchemaProperties)(s.properties),h=(0,t.allSchemaProperties)(s.patternProperties);function f(e){n.code((0,r._)`delete ${l}[${e}]`)}function g(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===o)return void f(t);if(!1===o){e.setParams({additionalProperty:t}),e.error(),d||n.break();return}if("object"==typeof o&&!(0,i.alwaysValidSchema)(u,o)){let a=n.name("valid");"failing"===p.removeAdditional?(y(t,a,!1),n.if((0,r.not)(a),()=>{e.reset(),f(t)})):(y(t,a),d||n.if((0,r.not)(a),()=>n.break()))}}function y(t,r,a){let n={keyword:"additionalProperties",dataProp:t,dataPropType:i.Type.Str};!1===a&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}n.forIn("key",l,a=>{m.length||h.length?n.if(function(a){let o;if(m.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,"properties");o=(0,t.isOwnProperty)(n,e,a)}else o=m.length?(0,r.or)(...m.map(e=>(0,r._)`${a} === ${e}`)):r.nil;return h.length&&(o=(0,r.or)(o,...h.map(i=>(0,r._)`${(0,t.usePattern)(e,i)}.test(${a})`))),(0,r.not)(o)}(a),()=>g(a)):g(a)}),e.ok((0,r._)`${c} === ${a.default.errors}`)}}}),dT=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u4(),r=uX(),a=uF(),i=dE();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,parentSchema:s,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===s.additionalProperties&&i.default.code(new t.KeywordCxt(c,i.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(o);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=a.mergeEvaluated.props(n,(0,a.toHash)(u),c.props));let d=u.filter(e=>!(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length)return;let p=n.name("valid");for(let t of d){var m;(m=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==o[m].default)?h(t):(n.if((0,r.propertyInData)(n,l,t,c.opts.ownProperties)),h(t),c.allErrors||n.else().var(p,!0),n.endIf()),e.it.definedProperties.add(t),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),dj=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uX(),r=uV(),a=uF(),i=uF();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,data:s,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(o),p=d.filter(e=>(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length||p.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let m=u.strictSchema&&!u.allowMatchingProperties&&l.properties,h=n.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,i.evaluatedPropsToName)(n,c.props));let{props:f}=c;for(let e of d)m&&function(e){for(let t in m)new RegExp(e).test(t)&&(0,a.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?g(e):(n.var(h,!0),g(e),n.if(h));function g(a){n.forIn("key",s,o=>{n.if((0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`,()=>{let t=p.includes(a);t||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:o,dataPropType:i.Type.Str},h),c.opts.unevaluated&&!0!==f?n.assign((0,r._)`${f}[${o}]`,!0):t||c.allErrors||n.if((0,r.not)(h),()=>n.break())})})}}}}),dO=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uF();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:a,it:i}=e;if((0,t.alwaysValidSchema)(i,a))return void e.fail();let n=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),dC=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uX().validateUnion,error:{message:"must match a schema in anyOf"}}}),dI=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF();e.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:a,schema:i,parentSchema:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=a.let("valid",!1),l=a.let("passing",null),c=a.name("_valid");e.setParams({passing:l}),a.block(function(){i.forEach((i,n)=>{let u;(0,r.alwaysValidSchema)(o,i)?a.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&a.if((0,t._)`${c} && ${s}`).assign(s,!1).assign(l,(0,t._)`[${l}, ${n}]`).else(),a.if(c,()=>{a.assign(s,!0),a.assign(l,n),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(s,()=>e.reset(),()=>e.error(!0))}}}),dN=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uF();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:a,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");let n=r.name("valid");a.forEach((r,a)=>{if((0,t.alwaysValidSchema)(i,r))return;let o=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(o)})}}}),dq=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF();function a(e,t){let a=e.schema[t];return void 0!==a&&!(0,r.alwaysValidSchema)(e,a)}e.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let i,{gen:n,parentSchema:o,it:s}=e;void 0===o.then&&void 0===o.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=a(s,"then"),c=a(s,"else");if(!l&&!c)return;let u=n.let("valid",!0),d=n.name("_valid");if(i=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(i),e.reset(),l&&c){let t=n.let("ifClause");e.setParams({ifClause:t}),n.if(d,p("then",t),p("else",t))}else l?n.if(d,p("then")):n.if((0,t.not)(d),p("else"));function p(r,a){return()=>{let i=e.subschema({keyword:r},d);n.assign(u,d),e.mergeValidEvaluated(i,u),a?n.assign(a,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),dA=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uF();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:a}){void 0===r.if&&(0,t.checkStrictMode)(a,`"${e}" without "if" is ignored`)}}}),dz=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dS(),r=dw(),a=d$(),i=dR(),n=dk(),o=dx(),s=dP(),l=dE(),c=dT(),u=dj(),d=dO(),p=dC(),m=dI(),h=dN(),f=dq(),g=dA();e.default=function(e=!1){let y=[d.default,p.default,m.default,h.default,f.default,g.default,s.default,l.default,o.default,c.default,u.default];return e?y.push(r.default,i.default):y.push(t.default,a.default),y.push(n.default),y}}),dM=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV();e.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,r){let a,i,n,o,s,l,{gen:c,data:u,$data:d,schema:p,schemaCode:m,it:h}=e,{opts:f,errSchemaPath:g,schemaEnv:y,self:v}=h;f.validateFormats&&(d?(a=c.scopeValue("formats",{ref:v.formats,code:f.code.formats}),i=c.const("fDef",(0,t._)`${a}[${m}]`),n=c.let("fType"),o=c.let("format"),c.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>c.assign(n,(0,t._)`${i}.type || "string"`).assign(o,(0,t._)`${i}.validate`),()=>c.assign(n,(0,t._)`"string"`).assign(o,i)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${m} && !${o}`,(s=y.$async?(0,t._)`(${i}.async ? await ${o}(${u}) : ${o}(${u}))`:(0,t._)`${o}(${u})`,l=(0,t._)`(typeof ${o} == "function" ? ${s} : ${o}.test(${u}))`,(0,t._)`${o} && ${o} !== true && ${n} === ${r} && !${l}`)))):function(){var a;let i,n,o=v.formats[p];if(!o){if(!1===f.strictSchema)return v.logger.warn(s());throw Error(s());function s(){return`unknown format "${p}" ignored in schema at path "${g}"`}}if(!0===o)return;let[l,d,m]=(i=(a=o)instanceof RegExp?(0,t.regexpCode)(a):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,n=c.scopeValue("formats",{key:p,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,n]:[a.type||"string",a.validate,(0,t._)`${n}.validate`]);l===r&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!y.$async)throw Error("async format in sync schema");return(0,t._)`await ${m}(${u})`}return"function"==typeof d?(0,t._)`${m}(${u})`:(0,t._)`${m}.test(${u})`}())}())}}}),dL=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[dM().default]}),dZ=H(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"]}),dD=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ds(),r=db(),a=dz(),i=dL(),n=dZ();e.default=[t.default,r.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),dU=H(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),dV=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=dU(),a=u6(),i=u5(),n=uF();e.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:a}})=>(0,t._)`{error: ${e}, tag: ${a}, tagValue: ${r}}`},code(e){let{gen:o,data:s,schema:l,parentSchema:c,it:u}=e,{oneOf:d}=c;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let m=o.let("valid",!1),h=o.const("tag",(0,t._)`${s}${(0,t.getProperty)(p)}`);o.if((0,t._)`typeof ${h} == "string"`,()=>(function(){let s=function(){var e;let t={},r=s(c),o=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,n.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=a.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof a.SchemaEnv&&(c=c.schema),void 0===c)throw new i.default(u.opts.uriResolver,u.baseId,e)}let m=null==(e=null==c?void 0:c.properties)?void 0:e[p];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);o=o&&(r||s(c)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(m,t)}if(!o)throw Error(`discriminator: "${p}" must be required`);return t;function s({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let r in o.if(!1),s)o.elseIf((0,t._)`${h} === ${r}`),o.assign(m,function(r){let a=o.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},a);return e.mergeEvaluated(i,t.Name),a}(s[r]));o.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:p}),o.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:p})),e.ok(m)}}}),dF=H((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}}),dH=H((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=da(),a=dD(),i=dV(),n=dF(),o=["/properties"],s="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=u4();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uV();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 d=u3();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=u5();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),dJ=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=uV(),r=uH(),a=u6(),i=dn();function n(e,n){let{gen:o,it:s}=e;s.schemaEnv.root.dynamicAnchors[n]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(n)}`,c="#"===s.errSchemaPath?s.validateName:function(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:o,baseId:s,localRefs:l,meta:c}=t.root,{schemaId:u}=n.opts,d=new a.SchemaEnv({schema:r,schemaId:u,root:o,baseId:s,localRefs:l,meta:c});return a.compileSchema.call(n,d),(0,i.getValidate)(e,d)}(e);o.if((0,t._)`!${l}`,()=>o.assign(l,c))}e.dynamicAnchor=n,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>n(e,e.schema)}}),dB=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=uV(),r=uH(),a=dn();function i(e,i){let{gen:n,keyword:o,it:s}=e;if("#"!==i[0])throw Error(`"${o}" only supports hash fragment reference`);let l=i.slice(1);if(s.allErrors)c();else{let t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(s.schemaEnv.root.dynamicAnchors[l]){let a=n.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);n.if(a,u(a,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,r){return r?()=>n.block(()=>{(0,a.callRef)(e,t),n.let(r,!0)}):()=>(0,a.callRef)(e,t)}}e.dynamicRef=i,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>i(e,e.schema)}}),dK=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dJ(),r=uF();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),dG=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dB();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),dW=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dJ(),r=dB(),a=dK(),i=dG();e.default=[t.default,r.default,a.default,i.default]}),dY=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dx();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),dX=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dx();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),dQ=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uF();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:a}){void 0===r.contains&&(0,t.checkStrictMode)(a,`"${e}" without "contains" is ignored`)}}}),d0=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dY(),r=dX(),a=dQ();e.default=[t.default,r.default,a.default]}),d1=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF(),a=uH();e.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:n,data:o,errsCount:s,it:l}=e;if(!s)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(a){if(!1===n){e.setParams({unevaluatedProperty:a}),e.error(),c||i.break();return}if(!(0,r.alwaysValidSchema)(l,n)){let n=i.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:r.Type.Str},n),c||i.if((0,t.not)(n),()=>i.break())}}u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn("key",o,e=>{var r,a;return i.if((r=u,a=e,(0,t._)`!${r} || !${r}[${a}]`),()=>d(e))})):!0!==u&&i.forIn("key",o,e=>void 0===u?d(e):i.if(function(e,r){let a=[];for(let i in e)!0===e[i]&&a.push((0,t._)`${r} !== ${i}`);return(0,t.and)(...a)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${s} === ${a.default.errors}`)}}}),d2=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uV(),r=uF();e.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:a,schema:i,data:n,it:o}=e,s=o.items||0;if(!0===s)return;let l=a.const("len",(0,t._)`${n}.length`);if(!1===i)e.setParams({len:s}),e.fail((0,t._)`${l} > ${s}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(o,i)){let i=a.var("valid",(0,t._)`${l} <= ${s}`);a.if((0,t.not)(i),()=>{var n,c;return n=i,c=s,void a.forRange("i",c,l,i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||a.if((0,t.not)(n),()=>a.break())})}),e.ok(i)}o.items=!0}}}),d9=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=d1(),r=d2();e.default=[t.default,r.default]}),d4=H((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"}]}}}}}),d3=H((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:"#"}}}}}),d5=H((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:"#"}}}}),d6=H((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:{}}}}}),d7=H((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"}}}}),d8=H((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}}}}),pe=H((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:[]}}}}),pt=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=d4(),r=d3(),a=d5(),i=d6(),n=d7(),o=d8(),s=pe(),l=["/properties"];e.default=function(e){return[t,r,a,i,c(this,n),o,c(this,s)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),pr=H((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=da(),a=dD(),i=dW(),n=d0(),o=d9(),s=dV(),l=pt(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),a.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(n.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(l.default.call(this,e),this.refs["http://json-schema.org/schema"]=c)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=u4();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=uV();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 m=u3();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=u5();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),pa=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ds(),r=db(),a=dz(),i=dW(),n=d0(),o=d9(),s=dL(),l=dZ();e.default=[i.default,t.default,r.default,(0,a.default)(!0),s.default,l.metadataVocabulary,l.contentVocabulary,n.default,o.default]}),pi=H((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}}}}),pn=H((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"}}}}}),po=H((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"}}}}),ps=H((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"}}}}),pl=H((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"}}}}),pc=H((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"}}}}),pu=H((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}}}}),pd=H((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:[]}}}}),pp=H(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=pi(),r=pn(),a=po(),i=ps(),n=pl(),o=pc(),s=pu(),l=pd(),c=["/properties"];e.default=function(e){return[t,r,a,i,n,u(this,o),s,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),pm=H((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=da(),a=pa(),i=dV(),n=pp(),o="https://json-schema.org/draft/2020-12/schema";var s=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(n.default.call(this,e),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=u4();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=uV();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=u3();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=u5();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),ph=H(e=>{function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(i,n),time:t(s(!0),l),"date-time":t(d(!0),p),"iso-time":t(s(),c),"iso-date-time":t(d(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.test(e)&&f.test(e)},"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:function(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},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:function(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=y}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},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$/,n),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"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,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"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,m),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);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let i=r.exec(e);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:a[o])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function s(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],n=+r[3],s=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!s)return!1;if(a<=23&&i<=59&&n<60)return!0;let d=i-u*l,p=a-c*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&n<61}}function l(e,t){if(!(e&&t))return;let r=(new Date("2020-01-01T"+e)).valueOf(),a=(new Date("2020-01-01T"+t)).valueOf();if(r&&a)return r-a}function c(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=s(e);return function(e){let r=e.split(u);return 2===r.length&&i(r[0])&&t(r[1])}}function p(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(u),[i,o]=t.split(u),s=n(r,i);if(void 0!==s)return s||l(a,o)}let h=/\/|:/,f=/^(?:[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,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,y=-0x80000000,v=0x7fffffff;function _(){return!0}let b=/[^\\]\\Z/}),pf=H(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=dH(),r=uV(),a=r.operators,i={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let a,n,{gen:o,data:s,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:p}=u;if(!d.validateFormats)return;let m=new t.KeywordCxt(u,p.RULES.all.format.definition,"format");function h(e){return(0,r._)`${e}.compare(${s}, ${l}) ${i[c].fail} 0`}m.$data?(a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),n=o.const("fmt",(0,r._)`${a}[${m.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${n} != "object"`,(0,r._)`${n} instanceof RegExp`,(0,r._)`typeof ${n}.compare != "function"`,h(n)))):function(){let t=m.schema,a=p.formats[t];if(!a||!0===a)return;if("object"!=typeof a||a instanceof RegExp||"function"!=typeof a.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let i=o.scopeValue("formats",{key:t,ref:a,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(h(i))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),pg=H((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=ph(),a=pf(),i=uV(),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,n),e;let[i,s]="fast"===t.mode?[r.fastFormats,o]:[r.fullFormats,n];return l(e,t.formats||r.formatNames,i,s),t.keywords&&(0,a.default)(e),e};function l(e,t,r,a){var n;for(let o of(null!=(n=e.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(o,r[o])}s.get=(e,t="full")=>{let a=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!a)throw Error(`Unknown format "${e}"`);return a},t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),py=dH(),pv=pr(),p_=pm();let pb=(J(pg(),1)).default;function pS(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pb(t),t}var p$=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=pS(p_.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let r=e.$schema.replace(/#$/,"");if(B.has(r))return"2020-12";if(K.has(r))return"2019-09";if(G.has(r)||W.has(r))return"draft-7";throw 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}`)}(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===t?this.ajv:"2019-09"===t?this._ajv2019??=pS(pv.Ajv2019):this._ajvDraft7??=pS(py.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&"string"==typeof e.$id?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}};py.Ajv,require("node:process");let pw=Symbol.for("mcp.completable");function pR(e){return!!e&&"object"==typeof e&&pw in e}function pk(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,0x7fffffff));return r.unref?.(),r}var px=class{static{u=e=>e._classification}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??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(e,t){if(this._used)throw Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||void 0===this.onmessage)throw Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw Error("PerRequestHTTPServerTransport is closed");this._used=!0;let r=t?.request?.signal;if(r?.aborted)throw await this.close(),new lH(lF.ConnectionClosed,"The request was aborted before it could be handled");let a={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(cB(e)){let t,i;this._requestId=e.id;let n=new Promise((e,r)=>{t=e,i=r});if(this._deferredResponse={promise:n,resolve:t,reject:i,settled:!1},void 0!==r){let e=()=>void this.close();r.addEventListener("abort",e,{once:!0}),this._abortCleanup=()=>r.removeEventListener("abort",e)}this._dispatchWindowOpen=!0;try{this.onmessage(e,a)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),n}return this.onmessage(e,a),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let r=cG(e)||cW(e),a=r?e.id:t?.relatedRequestId;if(void 0===this._requestId||void 0===a||a!==this._requestId){r&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(r){if(this._terminalDelivered)return;this._terminalDelivered=!0;let t=cW(e)?e.error.code:void 0,r=void 0!==t&&(this._dispatchWindowOpen||t===ch.MissingRequiredClientCapability)?ue[t]:void 0;if(void 0!==r&&void 0===this._sse){this.settleResponse(Response.json(e,{status:r,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(void 0!==this._sse||"sse"===this._responseMode){void 0===this._sse&&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}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||void 0===this._sse||this._sse.closed)return;let t=e.split("\n").map(e=>`: ${e}`).join("\n");this.writeFrame(`${t}
|
|
62
62
|
|
|
63
|
-
`)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.reject(new
|
|
64
|
-
data: ${JSON.stringify(
|
|
63
|
+
`)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.reject(new lH(lF.ConnectionClosed,"Connection closed before a response was produced"))),this.onclose?.()}}settleResponse(e){void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(e))}upgradeToSse(){let e,t=new ReadableStream({start:t=>{e=t},cancel:()=>{this.close()}});this._sse={controller:e,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=pk(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),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}queueMicrotask(()=>void this.close())}writeMessageFrame(e){this.writeFrame(`event: message
|
|
64
|
+
data: ${JSON.stringify(e)}
|
|
65
65
|
|
|
66
|
-
`)}writeFrame(t){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(t))}catch(t){this.onerror?.(Error(`Failed to write to the response stream: ${t}`))}}};async function pY(t,r,a){let n=new pW({classification:a.classification,...void 0!==a.responseMode&&{responseMode:a.responseMode},...void 0!==a.keepAliveMs&&{keepAliveMs:a.keepAliveMs}});return await t.connect(n),n.handleMessage(r,{...void 0!==a.request&&{request:a.request},...void 0!==a.authInfo&&{authInfo:a.authInfo}})}function pX(t){return`Payload Too Large: Request body must not exceed ${t} bytes`}function pQ(t){if(void 0===t)return 4194304;if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(t)}`);return t}async function p0(t,r=4194304){if(Number(t.headers.get("content-length"))>r)return{tooLarge:!0};if(null===t.body)return{tooLarge:!1,text:""};let a=t.body.getReader(),n=new TextDecoder,i=0,o="";try{for(;;){let{done:t,value:s}=await a.read();if(t)break;if((i+=s.byteLength)>r)return{tooLarge:!0};o+=n.decode(s,{stream:!0})}}finally{a.releaseLock()}return{tooLarge:!1,text:o+n.decode()}}var p1=class{sessionIdGenerator;_started=!1;_hasHandledRequest=!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;_maxRequestBodySize;_scopeChallengeResolver;sessionId;onclose;onerror;onmessage;constructor(t={}){this.sessionIdGenerator=t.sessionIdGenerator,this._enableJsonResponse=t.enableJsonResponse??!1,this._eventStore=t.eventStore,this._onsessioninitialized=t.onsessioninitialized,this._onsessionclosed=t.onsessionclosed,this._allowedHosts=t.allowedHosts,this._allowedOrigins=t.allowedOrigins,this._enableDnsRebindingProtection=t.enableDnsRebindingProtection??!1,this._retryInterval=t.retryInterval,this._supportedProtocolVersions=t.supportedProtocolVersions??iH,this._keepAliveMs=t.keepAliveMs??15e3,this._maxRequestBodySize=pQ(t.maxRequestBodySize)}startKeepAlive(t,r){if(this._closed)return;let a=px(this._keepAliveMs,()=>{try{t.enqueue(r.encode(": keepalive\n\n"))}catch{void 0!==a&&clearInterval(a)}});return a}setScopeChallengeResolver(t){this._scopeChallengeResolver=t}async start(){if(this._started)throw Error("Transport already started");this._started=!0}setSupportedProtocolVersions(t){this._supportedProtocolVersions=t}createJsonErrorResponse(t,r,a,n){let i={code:r,message:a};return n?.data!==void 0&&(i.data=n.data),Response.json({jsonrpc:"2.0",error:i,id:null},{status:t,headers:{"Content-Type":"application/json",...n?.headers}})}async _checkScopeChallenge(t,r){if(!this._scopeChallengeResolver)return;let a=await pC(t.filter(t=>cK(t)),r,this._scopeChallengeResolver);return void 0===a?void 0:pN(a,pI(r))}validateRequestHeaders(t){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=t.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let t=`Invalid Host header: ${r}`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(403,-32e3,t)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=t.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let t=`Invalid Origin header: ${r}`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(403,-32e3,t)}}}}async handleRequest(t,r){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!this.sessionIdGenerator&&this._hasHandledRequest)throw Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let a=this.validateRequestHeaders(t);if(a)return a;switch(t.method){case"POST":return this.handlePostRequest(t,r);case"GET":return this.handleGetRequest(t);case"DELETE":return this.handleDeleteRequest(t);default:return this.handleUnsupportedRequest()}}supportsEmptySSEData(t){return this._supportedProtocolVersions.includes(t)&&t>="2025-11-25"}async writePrimingEvent(t,r,a,n){if(!this._eventStore||!this.supportsEmptySSEData(n))return;let i=await this._eventStore.storeEvent(a,{}),o=`id: ${i}
|
|
66
|
+
`)}writeFrame(e){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(e){this.onerror?.(Error(`Failed to write to the response stream: ${e}`))}}};function pP(e){return e.replaceAll(/[\\"]/g,String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g," ")}function pE(e,t,r,a){let i=`Bearer error="${pP(e)}", error_description="${pP(t)}"`;return r.length>0&&(i+=`, scope="${pP(r.join(" "))}"`),a&&(i+=`, resource_metadata="${pP(a)}"`),i}async function pT(e,t,r){for(let i of e){let e=await r({request:i,...void 0!==t&&{authInfo:t}});if(void 0!==e){if(null===e||"object"!=typeof e||!Array.isArray(e.scopes)||0===e.scopes.length)throw TypeError("scope challenge must contain at least one scope");for(let[t,r]of e.scopes.entries()){var a=`scope challenge scopes[${t}]`;if("string"!=typeof r||!/^[\u0021\u0023-\u005B\u005D-\u007E]+$/.test(r))throw TypeError(`${a} must satisfy the OAuth scope-token grammar`)}if(void 0!==e.errorDescription&&"string"!=typeof e.errorDescription)throw TypeError("scope challenge errorDescription must be a string");if(void 0!==e.errorDescription&&!/^[\u0020-\u0021\u0023-\u005B\u005D-\u007E]+$/.test(e.errorDescription))throw TypeError("scope challenge errorDescription must satisfy the RFC 6750 error-description grammar");return e}}}function pj(e){if(e?.resourceMetadataUrl!==void 0)return e.resourceMetadataUrl;if(e?.resource?.protocol==="https:"||e?.resource?.protocol==="http:"){var t,r;let a,i;return a=new URL(t=e.resource),i=(r=t.pathname).length>1&&r.endsWith("/")?r.slice(0,-1):r,a.pathname=`/.well-known/oauth-protected-resource${"/"===i?"":i}`,a.hash="",a.href}}function pO(e,t){return function(e,t){let{requiredScopes:r=[],resourceMetadataUrl:a}=t??{};if(!(e instanceof lV)){let e=new lV(lU.ServerError,"Internal Server Error");return Response.json(e.toResponseObject(),{status:500})}switch(e.code){case lU.InvalidToken:{let t=pE(e.code,e.message,r,a);return Response.json(e.toResponseObject(),{status:401,headers:{"WWW-Authenticate":t}})}case lU.InsufficientScope:{let t=pE(e.code,e.message,r,a);return Response.json(e.toResponseObject(),{status:403,headers:{"WWW-Authenticate":t}})}case lU.ServerError:return Response.json(e.toResponseObject(),{status:500});default:return Response.json(e.toResponseObject(),{status:400})}}(new lV(lU.InsufficientScope,e.errorDescription??"Insufficient scope"),{requiredScopes:[...e.scopes],resourceMetadataUrl:t})}function pC(e,t,r){if(null===r||"object"!=typeof r||"string"!=typeof r.method)throw new cf(ch.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 a=function(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(void 0!==t&&(void 0!==t.tools||void 0!==t.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(r);if(void 0===a)throw new cf(ch.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:a}}function pI(e,t){if("tools/call"===e)return{content:[{type:"text",text:t}],isError:!0};throw new cf(ch.InternalError,t)}var pN=class{constructor(e){this._host=e}async fulfill(e,t,r,a,i){let{maxRounds:n,roundTimeoutMs:o}=this._host,s=a.mcpReq.signal,l=i,c=0;for(;;){let i;if((c+=1)>n)return pI(e,`Multi-round-trip request '${e}' still required input after ${n} rounds (inputRequired.maxRounds)`);let u=l.inputRequests,d=null!=u&&Object.keys(u).length>0,p="string"==typeof l.requestState?l.requestState:void 0;if(!d&&void 0===p)throw new cf(ch.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(d){let t=this._host.resolvedClientCapabilities(a),r=[];for(let[a,i]of Object.entries(u)){let{embedded:n,required:o}=pC(e,a,i);if("roots/list"!==n.method&&void 0===n.params)throw new cf(ch.InternalError,`Handler for ${e} returned an input request '${a}' of kind '${n.method}' without params`);if(void 0!==lK(o,t))return pI(e,`Cannot request input '${a}' (${n.method}): the client on this 2025-era connection did not declare the required capability${void 0===t?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);r.push([a,n])}let n=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:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",r)}}(s);try{let e={relatedRequestId:a.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:n.signal},t=await Promise.all(r.map(async([t,r])=>{try{return[t,await this._dispatchLeg(r,e)]}catch(e){throw n.abort(e),e}}));i=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return pI(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{n.dispose()}}else await function(e){return new Promise((t,r)=>{if(e?.aborted)return void r(e.reason instanceof lH?e.reason:new lH(lF.RequestTimeout,String(e.reason)));let a=setTimeout(()=>{e?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(a),r(e?.reason instanceof lH?e.reason:new lH(lF.RequestTimeout,String(e?.reason)))};e?.addEventListener("abort",i,{once:!0})})}(s);let m={...a,mcpReq:{...a.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(e){return()=>e}(p)}};if(void 0!==p){let t=await this._host.verifyRequestState(p,m,e);void 0!==t&&(m=uj(m,t))}let h=await t(r,m);if(!cY(h))return h;l=h}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return"url"===r.mode&&void 0===r.elicitationId&&(r={...r,elicitationId:function(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;let r=[...t].map(e=>e.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)}`}()}),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)}}};let pq=new Set(["tools/call","prompts/get","resources/read"]);var pA=class extends uO{_clientCapabilities;_clientVersion;static{d=(e,t)=>{void 0!==t.clientCapabilities&&(e._clientCapabilities=t.clientCapabilities),void 0!==t.clientInfo&&(e._clientVersion=t.clientInfo)},p=(e,t)=>{let r=t.filter(t=>!e._supportedProtocolVersions.includes(t));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},m=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_boundFromTransport=!1;_legacyInputRequiredShim(){return this._legacyShim??=new pN({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 p$,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=function(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??8,roundTimeoutMs:e?.roundTimeoutMs??6e5,legacyShim:e?.legacyShim??!0}}(t?.inputRequired),t?.cacheHints!==void 0){for(let[e,r]of Object.entries(t.cacheHints))void 0!==r&&cm(r,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",e=>this._oninitialize(e)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lY(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}async connect(e){if(void 0!==this.transport)throw new lH(lF.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");this._boundFromTransport&&(this._boundFromTransport=!1,this._negotiatedProtocolVersion=void 0);let t=(e instanceof px?u(e):void 0)?.revision;void 0!==t&&!this._servedModernEra()&&lW.includes(t)&&lY(this._supportedProtocolVersions).includes(t)&&(this._negotiatedProtocolVersion=t,this._boundFromTransport=!0),await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:a}=e.params,i=ib(sk,a);return i.success&&this._loggingLevels.set(r,i.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,r,a)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=e.mcpReq.envelope?.[nW]))return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:t,data:r,logger:a}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(sk.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)};registerCapabilities(e){if(this.transport)throw new lH(lF.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let i=r[e];r[e]=uC(i)&&uC(a)?{...i,...a}:a}return r}(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if("tools/call"!==e){let r=this._cacheHints?.[e],a=pq.has(e);return void 0!==r||a?async(i,n)=>{let o=a?await this._invokeInputRequiredCapableHandler(e,t,i,n):await t(i,n);if(cY(o)){if(!a)throw new cf(ch.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 o}return void 0===r?o:cu(o,r)}:async(r,a)=>{let i=await t(r,a);if(cY(i))throw new cf(ch.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 async(e,r)=>{let a=cq(this._negotiatedProtocolVersion),i=a.validateRequest("tools/call",e);if(!i.ok)throw new cf("not-in-era"===i.reason?ch.InternalError:ch.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let n=await this._invokeInputRequiredCapableHandler("tools/call",t,e,r);if(cY(n))return n;let o=l0(n),s=a.validateResult("tools/call",o);if(!s.ok)throw new cf("not-in-era"===s.reason?ch.InternalError:ch.InvalidParams,"not-in-era"===s.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lG}async _invokeInputRequiredCapableHandler(e,t,r,a){let i,n=this._servedModernEra(),o=a.mcpReq.requestState();if(void 0!==o&&"string"!=typeof o)throw new cf(ch.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let s=a;if("string"==typeof o){let t=await this._verifyRequestState(o,a,e);void 0!==t&&(s=uj(a,t))}try{i=await t(r,s)}catch(e){if(e instanceof cf&&e.code===ch.UrlElicitationRequired){if(!n)throw e;throw new cf(ch.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw e}if(!cY(i))return i;if(!n){if(!this._inputRequiredServing.legacyShim)throw new cf(ch.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??nV}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,s,i)}let l=i.inputRequests,c=null!=l&&Object.keys(l).length>0,u="string"==typeof i.requestState;if(!c&&!u)throw new cf(ch.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(c){let t=this._inputRequestCapabilityView(a);for(let[r,a]of Object.entries(l)){let{embedded:i,required:n}=pC(e,r,a),o=lK(n,t);if(void 0!==o)throw new c_({requiredCapabilities:o},`Cannot request input '${r}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(e,t,r){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${e instanceof Error?e.message:String(e)}`)),new cf(ch.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[nK]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new lH(lF.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 — 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 lH(lF.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lH(lF.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lH(lF.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new lH(lF.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 lH(lF.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lH(lF.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 lH(lF.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 lH(lF.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new lH(lF.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lH(lF.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lH(lF.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 lH(lF.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lH(lF.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=this._supportedProtocolVersions.filter(e=>!(e>=lG)),a=r.includes(t)?t:r[0]??nV;return this._negotiatedProtocolVersion=a,this.transport?.setProtocolVersion?.(a),{protocolVersion:a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lY(this._supportedProtocolVersions),capabilities:{...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 lH(lF.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages.at(-1),r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages.at(-2):void 0,n=i?Array.isArray(i.content)?i.content:[i.content]:[],o=n.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw new cf(ch.InvalidParams,"The last message must contain only tool_result content if any is present");if(!o)throw new cf(ch.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(o){let e=new Set(n.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new cf(ch.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),a=await this.request({method:"sampling/createMessage",params:e},t),i=this._wireCodec().samplingResultVariant(r,a);if(!i.ok)throw new lH(lF.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lH(lF.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lH(lF.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let a=e.mode??"form",i=r?.validateAcceptedContent??!0;switch(a){case"url":return this.request({method:"elicitation/create",params:e},t);case"form":{let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},t);if(i&&"accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new cf(ch.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof cf)throw e;throw new cf(ch.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new lH(lF.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"})}},pz=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(void 0!==t&&t.enabled){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(void 0===t.inputSchema)return pZ;try{let r=ud(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new pA(e,t),this._maxToolInputElements=function(e){if(void 0!==e&&1/0!==e){if("number"!=typeof e||Number.isNaN(e)||e<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}}(t?.maxToolInputElements),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return"object"==typeof e&&null!==e&&"setScopeChallengeResolver"in e&&"function"==typeof e.setScopeChallengeResolver&&e.setScopeChallengeResolver(e=>this.resolveScopeChallenge(e)),await this.server.connect(e)}async close(){await this.server.close()}resolveScopeChallenge=e=>{switch(e.request.method){case"tools/call":{let t=e.request.params?.name;if("string"!=typeof t)return;let r=this._registeredTools[t];if(void 0===r||!r.enabled)return;return r.scopeChallenge?.(e)}case"resources/read":{let t,r=e.request.params?.uri;if("string"!=typeof r)return;try{t=new URL(r)}catch{return}let a=this._registeredResources[t.toString()];if(void 0!==a)return a.enabled?a.scopeChallenge?.(e):void 0;for(let r of Object.values(this._registeredResourceTemplates))if(r.resourceTemplate.uriTemplate.match(t.toString()))return r.enabled?r.scopeChallenge?.(e):void 0;return}case"prompts/get":{let t=e.request.params?.name;if("string"!=typeof t)return;let r=this._registeredPrompts[t];if(void 0===r||!r.enabled)return;return r.scopeChallenge?.(e)}default:return}};_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])=>{var r;let a,i,n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?(r=e,(i=c1(a=ud(t.inputSchema,"input"))).valid||console.warn(`[mcp-sdk] tool '${r}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${i.reason}`),a):pZ,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(n.outputSchema=ud(t.outputSchema,"output")),n})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new cf(ch.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new cf(ch.InvalidParams,`Tool ${e.params.name} disabled`);try{let a=await this.validateToolInput(r,e.params.arguments,e.params.name),i=await this.executeToolHandler(r,a,t);if(await this.validateToolOutput(r,i,e.params.name),cY(i))return i;return this.server.projectCallToolResult(i,r.outputSchemaJson)}catch(e){if(e instanceof cf&&e.code===ch.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(void 0!==this._maxToolInputElements&&function(e,t){let r=0,a=[e];for(;a.length>0;){let e=a.pop();if(null!==e&&"object"==typeof e)if(Array.isArray(e))for(let i of e){if(++r>t)return r;null!==i&&"object"==typeof i&&a.push(i)}else for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;if(++r>t)return r;let n=e[i];null!==n&&"object"==typeof n&&a.push(n)}}return r}(t,this._maxToolInputElements)>this._maxToolInputElements)throw new cf(ch.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let a=await um(e.inputSchema,t??{});if(!a.success)throw new cf(ch.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a.error}`);return a.data}async validateToolOutput(e,t,r){if(!e.outputSchema||cY(t)||t.isError)return;if(void 0===t.structuredContent)throw new cf(ch.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=await um(e.outputSchema,t.structuredContent);if(!a.success)throw new cf(ch.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a.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":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new cf(ch.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new cf(ch.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new cf(ch.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return pF;let a=pJ(pH(r.argsSchema)?.[e.params.argument.name]);if(!pR(a))return pF;let i=a[pw]?.complete;return i?pV(await i(e.params.argument.value,e.params.context)):pF}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return pF;throw new cf(ch.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?pV(await a(e.params.argument.value,e.params.context)):pF}_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(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),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 cf(ch.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new cf(ch.InvalidParams,`Resource ${r} disabled`);return cu(await a.readCallback(r,t),a.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a){if(!e.enabled)throw new cf(ch.InvalidParams,`Resource template ${e.resourceTemplate.uriTemplate} disabled`);return cu(await e.readCallback(r,a,t),e.cacheHint)}}throw new cg(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])=>{let r,a,i;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(a=(r=ud(t.argsSchema,"input")).properties||{},i=r.required||[],Object.entries(a).map(([e,t])=>({name:e,description:t?.description,required:i.includes(e)}))):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 cf(ch.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new cf(ch.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,a){let{cacheHint:i,scopeChallenge:n,...o}=r;if(void 0!==i&&cm(i,`resource ${e}`),"string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,r.title,t,o,n,a);return void 0!==i&&(s.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,r.title,t,o,n,a);return void 0!==i&&(s.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,i,n){let o={name:e,title:t,metadata:a,readCallback:n,scopeChallenge:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=o)),void 0!==e.name&&(o.name=e.name),void 0!==e.metadata&&(o.metadata=e.metadata),void 0!==e.title&&(o.title=e.title,o.metadata={...o.metadata,title:e.title}),void 0!==e.callback&&(o.readCallback=e.callback),void 0!==e.scopeChallenge&&(o.scopeChallenge=null===e.scopeChallenge?void 0:e.scopeChallenge),void 0!==e.enabled&&(o.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=o,o}_createRegisteredResourceTemplate(e,t,r,a,i,n){let o={resourceTemplate:r,title:t,metadata:a,readCallback:n,scopeChallenge:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=o)),void 0!==t.template&&(o.resourceTemplate=t.template),void 0!==t.metadata&&(o.metadata=t.metadata),void 0!==t.title&&(o.title=t.title,o.metadata={...o.metadata,title:t.title}),void 0!==t.callback&&(o.readCallback=t.callback),void 0!==t.scopeChallenge&&(o.scopeChallenge=null===t.scopeChallenge?void 0:t.scopeChallenge),void 0!==t.enabled&&(o.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=o;let s=r.uriTemplate.variableNames;return Array.isArray(s)&&s.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(e,t,r,a,i,n,o,s){let l=a,c=i,u={title:t,description:r,argsSchema:a,icons:n,scopeChallenge:o,_meta:s,handler:pU(e,a,i),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=u)),void 0!==t.title&&(u.title=t.title),void 0!==t.description&&(u.description=t.description),void 0!==t.icons&&(u.icons=t.icons),void 0!==t.scopeChallenge&&(u.scopeChallenge=null===t.scopeChallenge?void 0:t.scopeChallenge),void 0!==t._meta&&(u._meta=t._meta);let r=!1;void 0!==t.argsSchema&&(u.argsSchema=t.argsSchema,l=t.argsSchema,r=!0),void 0!==t.callback&&(c=t.callback,r=!0),r&&(u.handler=pU(e,l,c)),void 0!==t.enabled&&(u.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,a){let e=pH(a);e&&Object.values(e).some(e=>pR(pJ(e)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(e,t,r,a,i,n,o,s,l,c,u){let d;uM(e);let p=u,m={title:t,description:r,inputSchema:a,outputSchema:i,get outputSchemaJson(){return d??=pD(m.outputSchema)},set outputSchemaJson(e){d=e},annotations:n,icons:o,execution:s,scopeChallenge:l,_meta:c,handler:u,executor:pL(a,u),enabled:!0,disable:()=>m.update({enabled:!1}),enable:()=>m.update({enabled:!0}),remove:()=>m.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&uM(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=m,e=t.name)),void 0!==t.title&&(m.title=t.title),void 0!==t.description&&(m.description=t.description);let r=!1;void 0!==t.paramsSchema&&(m.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],r=!0),void 0!==t.callback&&(m.handler=t.callback,p=t.callback,r=!0),r&&(m.executor=pL(m.inputSchema,p)),void 0!==t.outputSchema&&(m.outputSchema=t.outputSchema,m.outputSchemaJson=pD(t.outputSchema)),void 0!==t.annotations&&(m.annotations=t.annotations),void 0!==t.icons&&(m.icons=t.icons),void 0!==t.scopeChallenge&&(m.scopeChallenge=null===t.scopeChallenge?void 0:t.scopeChallenge),void 0!==t._meta&&(m._meta=t._meta),void 0!==t.enabled&&(m.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=m,this.setToolRequestHandlers(),this.sendToolListChanged(),m}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:i,inputSchema:n,outputSchema:o,annotations:s,icons:l,scopeChallenge:c,_meta:u}=t;return this._createRegisteredTool(e,a,i,uZ(n),uZ(o),s,l,void 0,c,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:i,argsSchema:n,icons:o,scopeChallenge:s,_meta:l}=t,c=this._createRegisteredPrompt(e,a,i,uZ(n),r,o,s,l);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return void 0!==this.server.transport}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()}},pM=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new uL(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function pL(e,t){return e?async(e,r)=>t(e,r):async(e,r)=>t(r)}let pZ={type:"object",properties:{}};function pD(e){if(void 0!==e)try{return ud(e,"output")}catch{return}}function pU(e,t,r){return t?async(a,i)=>{let n=await um(t,a??{});if(!n.success)throw new cf(ch.InvalidParams,`Invalid arguments for prompt ${e}: ${n.error}`);return r(n.data,i)}:async(e,t)=>r(t)}function pV(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}let pF={completion:{values:[],hasMore:!1}};function pH(e){if(e.shape&&"object"==typeof e.shape)return e.shape}function pJ(e){return e?.type!=="optional"?e:e.def?.innerType??e}var pB=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function pK(e,t,r){return Response.json({jsonrpc:"2.0",error:{code:t,message:r},id:e},{status:200})}function pG(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[nG]:t}}}}function pW(e){return`Payload Too Large: Request body must not exceed ${e} bytes`}function pY(e){if(void 0===e)return 4194304;if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(e)}`);return e}async function pX(e,t=4194304){if(Number(e.headers.get("content-length"))>t)return{tooLarge:!0};if(null===e.body)return{tooLarge:!1,text:""};let r=e.body.getReader(),a=new TextDecoder,i=0,n="";try{for(;;){let{done:e,value:o}=await r.read();if(e)break;if((i+=o.byteLength)>t)return{tooLarge:!0};n+=a.decode(o,{stream:!0})}}finally{r.releaseLock()}return{tooLarge:!1,text:n+a.decode()}}var pQ=class{sessionIdGenerator;_started=!1;_hasHandledRequest=!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;_maxRequestBodySize;_scopeChallengeResolver;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??nF,this._keepAliveMs=e.keepAliveMs??15e3,this._maxRequestBodySize=pY(e.maxRequestBodySize)}startKeepAlive(e,t){if(this._closed)return;let r=pk(this._keepAliveMs,()=>{try{e.enqueue(t.encode(": keepalive\n\n"))}catch{void 0!==r&&clearInterval(r)}});return r}setScopeChallengeResolver(e){this._scopeChallengeResolver=e}async start(){if(this._started)throw Error("Transport already started");this._started=!0}setSupportedProtocolVersions(e){this._supportedProtocolVersions=e}createJsonErrorResponse(e,t,r,a){let i={code:t,message:r};return a?.data!==void 0&&(i.data=a.data),Response.json({jsonrpc:"2.0",error:i,id:null},{status:e,headers:{"Content-Type":"application/json",...a?.headers}})}async _checkScopeChallenge(e,t){if(!this._scopeChallengeResolver)return;let r=await pT(e.filter(e=>cB(e)),t,this._scopeChallengeResolver);return void 0===r?void 0:pO(r,pj(t))}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 e=`Invalid Host header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.get("origin");if(t&&!this._allowedOrigins.includes(t)){let e=`Invalid Origin header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}}}async handleRequest(e,t){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!this.sessionIdGenerator&&this._hasHandledRequest)throw Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;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,a){if(!this._eventStore||!this.supportsEmptySSEData(a))return;let i=await this._eventStore.storeEvent(r,{}),n=`id: ${i}
|
|
67
67
|
data:
|
|
68
68
|
|
|
69
|
-
`;void 0!==this._retryInterval&&(
|
|
69
|
+
`;void 0!==this._retryInterval&&(n=`id: ${i}
|
|
70
70
|
retry: ${this._retryInterval}
|
|
71
71
|
data:
|
|
72
72
|
|
|
73
|
-
`),
|
|
74
|
-
`;return
|
|
75
|
-
`),i+=`data: ${JSON.stringify(
|
|
76
|
-
|
|
77
|
-
`,t.enqueue(r.encode(i)),!0}catch(t){return this.onerror?.(t),!1}}handleUnsupportedRequest(){return this.onerror?.(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(t,r){try{let a,n,i,o,s,l=t.headers.get("accept");if(!l?.includes("application/json")||!l.includes("text/event-stream"))return this.onerror?.(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(!uA(t.headers.get("content-type")))return this.onerror?.(Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");if(r?.parsedBody===void 0)try{let r=await p0(t,this._maxRequestBodySize);if(r.tooLarge){let t=pX(this._maxRequestBodySize);return this.onerror?.(Error(t)),this.createJsonErrorResponse(413,-32e3,t)}a=JSON.parse(r.text)}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else a=r.parsedBody;if(Array.isArray(a)&&a.length>100)return this.onerror?.(Error("Invalid Request: Batch must not exceed 100 messages")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Batch must not exceed 100 messages");try{n=Array.isArray(a)?a.map(t=>ol.parse(t)):[ol.parse(a)]}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let c=n.some(t=>ow.safeParse(t).success);if(c){if(this._initialized&&void 0!==this.sessionId)return this.onerror?.(Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(n.length>1)return this.onerror?.(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(!c){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");try{i=await this._checkScopeChallenge(n,r?.authInfo)}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(500,-32603,"Internal server error")}if(i)return i;if(!n.some(t=>cK(t))){for(let a of n)this.onmessage?.(a,{authInfo:r?.authInfo,request:t});return new Response(null,{status:202})}let u=crypto.randomUUID(),d=n.find(t=>ow.safeParse(t).success),p=d?d.params.protocolVersion:t.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(a=>{for(let t of(this._streamMapping.set(u,{resolveJson:a,cleanup:()=>{this._streamMapping.delete(u)}}),n))cK(t)&&this._requestToStreamMapping.set(t.id,u);for(let a of n)this.onmessage?.(a,{authInfo:r?.authInfo,request:t})});let m=new TextEncoder,h=new ReadableStream({start:t=>{o=t},cancel:()=>{void 0!==s&&clearInterval(s),this._streamMapping.get(u)?.controller===o&&this._streamMapping.delete(u)}}),f={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let t of(void 0!==this.sessionId&&(f["mcp-session-id"]=this.sessionId),n))cK(t)&&(this._streamMapping.set(u,{controller:o,encoder:m,cleanup:()=>{void 0!==s&&clearInterval(s),this._streamMapping.delete(u);try{o.close()}catch{}}}),this._requestToStreamMapping.set(t.id,u));for(let a of(await this.writePrimingEvent(o,m,u,p),n)){let n,i;cK(a)&&this._eventStore&&this.supportsEmptySSEData(p)&&(n=()=>{this.closeSSEStream(a.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(a,{authInfo:r?.authInfo,request:t,closeSSEStream:n,closeStandaloneSSEStream:i})}return this._streamMapping.get(u)?.controller===o&&(s=this.startKeepAlive(o,m)),new Response(h,{status:200,headers:f})}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(t)})}}async handleDeleteRequest(t){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(t){if(void 0===this.sessionIdGenerator)return;if(!this._initialized)return this.onerror?.(Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let r=t.headers.get("mcp-session-id");return r?r!==this.sessionId?(this.onerror?.(Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")):void 0:(this.onerror?.(Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required"))}validateProtocolVersion(t){let r=t.headers.get("mcp-protocol-version");if(null!==r&&!this._supportedProtocolVersions.includes(r)){let t=`Bad Request: Unsupported protocol version: ${r} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(400,-32e3,t)}}async close(){if(!this._closed){for(let{cleanup:t}of(this._closed=!0,this._streamMapping.values()))t();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(t){let r=this._requestToStreamMapping.get(t);if(!r)return;let a=this._streamMapping.get(r);a&&a.cleanup()}closeStandaloneSSEStream(){let t=this._streamMapping.get(this._standaloneSseStreamId);t&&t.cleanup()}async send(t,r){let a=r?.relatedRequestId;if((cW(t)||cY(t))&&(a=t.id),void 0===a){let r;if(cW(t)||cY(t))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(r=await this._eventStore.storeEvent(this._standaloneSseStreamId,t));let a=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===a)return;a.controller&&a.encoder&&(void 0===r||!a.replayedEventIds?.has(r))&&this.writeSSEEvent(a.controller,a.encoder,t,r);return}let n=this._requestToStreamMapping.get(a);if(!n)throw Error(`No connection established for request ID: ${String(a)}`);let i=this._streamMapping.get(n);if(!this._enableJsonResponse){let r;this._eventStore&&(r=await this._eventStore.storeEvent(n,t),i=this._streamMapping.get(n)),i?.controller&&i?.encoder&&(void 0===r||!i.replayedEventIds?.has(r))&&this.writeSSEEvent(i.controller,i.encoder,t,r)}if(cW(t)||cY(t)){this._requestResponseMap.set(a,t);let r=[...this._requestToStreamMapping.entries()].filter(([t,r])=>r===n).map(([t])=>t);if(r.every(t=>this._requestResponseMap.has(t))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(a)}`);if(!this._eventStore){for(let t of(this.onerror?.(Error(`Response for request ID ${String(a)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),r))this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}if(this._enableJsonResponse&&i.resolveJson){let t={"Content-Type":"application/json"};void 0!==this.sessionId&&(t["mcp-session-id"]=this.sessionId);let a=r.map(t=>this._requestResponseMap.get(t));1===a.length?i.resolveJson(Response.json(a[0],{status:200,headers:t})):i.resolveJson(Response.json(a,{status:200,headers:t})),i.cleanup()}else i.cleanup();for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t)}}}};function p2(t){if(null===t||"object"!=typeof t||Array.isArray(t))return null;let{method:r,id:a}=t;return"string"!=typeof r?null:"string"==typeof a||"number"==typeof a?a:null}function p9(t,r,a,n,i=null){return Response.json({jsonrpc:"2.0",error:{code:r,message:a,...void 0!==n&&{data:n}},id:i},{status:t})}function p4(t,r=null){return p9(t.httpStatus,t.code,t.message,t.data,r)}function p3(t){return t instanceof Error?t:Error(String(t))}function p6(t=null){return p9(500,-32603,"Internal server error",void 0,t)}function p5(t){if(void 0!==t.transport)throw Error("The factory returned an instance that is still serving another request. Return a new instance for each request.")}function p7(t){return{protocolVersionHeader:t.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:t.headers.get("mcp-method")??void 0,mcpNameHeader:t.headers.get("mcp-name")??void 0}}async function p8(t,r,a=!0,n=4194304){let i,o=t.method.toUpperCase(),s=r,l=t,c=!1;if("POST"===o){if(void 0===s){let r;a&&(l=t.clone());try{let a=await p0(t,n);if(a.tooLarge)return{step:"body-too-large"};r=a.text}catch{return{step:"unreadable-body"}}try{i=0===r.length?void 0:JSON.parse(r)}catch{c=!0}c||void 0===i||(s=i)}else i=s;if(c||void 0===i)return{step:"no-json-body",forwardRequest:l}}return{step:"classified",outcome:function(t){if("POST"!==(t={...t,...void 0!==t.protocolVersionHeader&&{protocolVersionHeader:ui(t.protocolVersionHeader)},...void 0!==t.mcpMethodHeader&&{mcpMethodHeader:ui(t.mcpMethodHeader)},...void 0!==t.mcpNameHeader&&{mcpNameHeader:ui(t.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let r=t.body;if(Array.isArray(r)){if(0===r.length)return ur("jsonrpc-shape","empty-batch",400,new cg(cf.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let t of r){if(cF(uo(t)?t.params:void 0))return ur("jsonrpc-shape","batch-with-modern-element",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(cK(t)||cG(t)||cW(t)||cY(t)))return ur("jsonrpc-shape","batch-with-invalid-element",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return cW(r)||cY(r)?{kind:"legacy",reason:"response"}:uo(r)&&cK(r)?function(t,r){let a=r.params,n=r.method,i=t.protocolVersionHeader,o=void 0!==i&&i>=lW;if("initialize"===n&&!function(t){if(!cF(t))return!1;let r=cH(t);if(void 0===r||!(r>=lW))return!1;let a=cV(t);return void 0!==a&&0===cJ(a).length}(a)){if(o)return ua("initialize-with-modern-header",i,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let t=uo(a)&&"string"==typeof a.protocolVersion?a.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==t&&{requestedVersion:t}}}if(cF(a)){let o=cV(a),s=(void 0===o?[]:cJ(o))[0];if(void 0!==s)return ur("envelope","envelope-invalid",400,new cg(cf.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${s.key}: ${s.problem}`,{envelope:s}),!0);let l=cH(a);return void 0!==i&&void 0!==l&&i!==l?ua("header-body-version-mismatch",i,`the body envelope names protocol version ${l} but the MCP-Protocol-Version header names ${i}`):void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("method-header-mismatch",t.mcpMethodHeader,`the body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:r,classification:us(l)}}if(o){let t=cV(a),r=cJ(t??{}).filter(t=>"missing"===t.problem).map(t=>t.key),n=void 0===t?["_meta"]:r.length>0?r:[iJ];return ur("envelope","modern-header-without-claim",400,new cg(cf.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${n.join(", ")}`,{envelope:{missing:n}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==i&&{requestedVersion:i}}}(t,r):uo(r)&&cG(r)?function(t,r){let a=r.params,n=r.method,i=t.protocolVersionHeader,o=void 0!==i&&i>=lW;if(cF(a)){let o=cH(a);if(void 0===o){let t=cV(a),r=(void 0===t?[]:cJ(t)).find(t=>t.key===iJ)??{key:iJ,problem:"expected a protocol version string"};return ur("envelope","notification-envelope-invalid",400,new cg(cf.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${r.key}: ${r.problem}`,{envelope:r}),!0)}if(void 0!==i&&i!==o)return ua("notification-header-body-version-mismatch",i,`the notification envelope names protocol version ${o} but the MCP-Protocol-Version header names ${i}`);let s=us(o);return"modern"===s.era&&void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:s}}return o?void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:{era:"modern",revision:i}}:{kind:"legacy",reason:"notification",...void 0!==i&&{requestedVersion:i}}}(t,r):ur("jsonrpc-shape","invalid-json-rpc-body",400,new cg(cf.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:o,...p7(t),...void 0!==i&&{body:i}}),body:i,parsedBody:s,forwardRequest:l}}let me=require("async_hooks"),mt=(t,r)=>{globalThis[t]=r},mr=t=>globalThis[t];function ma({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),n=Symbol.for(`xmcp-context-${t}-fallback-store`);if(mr(a))return mr(a);let i=new me.AsyncLocalStorage,o=globalThis[n]??{current:null};mt(n,o);let s={provider:(t,a)=>(r&&(o.current=t),i.run(t,a)),getContext:()=>{let a=i.getStore();if(a)return a;if(r&&o.current)return o.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let n=i.getStore()??(r?o.current:null);if(!n)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(n,a)}};return mt(a,s),s}let mn=ma({name:"http-request-context"}),mi=mn.setContext,mo=mn.getContext,ms=mn.provider,ml=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),mc=t=>{if(!ml(t)||"string"!=typeof t.name||"string"!=typeof t.version)return;let r={name:t.name,version:t.version};return"string"==typeof t.title&&(r.title=t.title),"string"==typeof t.websiteUrl&&(r.websiteUrl=t.websiteUrl),"string"==typeof t.description&&(r.description=t.description),r},mu=t=>{if(t&&"initialize"===t.method&&ml(t.params))return mc(t.params.clientInfo)},md=(t,r)=>{let a=r.toLowerCase();for(let[r,n]of Object.entries(t)){if(r.toLowerCase()!==a)continue;let t=Array.isArray(n)?n[0]:n;if("string"!=typeof t)break;let i=t.trim();return i.length>0?i:void 0}};function mp(t){let{tags:r,enabled:a,...n}=t;return{...n,_meta:void 0===r?n._meta:{...n._meta,"xmcp/tags":r}}}let mm=new class{add(t,r){this.resources.set(t,r)}getAll(){return this.resources}clear(){this.resources.clear()}has(t){return this.resources.has(t)}constructor(){!function(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a}(this,"resources",new Map)}},mh=ma({name:"request-context",fallback:!1}),mf=ma({name:"client-info-context"});mf.setContext;let mg=mf.getContext;mf.provider;let my=new Set(["message","mode","requestedSchema"]),mv=new Set(["elicitationId","message","mode","url"]),m_=new Set(["properties","required","type"]),mb=new Set(["default","description","format","maxLength","minLength","title","type"]),mS=new Set(["default","description","enum","enumNames","title","type"]),m$=new Set(["default","description","title","type"]),mw=new Set(["default","description","maximum","minimum","title","type"]),mR=new Set(["date","date-time","email","uri"]);async function mk(t,r,a){let n=function(t){let r=t.mode??"form";if("url"===r)return function(t){let r;mP(t,"Elicitation request must be a plain object."),mx(t,mv,"URL elicitation"),mE(t.message,"URL elicitation requires a string message."),mT(t.elicitationId,"URL elicitation requires a non-empty elicitationId."),mT(t.url,"URL elicitation requires a non-empty URL.");try{r=new URL(t.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(t),t;if("form"!==r)throw Error(`Unsupported elicitation mode "${String(t.mode)}". Expected "form" or "url".`);return function(t){mP(t,"Elicitation request must be a plain object."),mx(t,my,"Form elicitation"),mE(t.message,"Form elicitation requires a string message.");let r=t.requestedSchema;if(mP(r,"Form elicitation requires a flat object schema."),mx(r,m_,"Form elicitation schema"),"object"!==r.type)throw Error('Form elicitation schema must use type "object".');for(let[t,a]of(mP(r.properties,"Form elicitation schema requires a properties object."),Object.entries(r.properties)))!function(t,r){if(mP(r,`Form elicitation field "${t}" must be a plain object.`),mj(r.title,`Form elicitation field "${t}" title must be a string.`),mj(r.description,`Form elicitation field "${t}" description must be a string.`),"string"===r.type&&"enum"in r){var a,n;if(mx(r,mS,`Form elicitation field "${t}"`),mC(r.enum,`Form elicitation field "${t}" enum values must be strings.`),a=r.enumNames,n=`Form elicitation field "${t}" enumNames must be strings.`,void 0!==a&&mC(a,n),void 0!==r.enumNames&&r.enumNames.length!==r.enum.length)throw Error(`Form elicitation field "${t}" enumNames length must match enum length.`);if(mj(r.default,`Form elicitation field "${t}" default must be a string.`),void 0!==r.default&&!r.enum.includes(r.default))throw Error(`Form elicitation field "${t}" default must be one of its enum values.`);return}if("string"===r.type&&!("enum"in r)){mx(r,mb,`Form elicitation field "${t}"`),mO(r.minLength,`Form elicitation field "${t}" minLength must be a number.`),mO(r.maxLength,`Form elicitation field "${t}" maxLength must be a number.`),mj(r.default,`Form elicitation field "${t}" default must be a string.`);let a=r.format;if(mj(a,`Form elicitation field "${t}" format must be a string.`),void 0!==a&&!mR.has(a))throw Error(`Form elicitation field "${t}" format must be one of: ${Array.from(mR).join(", ")}.`);return}if("boolean"===r.type){if(mx(r,m$,`Form elicitation field "${t}"`),void 0!==r.default&&"boolean"!=typeof r.default)throw Error(`Form elicitation field "${t}" default must be a boolean.`);return}if("number"===r.type||"integer"===r.type){mx(r,mw,`Form elicitation field "${t}"`),mO(r.minimum,`Form elicitation field "${t}" minimum must be a number.`),mO(r.maximum,`Form elicitation field "${t}" maximum must be a number.`),mO(r.default,`Form elicitation field "${t}" default must be a number.`);return}throw Error(`Form elicitation field "${t}" uses unsupported type "${String(r.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(t,a);if(void 0!==r.required){if(!Array.isArray(r.required)||r.required.some(t=>"string"!=typeof t))throw Error("Form elicitation schema required fields must be a string array.");for(let t of r.required)if(!(t in r.properties))throw Error(`Form elicitation schema required field "${t}" is not defined in properties.`)}}(t),{...t,mode:"form"}}(r);try{let r=await t.mcpReq.elicitInput(n,a);return{...r,content:r.content??void 0}}catch(t){if(t instanceof lJ&&t.code===lH.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function mx(t,r,a){let n=Object.keys(t).filter(t=>!r.has(t));if(0!==n.length)throw Error(`${a} includes unsupported key(s): ${n.join(", ")}.`)}function mP(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}function mE(t,r){if("string"!=typeof t)throw Error(r)}function mT(t,r){if("string"!=typeof t||0===t.trim().length)throw Error(r)}function mj(t,r){if(void 0!==t&&"string"!=typeof t)throw Error(r)}function mO(t,r){if(void 0!==t&&"number"!=typeof t)throw Error(r)}function mC(t,r){if(!Array.isArray(t)||t.some(t=>"string"!=typeof t))throw Error(r)}let mI=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),mN=new Set(["task","toolChoice","tools"]),mq=new Set(["text","image","audio"]);async function mA(t,r,a){let n=function(t){mM(t,"Sampling request must be a plain object.");let r=Object.keys(t),a=r.filter(t=>mN.has(t));if(a.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${a.join(", ")}.`);let n=r.filter(t=>!mI.has(t));if(n.length>0)throw Error(`Sampling request includes unsupported key(s): ${n.join(", ")}.`);if(!Array.isArray(t.messages)||0===t.messages.length)throw Error("Sampling requires at least one message.");for(let[r,a]of t.messages.entries())!function(t,r){if(mM(r,`Sampling message at index ${t} must be a plain object.`),"user"!==r.role&&"assistant"!==r.role)throw Error(`Sampling message at index ${t} requires role "user" or "assistant".`);let a=r.content;mM(a,`Sampling message at index ${t} requires a content object.`);let n=a.type;if("string"!=typeof n||!mq.has(n))throw Error(`Sampling message at index ${t} uses unsupported content type "${String(n)}". Supported types are text, image, and audio.`);if("text"===n&&"string"!=typeof a.text)throw Error(`Sampling message at index ${t} requires string text content.`);if(("image"===n||"audio"===n)&&("string"!=typeof a.data||"string"!=typeof a.mimeType))throw Error(`Sampling message at index ${t} requires base64 data and a mimeType.`)}(r,a);if("number"!=typeof t.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return t}(r);try{return await t.mcpReq.requestSampling(n,a)}catch(t){if(t instanceof lJ&&t.code===lH.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw t}}function mM(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}let mz={text:t=>"string"!=typeof t.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:t=>"string"!=typeof t.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:t=>"string"!=typeof t.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:t=>"string"!=typeof t.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof t.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==t.title&&"string"!=typeof t.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==t.description&&"string"!=typeof t.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==t.mimeType&&"string"!=typeof t.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function mL(t){if(!t||"object"!=typeof t)return{valid:!1,error:"Content must be an object"};if("string"!=typeof t.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==t._meta&&(null===t._meta||"object"!=typeof t._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let r=mz[t.type];return r?r(t):{valid:!0}}function mZ(t,r,a,n){if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`Tool "${a}" ${n}: expected a plain object.`);let i=new Set(Object.keys(r)),o=Object.keys(t).filter(t=>!i.has(t));if(o.length>0)throw Error(`Tool "${a}" ${n}: unrecognized key(s): ${o.join(", ")}`);for(let[i,o]of Object.entries(r))try{o.parse(t[i])}catch(t){throw Error(`Tool "${a}" ${n}: ${t?.message??`invalid field "${i}"`}`)}}function mD(t){return!!(t&&"object"==typeof t&&Object.keys(t).some(t=>t.startsWith("ui/")))}function mU(t){let r=t.mcpReq.envelope,a=mc(r?.[iB]);if(!a)try{let t,r=mo();a=r.clientInfo??(t=r.headers,mc({name:md(t,"x-mcp-client-name"),version:md(t,"x-mcp-client-version"),title:md(t,"x-mcp-client-title"),websiteUrl:md(t,"x-mcp-client-website-url"),description:md(t,"x-mcp-client-description")}))}catch{}if(!a)try{a=mg().clientInfo}catch{}return a}function mV(t){let r=[...t];return(t,a,n)=>(function(t,r,a){let n,i=new Map;if(t.http){let t=mo(),r=Object.fromEntries(Object.entries(t.headers).map(([t,r])=>[t,Array.isArray(r)?Object.freeze([...r]):r]));n=Object.freeze({id:t.id,headers:Object.freeze(r)})}return mh.provider(Object.freeze({clientInfo:r?Object.freeze({...r}):void 0,http:n,authInfo:t.http?.authInfo,signal:t.mcpReq.signal,set(t,r){i.set(t,r)},get:t=>i.get(t),async progress(r,a){let n=t.mcpReq._meta?.progressToken;void 0!==n&&await t.mcpReq.notify({method:"notifications/progress",params:{progressToken:n,progress:r,...void 0===a?{}:{total:a}}})},log:(r,a)=>t.mcpReq.log(r,a)}),a)})(a,mU(a),async()=>{if(0===r.length)return n();let a=Object.freeze({...function(){try{return mh.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),...t,params:Object.freeze({...t.params})}),i=-1,o=async t=>{if(t<=i)throw Error("MCP middleware next() can only be called once");i=t;let s=r[t];return s?s(a,()=>o(t+1)):n()};return o(0)})}let mF=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function mH(t){return t.endsWith(".tsx")}let mJ=Symbol("Let zodToJsonSchema decide on which parser to use"),mB={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};(T=q||(q={})).assertEqual=t=>{},T.assertIs=function(t){},T.assertNever=function(t){throw Error()},T.arrayToEnum=t=>{let r={};for(let a of t)r[a]=a;return r},T.getValidEnumValues=t=>{let r=T.objectKeys(t).filter(r=>"number"!=typeof t[t[r]]),a={};for(let n of r)a[n]=t[n];return T.objectValues(a)},T.objectValues=t=>T.objectKeys(t).map(function(r){return t[r]}),T.objectKeys="function"==typeof Object.keys?t=>Object.keys(t):t=>{let r=[];for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push(a);return r},T.find=(t,r)=>{for(let a of t)if(r(a))return a},T.isInteger="function"==typeof Number.isInteger?t=>Number.isInteger(t):t=>"number"==typeof t&&Number.isFinite(t)&&Math.floor(t)===t,T.joinValues=function(t,r=" | "){return t.map(t=>"string"==typeof t?`'${t}'`:t).join(r)},T.jsonStringifyReplacer=(t,r)=>"bigint"==typeof r?r.toString():r,(A||(A={})).mergeShapes=(t,r)=>({...t,...r});let mK=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mG=t=>{switch(typeof t){case"undefined":return mK.undefined;case"string":return mK.string;case"number":return Number.isNaN(t)?mK.nan:mK.number;case"boolean":return mK.boolean;case"function":return mK.function;case"bigint":return mK.bigint;case"symbol":return mK.symbol;case"object":if(Array.isArray(t))return mK.array;if(null===t)return mK.null;if(t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch)return mK.promise;if("undefined"!=typeof Map&&t instanceof Map)return mK.map;if("undefined"!=typeof Set&&t instanceof Set)return mK.set;if("undefined"!=typeof Date&&t instanceof Date)return mK.date;return mK.object;default:return mK.unknown}},mW=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class mY extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(t){return t.message},a={_errors:[]},n=t=>{for(let i of t.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)a._errors.push(r(i));else{let t=a,n=0;for(;n<i.path.length;){let a=i.path[n],o=n===i.path.length-1;if("_errors"===a){o&&t._errors.push(r(i)),n++;continue}Object.prototype.hasOwnProperty.call(t,a)||("__proto__"===a?Object.defineProperty(t,a,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):t[a]={_errors:[]}),t=t[a],o&&t._errors.push(r(i)),n++}}};return n(this),a}static assert(t){if(!(t instanceof mY))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(t=t=>t.message){let r=Object.create(null),a=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];r[a]=r[a]||[],r[a].push(t(n))}else a.push(t(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}}mY.create=t=>new mY(t);let mX=(t,r)=>{let a;switch(t.code){case mW.invalid_type:a=t.received===mK.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case mW.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case mW.unrecognized_keys:a=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case mW.invalid_union:a="Invalid input";break;case mW.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case mW.invalid_enum_value:a=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case mW.invalid_arguments:a="Invalid function arguments";break;case mW.invalid_return_type:a="Invalid function return type";break;case mW.invalid_date:a="Invalid date";break;case mW.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:q.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case mW.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case mW.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case mW.custom:a="Invalid input";break;case mW.invalid_intersection_types:a="Intersection results could not be merged";break;case mW.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case mW.not_finite:a="Number must be finite";break;default:a=r.defaultError,q.assertNever(t)}return{message:a}};(j=M||(M={})).errToObj=t=>"string"==typeof t?{message:t}:t||{},j.toString=t=>"string"==typeof t?t:t?.message;let mQ=t=>{let{data:r,path:a,errorMaps:n,issueData:i}=t,o=[...a,...i.path||[]],s={...i,path:o};if(void 0!==i.message)return{...i,path:o,message:i.message};let l="";for(let t of n.filter(t=>!!t).slice().reverse())l=t(s,{data:r,defaultError:l}).message;return{...i,path:o,message:l}};function m0(t,r){let a=mQ({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mX,void 0].filter(t=>!!t)});t.common.issues.push(a)}class m1{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let n of r){if("aborted"===n.status)return m2;"dirty"===n.status&&t.dirty(),a.push(n.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let t of r){let r=await t.key,n=await t.value;a.push({key:r,value:n})}return m1.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let n of r){let{key:r,value:i}=n;if("aborted"===r.status||"aborted"===i.status)return m2;"dirty"===r.status&&t.dirty(),"dirty"===i.status&&t.dirty(),"__proto__"!==r.value&&(void 0!==i.value||n.alwaysSet)&&(a[r.value]=i.value)}return{status:t.value,value:a}}}let m2=Object.freeze({status:"aborted"}),m9=t=>({status:"dirty",value:t}),m4=t=>({status:"valid",value:t}),m3=t=>"undefined"!=typeof Promise&&t instanceof Promise;class m6{constructor(t,r,a,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let m5=(t,r)=>{if("valid"===r.status)return{success:!0,data:r.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new mY(t.common.issues);return this._error=r,this._error}}};function m7(t){if(!t)return{};let{errorMap:r,invalid_type_error:a,required_error:n,description:i}=t;if(r&&(a||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return r?{errorMap:r,description:i}:{errorMap:(r,i)=>{let{message:o}=t;return"invalid_enum_value"===r.code?{message:o??i.defaultError}:void 0===i.data?{message:o??n??i.defaultError}:"invalid_type"!==r.code?{message:i.defaultError}:{message:o??a??i.defaultError}},description:i}}class m8{get description(){return this._def.description}_getType(t){return mG(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new m1,ctx:{common:t.parent.common,data:t.data,parsedType:mG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(m3(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){return Promise.resolve(this._parse(t))}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)},n=this._parseSync({data:t,path:a.path,parent:a});return m5(a,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return"valid"===a.status?{value:a.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(t=>"valid"===t.status?{value:t.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)},n=this._parse({data:t,path:a.path,parent:a});return m5(a,await (m3(n)?n:Promise.resolve(n)))}refine(t,r){return this._refinement((a,n)=>{let i=t(a),o=()=>n.addIssue({code:mW.custom,..."string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(a):r});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(t=>!!t||(o(),!1)):!!i||(o(),!1)})}refinement(t,r){return this._refinement((a,n)=>!!t(a)||(n.addIssue("function"==typeof r?r(a,n):r),!1))}_refinement(t){return new hJ({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return hB.create(this,this._def)}nullable(){return hK.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hT.create(this)}promise(){return hH.create(this,this._def)}or(t){return hO.create([this,t],this._def)}and(t){return hN.create(this,t,this._def)}transform(t){return new hJ({...m7(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){return new hG({...m7(this._def),innerType:this,defaultValue:"function"==typeof t?t:()=>t,typeName:z.ZodDefault})}brand(){return new hX({typeName:z.ZodBranded,type:this,...m7(this._def)})}catch(t){return new hW({...m7(this._def),innerType:this,catchValue:"function"==typeof t?t:()=>t,typeName:z.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return hQ.create(this,t)}readonly(){return h0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let he=/^c[^\s-]{8,}$/i,ht=/^[0-9a-z]+$/,hr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ha=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hn=/^[a-z0-9_-]{21}$/i,hi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ho=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,hs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hl=/^(?:(?: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])$/,hc=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,hu=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,hd=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hm=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hh="((\\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])))",hf=RegExp(`^${hh}$`);function hg(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:null==t.precision&&(r=`${r}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${a}`}class hy extends m8{_parse(t){var r,a,n,i;let o;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==mK.string){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.string,received:r.parsedType}),m2}let s=new m1;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(m0(o=this._getOrReturnCtx(t,o),{code:mW.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)t.data.length>l.value&&(m0(o=this._getOrReturnCtx(t,o),{code:mW.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let r=t.data.length>l.value,a=t.data.length<l.value;(r||a)&&(o=this._getOrReturnCtx(t,o),r?m0(o,{code:mW.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):a&&m0(o,{code:mW.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)hs.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"email",code:mW.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)h||(h=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),h.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"emoji",code:mW.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)ha.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"uuid",code:mW.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)hn.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"nanoid",code:mW.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)he.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"cuid",code:mW.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)ht.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"cuid2",code:mW.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)hr.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"ulid",code:mW.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{m0(o=this._getOrReturnCtx(t,o),{validation:"url",code:mW.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"regex",code:mW.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(t){let r=`${hh}T${hg(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${a.join("|")})`,RegExp(`^${r}$`)})(l).test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?hf.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${hg(l)}$`).test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?ho.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"duration",code:mW.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&hl.test(r)||("v6"===a||!a)&&hu.test(r))&&1&&(m0(o=this._getOrReturnCtx(t,o),{validation:"ip",code:mW.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(t,r){if(!hi.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||r&&i.alg!==r)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(m0(o=this._getOrReturnCtx(t,o),{validation:"jwt",code:mW.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(n=t.data,!(("v4"===(i=l.version)||!i)&&hc.test(n)||("v6"===i||!i)&&hd.test(n))&&1&&(m0(o=this._getOrReturnCtx(t,o),{validation:"cidr",code:mW.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?hp.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"base64",code:mW.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?hm.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"base64url",code:mW.invalid_string,message:l.message}),s.dirty()):q.assertNever(l);return{status:s.value,value:t.data}}_regex(t,r,a){return this.refinement(r=>t.test(r),{validation:r,code:mW.invalid_string,...M.errToObj(a)})}_addCheck(t){return new hy({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...M.errToObj(t)})}url(t){return this._addCheck({kind:"url",...M.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...M.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...M.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...M.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...M.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...M.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...M.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...M.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...M.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...M.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...M.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...M.errToObj(t)})}datetime(t){return"string"==typeof t?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:void 0===t?.precision?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...M.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return"string"==typeof t?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:void 0===t?.precision?null:t?.precision,...M.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...M.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...M.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...M.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...M.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...M.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...M.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...M.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...M.errToObj(r)})}nonempty(t){return this.min(1,M.errToObj(t))}trim(){return new hy({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hy({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hy({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>"datetime"===t.kind)}get isDate(){return!!this._def.checks.find(t=>"date"===t.kind)}get isTime(){return!!this._def.checks.find(t=>"time"===t.kind)}get isDuration(){return!!this._def.checks.find(t=>"duration"===t.kind)}get isEmail(){return!!this._def.checks.find(t=>"email"===t.kind)}get isURL(){return!!this._def.checks.find(t=>"url"===t.kind)}get isEmoji(){return!!this._def.checks.find(t=>"emoji"===t.kind)}get isUUID(){return!!this._def.checks.find(t=>"uuid"===t.kind)}get isNANOID(){return!!this._def.checks.find(t=>"nanoid"===t.kind)}get isCUID(){return!!this._def.checks.find(t=>"cuid"===t.kind)}get isCUID2(){return!!this._def.checks.find(t=>"cuid2"===t.kind)}get isULID(){return!!this._def.checks.find(t=>"ulid"===t.kind)}get isIP(){return!!this._def.checks.find(t=>"ip"===t.kind)}get isCIDR(){return!!this._def.checks.find(t=>"cidr"===t.kind)}get isBase64(){return!!this._def.checks.find(t=>"base64"===t.kind)}get isBase64url(){return!!this._def.checks.find(t=>"base64url"===t.kind)}get minLength(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}hy.create=t=>new hy({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...m7(t)});class hv extends m8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){let r;if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==mK.number){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.number,received:r.parsedType}),m2}let a=new m1;for(let n of this._def.checks)"int"===n.kind?q.isInteger(t.data)||(m0(r=this._getOrReturnCtx(t,r),{code:mW.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):"min"===n.kind?(n.inclusive?t.data<n.value:t.data<=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):"max"===n.kind?(n.inclusive?t.data>n.value:t.data>=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):"multipleOf"===n.kind?0!==function(t,r){let a=(t.toString().split(".")[1]||"").length,n=(r.toString().split(".")[1]||"").length,i=a>n?a:n;return Number.parseInt(t.toFixed(i).replace(".",""))%Number.parseInt(r.toFixed(i).replace(".",""))/10**i}(t.data,n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(t.data)||(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_finite,message:n.message}),a.dirty()):q.assertNever(n);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,M.toString(r))}gt(t,r){return this.setLimit("min",t,!1,M.toString(r))}lte(t,r){return this.setLimit("max",t,!0,M.toString(r))}lt(t,r){return this.setLimit("max",t,!1,M.toString(r))}setLimit(t,r,a,n){return new hv({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:M.toString(n)}]})}_addCheck(t){return new hv({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:M.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:M.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:M.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&q.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks)if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;else"min"===a.kind?(null===r||a.value>r)&&(r=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value);return Number.isFinite(r)&&Number.isFinite(t)}}hv.create=t=>new hv({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...m7(t)});class h_ extends m8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){let r;if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==mK.bigint)return this._getInvalidInput(t);let a=new m1;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?t.data<n.value:t.data<=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):"max"===n.kind?(n.inclusive?t.data>n.value:t.data>=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):"multipleOf"===n.kind?t.data%n.value!==BigInt(0)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):q.assertNever(n);return{status:a.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.bigint,received:r.parsedType}),m2}gte(t,r){return this.setLimit("min",t,!0,M.toString(r))}gt(t,r){return this.setLimit("min",t,!1,M.toString(r))}lte(t,r){return this.setLimit("max",t,!0,M.toString(r))}lt(t,r){return this.setLimit("max",t,!1,M.toString(r))}setLimit(t,r,a,n){return new h_({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:M.toString(n)}]})}_addCheck(t){return new h_({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:M.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}h_.create=t=>new h_({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...m7(t)});class hb extends m8{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==mK.boolean){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.boolean,received:r.parsedType}),m2}return m4(t.data)}}hb.create=t=>new hb({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...m7(t)});class hS extends m8{_parse(t){let r;if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==mK.date){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.date,received:r.parsedType}),m2}if(Number.isNaN(t.data.getTime()))return m0(this._getOrReturnCtx(t),{code:mW.invalid_date}),m2;let a=new m1;for(let n of this._def.checks)"min"===n.kind?t.data.getTime()<n.value&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):"max"===n.kind?t.data.getTime()>n.value&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):q.assertNever(n);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new hS({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:M.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:M.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return null!=t?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return null!=t?new Date(t):null}}hS.create=t=>new hS({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...m7(t)});class h$ extends m8{_parse(t){if(this._getType(t)!==mK.symbol){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.symbol,received:r.parsedType}),m2}return m4(t.data)}}h$.create=t=>new h$({typeName:z.ZodSymbol,...m7(t)});class hw extends m8{_parse(t){if(this._getType(t)!==mK.undefined){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.undefined,received:r.parsedType}),m2}return m4(t.data)}}hw.create=t=>new hw({typeName:z.ZodUndefined,...m7(t)});class hR extends m8{_parse(t){if(this._getType(t)!==mK.null){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.null,received:r.parsedType}),m2}return m4(t.data)}}hR.create=t=>new hR({typeName:z.ZodNull,...m7(t)});class hk extends m8{constructor(){super(...arguments),this._any=!0}_parse(t){return m4(t.data)}}hk.create=t=>new hk({typeName:z.ZodAny,...m7(t)});class hx extends m8{constructor(){super(...arguments),this._unknown=!0}_parse(t){return m4(t.data)}}hx.create=t=>new hx({typeName:z.ZodUnknown,...m7(t)});class hP extends m8{_parse(t){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.never,received:r.parsedType}),m2}}hP.create=t=>new hP({typeName:z.ZodNever,...m7(t)});class hE extends m8{_parse(t){if(this._getType(t)!==mK.undefined){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.void,received:r.parsedType}),m2}return m4(t.data)}}hE.create=t=>new hE({typeName:z.ZodVoid,...m7(t)});class hT extends m8{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),n=this._def;if(r.parsedType!==mK.array)return m0(r,{code:mW.invalid_type,expected:mK.array,received:r.parsedType}),m2;if(null!==n.exactLength){let t=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(t||i)&&(m0(r,{code:t?mW.too_big:mW.too_small,minimum:i?n.exactLength.value:void 0,maximum:t?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&r.data.length<n.minLength.value&&(m0(r,{code:mW.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&r.data.length>n.maxLength.value&&(m0(r,{code:mW.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((t,a)=>n.type._parseAsync(new m6(r,t,r.path,a)))).then(t=>m1.mergeArray(a,t));let i=[...r.data].map((t,a)=>n.type._parseSync(new m6(r,t,r.path,a)));return m1.mergeArray(a,i)}get element(){return this._def.type}min(t,r){return new hT({...this._def,minLength:{value:t,message:M.toString(r)}})}max(t,r){return new hT({...this._def,maxLength:{value:t,message:M.toString(r)}})}length(t,r){return new hT({...this._def,exactLength:{value:t,message:M.toString(r)}})}nonempty(t){return this.min(1,t)}}hT.create=(t,r)=>new hT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...m7(r)});class hj extends m8{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let t=this._def.shape(),r=q.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==mK.object){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.object,received:r.parsedType}),m2}let{status:r,ctx:a}=this._processInputParams(t),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof hP&&"strip"===this._def.unknownKeys))for(let t in a.data)i.includes(t)||o.push(t);let s=[];for(let t of i){let r=n[t],i=a.data[t];s.push({key:{status:"valid",value:t},value:r._parse(new m6(a,i,a.path,t)),alwaysSet:t in a.data})}if(this._def.catchall instanceof hP){let t=this._def.unknownKeys;if("passthrough"===t)for(let t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===t)o.length>0&&(m0(a,{code:mW.unrecognized_keys,keys:o}),r.dirty());else if("strip"===t);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let t=this._def.catchall;for(let r of o){let n=a.data[r];s.push({key:{status:"valid",value:r},value:t._parse(new m6(a,n,a.path,r)),alwaysSet:r in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let t=[];for(let r of s){let a=await r.key,n=await r.value;t.push({key:a,value:n,alwaysSet:r.alwaysSet})}return t}).then(t=>m1.mergeObjectSync(r,t)):m1.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return M.errToObj,new hj({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return"unrecognized_keys"===r.code?{message:M.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new hj({...this._def,unknownKeys:"strip"})}passthrough(){return new hj({...this._def,unknownKeys:"passthrough"})}extend(t){return new hj({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new hj({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new hj({...this._def,catchall:t})}pick(t){let r={};for(let a of q.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new hj({...this._def,shape:()=>r})}omit(t){let r={};for(let a of q.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new hj({...this._def,shape:()=>r})}deepPartial(){return function t(r){if(r instanceof hj){let a={};for(let n in r.shape){let i=r.shape[n];a[n]=hB.create(t(i))}return new hj({...r._def,shape:()=>a})}if(r instanceof hT)return new hT({...r._def,type:t(r.element)});if(r instanceof hB)return hB.create(t(r.unwrap()));if(r instanceof hK)return hK.create(t(r.unwrap()));if(r instanceof hq)return hq.create(r.items.map(r=>t(r)));else return r}(this)}partial(t){let r={};for(let a of q.objectKeys(this.shape)){let n=this.shape[a];t&&!t[a]?r[a]=n:r[a]=n.optional()}return new hj({...this._def,shape:()=>r})}required(t){let r={};for(let a of q.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let t=this.shape[a];for(;t instanceof hB;)t=t._def.innerType;r[a]=t}return new hj({...this._def,shape:()=>r})}keyof(){return hU(q.objectKeys(this.shape))}}hj.create=(t,r)=>new hj({shape:()=>t,unknownKeys:"strip",catchall:hP.create(),typeName:z.ZodObject,...m7(r)}),hj.strictCreate=(t,r)=>new hj({shape:()=>t,unknownKeys:"strict",catchall:hP.create(),typeName:z.ZodObject,...m7(r)}),hj.lazycreate=(t,r)=>new hj({shape:t,unknownKeys:"strip",catchall:hP.create(),typeName:z.ZodObject,...m7(r)});class hO extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;if(r.common.async)return Promise.all(a.map(async t=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await t._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(function(t){for(let r of t)if("valid"===r.result.status)return r.result;for(let a of t)if("dirty"===a.result.status)return r.common.issues.push(...a.ctx.common.issues),a.result;let a=t.map(t=>new mY(t.ctx.common.issues));return m0(r,{code:mW.invalid_union,unionErrors:a}),m2});{let t,n=[];for(let i of a){let a={...r,common:{...r.common,issues:[]},parent:null},o=i._parseSync({data:r.data,path:r.path,parent:a});if("valid"===o.status)return o;"dirty"!==o.status||t||(t={result:o,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(t)return r.common.issues.push(...t.ctx.common.issues),t.result;let i=n.map(t=>new mY(t));return m0(r,{code:mW.invalid_union,unionErrors:i}),m2}}get options(){return this._def.options}}hO.create=(t,r)=>new hO({options:t,typeName:z.ZodUnion,...m7(r)});let hC=t=>{if(t instanceof hZ)return hC(t.schema);if(t instanceof hJ)return hC(t.innerType());if(t instanceof hD)return[t.value];if(t instanceof hV)return t.options;if(t instanceof hF)return q.objectValues(t.enum);else if(t instanceof hG)return hC(t._def.innerType);else if(t instanceof hw)return[void 0];else if(t instanceof hR)return[null];else if(t instanceof hB)return[void 0,...hC(t.unwrap())];else if(t instanceof hK)return[null,...hC(t.unwrap())];else if(t instanceof hX)return hC(t.unwrap());else if(t instanceof h0)return hC(t.unwrap());else if(t instanceof hW)return hC(t._def.innerType);else return[]};class hI extends m8{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==mK.object)return m0(r,{code:mW.invalid_type,expected:mK.object,received:r.parsedType}),m2;let a=this.discriminator,n=r.data[a],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(m0(r,{code:mW.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m2)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let n=new Map;for(let a of r){let r=hC(a.shape[t]);if(!r.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of r){if(n.has(i))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);n.set(i,a)}}return new hI({typeName:z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...m7(a)})}}class hN extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=(t,n)=>{if("aborted"===t.status||"aborted"===n.status)return m2;let i=function t(r,a){let n=mG(r),i=mG(a);if(r===a)return{valid:!0,data:r};if(n===mK.object&&i===mK.object){let n=q.objectKeys(a),i=q.objectKeys(r).filter(t=>-1!==n.indexOf(t)),o={...r,...a};for(let n of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===n)continue;let i=t(r[n],a[n]);if(!i.valid)return{valid:!1};o[n]=i.data}return{valid:!0,data:o}}if(n===mK.array&&i===mK.array){if(r.length!==a.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let o=t(r[i],a[i]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}if(n===mK.date&&i===mK.date&&+r==+a)return{valid:!0,data:r};return{valid:!1}}(t.value,n.value);return i.valid?(("dirty"===t.status||"dirty"===n.status)&&r.dirty(),{status:r.value,value:i.data}):(m0(a,{code:mW.invalid_intersection_types}),m2)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([t,r])=>n(t,r)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}hN.create=(t,r,a)=>new hN({left:t,right:r,typeName:z.ZodIntersection,...m7(a)});class hq extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.array)return m0(a,{code:mW.invalid_type,expected:mK.array,received:a.parsedType}),m2;if(a.data.length<this._def.items.length)return m0(a,{code:mW.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m2;!this._def.rest&&a.data.length>this._def.items.length&&(m0(a,{code:mW.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...a.data].map((t,r)=>{let n=this._def.items[r]||this._def.rest;return n?n._parse(new m6(a,t,a.path,r)):null}).filter(t=>!!t);return a.common.async?Promise.all(n).then(t=>m1.mergeArray(r,t)):m1.mergeArray(r,n)}get items(){return this._def.items}rest(t){return new hq({...this._def,rest:t})}}hq.create=(t,r)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new hq({items:t,typeName:z.ZodTuple,rest:null,...m7(r)})};class hA extends m8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.object)return m0(a,{code:mW.invalid_type,expected:mK.object,received:a.parsedType}),m2;let n=[],i=this._def.keyType,o=this._def.valueType;for(let t in a.data)n.push({key:i._parse(new m6(a,t,a.path,t)),value:o._parse(new m6(a,a.data[t],a.path,t)),alwaysSet:t in a.data});return a.common.async?m1.mergeObjectAsync(r,n):m1.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,a){return new hA(r instanceof m8?{keyType:t,valueType:r,typeName:z.ZodRecord,...m7(a)}:{keyType:hy.create(),valueType:t,typeName:z.ZodRecord,...m7(r)})}}class hM extends m8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.map)return m0(a,{code:mW.invalid_type,expected:mK.map,received:a.parsedType}),m2;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([t,r],o)=>({key:n._parse(new m6(a,t,a.path,[o,"key"])),value:i._parse(new m6(a,r,a.path,[o,"value"]))}));if(a.common.async){let t=new Map;return Promise.resolve().then(async()=>{for(let a of o){let n=await a.key,i=await a.value;if("aborted"===n.status||"aborted"===i.status)return m2;("dirty"===n.status||"dirty"===i.status)&&r.dirty(),t.set(n.value,i.value)}return{status:r.value,value:t}})}{let t=new Map;for(let a of o){let n=a.key,i=a.value;if("aborted"===n.status||"aborted"===i.status)return m2;("dirty"===n.status||"dirty"===i.status)&&r.dirty(),t.set(n.value,i.value)}return{status:r.value,value:t}}}}hM.create=(t,r,a)=>new hM({valueType:r,keyType:t,typeName:z.ZodMap,...m7(a)});class hz extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.set)return m0(a,{code:mW.invalid_type,expected:mK.set,received:a.parsedType}),m2;let n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(m0(a,{code:mW.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(m0(a,{code:mW.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(t){let a=new Set;for(let n of t){if("aborted"===n.status)return m2;"dirty"===n.status&&r.dirty(),a.add(n.value)}return{status:r.value,value:a}}let s=[...a.data.values()].map((t,r)=>i._parse(new m6(a,t,a.path,r)));return a.common.async?Promise.all(s).then(t=>o(t)):o(s)}min(t,r){return new hz({...this._def,minSize:{value:t,message:M.toString(r)}})}max(t,r){return new hz({...this._def,maxSize:{value:t,message:M.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}hz.create=(t,r)=>new hz({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...m7(r)});class hL extends m8{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==mK.function)return m0(r,{code:mW.invalid_type,expected:mK.function,received:r.parsedType}),m2;function a(t,a){return mQ({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mX,mX].filter(t=>!!t),issueData:{code:mW.invalid_arguments,argumentsError:a}})}function n(t,a){return mQ({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mX,mX].filter(t=>!!t),issueData:{code:mW.invalid_return_type,returnTypeError:a}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof hH){let t=this;return m4(async function(...r){let s=new mY([]),l=await t._def.args.parseAsync(r,i).catch(t=>{throw s.addIssue(a(r,t)),s}),c=await Reflect.apply(o,this,l);return await t._def.returns._def.type.parseAsync(c,i).catch(t=>{throw s.addIssue(n(c,t)),s})})}{let t=this;return m4(function(...r){let s=t._def.args.safeParse(r,i);if(!s.success)throw new mY([a(r,s.error)]);let l=Reflect.apply(o,this,s.data),c=t._def.returns.safeParse(l,i);if(!c.success)throw new mY([n(l,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new hL({...this._def,args:hq.create(t).rest(hx.create())})}returns(t){return new hL({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new hL({args:t||hq.create([]).rest(hx.create()),returns:r||hx.create(),typeName:z.ZodFunction,...m7(a)})}}class hZ extends m8{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}hZ.create=(t,r)=>new hZ({getter:t,typeName:z.ZodLazy,...m7(r)});class hD extends m8{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return m0(r,{received:r.data,code:mW.invalid_literal,expected:this._def.value}),m2}return{status:"valid",value:t.data}}get value(){return this._def.value}}function hU(t,r){return new hV({values:t,typeName:z.ZodEnum,...m7(r)})}hD.create=(t,r)=>new hD({value:t,typeName:z.ZodLiteral,...m7(r)});class hV extends m8{_parse(t){if("string"!=typeof t.data){let r=this._getOrReturnCtx(t),a=this._def.values;return m0(r,{expected:q.joinValues(a),received:r.parsedType,code:mW.invalid_type}),m2}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return m0(r,{received:r.data,code:mW.invalid_enum_value,options:a}),m2}return m4(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return hV.create(t,{...this._def,...r})}exclude(t,r=this._def){return hV.create(this.options.filter(r=>!t.includes(r)),{...this._def,...r})}}hV.create=hU;class hF extends m8{_parse(t){let r=q.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==mK.string&&a.parsedType!==mK.number){let t=q.objectValues(r);return m0(a,{expected:q.joinValues(t),received:a.parsedType,code:mW.invalid_type}),m2}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let t=q.objectValues(r);return m0(a,{received:a.data,code:mW.invalid_enum_value,options:t}),m2}return m4(t.data)}get enum(){return this._def.values}}hF.create=(t,r)=>new hF({values:t,typeName:z.ZodNativeEnum,...m7(r)});class hH extends m8{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);return r.parsedType!==mK.promise&&!1===r.common.async?(m0(r,{code:mW.invalid_type,expected:mK.promise,received:r.parsedType}),m2):m4((r.parsedType===mK.promise?r.data:Promise.resolve(r.data)).then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}}hH.create=(t,r)=>new hH({type:t,typeName:z.ZodPromise,...m7(r)});class hJ extends m8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:t=>{m0(a,t),t.fatal?r.abort():r.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let t=n.transform(a.data,i);if(a.common.async)return Promise.resolve(t).then(async t=>{if("aborted"===r.value)return m2;let n=await this._def.schema._parseAsync({data:t,path:a.path,parent:a});return"aborted"===n.status?m2:"dirty"===n.status||"dirty"===r.value?m9(n.value):n});{if("aborted"===r.value)return m2;let n=this._def.schema._parseSync({data:t,path:a.path,parent:a});return"aborted"===n.status?m2:"dirty"===n.status||"dirty"===r.value?m9(n.value):n}}if("refinement"===n.type){let t=t=>{let r=n.refinement(t,i);if(a.common.async)return Promise.resolve(r);if(r instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?m2:("dirty"===a.status&&r.dirty(),t(a.value).then(()=>({status:r.value,value:a.value}))));{let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?m2:("dirty"===n.status&&r.dirty(),t(n.value),{status:r.value,value:n.value})}}if("transform"===n.type)if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"valid"!==t.status?m2:Promise.resolve(n.transform(t.value,i)).then(t=>({status:r.value,value:t})));else{let t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if("valid"!==t.status)return m2;let o=n.transform(t.value,i);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}q.assertNever(n)}}hJ.create=(t,r,a)=>new hJ({schema:t,typeName:z.ZodEffects,effect:r,...m7(a)}),hJ.createWithPreprocess=(t,r,a)=>new hJ({schema:r,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...m7(a)});class hB extends m8{_parse(t){return this._getType(t)===mK.undefined?m4(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}hB.create=(t,r)=>new hB({innerType:t,typeName:z.ZodOptional,...m7(r)});class hK extends m8{_parse(t){return this._getType(t)===mK.null?m4(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}hK.create=(t,r)=>new hK({innerType:t,typeName:z.ZodNullable,...m7(r)});class hG extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===mK.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}hG.create=(t,r)=>new hG({innerType:t,typeName:z.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...m7(r)});class hW extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return m3(n)?n.then(t=>({status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new mY(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new mY(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}hW.create=(t,r)=>new hW({innerType:t,typeName:z.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...m7(r)});class hY extends m8{_parse(t){if(this._getType(t)!==mK.nan){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.nan,received:r.parsedType}),m2}return{status:"valid",value:t.data}}}hY.create=t=>new hY({typeName:z.ZodNaN,...m7(t)}),Symbol("zod_brand");class hX extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}}class hQ extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?m2:"dirty"===t.status?(r.dirty(),m9(t.value)):this._def.out._parseAsync({data:t.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?m2:"dirty"===t.status?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(t,r){return new hQ({in:t,out:r,typeName:z.ZodPipeline})}}class h0 extends m8{_parse(t){let r=this._def.innerType._parse(t),a=t=>("valid"===t.status&&(t.value=Object.freeze(t.value)),t);return m3(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}}h0.create=(t,r)=>new h0({innerType:t,typeName:z.ZodReadonly,...m7(r)}),hj.lazycreate,(O=z||(z={})).ZodString="ZodString",O.ZodNumber="ZodNumber",O.ZodNaN="ZodNaN",O.ZodBigInt="ZodBigInt",O.ZodBoolean="ZodBoolean",O.ZodDate="ZodDate",O.ZodSymbol="ZodSymbol",O.ZodUndefined="ZodUndefined",O.ZodNull="ZodNull",O.ZodAny="ZodAny",O.ZodUnknown="ZodUnknown",O.ZodNever="ZodNever",O.ZodVoid="ZodVoid",O.ZodArray="ZodArray",O.ZodObject="ZodObject",O.ZodUnion="ZodUnion",O.ZodDiscriminatedUnion="ZodDiscriminatedUnion",O.ZodIntersection="ZodIntersection",O.ZodTuple="ZodTuple",O.ZodRecord="ZodRecord",O.ZodMap="ZodMap",O.ZodSet="ZodSet",O.ZodFunction="ZodFunction",O.ZodLazy="ZodLazy",O.ZodLiteral="ZodLiteral",O.ZodEnum="ZodEnum",O.ZodEffects="ZodEffects",O.ZodNativeEnum="ZodNativeEnum",O.ZodOptional="ZodOptional",O.ZodNullable="ZodNullable",O.ZodDefault="ZodDefault",O.ZodCatch="ZodCatch",O.ZodPromise="ZodPromise",O.ZodBranded="ZodBranded",O.ZodPipeline="ZodPipeline",O.ZodReadonly="ZodReadonly";let h1=hy.create;hv.create,hY.create,h_.create,hb.create,hS.create,h$.create,hw.create,hR.create,hk.create,hx.create,hP.create,hE.create,hT.create;let h2=hj.create;hj.strictCreate,hO.create,hI.create,hN.create,hq.create,hA.create,hM.create,hz.create,hL.create,hZ.create,hD.create,hV.create,hF.create,hH.create,hJ.create,hB.create,hK.create,hJ.createWithPreprocess,hQ.create;let h9=(t,r)=>{let a=0;for(;a<t.length&&a<r.length&&t[a]===r[a];a++);return[(t.length-a).toString(),...r.slice(a)].join("/")};function h4(t){if("openAi"!==t.target)return{};let r=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===t.$refStrategy?h9(r,t.currentPath):r.join("/")}}function h3(t,r,a,n){n?.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[r]:a})}function h6(t,r,a,n,i){t[r]=a,h3(t,r,n,i)}function h5(t,r){return fv(t.type._def,r)}let h7=/^[cC][^\s-]{8,}$/,h8=/^[0-9a-z]+$/,fe=/^[0-9A-HJKMNP-TV-Z]{26}$/,ft=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,fr=()=>(void 0===w&&(w=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),w),fa=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,fn=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fs=/^[a-zA-Z0-9_-]{21}$/,fl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function fc(t,r){let a={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":h6(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,r);break;case"max":h6(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,r);break;case"email":switch(r.emailStrategy){case"format:email":fp(a,"email",n.message,r);break;case"format:idn-email":fp(a,"idn-email",n.message,r);break;case"pattern:zod":fm(a,ft,n.message,r)}break;case"url":fp(a,"uri",n.message,r);break;case"uuid":fp(a,"uuid",n.message,r);break;case"regex":fm(a,n.regex,n.message,r);break;case"cuid":fm(a,h7,n.message,r);break;case"cuid2":fm(a,h8,n.message,r);break;case"startsWith":fm(a,RegExp(`^${fu(n.value,r)}`),n.message,r);break;case"endsWith":fm(a,RegExp(`${fu(n.value,r)}$`),n.message,r);break;case"datetime":fp(a,"date-time",n.message,r);break;case"date":fp(a,"date",n.message,r);break;case"time":fp(a,"time",n.message,r);break;case"duration":fp(a,"duration",n.message,r);break;case"length":h6(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,r),h6(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,r);break;case"includes":fm(a,RegExp(fu(n.value,r)),n.message,r);break;case"ip":"v6"!==n.version&&fp(a,"ipv4",n.message,r),"v4"!==n.version&&fp(a,"ipv6",n.message,r);break;case"base64url":fm(a,fo,n.message,r);break;case"jwt":fm(a,fl,n.message,r);break;case"cidr":"v6"!==n.version&&fm(a,fa,n.message,r),"v4"!==n.version&&fm(a,fn,n.message,r);break;case"emoji":fm(a,fr(),n.message,r);break;case"ulid":fm(a,fe,n.message,r);break;case"base64":switch(r.base64Strategy){case"format:binary":fp(a,"binary",n.message,r);break;case"contentEncoding:base64":h6(a,"contentEncoding","base64",n.message,r);break;case"pattern:zod":fm(a,fi,n.message,r)}break;case"nanoid":fm(a,fs,n.message,r)}return a}function fu(t,r){return"escape"===r.patternStrategy?function(t){let r="";for(let a=0;a<t.length;a++)fd.has(t[a])||(r+="\\"),r+=t[a];return r}(t):t}let fd=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fp(t,r,a,n){t.format||t.anyOf?.some(t=>t.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.anyOf.push({format:r,...a&&n.errorMessages&&{errorMessage:{format:a}}})):h6(t,"format",r,a,n)}function fm(t,r,a,n){t.pattern||t.allOf?.some(t=>t.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.allOf.push({pattern:fh(r,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):h6(t,"pattern",fh(r,n),a,n)}function fh(t,r){if(!r.applyRegexFlags||!t.flags)return t.source;let a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=a.i?t.source.toLowerCase():t.source,i="",o=!1,s=!1,l=!1;for(let t=0;t<n.length;t++){if(o){i+=n[t],o=!1;continue}if(a.i){if(s){if(n[t].match(/[a-z]/)){l?(i+=n[t],i+=`${n[t-2]}-${n[t]}`.toUpperCase(),l=!1):"-"===n[t+1]&&n[t+2]?.match(/[a-z]/)?(i+=n[t],l=!0):i+=`${n[t]}${n[t].toUpperCase()}`;continue}}else if(n[t].match(/[a-z]/)){i+=`[${n[t]}${n[t].toUpperCase()}]`;continue}}if(a.m){if("^"===n[t]){i+=`(^|(?<=[\r
|
|
78
|
-
]))`;continue}else if("$"===
|
|
79
|
-
]))`;continue}}if(
|
|
80
|
-
`:`[${
|
|
81
|
-
]`;continue}i+=n[t],"\\"===n[t]?o=!0:s&&"]"===n[t]?s=!1:s||"["!==n[t]||(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${r.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return i}function ff(t,r){if("openAi"===r.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===r.target&&t.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((a,n)=>({...a,[n]:fv(t.valueType._def,{...r,currentPath:[...r.currentPath,"properties",n]})??h4(r)}),{}),additionalProperties:r.rejectedAdditionalProperties};let a={type:"object",additionalProperties:fv(t.valueType._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]})??r.allowedAdditionalProperties};if("openApi3"===r.target)return a;if(t.keyType?._def.typeName===z.ZodString&&t.keyType._def.checks?.length){let{type:n,...i}=fc(t.keyType._def,r);return{...a,propertyNames:i}}if(t.keyType?._def.typeName===z.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===z.ZodBranded&&t.keyType._def.type._def.typeName===z.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...i}=h5(t.keyType._def,r);return{...a,propertyNames:i}}return a}let fg={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},fy=(t,r)=>{let a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((t,a)=>fv(t._def,{...r,currentPath:[...r.currentPath,"anyOf",`${a}`]})).filter(t=>!!t&&(!r.strictUnions||"object"==typeof t&&Object.keys(t).length>0));return a.length?{anyOf:a}:void 0};function fv(t,r,a=!1){let n=r.seen.get(t);if(r.override){let i=r.override?.(t,r,n,a);if(i!==mJ)return i}if(n&&!a){let t=f_(n,r);if(void 0!==t)return t}let i={def:t,path:r.currentPath,jsonSchema:void 0};r.seen.set(t,i);let o=((t,r,a)=>{switch(r){case z.ZodString:return fc(t,a);case z.ZodNumber:let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",h3(n,"type",r.message,a);break;case"min":"jsonSchema7"===a.target?r.inclusive?h6(n,"minimum",r.value,r.message,a):h6(n,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(n.exclusiveMinimum=!0),h6(n,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?h6(n,"maximum",r.value,r.message,a):h6(n,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(n.exclusiveMaximum=!0),h6(n,"maximum",r.value,r.message,a));break;case"multipleOf":h6(n,"multipleOf",r.value,r.message,a)}return n;case z.ZodObject:return function(t,r){let a="openAi"===r.target,n={type:"object",properties:{}},i=[],o=t.shape();for(let t in o){let s=o[t];if(void 0===s||void 0===s._def)continue;let l=function(t){try{return t.isOptional()}catch{return!0}}(s);l&&a&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),l=!1);let c=fv(s._def,{...r,currentPath:[...r.currentPath,"properties",t],propertyPath:[...r.currentPath,"properties",t]});void 0!==c&&(n.properties[t]=c,l||i.push(t))}i.length&&(n.required=i);let s=function(t,r){if("ZodNever"!==t.catchall._def.typeName)return fv(t.catchall._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return r.allowedAdditionalProperties;case"strict":return r.rejectedAdditionalProperties;case"strip":return"strict"===r.removeAdditionalStrategy?r.allowedAdditionalProperties:r.rejectedAdditionalProperties}}(t,r);return void 0!==s&&(n.additionalProperties=s),n}(t,a);case z.ZodBigInt:let i={type:"integer",format:"int64"};if(!t.checks)return i;for(let r of t.checks)switch(r.kind){case"min":"jsonSchema7"===a.target?r.inclusive?h6(i,"minimum",r.value,r.message,a):h6(i,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(i.exclusiveMinimum=!0),h6(i,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?h6(i,"maximum",r.value,r.message,a):h6(i,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(i.exclusiveMaximum=!0),h6(i,"maximum",r.value,r.message,a));break;case"multipleOf":h6(i,"multipleOf",r.value,r.message,a)}return i;case z.ZodBoolean:return{type:"boolean"};case z.ZodDate:return function t(r,a,n){let i=n??a.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,i)=>t(r,a,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var o=r,s=a;let l={type:"integer",format:"unix-time"};if("openApi3"===s.target)return l;for(let t of o.checks)switch(t.kind){case"min":h6(l,"minimum",t.value,t.message,s);break;case"max":h6(l,"maximum",t.value,t.message,s)}return l}}(t,a);case z.ZodUndefined:return{not:h4(a)};case z.ZodNull:return"openApi3"===a.target?{enum:["null"],nullable:!0}:{type:"null"};case z.ZodArray:let o;return o={type:"array"},t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(o.items=fv(t.type._def,{...a,currentPath:[...a.currentPath,"items"]})),t.minLength&&h6(o,"minItems",t.minLength.value,t.minLength.message,a),t.maxLength&&h6(o,"maxItems",t.maxLength.value,t.maxLength.message,a),t.exactLength&&(h6(o,"minItems",t.exactLength.value,t.exactLength.message,a),h6(o,"maxItems",t.exactLength.value,t.exactLength.message,a)),o;case z.ZodUnion:case z.ZodDiscriminatedUnion:if("openApi3"===a.target)return fy(t,a);let s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(t=>t._def.typeName in fg&&(!t._def.checks||!t._def.checks.length))){let t=s.reduce((t,r)=>{let a=fg[r._def.typeName];return a&&!t.includes(a)?[...t,a]:t},[]);return{type:t.length>1?t:t[0]}}if(s.every(t=>"ZodLiteral"===t._def.typeName&&!t.description)){let t=s.reduce((t,r)=>{let a=typeof r._def.value;switch(a){case"string":case"number":case"boolean":return[...t,a];case"bigint":return[...t,"integer"];case"object":if(null===r._def.value)return[...t,"null"];default:return t}},[]);if(t.length===s.length){let r=t.filter((t,r,a)=>a.indexOf(t)===r);return{type:r.length>1?r:r[0],enum:s.reduce((t,r)=>t.includes(r._def.value)?t:[...t,r._def.value],[])}}}else if(s.every(t=>"ZodEnum"===t._def.typeName))return{type:"string",enum:s.reduce((t,r)=>[...t,...r._def.values.filter(r=>!t.includes(r))],[])};return fy(t,a);case z.ZodIntersection:let l,c,u;return l=[fv(t.left._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),fv(t.right._def,{...a,currentPath:[...a.currentPath,"allOf","1"]})].filter(t=>!!t),c="jsonSchema2019-09"===a.target?{unevaluatedProperties:!1}:void 0,u=[],l.forEach(t=>{if((!("type"in t)||"string"!==t.type)&&"allOf"in t)u.push(...t.allOf),void 0===t.unevaluatedProperties&&(c=void 0);else{let r=t;if("additionalProperties"in t&&!1===t.additionalProperties){let{additionalProperties:a,...n}=t;r=n}else c=void 0;u.push(r)}}),u.length?{allOf:u,...c}:void 0;case z.ZodTuple:return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((t,r)=>fv(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[]),additionalItems:fv(t.rest._def,{...a,currentPath:[...a.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((t,r)=>fv(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[])};case z.ZodRecord:return ff(t,a);case z.ZodLiteral:let d;return"bigint"!=(d=typeof t.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(t.value)?"array":"object"}:"openApi3"===a.target?{type:"bigint"===d?"integer":d,enum:[t.value]}:{type:"bigint"===d?"integer":d,const:t.value};case z.ZodEnum:return{type:"string",enum:Array.from(t.values)};case z.ZodNativeEnum:let p,m,h;return p=t.values,{type:1===(h=Array.from(new Set((m=Object.keys(t.values).filter(t=>"number"!=typeof p[p[t]]).map(t=>p[t])).map(t=>typeof t)))).length?"string"===h[0]?"string":"number":["string","number"],enum:m};case z.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return"openApi3"===a.target?{type:fg[t.innerType._def.typeName],nullable:!0}:{type:[fg[t.innerType._def.typeName],"null"]};if("openApi3"===a.target){let r=fv(t.innerType._def,{...a,currentPath:[...a.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let f=fv(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case z.ZodOptional:if(a.currentPath.toString()===a.propertyPath?.toString())return fv(t.innerType._def,a);let g=fv(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","1"]});return g?{anyOf:[{not:h4(a)},g]}:h4(a);case z.ZodMap:if("record"===a.mapStrategy)return ff(t,a);return{type:"array",maxItems:125,items:{type:"array",items:[fv(t.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||h4(a),fv(t.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||h4(a)],minItems:2,maxItems:2}};case z.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:fv(t.valueType._def,{...a,currentPath:[...a.currentPath,"items"]})},t.minSize&&h6(y,"minItems",t.minSize.value,t.minSize.message,a),t.maxSize&&h6(y,"maxItems",t.maxSize.value,t.maxSize.message,a),y;case z.ZodLazy:return()=>t.getter()._def;case z.ZodPromise:return fv(t.type._def,a);case z.ZodNaN:case z.ZodNever:return"openAi"===a.target?void 0:{not:h4({...a,currentPath:[...a.currentPath,"not"]})};case z.ZodEffects:return"input"===a.effectStrategy?fv(t.schema._def,a):h4(a);case z.ZodAny:case z.ZodUnknown:return h4(a);case z.ZodDefault:return{...fv(t.innerType._def,a),default:t.defaultValue()};case z.ZodBranded:return h5(t,a);case z.ZodReadonly:case z.ZodCatch:return fv(t.innerType._def,a);case z.ZodPipeline:if("input"===a.pipeStrategy)return fv(t.in._def,a);if("output"===a.pipeStrategy)return fv(t.out._def,a);let v=fv(t.in._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),_=fv(t.out._def,{...a,currentPath:[...a.currentPath,"allOf",v?"1":"0"]});return{allOf:[v,_].filter(t=>void 0!==t)};case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:default:return}})(t,t.typeName,r),s="function"==typeof o?fv(o(),r):o;if(s&&fb(t,r,s),r.postProcess){let a=r.postProcess(s,t,r);return i.jsonSchema=s,a}return i.jsonSchema=s,s}let f_=(t,r)=>{switch(r.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:h9(r.currentPath,t.path)};case"none":case"seen":if(t.path.length<r.currentPath.length&&t.path.every((t,a)=>r.currentPath[a]===t))return console.warn(`Recursive reference detected at ${r.currentPath.join("/")}! Defaulting to any`),h4(r);return"seen"===r.$refStrategy?h4(r):void 0}},fb=(t,r,a)=>(t.description&&(a.description=t.description,r.markdownDescription&&(a.markdownDescription=t.description)),a);function fS(t,r={}){let{strict:a=!1}=r,n=Object.entries(t),i=t=>({target:r})=>{let i={},o=[];for(let[a,s]of n)i[a]=function(t,r,a){let n=t["~standard"];if(n.jsonSchema)return n.jsonSchema[a]({target:r});if("zod"===t["~standard"].vendor&&!("_zod"in t)&&"_def"in t){let a=((t,r)=>{let a,n,i=(n=void 0!==(a="string"==typeof r?{...mB,name:r}:{...mB,...r}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([t,r])=>[r._def,{def:r._def,path:[...a.basePath,a.definitionPath,t],jsonSchema:void 0}]))}),o="object"==typeof r&&r.definitions?Object.entries(r.definitions).reduce((t,[r,a])=>({...t,[r]:fv(a._def,{...i,currentPath:[...i.basePath,i.definitionPath,r]},!0)??h4(i)}),{}):void 0,s="string"==typeof r?r:r?.nameStrategy==="title"?void 0:r?.name,l=fv(t._def,void 0===s?i:{...i,currentPath:[...i.basePath,i.definitionPath,s]},!1)??h4(i),c="object"==typeof r&&void 0!==r.name&&"title"===r.nameStrategy?r.name:void 0;void 0!==c&&(l.title=c),i.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[i.openAiAnyTypeName]||(o[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let u=void 0===s?o?{...l,[i.definitionPath]:o}:l:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,s].join("/"),[i.definitionPath]:{...o,[s]:l}};return"jsonSchema7"===i.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),u})(t,{$refStrategy:"none",target:"openapi-3.0"===r?"openApi3":"jsonSchema7"});return delete a.$schema,a}if("zod"===n.vendor&&"_zod"in t)try{let r=a8(t);return delete r.$schema,r}catch(t){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${t instanceof Error?t.message:String(t)}`)}throw Error(`Schema library "${n.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(s,r,t),!function(t,r){if("function"!=typeof t.safeParse)return!1;try{let a=t.safeParse(void 0);return a.success&&("input"===r||void 0===a.data)}catch{return!1}}(s,t)&&o.push(a);let s={type:"object",properties:i};return o.length>0&&(s.required=o),a&&(s.additionalProperties=!1),s},o=async r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{issues:[{message:"Expected an object."}]};let i={},o=[];for(let[t,a]of n){let n=await a["~standard"].validate(r[t]);if(n.issues)for(let r of n.issues)o.push({message:r.message,path:[t,...r.path??[]]});else(t in r||void 0!==n.value)&&(i[t]=n.value)}if(a)for(let a of Object.keys(r))a in t||o.push({message:`Unrecognized key: "${a}"`,path:[a]});return o.length>0?{issues:o}:{value:i}};return{shape:t,"~standard":{version:1,vendor:"xmcp",validate:o,jsonSchema:{input:i("input"),output:i("output")}}}}function f$(t){let r={};return!function t(a,n=""){if(a&&"object"==typeof a)for(let[i,o]of Object.entries(a)){let a=n?`${n}/${i}`:i;!o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp?r[a]=o:t(o,a)}}(t),r}let fw=["ui/resourceUri","resourceUri","visibility"],fR=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function fk(t){return"object"==typeof t&&null!==t&&Object.entries(t).every(([t,r])=>"string"==typeof t&&"object"==typeof r&&null!==r&&"parse"in r&&"function"==typeof r.parse)}function fx(t){return(t.split("/").pop()||t).replace(/\.[^/.]+$/,"")}function fP(t,r,a){return t.names?.includes(r)===!0||t.tags?.some(t=>a.includes(t))===!0}function fE(t,r){return r?new Map([...t].filter(([t,{metadata:a}])=>{if(a?.enabled===!1)return!1;let n=a?.name??fx(t),i=a?.tags??[];return(!r.include||fP(r.include,n,i))&&(!r.exclude||!fP(r.exclude,n,i))})):t}function fT(t){return Error(`[xmcp] Invalid prompt file: ${t}
|
|
82
|
-
-> Default export must be a prompt handler function.`)}
|
|
83
|
-
-> ${
|
|
84
|
-
-> Default export must be a resource handler function.`)}
|
|
85
|
-
-> ${
|
|
86
|
-
-> Default export must be a tool handler function.`)}
|
|
87
|
-
-> ${
|
|
73
|
+
`),e.enqueue(t.encode(n))}async handleGetRequest(e){let t,r;if(!e.headers.get("accept")?.includes("text/event-stream"))return this.onerror?.(Error("Not Acceptable: Client must accept text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept text/event-stream");let a=this.validateSession(e);if(a)return a;let i=this.validateProtocolVersion(e);if(i)return i;if(this._eventStore){let t=e.headers.get("last-event-id");if(t)return this.replayEvents(t)}if(void 0!==this._streamMapping.get(this._standaloneSseStreamId))return this.onerror?.(Error("Conflict: Only one SSE stream is allowed per session")),this.createJsonErrorResponse(409,-32e3,"Conflict: Only one SSE stream is allowed per session");let n=new TextEncoder,o=new ReadableStream({start:e=>{t=e},cancel:()=>{void 0!==r&&clearInterval(r),this._streamMapping.get(this._standaloneSseStreamId)?.controller===t&&this._streamMapping.delete(this._standaloneSseStreamId)}}),s={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};return void 0!==this.sessionId&&(s["mcp-session-id"]=this.sessionId),this._streamMapping.set(this._standaloneSseStreamId,{controller:t,encoder:n,cleanup:()=>{void 0!==r&&clearInterval(r),this._streamMapping.delete(this._standaloneSseStreamId);try{t.close()}catch{}}}),r=this.startKeepAlive(t,n),new Response(o,{headers:s})}async replayEvents(e){if(!this._eventStore)return this.onerror?.(Error("Event store not configured")),this.createJsonErrorResponse(400,-32e3,"Event store not configured");try{let t,r,a,i;if(this._eventStore.getStreamIdForEventId){if(!(t=await this._eventStore.getStreamIdForEventId(e)))return this.onerror?.(Error("Invalid event ID format")),this.createJsonErrorResponse(400,-32e3,"Invalid event ID format");if(void 0!==this._streamMapping.get(t))return this.onerror?.(Error("Conflict: Stream already has an active connection")),this.createJsonErrorResponse(409,-32e3,"Conflict: Stream already has an active connection")}let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};void 0!==this.sessionId&&(n["mcp-session-id"]=this.sessionId);let o=new TextEncoder,s=!1,l=new ReadableStream({start:e=>{r=e},cancel:()=>{s=!0,void 0!==a&&clearInterval(a),void 0!==i&&this._streamMapping.get(i)?.controller===r&&this._streamMapping.delete(i)}}),c=new Set;if(i=await this._eventStore.replayEventsAfter(e,{send:async(e,t)=>{if(c.add(e),!this.writeSSEEvent(r,o,t,e))try{r.close()}catch{}}}),this._closed||s){try{r.close()}catch{}return this.createJsonErrorResponse(404,-32001,"Session not found")}if(this._streamMapping.get(i)?.cleanup(),this._streamMapping.set(i,{controller:r,encoder:o,replayedEventIds:c,cleanup:()=>{void 0!==a&&clearInterval(a),this._streamMapping.delete(i);try{r.close()}catch{}}}),i!==this._standaloneSseStreamId&&![...this._requestToStreamMapping.values()].includes(i)){this._streamMapping.delete(i);try{r.close()}catch{}}return this._streamMapping.get(i)?.controller===r&&(a=this.startKeepAlive(r,o)),new Response(l,{headers:n})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(500,-32e3,"Error replaying events")}}writeSSEEvent(e,t,r,a){try{let i=`event: message
|
|
74
|
+
`;return a&&(i+=`id: ${a}
|
|
75
|
+
`),i+=`data: ${JSON.stringify(r)}
|
|
76
|
+
|
|
77
|
+
`,e.enqueue(t.encode(i)),!0}catch(e){return this.onerror?.(e),!1}}handleUnsupportedRequest(){return this.onerror?.(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,a,i,n,o,s=e.headers.get("accept");if(!s?.includes("application/json")||!s.includes("text/event-stream"))return this.onerror?.(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(!uA(e.headers.get("content-type")))return this.onerror?.(Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");if(t?.parsedBody===void 0)try{let t=await pX(e,this._maxRequestBodySize);if(t.tooLarge){let e=pW(this._maxRequestBodySize);return this.onerror?.(Error(e)),this.createJsonErrorResponse(413,-32e3,e)}r=JSON.parse(t.text)}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else r=t.parsedBody;if(Array.isArray(r)&&r.length>100)return this.onerror?.(Error("Invalid Request: Batch must not exceed 100 messages")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Batch must not exceed 100 messages");try{a=Array.isArray(r)?r.map(e=>os.parse(e)):[os.parse(r)]}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let l=a.some(e=>o$.safeParse(e).success);if(l){if(this._initialized&&void 0!==this.sessionId)return this.onerror?.(Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.onerror?.(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(!l){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");try{i=await this._checkScopeChallenge(a,t?.authInfo)}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(500,-32603,"Internal server error")}if(i)return i;if(!a.some(e=>cB(e))){for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e});return new Response(null,{status:202})}let c=crypto.randomUUID(),u=a.find(e=>o$.safeParse(e).success),d=u?u.params.protocolVersion:e.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(r=>{for(let e of(this._streamMapping.set(c,{resolveJson:r,cleanup:()=>{this._streamMapping.delete(c)}}),a))cB(e)&&this._requestToStreamMapping.set(e.id,c);for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e})});let p=new TextEncoder,m=new ReadableStream({start:e=>{n=e},cancel:()=>{void 0!==o&&clearInterval(o),this._streamMapping.get(c)?.controller===n&&this._streamMapping.delete(c)}}),h={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let e of(void 0!==this.sessionId&&(h["mcp-session-id"]=this.sessionId),a))cB(e)&&(this._streamMapping.set(c,{controller:n,encoder:p,cleanup:()=>{void 0!==o&&clearInterval(o),this._streamMapping.delete(c);try{n.close()}catch{}}}),this._requestToStreamMapping.set(e.id,c));for(let r of(await this.writePrimingEvent(n,p,c,d),a)){let a,i;cB(r)&&this._eventStore&&this.supportsEmptySSEData(d)&&(a=()=>{this.closeSSEStream(r.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(r,{authInfo:t?.authInfo,request:e,closeSSEStream:a,closeStandaloneSSEStream:i})}return this._streamMapping.get(c)?.controller===n&&(o=this.startKeepAlive(n,p)),new Response(m,{status:200,headers:h})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(e)})}}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(void 0===this.sessionIdGenerator)return;if(!this._initialized)return this.onerror?.(Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let t=e.headers.get("mcp-session-id");return t?t!==this.sessionId?(this.onerror?.(Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")):void 0:(this.onerror?.(Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required"))}validateProtocolVersion(e){let t=e.headers.get("mcp-protocol-version");if(null!==t&&!this._supportedProtocolVersions.includes(t)){let e=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(400,-32e3,e)}}async close(){if(!this._closed){for(let{cleanup:e}of(this._closed=!0,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((cG(e)||cW(e))&&(r=e.id),void 0===r){let t;if(cG(e)||cW(e))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(t=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let r=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===r)return;r.controller&&r.encoder&&(void 0===t||!r.replayedEventIds?.has(t))&&this.writeSSEEvent(r.controller,r.encoder,e,t);return}let a=this._requestToStreamMapping.get(r);if(!a)throw Error(`No connection established for request ID: ${String(r)}`);let i=this._streamMapping.get(a);if(!this._enableJsonResponse){let t;this._eventStore&&(t=await this._eventStore.storeEvent(a,e),i=this._streamMapping.get(a)),i?.controller&&i?.encoder&&(void 0===t||!i.replayedEventIds?.has(t))&&this.writeSSEEvent(i.controller,i.encoder,e,t)}if(cG(e)||cW(e)){this._requestResponseMap.set(r,e);let t=[...this._requestToStreamMapping.entries()].filter(([e,t])=>t===a).map(([e])=>e);if(t.every(e=>this._requestResponseMap.has(e))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(r)}`);if(!this._eventStore){for(let e of(this.onerror?.(Error(`Response for request ID ${String(r)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),t))this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}if(this._enableJsonResponse&&i.resolveJson){let e={"Content-Type":"application/json"};void 0!==this.sessionId&&(e["mcp-session-id"]=this.sessionId);let r=t.map(e=>this._requestResponseMap.get(e));1===r.length?i.resolveJson(Response.json(r[0],{status:200,headers:e})):i.resolveJson(Response.json(r,{status:200,headers:e})),i.cleanup()}else i.cleanup();for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e)}}}};function p0(e){if(null===e||"object"!=typeof e||Array.isArray(e))return null;let{method:t,id:r}=e;return"string"!=typeof t?null:"string"==typeof r||"number"==typeof r?r:null}function p1(e,t,r,a,i=null){return Response.json({jsonrpc:"2.0",error:{code:t,message:r,...void 0!==a&&{data:a}},id:i},{status:e,...405===e&&{headers:{Allow:"POST"}}})}function p2(e,t=null){return p1(e.httpStatus,e.code,e.message,e.data,t)}function p9(e){return e instanceof Error?e:Error(String(e))}function p4(e=null){return p1(500,-32603,"Internal server error",void 0,e)}function p3(e){if(void 0!==e.transport)throw Error("The factory returned an instance that is still serving another request. Return a new instance for each request.")}function p5(e){return{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}}let p6=require("async_hooks"),p7=(e,t)=>{globalThis[e]=t},p8=e=>globalThis[e];function me({name:e,fallback:t=!0}){let r=Symbol.for(`xmcp-context-${e}`),a=Symbol.for(`xmcp-context-${e}-fallback-store`);if(p8(r))return p8(r);let i=new p6.AsyncLocalStorage,n=globalThis[a]??{current:null};p7(a,n);let o={provider:(e,r)=>(t&&(n.current=e),i.run(e,r)),getContext:()=>{let r=i.getStore();if(r)return r;if(t&&n.current)return n.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:r=>{let a=i.getStore()??(t?n.current:null);if(!a)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(a,r)}};return p7(r,o),o}let mt=me({name:"http-request-context"}),mr=mt.setContext,ma=mt.getContext,mi=mt.provider,mn=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),mo=e=>{if(!mn(e)||"string"!=typeof e.name||"string"!=typeof e.version)return;let t={name:e.name,version:e.version};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.websiteUrl&&(t.websiteUrl=e.websiteUrl),"string"==typeof e.description&&(t.description=e.description),t},ms=e=>{if(e&&"initialize"===e.method&&mn(e.params))return mo(e.params.clientInfo)},ml=(e,t)=>{let r=t.toLowerCase();for(let[t,a]of Object.entries(e)){if(t.toLowerCase()!==r)continue;let e=Array.isArray(a)?a[0]:a;if("string"!=typeof e)break;let i=e.trim();return i.length>0?i:void 0}};function mc(e){let{tags:t,enabled:r,...a}=e;return{...a,_meta:void 0===t?a._meta:{...a._meta,"xmcp/tags":t}}}let mu=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){var e,t;e="resources",t=new Map,e in this?Object.defineProperty(this,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):this[e]=t}},md=me({name:"request-context",fallback:!1}),mp=me({name:"client-info-context"});mp.setContext;let mm=mp.getContext;mp.provider;let mh=new Set(["message","mode","requestedSchema"]),mf=new Set(["elicitationId","message","mode","url"]),mg=new Set(["properties","required","type"]),my=new Set(["default","description","format","maxLength","minLength","title","type"]),mv=new Set(["default","description","enum","enumNames","title","type"]),m_=new Set(["default","description","title","type"]),mb=new Set(["default","description","maximum","minimum","title","type"]),mS=new Set(["date","date-time","email","uri"]);function m$(e,t,r){let a=Object.keys(e).filter(e=>!t.has(e));if(0!==a.length)throw Error(`${r} includes unsupported key(s): ${a.join(", ")}.`)}function mw(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function mR(e,t){if("string"!=typeof e)throw Error(t)}function mk(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function mx(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function mP(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function mE(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let mT=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),mj=new Set(["task","toolChoice","tools"]),mO=new Set(["text","image","audio"]);function mC(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}let mI={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function mN(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=mI[e.type];return t?t(e):{valid:!0}}function mq(e,t,r,a){if(null===e||"object"!=typeof e||Array.isArray(e))throw Error(`Tool "${r}" ${a}: expected a plain object.`);let i=new Set(Object.keys(t)),n=Object.keys(e).filter(e=>!i.has(e));if(n.length>0)throw Error(`Tool "${r}" ${a}: unrecognized key(s): ${n.join(", ")}`);for(let[i,n]of Object.entries(t))try{n.parse(e[i])}catch(e){throw Error(`Tool "${r}" ${a}: ${e?.message??`invalid field "${i}"`}`)}}function mA(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function mz(e){let t=e.mcpReq.envelope,r=mo(t?.[nJ]);if(!r)try{let e,t=ma();r=t.clientInfo??(e=t.headers,mo({name:ml(e,"x-mcp-client-name"),version:ml(e,"x-mcp-client-version"),title:ml(e,"x-mcp-client-title"),websiteUrl:ml(e,"x-mcp-client-website-url"),description:ml(e,"x-mcp-client-description")}))}catch{}if(!r)try{r=mm().clientInfo}catch{}return r}function mM(e){let t=[...e];return(e,r,a)=>(function(e,t,r){let a,i=new Map;if(e.http){let e=ma(),t=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,Array.isArray(t)?Object.freeze([...t]):t]));a=Object.freeze({id:e.id,headers:Object.freeze(t)})}return md.provider(Object.freeze({clientInfo:t?Object.freeze({...t}):void 0,http:a,authInfo:e.http?.authInfo,signal:e.mcpReq.signal,set(e,t){i.set(e,t)},get:e=>i.get(e),async progress(t,r){let a=e.mcpReq._meta?.progressToken;void 0!==a&&await e.mcpReq.notify({method:"notifications/progress",params:{progressToken:a,progress:t,...void 0===r?{}:{total:r}}})},log:(t,r)=>e.mcpReq.log(t,r)}),r)})(r,mz(r),async()=>{if(0===t.length)return a();let r=Object.freeze({...function(){try{return md.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),...e,params:Object.freeze({...e.params})}),i=-1,n=async e=>{if(e<=i)throw Error("MCP middleware next() can only be called once");i=e;let o=t[e];return o?o(r,()=>n(e+1)):a()};return n(0)})}let mL=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function mZ(e){return e.endsWith(".tsx")}let mD=Symbol("Let zodToJsonSchema decide on which parser to use"),mU={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};(T=q||(q={})).assertEqual=e=>{},T.assertIs=function(e){},T.assertNever=function(e){throw Error()},T.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},T.getValidEnumValues=e=>{let t=T.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return T.objectValues(r)},T.objectValues=e=>T.objectKeys(e).map(function(t){return e[t]}),T.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},T.find=(e,t)=>{for(let r of e)if(t(r))return r},T.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,T.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},T.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(A||(A={})).mergeShapes=(e,t)=>({...e,...t});let mV=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mF=e=>{switch(typeof e){case"undefined":return mV.undefined;case"string":return mV.string;case"number":return Number.isNaN(e)?mV.nan:mV.number;case"boolean":return mV.boolean;case"function":return mV.function;case"bigint":return mV.bigint;case"symbol":return mV.symbol;case"object":if(Array.isArray(e))return mV.array;if(null===e)return mV.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return mV.promise;if("u">typeof Map&&e instanceof Map)return mV.map;if("u">typeof Set&&e instanceof Set)return mV.set;if("u">typeof Date&&e instanceof Date)return mV.date;return mV.object;default:return mV.unknown}},mH=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class mJ extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a],n=a===i.path.length-1;if("_errors"===r){n&&e._errors.push(t(i)),a++;continue}Object.prototype.hasOwnProperty.call(e,r)||("__proto__"===r?Object.defineProperty(e,r,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):e[r]={_errors:[]}),e=e[r],n&&e._errors.push(t(i)),a++}}};return a(this),r}static assert(e){if(!(e instanceof mJ))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}mJ.create=e=>new mJ(e);let mB=(e,t)=>{let r;switch(e.code){case mH.invalid_type:r=e.received===mV.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case mH.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,q.jsonStringifyReplacer)}`;break;case mH.unrecognized_keys:r=`Unrecognized key(s) in object: ${q.joinValues(e.keys,", ")}`;break;case mH.invalid_union:r="Invalid input";break;case mH.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${q.joinValues(e.options)}`;break;case mH.invalid_enum_value:r=`Invalid enum value. Expected ${q.joinValues(e.options)}, received '${e.received}'`;break;case mH.invalid_arguments:r="Invalid function arguments";break;case mH.invalid_return_type:r="Invalid function return type";break;case mH.invalid_date:r="Invalid date";break;case mH.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:q.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case mH.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case mH.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case mH.custom:r="Invalid input";break;case mH.invalid_intersection_types:r="Intersection results could not be merged";break;case mH.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case mH.not_finite:r="Number must be finite";break;default:r=t.defaultError,q.assertNever(e)}return{message:r}};(j=z||(z={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},j.toString=e=>"string"==typeof e?e:e?.message;function mK(e,t){let r=(e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],o={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let s="";for(let e of a.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:n,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,mB,void 0].filter(e=>!!e)});e.common.issues.push(r)}class mG{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return mW;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return mG.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return mW;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let mW=Object.freeze({status:"aborted"}),mY=e=>({status:"dirty",value:e}),mX=e=>({status:"valid",value:e}),mQ=e=>"u">typeof Promise&&e instanceof Promise;class m0{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let m1=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new mJ(e.common.issues);return this._error=t,this._error}}};function m2(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:n}=e;return"invalid_enum_value"===t.code?{message:n??i.defaultError}:void 0===i.data?{message:n??a??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:n??r??i.defaultError}},description:i}}class m9{get description(){return this._def.description}_getType(e){return mF(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:mF(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new mG,ctx:{common:e.parent.common,data:e.data,parsedType:mF(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(mQ(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mF(e)},a=this._parseSync({data:e,path:r.path,parent:r});return m1(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mF(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mF(e)},a=this._parse({data:e,path:r.path,parent:r});return m1(r,await (mQ(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),n=()=>a.addIssue({code:mH.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new hA({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return hz.create(this,this._def)}nullable(){return hM.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hw.create(this)}promise(){return hq.create(this,this._def)}or(e){return hk.create([this,e],this._def)}and(e){return hx.create(this,e,this._def)}transform(e){return new hA({...m2(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new hL({...m2(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:M.ZodDefault})}brand(){return new hU({typeName:M.ZodBranded,type:this,...m2(this._def)})}catch(e){return new hZ({...m2(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:M.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return hV.create(this,e)}readonly(){return hF.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let m4=/^c[^\s-]{8,}$/i,m3=/^[0-9a-z]+$/,m5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,m6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,m7=/^[a-z0-9_-]{21}$/i,m8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,he=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ht=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hr=/^(?:(?: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])$/,ha=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,hi=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,hn=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ho=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hl="((\\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])))",hc=RegExp(`^${hl}$`);function hu(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class hd extends m9{_parse(e){var t,r,a,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==mV.string){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.string,received:t.parsedType}),mW}let o=new mG;for(let s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(mK(n=this._getOrReturnCtx(e,n),{code:mH.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("max"===s.kind)e.data.length>s.value&&(mK(n=this._getOrReturnCtx(e,n),{code:mH.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("length"===s.kind){let t=e.data.length>s.value,r=e.data.length<s.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?mK(n,{code:mH.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&mK(n,{code:mH.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if("email"===s.kind)ht.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"email",code:mH.invalid_string,message:s.message}),o.dirty());else if("emoji"===s.kind)h||(h=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),h.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:mH.invalid_string,message:s.message}),o.dirty());else if("uuid"===s.kind)m6.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:mH.invalid_string,message:s.message}),o.dirty());else if("nanoid"===s.kind)m7.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:mH.invalid_string,message:s.message}),o.dirty());else if("cuid"===s.kind)m4.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:mH.invalid_string,message:s.message}),o.dirty());else if("cuid2"===s.kind)m3.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:mH.invalid_string,message:s.message}),o.dirty());else if("ulid"===s.kind)m5.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:mH.invalid_string,message:s.message}),o.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{mK(n=this._getOrReturnCtx(e,n),{validation:"url",code:mH.invalid_string,message:s.message}),o.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"regex",code:mH.invalid_string,message:s.message}),o.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):"datetime"===s.kind?(function(e){let t=`${hl}T${hu(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(s).test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:"datetime",message:s.message}),o.dirty()):"date"===s.kind?hc.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:"date",message:s.message}),o.dirty()):"time"===s.kind?RegExp(`^${hu(s)}$`).test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{code:mH.invalid_string,validation:"time",message:s.message}),o.dirty()):"duration"===s.kind?he.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"duration",code:mH.invalid_string,message:s.message}),o.dirty()):"ip"===s.kind?(t=e.data,!(("v4"===(r=s.version)||!r)&&hr.test(t)||("v6"===r||!r)&&hi.test(t))&&1&&(mK(n=this._getOrReturnCtx(e,n),{validation:"ip",code:mH.invalid_string,message:s.message}),o.dirty())):"jwt"===s.kind?!function(e,t){if(!m8.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,s.alg)&&(mK(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:mH.invalid_string,message:s.message}),o.dirty()):"cidr"===s.kind?(a=e.data,!(("v4"===(i=s.version)||!i)&&ha.test(a)||("v6"===i||!i)&&hn.test(a))&&1&&(mK(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:mH.invalid_string,message:s.message}),o.dirty())):"base64"===s.kind?ho.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"base64",code:mH.invalid_string,message:s.message}),o.dirty()):"base64url"===s.kind?hs.test(e.data)||(mK(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:mH.invalid_string,message:s.message}),o.dirty()):q.assertNever(s);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:mH.invalid_string,...z.errToObj(r)})}_addCheck(e){return new hd({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new hd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hd({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}hd.create=e=>new hd({checks:[],typeName:M.ZodString,coerce:e?.coerce??!1,...m2(e)});class hp extends m9{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==mV.number){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.number,received:t.parsedType}),mW}let r=new mG;for(let a of this._def.checks)"int"===a.kind?q.isInteger(e.data)||(mK(t=this._getOrReturnCtx(e,t),{code:mH.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,a.value)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(mK(t=this._getOrReturnCtx(e,t),{code:mH.not_finite,message:a.message}),r.dirty()):q.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,r,a){return new hp({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:z.toString(a)}]})}_addCheck(e){return new hp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&q.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}hp.create=e=>new hp({checks:[],typeName:M.ZodNumber,coerce:e?.coerce||!1,...m2(e)});class hm extends m9{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==mV.bigint)return this._getInvalidInput(e);let r=new mG;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):q.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.bigint,received:t.parsedType}),mW}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,r,a){return new hm({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:z.toString(a)}]})}_addCheck(e){return new hm({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}hm.create=e=>new hm({checks:[],typeName:M.ZodBigInt,coerce:e?.coerce??!1,...m2(e)});class hh extends m9{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==mV.boolean){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.boolean,received:t.parsedType}),mW}return mX(e.data)}}hh.create=e=>new hh({typeName:M.ZodBoolean,coerce:e?.coerce||!1,...m2(e)});class hf extends m9{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==mV.date){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.date,received:t.parsedType}),mW}if(Number.isNaN(e.data.getTime()))return mK(this._getOrReturnCtx(e),{code:mH.invalid_date}),mW;let r=new mG;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(mK(t=this._getOrReturnCtx(e,t),{code:mH.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):q.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hf({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}hf.create=e=>new hf({checks:[],coerce:e?.coerce||!1,typeName:M.ZodDate,...m2(e)});class hg extends m9{_parse(e){if(this._getType(e)!==mV.symbol){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.symbol,received:t.parsedType}),mW}return mX(e.data)}}hg.create=e=>new hg({typeName:M.ZodSymbol,...m2(e)});class hy extends m9{_parse(e){if(this._getType(e)!==mV.undefined){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.undefined,received:t.parsedType}),mW}return mX(e.data)}}hy.create=e=>new hy({typeName:M.ZodUndefined,...m2(e)});class hv extends m9{_parse(e){if(this._getType(e)!==mV.null){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.null,received:t.parsedType}),mW}return mX(e.data)}}hv.create=e=>new hv({typeName:M.ZodNull,...m2(e)});class h_ extends m9{constructor(){super(...arguments),this._any=!0}_parse(e){return mX(e.data)}}h_.create=e=>new h_({typeName:M.ZodAny,...m2(e)});class hb extends m9{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mX(e.data)}}hb.create=e=>new hb({typeName:M.ZodUnknown,...m2(e)});class hS extends m9{_parse(e){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.never,received:t.parsedType}),mW}}hS.create=e=>new hS({typeName:M.ZodNever,...m2(e)});class h$ extends m9{_parse(e){if(this._getType(e)!==mV.undefined){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.void,received:t.parsedType}),mW}return mX(e.data)}}h$.create=e=>new h$({typeName:M.ZodVoid,...m2(e)});class hw extends m9{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==mV.array)return mK(t,{code:mH.invalid_type,expected:mV.array,received:t.parsedType}),mW;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(mK(t,{code:e?mH.too_big:mH.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(mK(t,{code:mH.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(mK(t,{code:mH.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new m0(t,e,t.path,r)))).then(e=>mG.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new m0(t,e,t.path,r)));return mG.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new hw({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new hw({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new hw({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}}hw.create=(e,t)=>new hw({type:e,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...m2(t)});class hR extends m9{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=q.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==mV.object){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.object,received:t.parsedType}),mW}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof hS&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let o=[];for(let e of i){let t=a[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new m0(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof hS){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(mK(r,{code:mH.unrecognized_keys,keys:n}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of n){let a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new m0(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>mG.mergeObjectSync(t,e)):mG.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new hR({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:z.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new hR({...this._def,unknownKeys:"strip"})}passthrough(){return new hR({...this._def,unknownKeys:"passthrough"})}extend(e){return new hR({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new hR({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new hR({...this._def,catchall:e})}pick(e){let t={};for(let r of q.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new hR({...this._def,shape:()=>t})}omit(e){let t={};for(let r of q.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new hR({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof hR){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=hz.create(e(i))}return new hR({...t._def,shape:()=>r})}if(t instanceof hw)return new hw({...t._def,type:e(t.element)});if(t instanceof hz)return hz.create(e(t.unwrap()));if(t instanceof hM)return hM.create(e(t.unwrap()));if(t instanceof hP)return hP.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of q.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new hR({...this._def,shape:()=>t})}required(e){let t={};for(let r of q.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof hz;)e=e._def.innerType;t[r]=e}return new hR({...this._def,shape:()=>t})}keyof(){return hC(q.objectKeys(this.shape))}}hR.create=(e,t)=>new hR({shape:()=>e,unknownKeys:"strip",catchall:hS.create(),typeName:M.ZodObject,...m2(t)}),hR.strictCreate=(e,t)=>new hR({shape:()=>e,unknownKeys:"strict",catchall:hS.create(),typeName:M.ZodObject,...m2(t)}),hR.lazycreate=(e,t)=>new hR({shape:e,unknownKeys:"strip",catchall:hS.create(),typeName:M.ZodObject,...m2(t)});class hk extends m9{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new mJ(e.ctx.common.issues));return mK(t,{code:mH.invalid_union,unionErrors:r}),mW});{let e,a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new mJ(e));return mK(t,{code:mH.invalid_union,unionErrors:i}),mW}}get options(){return this._def.options}}hk.create=(e,t)=>new hk({options:e,typeName:M.ZodUnion,...m2(t)});class hx extends m9{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return mW;let i=function e(t,r){let a=mF(t),i=mF(r);if(t===r)return{valid:!0,data:t};if(a===mV.object&&i===mV.object){let a=q.objectKeys(r),i=q.objectKeys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of(Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__,i)){if("__proto__"===a)continue;let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};n[a]=i.data}return{valid:!0,data:n}}if(a===mV.array&&i===mV.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}if(a===mV.date&&i===mV.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(mK(r,{code:mH.invalid_intersection_types}),mW)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}hx.create=(e,t,r)=>new hx({left:e,right:t,typeName:M.ZodIntersection,...m2(r)});class hP extends m9{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==mV.array)return mK(r,{code:mH.invalid_type,expected:mV.array,received:r.parsedType}),mW;if(r.data.length<this._def.items.length)return mK(r,{code:mH.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mW;!this._def.rest&&r.data.length>this._def.items.length&&(mK(r,{code:mH.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new m0(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>mG.mergeArray(t,e)):mG.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new hP({...this._def,rest:e})}}hP.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new hP({items:e,typeName:M.ZodTuple,rest:null,...m2(t)})};class hE extends m9{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==mV.map)return mK(r,{code:mH.invalid_type,expected:mV.map,received:r.parsedType}),mW;let a=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new m0(r,e,r.path,[n,"key"])),value:i._parse(new m0(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return mW;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return mW;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}hE.create=(e,t,r)=>new hE({valueType:t,keyType:e,typeName:M.ZodMap,...m2(r)});class hT extends m9{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==mV.set)return mK(r,{code:mH.invalid_type,expected:mV.set,received:r.parsedType}),mW;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(mK(r,{code:mH.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(mK(r,{code:mH.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let a of e){if("aborted"===a.status)return mW;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new m0(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>n(e)):n(o)}min(e,t){return new hT({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new hT({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}hT.create=(e,t)=>new hT({valueType:e,minSize:null,maxSize:null,typeName:M.ZodSet,...m2(t)});class hj extends m9{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}hj.create=(e,t)=>new hj({getter:e,typeName:M.ZodLazy,...m2(t)});class hO extends m9{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return mK(t,{received:t.data,code:mH.invalid_literal,expected:this._def.value}),mW}return{status:"valid",value:e.data}}get value(){return this._def.value}}function hC(e,t){return new hI({values:e,typeName:M.ZodEnum,...m2(t)})}hO.create=(e,t)=>new hO({value:e,typeName:M.ZodLiteral,...m2(t)});class hI extends m9{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return mK(t,{expected:q.joinValues(r),received:t.parsedType,code:mH.invalid_type}),mW}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return mK(t,{received:t.data,code:mH.invalid_enum_value,options:r}),mW}return mX(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return hI.create(e,{...this._def,...t})}exclude(e,t=this._def){return hI.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}hI.create=hC;class hN extends m9{_parse(e){let t=q.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==mV.string&&r.parsedType!==mV.number){let e=q.objectValues(t);return mK(r,{expected:q.joinValues(e),received:r.parsedType,code:mH.invalid_type}),mW}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=q.objectValues(t);return mK(r,{received:r.data,code:mH.invalid_enum_value,options:e}),mW}return mX(e.data)}get enum(){return this._def.values}}hN.create=(e,t)=>new hN({values:e,typeName:M.ZodNativeEnum,...m2(t)});class hq extends m9{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==mV.promise&&!1===t.common.async?(mK(t,{code:mH.invalid_type,expected:mV.promise,received:t.parsedType}),mW):mX((t.parsedType===mV.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}hq.create=(e,t)=>new hq({type:e,typeName:M.ZodPromise,...m2(t)});class hA extends m9{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{mK(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return mW;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?mW:"dirty"===a.status||"dirty"===t.value?mY(a.value):a});{if("aborted"===t.value)return mW;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?mW:"dirty"===a.status||"dirty"===t.value?mY(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?mW:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?mW:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?mW:Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return mW;let n=a.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}q.assertNever(a)}}hA.create=(e,t,r)=>new hA({schema:e,typeName:M.ZodEffects,effect:t,...m2(r)}),hA.createWithPreprocess=(e,t,r)=>new hA({schema:t,effect:{type:"preprocess",transform:e},typeName:M.ZodEffects,...m2(r)});class hz extends m9{_parse(e){return this._getType(e)===mV.undefined?mX(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hz.create=(e,t)=>new hz({innerType:e,typeName:M.ZodOptional,...m2(t)});class hM extends m9{_parse(e){return this._getType(e)===mV.null?mX(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hM.create=(e,t)=>new hM({innerType:e,typeName:M.ZodNullable,...m2(t)});class hL extends m9{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===mV.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}hL.create=(e,t)=>new hL({innerType:e,typeName:M.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...m2(t)});class hZ extends m9{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return mQ(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new mJ(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new mJ(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hZ.create=(e,t)=>new hZ({innerType:e,typeName:M.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...m2(t)});class hD extends m9{_parse(e){if(this._getType(e)!==mV.nan){let t=this._getOrReturnCtx(e);return mK(t,{code:mH.invalid_type,expected:mV.nan,received:t.parsedType}),mW}return{status:"valid",value:e.data}}}hD.create=e=>new hD({typeName:M.ZodNaN,...m2(e)}),Symbol("zod_brand");class hU extends m9{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class hV extends m9{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?mW:"dirty"===e.status?(t.dirty(),mY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?mW:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new hV({in:e,out:t,typeName:M.ZodPipeline})}}class hF extends m9{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return mQ(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}hF.create=(e,t)=>new hF({innerType:e,typeName:M.ZodReadonly,...m2(t)}),hR.lazycreate,(O=M||(M={})).ZodString="ZodString",O.ZodNumber="ZodNumber",O.ZodNaN="ZodNaN",O.ZodBigInt="ZodBigInt",O.ZodBoolean="ZodBoolean",O.ZodDate="ZodDate",O.ZodSymbol="ZodSymbol",O.ZodUndefined="ZodUndefined",O.ZodNull="ZodNull",O.ZodAny="ZodAny",O.ZodUnknown="ZodUnknown",O.ZodNever="ZodNever",O.ZodVoid="ZodVoid",O.ZodArray="ZodArray",O.ZodObject="ZodObject",O.ZodUnion="ZodUnion",O.ZodDiscriminatedUnion="ZodDiscriminatedUnion",O.ZodIntersection="ZodIntersection",O.ZodTuple="ZodTuple",O.ZodRecord="ZodRecord",O.ZodMap="ZodMap",O.ZodSet="ZodSet",O.ZodFunction="ZodFunction",O.ZodLazy="ZodLazy",O.ZodLiteral="ZodLiteral",O.ZodEnum="ZodEnum",O.ZodEffects="ZodEffects",O.ZodNativeEnum="ZodNativeEnum",O.ZodOptional="ZodOptional",O.ZodNullable="ZodNullable",O.ZodDefault="ZodDefault",O.ZodCatch="ZodCatch",O.ZodPromise="ZodPromise",O.ZodBranded="ZodBranded",O.ZodPipeline="ZodPipeline",O.ZodReadonly="ZodReadonly";let hH=hd.create;hp.create,hD.create,hm.create,hh.create,hf.create,hg.create,hy.create,hv.create,h_.create,hb.create,hS.create,h$.create,hw.create;let hJ=hR.create;hR.strictCreate,hk.create,hx.create,hP.create,hE.create,hT.create,hj.create,hO.create,hI.create,hN.create,hq.create,hA.create,hz.create,hM.create,hA.createWithPreprocess,hV.create;let hB=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function hK(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?hB(t,e.currentPath):t.join("/")}}function hG(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function hW(e,t,r,a,i){e[t]=r,hG(e,t,a,i)}function hY(e,t){return fl(e.type._def,t)}let hX=/^[cC][^\s-]{8,}$/,hQ=/^[0-9a-z]+$/,h0=/^[0-9A-HJKMNP-TV-Z]{26}$/,h1=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,h2=()=>(void 0===w&&(w=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),w),h9=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,h4=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,h5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,h6=/^[a-zA-Z0-9_-]{21}$/,h7=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function h8(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":hW(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":hW(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":fr(r,"email",a.message,t);break;case"format:idn-email":fr(r,"idn-email",a.message,t);break;case"pattern:zod":fa(r,h1,a.message,t)}break;case"url":fr(r,"uri",a.message,t);break;case"uuid":fr(r,"uuid",a.message,t);break;case"regex":fa(r,a.regex,a.message,t);break;case"cuid":fa(r,hX,a.message,t);break;case"cuid2":fa(r,hQ,a.message,t);break;case"startsWith":fa(r,RegExp(`^${fe(a.value,t)}`),a.message,t);break;case"endsWith":fa(r,RegExp(`${fe(a.value,t)}$`),a.message,t);break;case"datetime":fr(r,"date-time",a.message,t);break;case"date":fr(r,"date",a.message,t);break;case"time":fr(r,"time",a.message,t);break;case"duration":fr(r,"duration",a.message,t);break;case"length":hW(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),hW(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":fa(r,RegExp(fe(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&fr(r,"ipv4",a.message,t),"v4"!==a.version&&fr(r,"ipv6",a.message,t);break;case"base64url":fa(r,h5,a.message,t);break;case"jwt":fa(r,h7,a.message,t);break;case"cidr":"v6"!==a.version&&fa(r,h9,a.message,t),"v4"!==a.version&&fa(r,h4,a.message,t);break;case"emoji":fa(r,h2(),a.message,t);break;case"ulid":fa(r,h0,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":fr(r,"binary",a.message,t);break;case"contentEncoding:base64":hW(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":fa(r,h3,a.message,t)}break;case"nanoid":fa(r,h6,a.message,t)}return r}function fe(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)ft.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let ft=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fr(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):hW(e,"format",t,r,a)}function fa(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:fi(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):hW(e,"pattern",fi(t,a),r,a)}function fi(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,i="",n=!1,o=!1,s=!1;for(let e=0;e<a.length;e++){if(n){i+=a[e],n=!1;continue}if(r.i){if(o){if(a[e].match(/[a-z]/)){s?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),s=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],s=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){i+=`(^|(?<=[\r
|
|
78
|
+
]))`;continue}else if("$"===a[e]){i+=`($|(?=[\r
|
|
79
|
+
]))`;continue}}if(r.s&&"."===a[e]){i+=o?`${a[e]}\r
|
|
80
|
+
`:`[${a[e]}\r
|
|
81
|
+
]`;continue}i+=a[e],"\\"===a[e]?n=!0:o&&"]"===a[e]?o=!1:o||"["!==a[e]||(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function fn(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:fl(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??hK(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:fl(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===M.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=h8(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===M.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===M.ZodBranded&&e.keyType._def.type._def.typeName===M.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=hY(e.keyType._def,t);return{...r,propertyNames:i}}return r}let fo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},fs=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>fl(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function fl(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==mD)return i}if(a&&!r){let e=fc(a,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let n=((e,t,r)=>{switch(t){case M.ZodString:return h8(e,r);case M.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",hG(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?hW(a,"minimum",t.value,t.message,r):hW(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),hW(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?hW(a,"maximum",t.value,t.message,r):hW(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),hW(a,"maximum",t.value,t.message,r));break;case"multipleOf":hW(a,"multipleOf",t.value,t.message,r)}return a;case M.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],n=e.shape();for(let e in n){let o=n[e];if(void 0===o||void 0===o._def)continue;let s=function(e){try{return e.isOptional()}catch{return!0}}(o);s&&r&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let l=fl(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,s||i.push(e))}i.length&&(a.required=i);let o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return fl(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(a.additionalProperties=o),a}(e,r);case M.ZodBigInt:let i={type:"integer",format:"int64"};if(!e.checks)return i;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?hW(i,"minimum",t.value,t.message,r):hW(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),hW(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?hW(i,"maximum",t.value,t.message,r):hW(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),hW(i,"maximum",t.value,t.message,r));break;case"multipleOf":hW(i,"multipleOf",t.value,t.message,r)}return i;case M.ZodBoolean:return{type:"boolean"};case M.ZodDate:return function e(t,r,a){let i=a??r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((a,i)=>e(t,r,a))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var n=t,o=r;let s={type:"integer",format:"unix-time"};if("openApi3"===o.target)return s;for(let e of n.checks)switch(e.kind){case"min":hW(s,"minimum",e.value,e.message,o);break;case"max":hW(s,"maximum",e.value,e.message,o)}return s}}(e,r);case M.ZodUndefined:return{not:hK(r)};case M.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case M.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==M.ZodAny&&(n.items=fl(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&hW(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&hW(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(hW(n,"minItems",e.exactLength.value,e.exactLength.message,r),hW(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case M.ZodUnion:case M.ZodDiscriminatedUnion:if("openApi3"===r.target)return fs(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in fo&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=fo[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return fs(e,r);case M.ZodIntersection:let s,l,c;return s=[fl(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),fl(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,c=[],s.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)c.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;c.push(t)}}),c.length?{allOf:c,...l}:void 0;case M.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>fl(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:fl(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>fl(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case M.ZodRecord:return fn(e,r);case M.ZodLiteral:let u;return"bigint"!=(u=typeof e.value)&&"number"!==u&&"boolean"!==u&&"string"!==u?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===u?"integer":u,enum:[e.value]}:{type:"bigint"===u?"integer":u,const:e.value};case M.ZodEnum:return{type:"string",enum:Array.from(e.values)};case M.ZodNativeEnum:let d,p,m;return d=e.values,{type:1===(m=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof d[d[e]]).map(e=>d[e])).map(e=>typeof e)))).length?"string"===m[0]?"string":"number":["string","number"],enum:p};case M.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:fo[e.innerType._def.typeName],nullable:!0}:{type:[fo[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=fl(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=fl(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case M.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return fl(e.innerType._def,r);let f=fl(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:hK(r)},f]}:hK(r);case M.ZodMap:if("record"===r.mapStrategy)return fn(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[fl(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||hK(r),fl(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||hK(r)],minItems:2,maxItems:2}};case M.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:fl(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&hW(g,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&hW(g,"maxItems",e.maxSize.value,e.maxSize.message,r),g;case M.ZodLazy:return()=>e.getter()._def;case M.ZodPromise:return fl(e.type._def,r);case M.ZodNaN:case M.ZodNever:return"openAi"===r.target?void 0:{not:hK({...r,currentPath:[...r.currentPath,"not"]})};case M.ZodEffects:return"input"===r.effectStrategy?fl(e.schema._def,r):hK(r);case M.ZodAny:case M.ZodUnknown:return hK(r);case M.ZodDefault:return{...fl(e.innerType._def,r),default:e.defaultValue()};case M.ZodBranded:return hY(e,r);case M.ZodReadonly:case M.ZodCatch:return fl(e.innerType._def,r);case M.ZodPipeline:if("input"===r.pipeStrategy)return fl(e.in._def,r);if("output"===r.pipeStrategy)return fl(e.out._def,r);let y=fl(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=fl(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",y?"1":"0"]});return{allOf:[y,v].filter(e=>void 0!==e)};case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?fl(n(),t):n;if(o&&fu(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}let fc=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:hB(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),hK(t);return"seen"===t.$refStrategy?hK(t):void 0}},fu=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function fd(e,t={}){let{strict:r=!1}=t,a=Object.entries(e),i=e=>({target:t})=>{let i={},n=[];for(let[r,o]of a)i[r]=function(e,t,r){let a=e["~standard"];if(a.jsonSchema)return a.jsonSchema[r]({target:t});if("zod"===e["~standard"].vendor&&!("_zod"in e)&&"_def"in e){let r=((e,t)=>{let r,a,i=(a=void 0!==(r="string"==typeof t?{...mU,name:t}:{...mU,...t}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,{...r,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(r.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...r.basePath,r.definitionPath,e],jsonSchema:void 0}]))}),n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:fl(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??hK(i)}),{}):void 0,o="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,s=fl(e._def,void 0===o?i:{...i,currentPath:[...i.basePath,i.definitionPath,o]},!1)??hK(i),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(s.title=l),i.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[i.openAiAnyTypeName]||(n[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let c=void 0===o?n?{...s,[i.definitionPath]:n}:s:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,o].join("/"),[i.definitionPath]:{...n,[o]:s}};return"jsonSchema7"===i.target?c.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c})(e,{$refStrategy:"none",target:"openapi-3.0"===t?"openApi3":"jsonSchema7"});return delete r.$schema,r}if("zod"===a.vendor&&"_zod"in e)try{let t=a8(e);return delete t.$schema,t}catch(e){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${e instanceof Error?e.message:String(e)}`)}throw Error(`Schema library "${a.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(o,t,e),!function(e,t){if("function"!=typeof e.safeParse)return!1;try{let r=e.safeParse(void 0);return r.success&&("input"===t||void 0===r.data)}catch{return!1}}(o,e)&&n.push(r);let o={type:"object",properties:i};return n.length>0&&(o.required=n),r&&(o.additionalProperties=!1),o};return{shape:e,"~standard":{version:1,vendor:"xmcp",validate:async t=>{if("object"!=typeof t||null===t||Array.isArray(t))return{issues:[{message:"Expected an object."}]};let i={},n=[];for(let[e,r]of a){let a=await r["~standard"].validate(t[e]);if(a.issues)for(let t of a.issues)n.push({message:t.message,path:[e,...t.path??[]]});else(e in t||void 0!==a.value)&&(i[e]=a.value)}if(r)for(let r of Object.keys(t))r in e||n.push({message:`Unrecognized key: "${r}"`,path:[r]});return n.length>0?{issues:n}:{value:i}},jsonSchema:{input:i("input"),output:i("output")}}}}function fp(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[i,n]of Object.entries(r)){let r=a?`${a}/${i}`:i;!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp?t[r]=n:e(n,r)}}(e),t}let fm=["ui/resourceUri","resourceUri","visibility"],fh=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function ff(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function fg(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function fy(e,t,r){return e.names?.includes(t)===!0||e.tags?.some(e=>r.includes(e))===!0}function fv(e,t){return t?new Map([...e].filter(([e,{metadata:r}])=>{if(r?.enabled===!1)return!1;let a=r?.name??fg(e),i=r?.tags??[];return(!t.include||fy(t.include,a,i))&&(!t.exclude||!fy(t.exclude,a,i))})):e}function f_(e){return Error(`[xmcp] Invalid prompt file: ${e}
|
|
82
|
+
-> Default export must be a prompt handler function.`)}let fb=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load prompt file: ${t}
|
|
83
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function fS(e){return Error(`[xmcp] Invalid resource file: ${e}
|
|
84
|
+
-> Default export must be a resource handler function.`)}let f$=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load resource file: ${t}
|
|
85
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function fw(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}function fR(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let i=t[r].slice(1,-1),n=t.slice(r+1),o=n[n.length-1];if(o&&o.includes(".")){let e=o.split(".")[0];"index"!==e?n[n.length-1]=e:n.pop()}let s=[],l=[],c=n.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return s.push(t),`{${t}}`}}),u=`${i}://${c.join("/")}`,d=s.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:i,parameters:s,pathSegments:l,type:d}}let fk={ttlMs:0,cacheScope:"private"},fx=hJ({cursor:hH().optional()}).passthrough().optional(),fP=hJ({uri:hH()}).passthrough();function fE({uri:e,frontmatter:t,files:r}){return{uri:e,frontmatter:t,resources:r.map(({uri:e,digest:t,size:r})=>({uri:e,digest:t,size:r}))}}function fT(e){return Error(`[xmcp] Invalid tool file: ${e}
|
|
86
|
+
-> Default export must be a tool handler function.`)}let fj=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load tool file: ${t}
|
|
87
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),fO=INJECTED_TOOLS,fC=INJECTED_PROMPTS,fI=INJECTED_RESOURCES,fN="u"<typeof INJECTED_SKILLS?[]:INJECTED_SKILLS??[],fq=SERVER_INFO,fA={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*","Access-Control-Max-Age":"86400"};function fz(e,t,r,a,i){let n=new URL(e.url).origin,o=`${n}/.well-known/oauth-protected-resource`;return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:i,message:r},id:null}),{status:a,headers:{"WWW-Authenticate":`Bearer error="${t}", error_description="${r}", resource_metadata="${o}"`,"Content-Type":"application/json"}})}function fM(e,t){return async r=>{var a,i;let n,{verifyToken:o,required:s=!1,requiredScopes:l}=t,c=function(e){let t=e.headers.get("Authorization"),[r,a]=t?.split(" ")||[];return r?.toLowerCase()==="bearer"?a:void 0}(r);try{n=await o(r,c)}catch(e){return console.error("[MCP Auth] Error verifying token:",e),fz(r,"invalid_token","Invalid token",401,-32001)}return s&&!n?fz(r,"invalid_token","No authorization provided",401,-32001):n?void 0!==(a=n).expiresAt&&a.expiresAt<Date.now()/1e3?fz(r,"invalid_token","Token has expired",401,-32001):l?.length&&(i=n,!l.every(e=>i.scopes.includes(e)))?fz(r,"insufficient_scope","Insufficient scope",403,-32002):(r.auth=n,e(r)):e(r)}}function fL(e){return t=>{let r;return new Response(JSON.stringify({resource:((r=new URL(t.url)).pathname=r.pathname.replace(/^\/\.well-known\/[^\/]+/,""),"/"===r.pathname?r.toString().replace(/\/$/,""):r.toString()),authorization_servers:e.authorizationServers}),{headers:{...fA,"Cache-Control":"max-age=3600","Content-Type":"application/json"}})}}function fZ(e){return new Response(null,{status:200,headers:fA})}let fD=function(e,t={}){var r;let{legacy:a,onerror:i,responseMode:n}=t,o=pY(t.maxRequestBodySize);if("function"==typeof a)throw 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,l=!1,u=e=>{try{i?.(e)}catch{}},h=t.bus??new pB(u),f={toolsChanged:()=>h.publish({kind:"tools_list_changed"}),promptsChanged:()=>h.publish({kind:"prompts_list_changed"}),resourcesChanged:()=>h.publish({kind:"resources_list_changed"}),resourceUpdated:e=>h.publish({kind:"resource_updated",uri:e})},g=function(e){let{bus:t,onerror:r}=e,a=e.maxSubscriptions??1024,i=e.keepAliveMs??15e3,n=new Set;return{serve:function(e,o,s,l){let c,u,d,p,m,h,f;if(n.size>=a)return r?.(Error(`subscriptions/listen refused: subscription limit reached (${a})`)),pK(e.id,-32603,"Subscription limit reached");let g=(m=cq(cN).validateRequest("subscriptions/listen",e)).ok?m.value.params?.notifications:void 0;if(void 0===g)return pK(e.id,-32602,"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");let y=(h={},f=e=>void 0===s||!0===e,!0===g.toolsListChanged&&f(s?.tools?.listChanged)&&(h.toolsListChanged=!0),!0===g.promptsListChanged&&f(s?.prompts?.listChanged)&&(h.promptsListChanged=!0),!0===g.resourcesListChanged&&f(s?.resources?.listChanged)&&(h.resourcesListChanged=!0),void 0!==g.resourceSubscriptions&&g.resourceSubscriptions.length>0&&f(s?.resources?.subscribe)&&(h.resourceSubscriptions=[...g.resourceSubscriptions]),h),v=e.id,_=new TextEncoder,b=!1,S=e=>{if(!b)try{c.enqueue(_.encode(e))}catch(e){r?.(e instanceof Error?e:Error(String(e)))}},$=(e,t)=>{S(`event: message
|
|
88
|
+
data: ${JSON.stringify({jsonrpc:"2.0",method:e,params:t})}
|
|
89
|
+
|
|
90
|
+
`)},w=e=>{if(!b){e&&S(`event: message
|
|
91
|
+
data: ${JSON.stringify({jsonrpc:"2.0",id:v,result:{resultType:"complete",_meta:{[nG]:v,[nB]:l}}})}
|
|
92
|
+
|
|
93
|
+
`),b=!0;try{u?.()}catch(e){r?.(e instanceof Error?e:Error(String(e)))}void 0!==d&&clearInterval(d),p?.(),n.delete(w);try{c.close()}catch{}}},R=new ReadableStream({start(e){c=e;let r=pG({method:"notifications/subscriptions/acknowledged",params:{notifications:y}},v);($(r.method,r.params),0===Object.keys(y).length)?w(!0):(u=t.subscribe(e=>{if(b||!function(e,t){switch(t.kind){case"tools_list_changed":return!0===e.toolsListChanged;case"prompts_list_changed":return!0===e.promptsListChanged;case"resources_list_changed":return!0===e.resourcesListChanged;case"resource_updated":return void 0!==e.resourceSubscriptions&&e.resourceSubscriptions.includes(t.uri)}}(y,e))return;let t=pG(function(e){switch(e.kind){case"tools_list_changed":return{method:"notifications/tools/list_changed",...void 0!==e.params&&{params:e.params}};case"prompts_list_changed":return{method:"notifications/prompts/list_changed",...void 0!==e.params&&{params:e.params}};case"resources_list_changed":return{method:"notifications/resources/list_changed",...void 0!==e.params&&{params:e.params}};case"resource_updated":return{method:"notifications/resources/updated",params:{...e.params,uri:e.uri}}}}(e),v);$(t.method,t.params)}),d=pk(i,()=>S(": keepalive\n\n")),n.add(w))},cancel(){w(!1)}});if(void 0!==o)if(o.aborted)w(!1);else{let e=()=>w(!1);o.addEventListener("abort",e,{once:!0}),p=()=>o.removeEventListener("abort",e)}return new Response(R,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let e of n)e(!0)},get openCount(){return n.size}}}({bus:h,maxSubscriptions:t.maxSubscriptions??1024,keepAliveMs:t.keepAliveMs??15e3,onerror:u});"json"===n&&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 y="reject"===a?void 0:(r=t.keepAliveMs,async(t,a)=>{if("POST"!==t.method.toUpperCase())return p1(405,-32e3,"Method not allowed.");try{let i=await e({era:"legacy",...a?.authInfo!==void 0&&{authInfo:a.authInfo},requestInfo:t}),n=new pQ({sessionIdGenerator:void 0,...void 0!==r&&{keepAliveMs:r},...void 0!==o&&{maxRequestBodySize:o}});await i.connect(n);let s=()=>{n.close().catch(()=>{}),i.close().catch(()=>{})};t.signal?.addEventListener("abort",s,{once:!0});let l=await n.handleRequest(t,{...a?.authInfo!==void 0&&{authInfo:a.authInfo},...a?.parsedBody!==void 0&&{parsedBody:a.parsedBody}});if(null===l.body||"text/event-stream"!==uq(l.headers.get("content-type")))return s(),l;let c=l.body.getReader(),u=!1,d=()=>{u||(u=!0,s())},p=new ReadableStream({pull:async e=>{try{let{done:t,value:r}=await c.read();if(t){d(),e.close();return}void 0!==r&&e.enqueue(r)}catch(t){d(),e.error(t)}},cancel:e=>(d(),c.cancel(e).catch(()=>{}))});return new Response(p,{status:l.status,statusText:l.statusText,headers:l.headers})}catch(e){try{u?.(p9(e))}catch{}return p4(p0(a?.parsedBody))}});return{fetch:async(r,a)=>{if(l)throw Error("This MCP handler has been closed");try{return await async function(r,a){let i=a?.authInfo;if("POST"===r.method.toUpperCase()&&!uA(r.headers.get("content-type")))return u(Error("Unsupported Media Type: Content-Type must be application/json")),p1(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let l=await async function(e,t,r=!0,a=4194304){let i,n=e.method.toUpperCase(),o=t,s=e,l=!1;if("POST"===n){if(void 0===o){let t;r&&(s=e.clone());try{let r=await pX(e,a);if(r.tooLarge)return{step:"body-too-large"};t=r.text}catch{return{step:"unreadable-body"}}try{i=0===t.length?void 0:JSON.parse(t)}catch{l=!0}l||void 0===i||(o=i)}else i=o;if(l||void 0===i)return{step:"no-json-body",forwardRequest:s}}return{step:"classified",outcome:function(e){if("POST"!==(e={...e,...void 0!==e.protocolVersionHeader&&{protocolVersionHeader:ui(e.protocolVersionHeader)},...void 0!==e.mcpMethodHeader&&{mcpMethodHeader:ui(e.mcpMethodHeader)},...void 0!==e.mcpNameHeader&&{mcpNameHeader:ui(e.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let t=e.body;if(Array.isArray(t)){if(0===t.length)return ut("jsonrpc-shape","empty-batch",400,new cf(ch.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let e of t){if(cV(un(e)?e.params:void 0))return ut("jsonrpc-shape","batch-with-modern-element",400,new cf(ch.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(cB(e)||cK(e)||cG(e)||cW(e)))return ut("jsonrpc-shape","batch-with-invalid-element",400,new cf(ch.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return cG(t)||cW(t)?{kind:"legacy",reason:"response"}:un(t)&&cB(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=lG;if("initialize"===a&&!function(e){if(!cV(e))return!1;let t=cF(e);if(void 0===t||!(t>=lG))return!1;let r=cU(e);return void 0!==r&&0===cH(r).length}(r)){if(n)return ur("initialize-with-modern-header",i,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let e=un(r)&&"string"==typeof r.protocolVersion?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==e&&{requestedVersion:e}}}if(cV(r)){let n=cU(r),o=(void 0===n?[]:cH(n))[0];if(void 0!==o)return ut("envelope","envelope-invalid",400,new cf(ch.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${o.key}: ${o.problem}`,{envelope:o}),!0);let s=cF(r);return void 0!==i&&void 0!==s&&i!==s?ur("header-body-version-mismatch",i,`the body envelope names protocol version ${s} but the MCP-Protocol-Version header names ${i}`):void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?ur("method-header-mismatch",e.mcpMethodHeader,`the body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:t,classification:uo(s)}}if(n){let e=cU(r),t=cH(e??{}).filter(e=>"missing"===e.problem).map(e=>e.key),a=void 0===e?["_meta"]:t.length>0?t:[nH];return ut("envelope","modern-header-without-claim",400,new cf(ch.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${a.join(", ")}`,{envelope:{missing:a}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==i&&{requestedVersion:i}}}(e,t):un(t)&&cK(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=lG;if(cV(r)){let n=cF(r);if(void 0===n){let e=cU(r),t=(void 0===e?[]:cH(e)).find(e=>e.key===nH)??{key:nH,problem:"expected a protocol version string"};return ut("envelope","notification-envelope-invalid",400,new cf(ch.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${t.key}: ${t.problem}`,{envelope:t}),!0)}if(void 0!==i&&i!==n)return ur("notification-header-body-version-mismatch",i,`the notification envelope names protocol version ${n} but the MCP-Protocol-Version header names ${i}`);let o=uo(n);return"modern"===o.era&&void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?ur("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:o}}return n?void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?ur("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:{era:"modern",revision:i}}:{kind:"legacy",reason:"notification",...void 0!==i&&{requestedVersion:i}}}(e,t):ut("jsonrpc-shape","invalid-json-rpc-body",400,new cf(ch.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:n,...p5(e),...void 0!==i&&{body:i}}),body:i,parsedBody:o,forwardRequest:s}}(r,a?.parsedBody,!0,o);if("unreadable-body"===l.step)return p1(400,-32700,"Parse error: the request body could not be read");if("body-too-large"===l.step)return p1(413,-32e3,pW(o));if("no-json-body"===l.step)return void 0!==y?y(l.forwardRequest,{...void 0!==i&&{authInfo:i}}):p1(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:h,body:f,parsedBody:v,forwardRequest:_}=l;try{switch(h.kind){case"reject":return u(Error(`Rejected inbound request (${h.cell}): ${h.message}`)),p2(h,p0(f));case"modern":return await async function(r,a,i){var o,l;let h=r.classification.revision;if(void 0===h||!lW.includes(h)){let e=new cv({supported:[...lW],requested:h??"unknown"});return u(e),p1(400,e.code,e.message,e.data,p0(r.message))}let f=function(e,t){if("request"!==t.messageKind)return;let r=t.message.method;if(void 0===e.protocolVersionHeader){let e=t.classification.revision;return ur("version-header-missing","(missing)",void 0===e?"the body carries a modern per-request envelope but the required MCP-Protocol-Version header is absent":`the body envelope names protocol version ${e} but the required MCP-Protocol-Version header is absent`,"standard-header-validation")}if(void 0===e.mcpMethodHeader)return ur("method-header-missing","(missing)",`the body names method ${r} but the required Mcp-Method header is absent`,"standard-header-validation");let a=function(e,t){let r=Object.hasOwn(ua,e)?ua[e]:void 0;if(void 0===r)return;let a=un(t)?t[r]:void 0;return{field:r,value:"string"==typeof a?a:void 0}}(r,t.message.params);if(void 0===a)return;let{field:i,value:n}=a;if(void 0===e.mcpNameHeader){if(void 0===n)return;return ur("name-header-missing","(missing)",`the body carries params.${i}="${n}" but the required Mcp-Name header is absent`,"standard-header-validation")}let o=ui(e.mcpNameHeader),s=c6(o);return void 0===s?ur("name-header-invalid-encoding",o,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==n&&s!==n?ur("name-header-mismatch",o,`the body carries params.${i}="${n}" but the Mcp-Name header names "${s}"`,"standard-header-validation"):void 0}({httpMethod:a.method,...p5(a)},r);if(void 0!==f)return u(Error(`Rejected inbound request (${f.cell}): ${f.message}`)),p2(f,p0(r.message));let y="request"===r.messageKind?cU(r.message.params):void 0,v=y?.[nK];if("request"===r.messageKind){let e=Object.hasOwn(lJ,o=r.message.method)?lJ[o]:void 0;if(void 0!==e){let t=lK(e,v);if(void 0!==t){let e=new c_({requiredCapabilities:t});return u(e),p1(ue[e.code]??400,e.code,e.message,e.data,r.message.id)}}}let _=await e({era:"modern",...void 0!==i&&{authInfo:i},requestInfo:a}),b=_ instanceof pz?_.server:_;if(p3(b),"request"===r.messageKind&&"subscriptions/listen"===r.message.method){let e=b.getCapabilities(),t=m(b);return _.close().catch(u),g.serve(r.message,a.signal,e,t)}if("request"===r.messageKind&&"tools/call"===r.message.method&&_ instanceof pz){let e=r.message.params,t="string"==typeof e?.name?e.name:void 0,i=void 0===t?void 0:_.toolInputSchemaJson(t);if(void 0!==i){let t=c1(i);if(void 0!==t.declarations&&t.declarations.length>0){let i=function(e,t,r){for(let a of e){let e=`Mcp-Param-${a.headerName}`,i=r.get(e),n=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,a.path);if(null==n)continue;let o=function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e){if(!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}(n);if(void 0===o)continue;if(null===i)return c7("param-header-missing",e,`the body carries ${c4(a.path)}=${JSON.stringify(n)} but the ${e} header is absent`);let s=c6(i);if(void 0===s)return c7("param-header-invalid-encoding",e,`the ${e} header carries an invalid Base64 sentinel value`);if(!(("integer"===a.type||"number"===a.type)&&c5.test(s)&&"number"==typeof n?Number(s)===n:s===o))return c7("param-header-mismatch",e,`the ${e} header decodes to ${JSON.stringify(s)} but the body carries ${c4(a.path)}=${JSON.stringify(n)}`)}}(t.declarations,e?.arguments,a.headers);if(void 0!==i)return _.close().catch(u),u(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),p2(i,r.message.id)}}}if("request"===r.messageKind&&_ instanceof pz)try{let e=await pT([r.message],i,e=>_.resolveScopeChallenge(e));if(void 0!==e)return _.close().catch(u),pO(e,pj(i))}catch(e){return _.close().catch(u),u(p9(e)),p4(r.message.id)}p3(b),c(b,h),p(b,lW),void 0!==y&&(l={clientInfo:y[nJ],clientCapabilities:v},d(b,l));let S=b.onclose;s.add(b);let $=()=>{s.delete(b),b.onclose===$&&(b.onclose=S),S?.()};b.onclose=$;try{let e=await async function(e,t,r){let a=new px({classification:r.classification,...void 0!==r.responseMode&&{responseMode:r.responseMode},...void 0!==r.keepAliveMs&&{keepAliveMs:r.keepAliveMs}});return await e.connect(a),a.handleMessage(t,{...void 0!==r.request&&{request:r.request},...void 0!==r.authInfo&&{authInfo:r.authInfo}})}(_,r.message,{classification:r.classification,request:a,...void 0!==i&&{authInfo:i},...void 0!==n&&{responseMode:n},...void 0!==t.keepAliveMs&&{keepAliveMs:t.keepAliveMs}});return"notification"===r.messageKind&&queueMicrotask(()=>void b.close().catch(()=>{})),e}catch(e){if(e instanceof lH&&e.code===lF.ConnectionClosed)return new Response(null,{status:499});return await b.close().catch(()=>{}),s.delete(b),u(p9(e)),p4(p0(r.message))}}(h,r,i);case"legacy":return await async function(e,t,r,a){if(void 0!==y)return y(t,{...void 0!==r&&{authInfo:r},...void 0!==a&&{parsedBody:a}});let i=function(e,t){switch(e.reason){case"http-method":return ut("http-method","modern-only-method-not-allowed",405,new cf(-32e3,"Method not allowed."),!0);case"batch":return ut("jsonrpc-shape","modern-only-batch-not-supported",400,new cf(ch.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return ut("jsonrpc-shape","modern-only-response-post",400,new cf(ch.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 ut("era-classification","modern-only-missing-envelope",400,void 0===r?new cf(ch.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new cv({supported:[...t],requested:r}),!0)}}}(e,lW);return void 0===i?new Response(null,{status:202}):(u(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),p2(i,p0(a)))}(h,_,i,v)}}catch(e){return u(p9(e)),p4(p0(f))}}(r,a)}catch(e){return u(p9(e)),p4(p0(a?.parsedBody))}},notify:f,bus:h,close:async()=>{l=!0,g.closeAll();let e=[...s].map(e=>e.close().catch(()=>{}));s.clear(),await Promise.all(e)}}}(async function(){let e=async function(){let{toolModules:e,skippedTools:t}=await async function(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw fT(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw fT(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default tool handler."}}:{skipped:!1,path:e,toolModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.toolModule)}return{toolModules:t,skippedTools:r}}(fO);return fj(t),e}(),t=async function(){let{promptModules:e,skippedPrompts:t}=await async function(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw f_(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw f_(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default prompt handler."}}:{skipped:!1,path:e,promptModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.promptModule)}return{promptModules:t,skippedPrompts:r}}(fC);return fb(t),e}(),a=async function(){let{resourceModules:e,skippedResources:t}=await async function(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw fS(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw fS(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default resource handler."}}:{skipped:!1,path:e,resourceModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.resourceModule)}return{resourceModules:t,skippedResources:r}}(fI);return f$(t),e}(),[i,n,o]=await Promise.all([e,t,a]),{instructions:s,...l}=fq,c=new pz(l,{instructions:s});return await async function(e,t,a,i){let n=await INJECTED_MIDDLEWARE?.(),o=function(e){if(void 0===e)return[];let t=Array.isArray(e)?[...e]:[e];if(!t.every(e=>"function"==typeof e))throw Error("src/middleware.ts must export mcp as a function or an array of functions");return t}(n?.mcp),s="u">typeof OBSERVABILITY_CONFIG&&OBSERVABILITY_CONFIG.enabled?function(e=e=>console.error(e)){let t=new Map,r=[];function a(t){try{e(JSON.stringify({"@timestamp":new Date().toISOString(),...t}))}catch{}}return{middleware:async(e,i)=>{let n,o,s;if("tools/call"!==e.method&&"prompts/get"!==e.method&&"resources/read"!==e.method)return i();try{o=performance.now(),n={log:{level:"info"},...function(e){let t=e.http?.headers.traceparent;if("string"!=typeof t)return{};let r=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/.exec(t);return!r||"ff"===r[1]||/^0+$/.test(r[2])||/^0+$/.test(r[3])||"00"===r[1]&&void 0!==r[5]?{}:{trace:{id:r[2]},parent:{id:r[3]}}}(e),transaction:{id:crypto.randomUUID()},...e.http?{http:{request:{id:e.http.id}}}:{},xmcp:{method:e.method,component:"resources/read"===e.method?function(e){try{let a=new URL(e).href;return t.get(a)??r.find(({template:e})=>e.uriTemplate.match(a))?.name??"unknown"}catch{return"unknown"}}(e.params.uri):e.params.name}}}catch{return i()}a({...n,event:{kind:"event",category:["api"],type:["start"],action:"execution.start"}});let l="unknown";try{let t=await i();try{l=e.signal.aborted?"cancelled":cY(t)?"input_required":"isError"in t&&!0===t.isError?"failure":"success","failure"===l&&(s={message:"Operation returned an error result"})}catch{}return t}catch(t){throw s={message:"cancelled"==(l=e.signal.aborted?"cancelled":"failure")?"Operation cancelled":"Operation threw an exception"},t}finally{try{a({...n,log:{level:"failure"===l?"error":"info"},event:{kind:"event",category:["api"],type:["end"],action:"execution.end",duration:Math.round((performance.now()-o)*1e6),outcome:"success"===l?"success":"failure"===l?"failure":"unknown"},xmcp:{...n.xmcp,status:l},...s?{error:s}:{}})}catch{}}},registerResource(e,a){try{"string"==typeof a?t.set(new URL(a).href,e):r.push({name:e,template:a})}catch{}}}}():void 0;s&&o.unshift(s.middleware),mu.clear();let l="u"<typeof COMPONENTS_CONFIG?void 0:COMPONENTS_CONFIG;return!function(e,t,r){let a=e.server,i=a.setRequestHandler,n=mM(t);a.setRequestHandler=(e,...t)=>{if(mL.has(e)&&1===t.length&&"function"==typeof t[0]){let e=t[0];t[0]=(t,r)=>n({method:t.method,params:t.params??{}},r,()=>e(t,r))}Reflect.apply(i,a,[e,...t])};try{r()}finally{a.setRequestHandler=i}}(e,o,()=>{var n,c;!function(e,t,r=[]){t.forEach((t,a)=>{var i,n;let o,s,l,c,u={name:fg(a),description:"No description provided"},{default:d,metadata:p,schema:m,outputSchema:h}=t;if("object"==typeof p&&null!==p&&Object.assign(u,p),!1===u.enabled)return;if("function"==typeof d&&"__x402"in d){let e=global.__XMCP_X402_REGISTRY;e&&e.set(u.name,d.__x402)}let f={};if(ff(m)?f=m:null!=m&&console.warn(`Invalid schema for tool "${u.name}" at ${a}. Expected Record<string, z.ZodType>`),null!=h)if(ff(h))o=h;else throw Error(`Invalid outputSchema for tool "${u.name}" at ${a}. Expected Record<string, z.ZodType>`);u.annotations={...u.annotations??{}},void 0===u.annotations.title&&(u.annotations.title=u.name),u._meta={...mc(u)._meta};let g=mZ(a),y=!!(i=u._meta)&&"object"==typeof i&&"ui"in i&&"object"==typeof i.ui||g,v=u._meta;if(y){let e=`ui://app/${u.name}.html`;u._meta.ui||(u._meta.ui={}),u._meta.ui.resourceUri||(u._meta.ui.resourceUri=e);let t=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,i={},n={};for(let[e,t]of Object.entries(a))fm.includes(e)?i[e]=t:fh.includes(e)?n[e]=t:i[e]=t;Object.keys(i).length>0&&(t.ui=i),Object.keys(n).length>0&&(r.ui=n)}for(let[r,a]of Object.entries(e))"ui"!==r&&(t[r]=a);return{toolMeta:t,resourceMeta:r}}(v);v=t.toolMeta;let r=t.resourceMeta;r.ui=r.ui||{},r.ui.csp=r.ui.csp||{},r.ui.csp.resourceDomains=r.ui.csp.resourceDomains||[],r.ui.csp.resourceDomains.includes("https://esm.sh")||r.ui.csp.resourceDomains.push("https://esm.sh"),mu.add(u.name,{name:u.name,uri:e,handler:d,mimeType:"text/html;profile=mcp-app",_meta:r,toolPath:g?a:void 0})}let _=fp(v),b=y?_:void 0;s=mZ(a)&&y?async(e,t)=>({content:[{type:"text",text:""}],_meta:b,structuredContent:{args:e}}):function(e,t,r,a="unknown-tool"){return async(i,n)=>{let o,s,l=e(i,(o=mz(n),s=function(e){if(!e)return;let t={};return e.headers.forEach((e,r)=>{t[r]=e}),t}(n.http?.req),{signal:n.mcpReq.signal,authInfo:n.http?.authInfo,sessionId:n.sessionId,_meta:n.mcpReq._meta,requestId:n.mcpReq.id,requestInfo:s?{headers:s}:void 0,clientInfo:o,sendNotification:e=>n.mcpReq.notify(e),sendRequest:(e,t,r)=>n.mcpReq.send(e,t,r),elicit:(e,t)=>(async function(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;mw(e,"Elicitation request must be a plain object."),m$(e,mf,"URL elicitation"),mR(e.message,"URL elicitation requires a string message."),mk(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),mk(e.url,"URL elicitation requires a non-empty URL.");try{t=new URL(e.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(e),e;if("form"!==t)throw Error(`Unsupported elicitation mode "${String(e.mode)}". Expected "form" or "url".`);return function(e){mw(e,"Elicitation request must be a plain object."),m$(e,mh,"Form elicitation"),mR(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(mw(t,"Form elicitation requires a flat object schema."),m$(t,mg,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(mw(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(mw(t,`Form elicitation field "${e}" must be a plain object.`),mx(t.title,`Form elicitation field "${e}" title must be a string.`),mx(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(m$(t,mv,`Form elicitation field "${e}"`),mE(t.enum,`Form elicitation field "${e}" enum values must be strings.`),r=t.enumNames,a=`Form elicitation field "${e}" enumNames must be strings.`,void 0!==r&&mE(r,a),void 0!==t.enumNames&&t.enumNames.length!==t.enum.length)throw Error(`Form elicitation field "${e}" enumNames length must match enum length.`);if(mx(t.default,`Form elicitation field "${e}" default must be a string.`),void 0!==t.default&&!t.enum.includes(t.default))throw Error(`Form elicitation field "${e}" default must be one of its enum values.`);return}if("string"===t.type&&!("enum"in t)){m$(t,my,`Form elicitation field "${e}"`),mP(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),mP(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),mx(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(mx(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!mS.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(mS).join(", ")}.`);return}if("boolean"===t.type){if(m$(t,m_,`Form elicitation field "${e}"`),void 0!==t.default&&"boolean"!=typeof t.default)throw Error(`Form elicitation field "${e}" default must be a boolean.`);return}if("number"===t.type||"integer"===t.type){m$(t,mb,`Form elicitation field "${e}"`),mP(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),mP(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),mP(t.default,`Form elicitation field "${e}" default must be a number.`);return}throw Error(`Form elicitation field "${e}" uses unsupported type "${String(t.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(e,r);if(void 0!==t.required){if(!Array.isArray(t.required)||t.required.some(e=>"string"!=typeof e))throw Error("Form elicitation schema required fields must be a string array.");for(let e of t.required)if(!(e in t.properties))throw Error(`Form elicitation schema required field "${e}" is not defined in properties.`)}}(e),{...e,mode:"form"}}(t);try{let t=await e.mcpReq.elicitInput(a,r);return{...t,content:t.content??void 0}}catch(e){if(e instanceof lH&&e.code===lF.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}})(n,e,t),sample:(e,t)=>(async function(e,t,r){let a=function(e){mC(e,"Sampling request must be a plain object.");let t=Object.keys(e),r=t.filter(e=>mj.has(e));if(r.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${r.join(", ")}.`);let a=t.filter(e=>!mT.has(e));if(a.length>0)throw Error(`Sampling request includes unsupported key(s): ${a.join(", ")}.`);if(!Array.isArray(e.messages)||0===e.messages.length)throw Error("Sampling requires at least one message.");for(let[t,r]of e.messages.entries())!function(e,t){if(mC(t,`Sampling message at index ${e} must be a plain object.`),"user"!==t.role&&"assistant"!==t.role)throw Error(`Sampling message at index ${e} requires role "user" or "assistant".`);let r=t.content;mC(r,`Sampling message at index ${e} requires a content object.`);let a=r.type;if("string"!=typeof a||!mO.has(a))throw Error(`Sampling message at index ${e} uses unsupported content type "${String(a)}". Supported types are text, image, and audio.`);if("text"===a&&"string"!=typeof r.text)throw Error(`Sampling message at index ${e} requires string text content.`);if(("image"===a||"audio"===a)&&("string"!=typeof r.data||"string"!=typeof r.mimeType))throw Error(`Sampling message at index ${e} requires base64 data and a mimeType.`)}(t,r);if("number"!=typeof e.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return e}(t);try{return await e.mcpReq.requestSampling(a,r)}catch(e){if(e instanceof lH&&e.code===lF.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}})(n,e,t),inputResponses:n.mcpReq.inputResponses,requestState:n.mcpReq.requestState}));if(l instanceof Promise&&(l=await l),cY(l))return l;if("string"==typeof l||"number"==typeof l){if(r){let e=Object.entries(r);if(1===e.length){let[t,r]=e[0];try{return r.parse(l),{content:[{type:"text",text:"number"==typeof l?`${l}`:l}],structuredContent:{[t]:l}}}catch{}}}return mA(t)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:t}:{content:[{type:"text",text:"number"==typeof l?`${l}`:l}]}}if(!r||!l||"object"!=typeof l||Array.isArray(l)||"structuredContent"in l||"content"in l&&Array.isArray(l.content)||"_meta"in l||"isError"in l||(mq(l,r,a,"returned data that does not match outputSchema"),l={structuredContent:l}),l&&"object"==typeof l&&"_meta"in l&&!("content"in l)&&!("structuredContent"in l)){let e=l._meta;if(mA(e))return{content:[{type:"text",text:""}],_meta:e}}if(!l||"object"!=typeof l){let e=null===l?"null":typeof l,t=void 0===l?"undefined":null===l?"null":"object"==typeof l?JSON.stringify(l,null,2):String(l);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
|
|
88
94
|
|
|
89
95
|
Expected CallToolResult format:
|
|
90
96
|
{
|
|
@@ -113,7 +119,7 @@ Or for widget metadata only:
|
|
|
113
119
|
_meta: {
|
|
114
120
|
"ui/...": ...
|
|
115
121
|
}
|
|
116
|
-
}`)}let
|
|
122
|
+
}`)}let c="content"in l&&Array.isArray(l.content),u="structuredContent"in l,d="isError"in l&&!0===l.isError;if(!c&&!u&&!d){let e=JSON.stringify(l,null,2);throw Error(`Tool handler must return at least 'content' or 'structuredContent'. Got: ${e}
|
|
117
123
|
|
|
118
124
|
Expected CallToolResult format:
|
|
119
125
|
{
|
|
@@ -134,16 +140,16 @@ Or both for backwards compatibility:
|
|
|
134
140
|
{
|
|
135
141
|
content: [{ type: "text", text: "fallback" }],
|
|
136
142
|
structuredContent: { your: "data" }
|
|
137
|
-
}`)}if(
|
|
143
|
+
}`)}if(d&&!c&&!u){let{isError:e,...t}=l,r=Object.keys(t).length>0?`Tool execution failed: ${JSON.stringify(t)}`:"Tool execution failed";l.content=[{type:"text",text:r}],c=!0}if(r&&u&&!d&&mq(l.structuredContent,r,a,"returned structuredContent that does not match outputSchema"),!c&&u&&(l.content=[{type:"text",text:JSON.stringify(l.structuredContent)}],c=!0),c)for(let e=0;e<l.content.length;e++){let t=l.content[e],r=mN(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
|
|
138
144
|
|
|
139
|
-
Content item: ${JSON.stringify(
|
|
145
|
+
Content item: ${JSON.stringify(t,null,2)}
|
|
140
146
|
|
|
141
147
|
Expected content formats:
|
|
142
148
|
- Text: { type: "text", text: "your text here" }
|
|
143
149
|
- Image: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
144
150
|
- Audio: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
145
151
|
- Resource: { type: "resource_link", name: "name", uri: "uri" }
|
|
146
|
-
All content types support an optional "_meta" object property`)}if(
|
|
152
|
+
All content types support an optional "_meta" object property`)}if(u){let e=l.structuredContent;if(null===e||"object"!=typeof e||Array.isArray(e)){let t=Array.isArray(e)?"array":typeof e;throw Error(`'structuredContent' must be a plain object (not an array or primitive). Got ${t}: ${JSON.stringify(e,null,2)}
|
|
147
153
|
|
|
148
154
|
Expected format:
|
|
149
155
|
{
|
|
@@ -151,9 +157,9 @@ Expected format:
|
|
|
151
157
|
key: "value",
|
|
152
158
|
nested: { data: "here" }
|
|
153
159
|
}
|
|
154
|
-
}`)}}return
|
|
160
|
+
}`)}}return l}}(d,b,o,u.name);let S={title:u.annotations?.title,description:u.description,inputSchema:fd(f),outputSchema:o?fd(o,{strict:!0}):void 0,annotations:u.annotations,icons:u.icons,_meta:_};e.registerTool(u.name,S,(n={name:u.name,description:S.description,annotations:S.annotations,icons:S.icons,tags:u.tags,_meta:S._meta},l=mM(r),c=Object.freeze({metadata:function e(t,r=new WeakMap){if(null===t||"object"!=typeof t)return t;let a=Object.getPrototypeOf(t);if(!Array.isArray(t)&&a!==Object.prototype&&null!==a)return t;if(r.has(t))return r.get(t);let i=Array.isArray(t)?[]:Object.create(a);for(let[a,n]of(r.set(t,i),Object.entries(t)))Object.defineProperty(i,a,{value:e(n,r),enumerable:!0,configurable:!0,writable:!0});return Object.freeze(i)}(n)}),(e,t)=>l({method:"tools/call",params:{name:c.metadata.name,arguments:e},tool:c},t,()=>s(e,t))))})}(e,fv(t,l),o),fv(a,l).forEach((t,r)=>{let a=fg(r),i={name:a,title:a,description:"No description provided"},n={},{default:o,metadata:s,schema:l}=t;if("object"==typeof s&&null!==s&&Object.assign(i,s),!1===i.enabled)return;let c=function(e,t="assistant"){return async(r,a)=>{let i,n=e(r,a);if(n instanceof Promise&&(n=await n),Array.isArray(n)||null!==n&&"object"==typeof n&&"messages"in n){let e=Array.isArray(n)?{messages:n}:n,t=await uR.GetPromptResult["~standard"].validate(e);if(t.issues){let e=t.issues.map(e=>{let t=e.path?.map(e=>"object"==typeof e?e.key:e).join(".");return`${t||"result"}: ${e.message}`});throw Error(`Invalid prompt result: ${e.join("; ")}`)}return e}if("string"==typeof n||"number"==typeof n)i={type:"text",text:"number"==typeof n?`${n}`:n};else{let e=mN(n);if(e.valid)i=n;else{let t=null===n?"null":typeof n,r=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Prompt handler must return a PromptContent object, string, number, PromptMessage[], or GetPromptResult. Got ${t}: ${r}
|
|
155
161
|
|
|
156
|
-
Validation error: ${
|
|
162
|
+
Validation error: ${e.error}
|
|
157
163
|
|
|
158
164
|
Expected formats:
|
|
159
165
|
- String: "your text here"
|
|
@@ -164,11 +170,11 @@ Expected formats:
|
|
|
164
170
|
- Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
165
171
|
- Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
166
172
|
- Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
|
|
167
|
-
- All content types support an optional "_meta" object property`)}}if("user"!==
|
|
173
|
+
- All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:i}]}}}(o,i.role||"assistant");ff(l)?Object.assign(n,l):null!=l&&console.warn(`Invalid schema for prompt "${i.name}" at ${r}. Expected Record<string, z.ZodType>`),e.registerPrompt(i.name,{title:i.title,description:i.description,icons:i.icons,_meta:mc(i)._meta,argsSchema:fd(n)},c)}),n=fv(i,l),c=s?.registerResource,[...mu.getAll()].forEach(([t,a])=>{let i=a.mimeType||"text/html;profile=mcp-app",n=a?._meta?fp(a._meta):void 0,o={name:a.name,description:`Auto-generated resource for ${a.name} tool`,mimeType:a.mimeType,_meta:n};c?.(a.name,a.uri),e.registerResource(a.name,a.uri,o,async(e,t)=>{if(a.mimeType&&a.toolPath)try{var n;let e,t,o=(n=a.toolPath,IS_CLOUDFLARE?function(e){let{normalizedPath:t,baseName:r}=fw(e),a=5381;for(let e=0;e<t.length;e++)a=Math.imul(a,33)+t.charCodeAt(e)>>>0;let i=a.toString(16).slice(0,6).padStart(6,"0");return`${r}_${i}`}(n):function(e){let{normalizedPath:t,baseName:a}=fw(e),i=r(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${a}_${i}`}(n)),s=function(e){if(INJECTED_CLIENT_BUNDLES)return INJECTED_CLIENT_BUNDLES[e]||null;if(!IS_CLOUDFLARE)try{let t=r(9896),a=r(6928);for(let r of[a.join(process.cwd(),"dist","client"),a.join(process.cwd(),"client")]){let i=a.join(r,`${e}.bundle.js`),n=a.join(r,`${e}.bundle.css`);if(t.existsSync(i)){let e,r=t.readFileSync(i,"utf-8");return t.existsSync(n)&&(e=t.readFileSync(n,"utf-8")),{js:r,css:e}}}}catch{}return null}(o);if(!s)throw Error(`React client bundle not found for "${a.name}" (bundle: "${o}").
|
|
168
174
|
React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
|
|
169
|
-
Please re-run the build so the framework can regenerate the bundle.`);let
|
|
175
|
+
Please re-run the build so the framework can regenerate the bundle.`);let l=s.js,c=s.css,u=(e=`
|
|
170
176
|
<script type="module">
|
|
171
|
-
const componentSource = ${JSON.stringify(
|
|
177
|
+
const componentSource = ${JSON.stringify(l)};
|
|
172
178
|
const blobUrl = URL.createObjectURL(
|
|
173
179
|
new Blob([componentSource], { type: "text/javascript" })
|
|
174
180
|
);
|
|
@@ -208,18 +214,18 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
208
214
|
requestAnimationFrame(() => {
|
|
209
215
|
URL.revokeObjectURL(blobUrl);
|
|
210
216
|
});
|
|
211
|
-
|
|
217
|
+
<\/script>`,t=c?`<style>${c}</style>`:"",`<!DOCTYPE html>
|
|
212
218
|
<html>
|
|
213
219
|
<head>
|
|
214
220
|
<meta charset="utf-8">
|
|
215
221
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
216
|
-
${
|
|
222
|
+
${t}
|
|
217
223
|
</head>
|
|
218
224
|
<body>
|
|
219
225
|
<div id="root"></div>
|
|
220
|
-
${
|
|
226
|
+
${e}
|
|
221
227
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:
|
|
228
|
+
</html>`);return{contents:[{uri:a.uri,text:u,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let o=a.handler({},t);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:a.uri,text:o,mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let e=o.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:a.uri,text:e.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}})}),n.forEach((t,r)=>{let a={name:fg(r),description:"No description provided"},{default:i,metadata:n,schema:o,complete:s}=t;if("object"==typeof n&&null!==n&&Object.assign(a,n),!1===a.enabled)return;let l={};ff(o)?l=o:null!=o&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let u=fR(r);if(!u)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let d=u.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(d=d.endsWith(".html")?d:`${d}.html`);let p=function(e,t,r={}){let a=fR(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,i)=>{let n=e(function(e,t,r){let a={},i={};if(0===t.parameters.length)return i;let n=t.uriTemplate.split("://")[1]||"",o=e.split("://")[1]||"",s=n.split("/"),l=o.split("/");for(let e=0;e<s.length&&e<l.length;e++){let t=s[e],r=l[e],i=t.match(/^\{(.+)\}$/);i&&(a[i[1]]=r)}for(let e of t.parameters){let t=a[e],n=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!n){i[e]=t;continue}try{i[e]=n.parse(t)}catch(r){throw Error(`Invalid parameter "${e}": ${t}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return i}(t.href,a,r),i);if(n instanceof Promise&&(n=await n),cY(n))return n;if("string"==typeof n)return{contents:[{uri:t.href,text:n}]};if(!n||"object"!=typeof n||!Array.isArray(n.contents)){let e=null===n?"null":typeof n,t=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${e}: ${t}
|
|
223
229
|
|
|
224
230
|
Expected ReadResourceResult format:
|
|
225
231
|
{
|
|
@@ -228,10 +234,4 @@ Expected ReadResourceResult format:
|
|
|
228
234
|
{ uri: "resource://uri", mimeType: "application/json", text: "json content" },
|
|
229
235
|
{ uri: "resource://uri", blob: base64data }
|
|
230
236
|
]
|
|
231
|
-
}`)}return
|
|
232
|
-
data: ${JSON.stringify({jsonrpc:"2.0",method:t,params:r})}
|
|
233
|
-
|
|
234
|
-
`)},P=t=>{if(!R){t&&k(`event: message
|
|
235
|
-
data: ${JSON.stringify({jsonrpc:"2.0",id:$,result:{resultType:"complete",_meta:{[iW]:$,[iK]:c}}})}
|
|
236
|
-
|
|
237
|
-
`),R=!0;try{h?.()}catch(t){a?.(t instanceof Error?t:Error(String(t)))}void 0!==f&&clearInterval(f),g?.(),o.delete(P);try{m.close()}catch{}}},E=new ReadableStream({start(t){m=t;let a=pT({method:"notifications/subscriptions/acknowledged",params:{notifications:S}},$);(x(a.method,a.params),0===Object.keys(S).length)?P(!0):(h=r.subscribe(t=>{if(R||!function(t,r){switch(r.kind){case"tools_list_changed":return!0===t.toolsListChanged;case"prompts_list_changed":return!0===t.promptsListChanged;case"resources_list_changed":return!0===t.resourcesListChanged;case"resource_updated":return void 0!==t.resourceSubscriptions&&t.resourceSubscriptions.includes(r.uri)}}(S,t))return;let r=pT(function(t){switch(t.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:t.uri}}}}(t),$);x(r.method,r.params)}),f=px(i,()=>k(": keepalive\n\n")),o.add(P))},cancel(){P(!1)}});if(void 0!==s)if(s.aborted)P(!1);else{let t=()=>P(!1);s.addEventListener("abort",t,{once:!0}),g=()=>s.removeEventListener("abort",t)}return new Response(E,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let t of o)t(!0)},get openCount(){return o.size}}}({bus:f,maxSubscriptions:r.maxSubscriptions??1024,keepAliveMs:r.keepAliveMs??15e3,onerror:h});"json"===o&&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 v="reject"===n?void 0:(a=r.keepAliveMs,async(r,n)=>{if("POST"!==r.method.toUpperCase())return p9(405,-32e3,"Method not allowed.");try{let i=await t({era:"legacy",...n?.authInfo!==void 0&&{authInfo:n.authInfo},requestInfo:r}),o=new p1({sessionIdGenerator:void 0,...void 0!==a&&{keepAliveMs:a},...void 0!==s&&{maxRequestBodySize:s}});await i.connect(o);let l=()=>{o.close().catch(()=>{}),i.close().catch(()=>{})};r.signal?.addEventListener("abort",l,{once:!0});let c=await o.handleRequest(r,{...n?.authInfo!==void 0&&{authInfo:n.authInfo},...n?.parsedBody!==void 0&&{parsedBody:n.parsedBody}});if(null===c.body||"text/event-stream"!==uq(c.headers.get("content-type")))return l(),c;let u=c.body.getReader(),d=!1,p=()=>{d||(d=!0,l())},m=new ReadableStream({pull:async t=>{try{let{done:r,value:a}=await u.read();if(r){p(),t.close();return}void 0!==a&&t.enqueue(a)}catch(r){p(),t.error(r)}},cancel:t=>(p(),u.cancel(t).catch(()=>{}))});return new Response(m,{status:c.status,statusText:c.statusText,headers:c.headers})}catch(t){try{h?.(p3(t))}catch{}return p6(p2(n?.parsedBody))}});async function _(a,n,i){var s,c;let f=a.classification.revision;if(void 0===f||!lY.includes(f)){let t=new c_({supported:[...lY],requested:f??"unknown"});return h(t),p9(400,t.code,t.message,t.data,p2(a.message))}let g=function(t,r){if("request"!==r.messageKind)return;let a=r.message.method;if(void 0===t.protocolVersionHeader){let t=r.classification.revision;return ua("version-header-missing","(missing)",void 0===t?"the body carries a modern per-request envelope but the required MCP-Protocol-Version header is absent":`the body envelope names protocol version ${t} but the required MCP-Protocol-Version header is absent`,"standard-header-validation")}if(void 0===t.mcpMethodHeader)return ua("method-header-missing","(missing)",`the body names method ${a} but the required Mcp-Method header is absent`,"standard-header-validation");let n=function(t,r){let a=Object.hasOwn(un,t)?un[t]:void 0;if(void 0===a)return;let n=uo(r)?r[a]:void 0;return{field:a,value:"string"==typeof n?n:void 0}}(a,r.message.params);if(void 0===n)return;let{field:i,value:o}=n;if(void 0===t.mcpNameHeader){if(void 0===o)return;return ua("name-header-missing","(missing)",`the body carries params.${i}="${o}" but the required Mcp-Name header is absent`,"standard-header-validation")}let s=ui(t.mcpNameHeader),l=c7(s);return void 0===l?ua("name-header-invalid-encoding",s,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==o&&l!==o?ua("name-header-mismatch",s,`the body carries params.${i}="${o}" but the Mcp-Name header names "${l}"`,"standard-header-validation"):void 0}({httpMethod:n.method,...p7(n)},a);if(void 0!==g)return h(Error(`Rejected inbound request (${g.cell}): ${g.message}`)),p4(g,p2(a.message));let v="request"===a.messageKind?cV(a.message.params):void 0,_=v?.[iG];if("request"===a.messageKind){let t=Object.hasOwn(lB,s=a.message.method)?lB[s]:void 0;if(void 0!==t){let r=lG(t,_);if(void 0!==r){let t=new cb({requiredCapabilities:r});return h(t),p9(ut[t.code]??400,t.code,t.message,t.data,a.message.id)}}}let b=await t({era:"modern",...void 0!==i&&{authInfo:i},requestInfo:n}),S=b instanceof pZ?b.server:b;if(p5(S),"request"===a.messageKind&&"subscriptions/listen"===a.message.method){let t=S.getCapabilities(),r=m(S);return b.close().catch(h),y.serve(a.message,n.signal,t,r)}if("request"===a.messageKind&&"tools/call"===a.message.method&&b instanceof pZ){let t=a.message.params,r="string"==typeof t?.name?t.name:void 0,i=void 0===r?void 0:b.toolInputSchemaJson(r);if(void 0!==i){let r=c2(i);if(r.valid&&r.declarations.length>0){let i=function(t,r,a){for(let n of t){let t=`Mcp-Param-${n.headerName}`,i=a.get(t),o=function(t,r){let a=t;for(let t of r){if(null===a||"object"!=typeof a)return;a=a[t]}return a}(r,n.path);if(null==o)continue;let s=function(t){if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t){if(!Number.isFinite(t)||Number.isInteger(t)&&!Number.isSafeInteger(t))return;return String(t)}}(o);if(void 0===s)continue;if(null===i)return c8("param-header-missing",t,`the body carries ${c3(n.path)}=${JSON.stringify(o)} but the ${t} header is absent`);let l=c7(i);if(void 0===l)return c8("param-header-invalid-encoding",t,`the ${t} header carries an invalid Base64 sentinel value`);if(!(("integer"===n.type||"number"===n.type)&&c5.test(l)&&"number"==typeof o?Number(l)===o:l===s))return c8("param-header-mismatch",t,`the ${t} header decodes to ${JSON.stringify(l)} but the body carries ${c3(n.path)}=${JSON.stringify(o)}`)}}(r.declarations,t?.arguments,n.headers);if(void 0!==i)return b.close().catch(h),h(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),p4(i,a.message.id)}}}if("request"===a.messageKind&&b instanceof pZ)try{let t=await pC([a.message],i,t=>b.resolveScopeChallenge(t));if(void 0!==t)return b.close().catch(h),pN(t,pI(i))}catch(t){return b.close().catch(h),h(p3(t)),p6(a.message.id)}p5(S),u(S,f),p(S,lY),void 0!==v&&(c={clientInfo:v[iB],clientCapabilities:_},d(S,c));let $=S.onclose;l.add(S);let w=()=>{l.delete(S),S.onclose===w&&(S.onclose=$),$?.()};S.onclose=w;try{let t=await pY(b,a.message,{classification:a.classification,request:n,...void 0!==i&&{authInfo:i},...void 0!==o&&{responseMode:o},...void 0!==r.keepAliveMs&&{keepAliveMs:r.keepAliveMs}});return"notification"===a.messageKind&&queueMicrotask(()=>void S.close().catch(()=>{})),t}catch(t){if(t instanceof lJ&&t.code===lH.ConnectionClosed)return new Response(null,{status:499});return await S.close().catch(()=>{}),l.delete(S),h(p3(t)),p6(p2(a.message))}}async function b(t,r,a,n){if(void 0!==v)return v(r,{...void 0!==a&&{authInfo:a},...void 0!==n&&{parsedBody:n}});let i=function(t,r){switch(t.reason){case"http-method":return ur("http-method","modern-only-method-not-allowed",405,new cg(-32e3,"Method not allowed."),!0);case"batch":return ur("jsonrpc-shape","modern-only-batch-not-supported",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return ur("jsonrpc-shape","modern-only-response-post",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let a=t.requestedVersion;return ur("era-classification","modern-only-missing-envelope",400,void 0===a?new cg(cf.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...r]}):new c_({supported:[...r],requested:a}),!0)}}}(t,lY);return void 0===i?new Response(null,{status:202}):(h(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),p4(i,p2(n)))}async function S(t,r){let a=r?.authInfo;if("POST"===t.method.toUpperCase()&&!uA(t.headers.get("content-type")))return h(Error("Unsupported Media Type: Content-Type must be application/json")),p9(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let n=await p8(t,r?.parsedBody,!0,s);if("unreadable-body"===n.step)return p9(400,-32700,"Parse error: the request body could not be read");if("body-too-large"===n.step)return p9(413,-32e3,pX(s));if("no-json-body"===n.step)return void 0!==v?v(n.forwardRequest,{...void 0!==a&&{authInfo:a}}):p9(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:i,body:o,parsedBody:l,forwardRequest:c}=n;try{switch(i.kind){case"reject":return h(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),p4(i,p2(o));case"modern":return await _(i,t,a);case"legacy":return await b(i,c,a,l)}}catch(t){return h(p3(t)),p6(p2(o))}}return{fetch:async(t,r)=>{if(c)throw Error("This MCP handler has been closed");try{return await S(t,r)}catch(t){return h(p3(t)),p6(p2(r?.parsedBody))}},notify:g,bus:f,close:async()=>{c=!0,y.closeAll();let t=[...l].map(t=>t.close().catch(()=>{}));l.clear(),await Promise.all(t)}}}(async function t(){let t=fW(),r=fY(),a=fX(),[n,i,o]=await Promise.all([t,r,a]),{instructions:s,...l}=fK,c=new pZ(l,{instructions:s});return await fG(c,n,i,o),c},{legacy:"stateless",maxSubscriptions:HTTP_CONFIG.maxSubscriptions});async function f3(t){return ms({id:(0,R.randomUUID)(),headers:Object.fromEntries(t.headers.entries()),clientInfo:void 0},async()=>{try{let r;return"POST"===t.method&&(r=await t.json().catch(()=>void 0),mi({clientInfo:(t=>{for(let r of Array.isArray(t)?t:[t]){let t=mu(r);if(t)return t}})(r)})),await f4.fetch(t,{authInfo:t.auth,parsedBody:r})}catch(t){return console.error("[Next.js MCP] Error handling MCP request:",t),Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}})}function f6(t){let r=new URL(t.url),a=r.hostname.split(".").reverse().join("."),n={$schema:"https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",name:`${a}/mcp`,version:SERVER_INFO.version,description:TEMPLATE_CONFIG.description,title:TEMPLATE_CONFIG.name,remotes:[{type:"streamable-http",url:`${r.origin}${HTTP_CONFIG.endpoint}`}]};return TEMPLATE_CONFIG.icons?.length&&(n.icons=TEMPLATE_CONFIG.icons),Response.json(n,{headers:{"Content-Type":"application/mcp-server-card+json","Cache-Control":"public, max-age=3600, must-revalidate","Access-Control-Allow-Origin":"*"}})}})(),n})());
|
|
237
|
+
}`)}return n.contents.forEach(e=>{e.uri||(e.uri=t.href)}),n}}(i,r,l);if("direct"===u.type)c?.(a.name,d),e.registerResource(a.name,d,mc(a),p);else{let t=Object.create(null);for(let e of u.parameters)s&&Object.hasOwn(s,e)&&(t[e]=s[e]);let r=new pM(d,{list:void 0,complete:t});c?.(a.name,r),e.registerResource(a.name,r,mc(a),async(e,t,r)=>{let a={};for(let e of u.parameters){let r=t[e],i=l[e];if(void 0===r)throw Error(`Missing required parameter: ${e}. Available variables: ${Object.keys(t)}`);i?a[e]=i.parse(r):a[e]=r}let n=i(a,r);return n instanceof Promise&&(n=await n),"string"==typeof n?{contents:[{uri:e.href,text:n}]}:n})}}),function(e,t,r,a){let i=[...fv(new Map(t.map(e=>[e.uri,{metadata:{name:e.frontmatter.name},skill:e}])),r).values()].map(({skill:e})=>e);if(0===i.length)return;for(let{frontmatter:t,files:r}of i){let i=r[0].uri.slice(0,r[0].uri.lastIndexOf("/")+1);r.forEach(({uri:r,mimeType:n,text:o,blob:s},l)=>{let c=0===l?{mimeType:n,description:t.description}:{mimeType:n},u=0===l?t.name:`${t.name}/${decodeURIComponent(r.slice(i.length))}`,d=void 0!==o?{uri:r,mimeType:n,text:o}:{uri:r,mimeType:n,blob:s??""};a?.(u,r),e.registerResource(u,r,c,()=>({contents:[d]}))})}let n=i.map(fE),o=new Map(n.map(e=>[e.uri,e]));e.server.registerCapabilities({extensions:{"io.modelcontextprotocol/skills":{}}}),e.server.setRequestHandler("skills/list",{params:fx},e=>{let t=e?.cursor===void 0?0:function(e,t){let r=0/0;try{r=Number(atob(e))}catch{}if(!Number.isSafeInteger(r)||r<=0||r>=t)throw new cf(ch.InvalidParams,`Invalid cursor: ${e}`);return r}(e.cursor,n.length),r=t+50;return{skills:n.slice(t,r),...r<n.length?{nextCursor:btoa(String(r))}:{},...fk}}),e.server.setRequestHandler("skills/get",{params:fP},({uri:e})=>{let t=o.get(e);if(!t)throw new cf(ch.InvalidParams,`No skill is served at ${e}`);return{skill:t,...fk}})}(e,fN,l,s?.registerResource)}),e}(c,i,n,o),c},{legacy:"stateless",maxSubscriptions:HTTP_CONFIG.maxSubscriptions});async function fU(e){return mi({id:(0,R.randomUUID)(),headers:Object.fromEntries(e.headers.entries()),clientInfo:void 0},async()=>{try{let t;return"POST"===e.method&&(t=await e.json().catch(()=>void 0),mr({clientInfo:(e=>{for(let t of Array.isArray(e)?e:[e]){let e=ms(t);if(e)return e}})(t)})),await fD.fetch(e,{authInfo:e.auth,parsedBody:t})}catch(e){return console.error("[Next.js MCP] Error handling MCP request:",e),Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}})}function fV(e){let t=new URL(e.url),r=t.hostname.split(".").reverse().join("."),a={$schema:"https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",name:`${r}/mcp`,version:SERVER_INFO.version,description:TEMPLATE_CONFIG.description,title:TEMPLATE_CONFIG.name,remotes:[{type:"streamable-http",url:`${t.origin}${HTTP_CONFIG.endpoint}`}]};return TEMPLATE_CONFIG.icons?.length&&(a.icons=TEMPLATE_CONFIG.icons),Response.json(a,{headers:{"Content-Type":"application/mcp-server-card+json","Cache-Control":"public, max-age=3600, must-revalidate","Access-Control-Allow-Origin":"*"}})}})(),a})());
|